This application is based on and derives the benefit of Indian Provisional Application 202321032553, the contents of which are incorporated herein by reference.
Embodiments disclosed herein relate to blockchain based currency protocol, and more particularly to formation and termination mechanisms for a general-purpose Cross-Chain Payment Channel (CCPC) protocol and a general-purpose Cross-Shard Payment Channel (CSPC).
The Bitcoin protocol establishes a trustless decentralized network for maintaining a unique currency ledger. However, its Proof-of-Work (PoW) consensus algorithm, while enabling decentralization, limits scalability due to its performance constraints. Byzantine Fault Tolerance (BFT) algorithms are not suitable for large-scale networks due to high message complexity. Sharding is proposed as a scalability solution but introduces latency challenges.
A blockchain operates as a distributed state machine, where transactions change the system's state. It maintains a ledger with a sequence of blocks, each linked to the previous one, ensuring immutability. Consensus algorithms are crucial for maintaining a consistent state across all nodes. In permissioned networks, PBFT-like algorithms work well, while open networks require PoW for consensus. PoW is scalable due to its low message complexity but faces throughput limitations.
To address scalability issues, payment channels, like the Lightning Network, operate off-chain and offer high-speed transactions. Sharding aims to scale layer 1 blockchains but faces challenges with cross-shard transactions. Dynamic sharding and account segmentation are proposed to optimize shard assignment. Cross-chain bridges facilitate asset transfers between different blockchains, but some rely on centralized custodians.
A state machine has a state at a given point in time, wherein each new transaction performed on this state machine basically attempts to change the state of the machine. The current state of a machine is a result of past transactions, the next state of the machine will be a function of the current state and new transaction. In a distributed system, a state machine has to be consistent across all nodes.
Essentially, a blockchain based system is a replicated state machine. In blockchain based currency, states are basically balances of different accounts on the blockchain. Each new block introduces new transactions and each new transaction updates the state of the system. Blockchain basically stores a list of transactions in a sequence. Each block is connected to the previous block by storing its hash. Such a hash chain structure makes the blockchain immutable.
Just building a working state machine is not enough for a decentralized system. Unless every node in the network has the same transaction logs, no one would have the same state in their machine. Transaction log means the blockchain itself. Hence, a method is required to reach an agreement on a common blockchain for everybody. This problem gets harder as byzantine nodes (or malicious) have to be introduced into the network, which can lie to other nodes about blocks. In presence of byzantine nodes, achieving consensus is difficult and several algorithms have been each having its own trade-off.
Different kinds of network environments would need a different kind of consensus algorithm. In a permissioned network, where the identities of every node are known beforehand, PBFT (Practical Byzantine Fault Tolerance) like algorithms can be used to achieve consensus on any data. PBFT achieves consensus on data by broadcasting messages to the network in multiple rounds by all nodes. Consensus is achieved when nodes receive confirmations in the form of a quorum. PBFT requires static nodes and node identities to be known. Though byzantine is fault tolerant, it has quadratic messaging complexity (O(i where n is the number of nodes in the network) which works well up to a few 100 nodes, but becomes impractical if thousands of nodes are involved.
In an open network, where the identities of nodes are not known and any number of nodes can join and leave, PBFT does not work. Nakamoto consensus involving Proof-of-Work (PoW) can be used in this setting. Using PoW for consensus is a radically different technique than message passing based consensus. Achieving consensus basically means that, all honest nodes of the network agree on the same blockchain. To achieve that using the Nakamoto consensus protocol, every node should accept the first new block they see having a valid PoW. PoW refers to a solution for a cryptographic puzzle that requires significant computational power. The idea behind the protocol is that the person spending such an amount of power should be a legitimate person. Also, since high computational power is a barrier to proposing a new block, the PoW protocol is also Sybil-resistant.
Message complexity is irrelevant to the number of nodes in PoW consensus, so it can work with a very large number of nodes without congesting the network. Due to the protocol scheme, everyone in the network is allowed to propose a block. The difficulty of the puzzle has to be set hard enough so that the inter-arrival time of a block stays moderate to avoid forking. This is exactly what causes a bottleneck in the scalability of the PoW blockchain system.
The Bitcoin blockchain has 10 minutes of inter-arrival time and 1 MB of average block size. This configuration results in a throughput of 4-7 transactions per second. This value is really low compared to the transaction throughput of centralized currencies managed by companies like Visa, which has an average throughput of 1700 transactions per second. For cryptocurrency to be practical as a centralized currency, the blockchain has to somehow scale to that level.
Naive ideas to scale the PoW chain are to either increase the block size or to decrease the inter-arrival time of the block. Decreasing the inter-arrival time of blocks means decreasing the difficulty of the PoW puzzle, this will result in block generation faster while generating more forks 202 (
BFT consensus algorithms, on the other hand, rely on inter-node communication to reach consensus. Though this achieves slightly better throughput than PoW chains, it is not scalable as more nodes join the network. The BFT protocol fails due to quadratic message-passing complexity. Hence, it could not be used for an open network like Bitcoin has.
This high number of network nodes and transaction throughput trade-off is basically what the scalability issue is. In PBFT we can have fairly high throughput, but we can't have a high number of nodes participating in the network. PBFT-based consensus may have 100-200 nodes. In PoW consensus, a high throughput cannot be obtained, but a very large number of nodes can be present. A truly scalable blockchain system should have higher throughput as the number of nodes increases in the network.
Use of sharding to scale a single common blockchain hypothetically would eventually hit the physical limits of the internet network. The root of the problem of the single blockchain approach is that every node in the network stores and processes the exact same transactions. This replication becomes the bottleneck for scalability. This section goes through the basic idea of sharding in blockchain, how it is inspired by database sharding, and its major challenges.
Sharding has been used for databases generally to divide a load of requests to multiple servers by achieving horizontal scalability. It does so by partitioning different sets of rows of a table into multiple tables. Now, these multiple tables can be stored independently in multiple servers and all of these servers can now process user requests in parallel which results in higher throughput. Sharding in Blockchain takes a similar idea from this and applies it to scale the blockchain system.
Defining shard assignments for nodes in a permissionless network is a challenge. There has to be a mechanism to assign nodes to some shard. We would want such a mechanism to be as random as possible, if not, adversaries could collude to achieve more than 50% fraction of a shard. Achieving such public randomness is generally hard. Another major challenge of the sharded blockchain system are cross-shard transactions.
One of the major challenges for blockchain sharding is the execution of cross-shard transactions. In such sharded systems, disjoint states are stored in different blockchains. If the input ID from shard A wants to perform a transaction to output ID from shard B, there has to be a protocol to safely execute such transactions. Existing solutions to execute these transactions while maintaining consistency essentially involves a two-phase commit technique which turns out be slower than the execution of regular intra-shard transactions.
A naive approach to minimize the fraction of cross-shard transactions is to shard accounts optimally based on their past interactions with other accounts. This will not work in real-world scenarios as even with optimal sharding based on past transactions observed among accounts in the history of the Ethereum blockchain, a high fraction of cross-shard transactions is observed.
A current solution has computed optimal sharding for 6 shards based on the Ethereum transaction history of 4000 blocks starting from 7.3 millionth blocks. It achieves 30% cross-shard fraction. The timespan for these 4000 blocks in Ethereum is about 15 hours, and hence this resulting optimal cross-shard fraction might not be the true representative of real-world usage.
Another sharding blockchain solution computes optimal sharding using METIS using the history of Ethereum transactions from a roughly 6 months window (August '15 to February '16), which found out the cross-shard fraction to be 83% for 64 shards and about 75% for 32 shards.
Moreover, it can now be observed that the fraction of cross-shard transactions will inevitably increase as the number of shards increases regardless of how the accounts can be distributed optimally in appropriate shards. This also shows a limitation of the sharding mechanism for scalability. The maximum number of shards possible is equal to the total number of accounts, at which the cross-shard transaction fraction would be 100%.
Various approaches have been attempted to scale a single common blockchain to achieve higher throughput and computation capacity of smart contracts. A physical limit of performance of a single blockchain can be reached due to network latency and link capacity. The sharding approach can potentially scale the system beyond this physical limit.
A Two Phase Commit protocol, a blockchain sharding protocol achieves sharding in terms of transaction computation by allowing parallel execution of transactions in different shards, but does not achieve sharding in terms of space as each node has to maintain the same global blockchain. Hence does not count as a full-sharding method as it does not need to deal with cross-shard transactions as all shard maintains a global blockchain.
Another solution proposes a full sharding mechanism for a permissionless blockchain system, however, this would necessarily require a mechanism to atomically execute cross-shard transactions. An Atomix Protocol has been proposed, which achieves this using a two-phase commit technique.
Another solution proposes a similar two-phase commit technique to execute cross-shard transactions involving relay transactions on PoW Shards. In essence, the high latency of cross-shard transactions and an inevitably high fraction of cross-shard transactions is the core problem of the Blockchain Sharding system in terms of scalability.
The majority of existing blockchain sharding protocols assumes static sharding. That means once accounts are assigned to a shard they would stick to the shard forever. Another solution introduces a different approach to sharding, and this section discusses this briefly.
Shards could be dynamically changed to minimize cross-shard trans-actions. A solution proposes a protocol for chain splitting and chain fusion in a permissioned sharding system (hereinafter referred to as mitosis). The solution uses a central registry to keep track of the current sharding status across all shards. Though, the solution defines a mechanism to dynamically resize shards, It does so at the will of nodes of relevant shards. Hence the protocol does not enforce particular sharding to achieve optimal cross-shard fraction. Even if the protocol dynamically enforces changing shards based on some optimal partitioning of the account interaction graph with the hope of reducing the cross-shard fraction, a significantly high cross-shard fraction would hit them anyways based on observation(s). Also, the cross-shard transactions are handled in a similar two-phase manner which would eventually bring the system to the same scalability issue as observed in other sharding systems.
As shown in
Payment Channel is another radical approach to achieving higher transaction throughput. All other approaches discussed till now scale the blockchain at layer 1, wherein layer 1 refers to the transactions recorded on the actual blockchain ledger. The payment channel operates at layer 2, which is also called off-chain. The concept of a payment channel is parallel to the idea of cash. In a regular centralized currency, all transactions need not be performed through the bank, as customers are allowed to take out cash, and using this cash, the customer is able to perform unlimited transactions with someone else owning the cash of the same currency. Just like how transactions of this cash would not be affected by the bank's server limitations, off-chain transactions done via a payment channel would not be affected by the transaction throughput limit of layer 1 blockchain.
Lightning Network is the first attempt at a payment channel in blockchain based cryptocurrency. As discussed previously, it simulates cash withdrawal and deposit, but on the blockchain. Lightning Network is a payment channel implementation on the Bitcoin blockchain. Formation of the payment channel requires only one layer 1 transaction, which is called a Funding Transaction. This transaction mentions how many tokens both participants are willing to fund in the channel and how it is distributed among these two participants. Once this funding transaction gets on the chain, these two participants are allowed to make off-chain transactions within the limits of the balance mentioned in the funding transaction sent to the blockchain. This is done by sending balance commitments to each other. A commitment is said to be valid only if it is signed by both participants and it is the latest commitment shared between these two participants. Since these off-chain transactions are not logged onto the blockchain there is no way any node in the bitcoin network could tell if the given commitment is the latest or not. So, the protocol of Lightning Network ensures this using RSMC (Revocable Sequence Maturity Contract). This contract allows one or both participants to withdraw their money from the funding transaction while ensuring no one cheats on the other party. Lightning Network's protocol for payment channels enforces participants to share private keys of old commitments after a new commitment is created. This way, if one cheats with an older commitment, RSMC allows the victim party to take all the money using the secret key of the old commitment. The publisher of a withdrawal transaction is identified by the order of digital signatures done on the commitment.
A single payment channel would allow only these two participants to perform transactions faster. If a participant wants to make transactions via a payment channel with someone else, it would be not practical to open a payment channel for each and every one on the network. To deal with this, Lightning Network utilizes HTLC (Hash Time-Locked Contract) to make a safe payment between participants who are not directly connected via a payment channel but have a path to reach other via multiple payment channels.
Raiden Network is an Ethereum version of the lightning network, wherein the core concepts are pretty much similar to the lightning network. Since Raiden can utilize the Turing complete smart contract functionality of the Ethereum blockchain platform, the formation of a payment channel is quite simpler here. The smart contract holding the balance details of two participants maintains a counter variable initialized to zero. The off-chain transaction here is referred to as Balance Proofs. Each new balance proof generated must increment the counter. Hence, any user deciding to leave the channel or withdraw their tokens can present the latest balance proof to the smart contract. If a partner cheats and puts old balance proof, the other partner can simply present a balance proof with a higher counter, which will then be accepted by the smart contract and tokens will be distributed based on the latest balance proof received.
Cross chain bridges allow interoperability between different blockchain networks by enabling the transfer of assets between them. Different blockchain networks may have unique tokens and features and different protocols specific to their network. For these reasons, different users might choose to have tokens in the blockchain of their choice, which can cause two people wanting to perform a trade, unable to do so. This situation demands a bridge functionality that can allow such cross-chain transfers.
Wrapped Bitcoin (wBTC) is one such cross-chain bridge that allows the transfer of BTC tokens onto the Ethereum blockchain as wBTC tokens in a smart contract. Similarly, wBTC can be converted back to the original BTC token. This transfer is done with the help of a custodian. This custodian has the authority to mint wBTC tokens on the smart contract. BTC owner who wants to get his tokens on the Ethereum blockchain as wBTC has to first send his BTC to the custodian who later mints the wBTC and sends it to the original BTC owner's account address in the Ethereum blockchain for use. Since this transfer relies on a central custodian, this approach is not considered as secure as standard token transfer within a blockchain network.
RenBTC is another example of a cross-chain bridge. This allows a similar conversion from BTC token to RenBTC token on the Ethereum blockchain and the conversion from RenBTC token to original BTC token on the Bitcoin blockchain. The major difference of RenBTC and WBTC is that rather than centralizing custody of transferred BTC, it is decentralized. RenBTC protocol utilizes Shamir's Secret Sharing and Secure Multiparty Computation to achieve this.
BTC Relay protocol allows the verification of Bitcoin transactions on the Ethereum network. It is a decentralized smart contract system built on Ethereum that enables Ethereum smart contracts to securely verify Bitcoin transactions without the need for a trusted third party. The BTC Relay achieves this with the help of relay nodes that sends new block headers to the smart contract. These headers can be utilized to verify any Bitcoin transactions within the BTC Relay smart contract.
Cross-chain transfers in a Lightning Network enables the existing payment channel network of bitcoin to connect with a similar payment channel network of any other blockchain. To enable this cross-chain interoperability, the Lightning Network relies on a participant who holds funds in both blockchain networks and is part of the payment channel network of both. This participant acts as a relay, transferring funds from one payment channel network to the other, essentially creating a bridge between the two networks. This mechanism enables cross-chain transfers between different payment channel networks without building any cross-chain payment channel. One caveat that this strategy introduces is that the common participant has to distribute their funds across two channels. Cross-chain payment channels can potentially eliminate the need for such distribution to enable higher liquidity of funds in the payment channel network.
XClaim is presented as an alternative for Atomic Cross-Chain Swaps, which enables cross-chain transfers between a sender and receiver by creating a smart contract that stores and maintains the headers of the blockchain where the sender resides. Tokens are then essentially burnt on the sender's blockchain, and new tokens are generated on the receiver's blockchain, where the value of these new tokens is validated by the verified proof of burning using only their block headers. Such validation strategy is also used in cross-shard transactions in blockchain sharding systems. XClaim claims that its methodology can be extended to enable cross-chain payment channels, but it does not provide any concrete protocol to achieve that.
Though such existing cross-chain bridges allow the transfer of tokens between different blockchain networks, they sometimes rely on a centralized authority to do so, which is not a desirable property in terms of security. Even if other cross-chain bridges achieve this token transfer in a decentralized manner, none of the existing cross-chain transfer techniques provides a general-purpose cross-chain payment channel protocol that allows the transfer of native tokens.
Hence, there is a need in the art for solutions which will overcome the above-mentioned drawback(s), among others.
The principal object of embodiments herein is to disclose a formation and termination mechanism for a general-purpose Cross-Chain Payment Channel (CCPC) protocol, wherein the CCPC protocol represents a solution for executing fund transfers between two accounts residing in different blockchains off-chain by building a payment channel between the two accounts and breaking down the funding and withdrawal transactions into multiple transactions to allow for the safe formation and termination of a payment channel between the two blockchains.
Another object of embodiments herein is to disclose a formation and termination mechanism for a general-purpose Cross-Shard Payment Channel (CSPC) protocol in a sharding system to perform cross-shard transactions, wherein a payment channel is built between accounts from two shards, which would dramatically reduce the number of actual cross-shard transactions recorded at the layer 1 blockchain, resulting in lower latency of cross-shard transactions, as compared to existing sharding schemes.
These and other aspects of the embodiments herein will be better appreciated and understood when considered in conjunction with the following description and the accompanying drawings. It should be understood, however, that the following descriptions, while indicating at least one embodiment and numerous specific details thereof, are given by way of illustration and not of limitation. Many changes and modifications may be made within the scope of the embodiments herein without departing from the spirit thereof, and the embodiments herein include all such modifications.
Embodiments herein are illustrated in the accompanying drawings, throughout which like reference letters indicate corresponding parts in the various figures. The embodiments herein will be better understood from the following description with reference to the following illustratory drawings. Embodiments herein are illustrated by way of examples in the accompanying drawings, and in which:
The embodiments herein and the various features and advantageous details thereof are explained more fully with reference to the non-limiting embodiments that are illustrated in the accompanying drawings and detailed in the following description. Descriptions of well-known components and processing techniques are omitted so as to not unnecessarily obscure the embodiments herein. The examples used herein are intended merely to facilitate an understanding of ways in which the embodiments herein may be practiced and to further enable those of skill in the art to practice the embodiments herein. Accordingly, the examples should not be construed as limiting the scope of the embodiments herein.
For the purposes of interpreting this specification, the definitions (as defined herein) will apply and whenever appropriate the terms used in singular will also include the plural and vice versa. It is to be understood that the terminology used herein is for the purposes of describing particular embodiments only and is not intended to be limiting. The terms “comprising”, “having” and “including” are to be construed as open-ended terms unless otherwise noted.
The words/phrases “exemplary”, “example”, “illustration”, “in an instance”, “and the like”, “and so on”, “etc.”, “etcetera”, “e.g.,”, “i.e.,” are merely used herein to mean “serving as an example, instance, or illustration.” Any embodiment or implementation of the present subject matter described herein using the words/phrases “exemplary”, “example”, “illustration”, “in an instance”, “and the like”, “and so on”, “etc.”, “etcetera”, “e.g.,”, “i.e.,” is not necessarily to be construed as preferred or advantageous over other embodiments.
Embodiments herein may be described and illustrated in terms of blocks which carry out a described function or functions. These blocks, which may be referred to herein as managers, units, modules, hardware components or the like, are physically implemented by analog and/or digital circuits such as logic gates, integrated circuits, microprocessors, microcontrollers, memory circuits, passive electronic components, active electronic components, optical components, hardwired circuits and the like, and may optionally be driven by a firmware. The circuits may, for example, be embodied in one or more semiconductor chips, or on substrate supports such as printed circuit boards and the like. The circuits constituting a block may be implemented by dedicated hardware, or by a processor (e.g., one or more programmed microprocessors and associated circuitry), or by a combination of dedicated hardware to perform some functions of the block and a processor to perform other functions of the block. Each block of the embodiments may be physically separated into two or more interacting and discrete blocks without departing from the scope of the disclosure. Likewise, the blocks of the embodiments may be physically combined into more complex blocks without departing from the scope of the disclosure.
It should be noted that elements in the drawings are illustrated for the purposes of this description and ease of understanding and may not have necessarily been drawn to scale. For example, the flowcharts/sequence diagrams illustrate the method in terms of the steps required for understanding of aspects of the embodiments as disclosed herein. Furthermore, in terms of the construction of the device, one or more components of the device may have been represented in the drawings by conventional symbols, and the drawings may show only those specific details that are pertinent to understanding the present embodiments so as not to obscure the drawings with details that will be readily apparent to those of ordinary skill in the art having the benefit of the description herein. Furthermore, in terms of the system, one or more components/modules which comprise the system may have been represented in the drawings by conventional symbols, and the drawings may show only those specific details that are pertinent to understanding the present embodiments so as not to obscure the drawings with details that will be readily apparent to those of ordinary skill in the art having the benefit of the description herein.
The accompanying drawings are used to help easily understand various technical features and it should be understood that the embodiments presented herein are not limited by the accompanying drawings. As such, the present disclosure should be construed to extend to any modifications, equivalents, and substitutes in addition to those which are particularly set out in the accompanying drawings and the corresponding description. Usage of words such as first, second, third etc., to describe components/elements/steps is for the purposes of this description and should not be construed as sequential ordering/placement/occurrence unless specified otherwise.
Embodiments herein achieve a formation and termination mechanism for a Cross Shard Payment Channel protocol. Referring now to the drawings, and more particularly to
Embodiments herein tackle cross-shard transaction latency issues by leveraging concepts from the payment channel, wherein cross-shard transactions are optimized in a sharded blockchain system to have a payment channel between shards.
Embodiments herein disclose a formation and termination mechanism for a general-purpose Cross-Chain Payment Channel (CCPC) protocol, wherein the CCPC protocol represents a solution for executing fund transfers between two accounts residing in different blockchains off-chain by building a payment channel between the two accounts and breaking down the funding and withdrawal transactions into multiple transactions to allow for the safe formation and termination of a payment channel between the two blockchains. Embodiments herein disclose a formation and termination mechanism for a general-purpose Cross-Shard Payment Channel (CSPC) protocol in a sharding system to perform cross-shard transactions, wherein a payment channel is built between accounts from two shards, which would dramatically reduce the number of actual cross-shard transactions recorded at the layer 1 blockchain, resulting in lower latency of cross-shard transactions, as compared to the existing sharding schemes.
In addition to their own shard's blockchain, each node in a shard listens for and maintains headers of all other shards' blockchains. Since headers are lightweight, this does not impose a significant resource requirement on the node. For instance, as shown in
For two account owners from different shards to participate in a cross-shard payment channel, they must be full nodes of both shards. Full nodes are nodes that maintain the full blockchain but may not necessarily participate in consensus.
The funding phase comprises a proposed funding transaction and a confirmed funding transaction. To initiate a cross-shard payment channel (CSPC), both participants must first agree on the channel's balance off-chain, after which they will broadcast a “Propose Funding” transaction in their respective shards. This transaction should contain the balance of each participant and the necessary digital signatures, serving as the first balance proof of the payment channel. In α's shard, the balance proof in the ‘Propose Funding’ transaction must be signed by β or both participants and similarly, in β's shard, the balance proof in the funding transaction must be signed by α or both participants. This transaction locks the mentioned funds for a minimum time period ‘T’, which can be defined in terms of the number of blocks.
However, the proposed funding transaction alone is insufficient to establish a payment channel, as the consensus nodes in each shard cannot trust the balance of the participant of the CSPC from the other shard. To gain this trust, both participants must present proof to their respective shards showing that their partner's balance is locked in their funding transaction as well. This proof must be provided before the timeout expires and is shown in the “Confirm Funding” transaction.
After the Propose Funding transaction is broadcasted and confirmed on the blockchain, a waiting period T begins for the ‘Confirm Funding’ transaction to be submitted. If a participant fails to show valid proof with the ‘Confirm Funding’ transaction within the waiting period T, the ‘Propose Funding’ transaction is discarded, and the payment channel is not established. However, if both participants successfully provide valid proofs with their ‘Confirm Funding’ transactions before the waiting period T ends, the payment channel is successfully formed.
In the event that one participant fails to submit a ‘Confirm Funding’ transaction, while the other participants successfully lock their tokens in the payment channel, the participant who is unable to lock their tokens may lose them permanently. To avoid this scenario, both participants should broadcast their own Merkle proof in the form of a ‘Confirm Funding’ transaction to their partner's shard each time a payment channel is formed.
However, if a situation arises where the funding transaction is confirmed in one shard, but the ‘Propose Funding’ transaction times out in the other, the smart contract will allow the release of a “FUNDING DISCARDED” event. Any participant can request the smart contract to generate this event.
Establishing a successful Cross-Shard Payment Channel allows participants to perform off-chain transactions by sending updated balance proofs to each other.
According to the embodiments herein, in scenarios, where two users are not directly connected by a payment channel, the users can still transfer funds by utilizing intermediate payment channels. In such cases, participants of mediated transfer would send a hash-locked balance proof, which is considered valid only if presented with a valid secret. This mechanism is commonly known as Hash Time-Locked Contracts (HTLCs). To perform a mediated transfer, the participant initiating the mediated transfer locks a certain amount of funds in a payment channel with an intermediary node and provides a hash-locked balance proof to that node, who in turn does the same with another intermediary node or directly to the recipient node. The recipient can claim the funds by revealing the pre-image of the hash lock within a certain time frame; otherwise, the locked funds will be refunded back to the initiator. These hash-locked balance proofs could be enforced on the cross-shard payment channel with a valid secret, using the withdrawal mechanism discussed in the following section.
One or both participants may decide to leave the channel at any time, so the CSPC protocol should allow for this functionality in a multi-shard system. However, closing the channel and releasing the funds back to the blockchain must be handled carefully to ensure that any partially committed withdrawal does not result in an inconsistent system. Embodiments herein disclose two different possible scenarios for attempting a withdrawal in detail. Case 1 is when only one of the participants proposes the withdrawal; and case 2 is when both the participants propose the withdrawal.
Now, participant α can release their funds from their own channel by presenting proof that they have waited long enough for R to challenge the withdrawal. This is achieved by submitting a ‘Final Confirm Withdraw’ (CW1) transaction that includes the Merkle proof of PeW2 and CW2. The contract on the blockchain verifies whether the block distance between these two transactions is greater than or equal to K. Once this is confirmed, committing the CW1 transaction releases the funds from the channel and the channel is permanently closed.
The proposer might try to maliciously close the channel based on some older balance proof.
In case 2, where both the participants agree to close the channel cooperatively, they can initiate a ‘Propose Withdraw’ request in their respective shards, using the same balance proof. To achieve a partially completed withdrawal, both participants are required to share the Merkle proof of their proposal with each other. However, this state is not yet confirmed, as there is no guarantee that the other participant has successfully presented the proof of proposal before the timeout. To avoid such inconsistencies, both participants must provide a ‘Final Confirmation’ which includes the Merkle proof of the ‘Partial Confirmation’ from the other participant's shard.
In some cases, a partially completed withdrawal may result in a failed withdrawal, if one of the participants fails to achieve partial confirmation before the timeout.
Embodiments herein disclose Cross Chain Payment Channel (CCPC) protocol which extends the previously discussed CSPC protocol to support token transfer between two different blockchain networks. CCPC is essentially a cross-chain bridge that can be easily integrated with the existing payment channel network supporting CSPC protocol, to allow a larger payment channel network that can safely transfer tokens off-chain in a trustless environment.
The CCPC protocol outlines a method for creating and closing a payment channel between two accounts located on two distinct and autonomous blockchains. Blockchain systems should support Turing-complete smart contracts which shall later be used to verify proof showing the locking of tokens in the other blockchain. The smart contract handling the CCPC stores block headers of the other blockchain with the help of relay nodes. This strategy resembles the one used in BTC Relay. Block headers of the other chain are maintained on smart contracts from both blockchains.
Since the involved blockchains support different tokens, a simple token transfer in a one-to-one ratio would not work as their token value ratio might be uneven. To enable the cross-chain transfer, participants involved in CCPC own an address in each blockchain. Participants initiate funding of this CCPC channel by locking their tokens into the smart contract which maintains a state of their balances in both chains. Funding of the cross chain payment channel proceeds with a state represented in State 0 as shown in
Since both participants can own tokens in both blockchains, the token exchange becomes easier. After the funding phase of the channel is complete, if α wants to make a payment of x′ tokens of Blockchain 1 to β, α can send a signed balance proof to β containing a state as shown in State 1a in
Withdrawal process in the CCPC protocol is implemented similar to the CSPC protocol. However, there are variations in the specific state representation involved. If participants decide to perform a withdrawal at State 0 as shown in
In another embodiment herein, in situations where participants prefer not to hold an account in a different blockchain, the protocol should cater to their needs. For instance, participant α may only want to possess tokens in Blockchain 1 while participant β may prefer to hold tokens solely in Blockchain 2. To address this issue, the CCPC protocol can be modified to include a unique ‘Cross Token’, denoted by a new token symbol such as ‘cTokenName’ and referred to as “Cross TokenName”. This token would represent a token from the other blockchain, allowing participants to hold and transact using it without actually maintaining an account in the foreign blockchain. For example, as shown in
It is assumed that participants in cross-chain payment channels must operate as full nodes on both blockchains, which can significantly strain their computational resources. However, there is a more efficient approach that can reduce resource usage without compromising security. Participants can choose to operate as a full node only on their native blockchain while remaining a light node on their partner's blockchain. This optimized mode enables participants to conserve their resources until their partner exhibits malicious behavior. If a participant detects malicious behavior on their blockchain from their partner, they can switch to become a full node on the other blockchain and continue with the protocol. The wait time can be adjusted to ensure that victims using this optimized mode have ample time to make the switch. By adopting this optimized mode, participants in cross-chain payment channels can maintain security while reducing the burden on their computational resources.
According to the embodiments herein, the cross-shard payment channel formation module 2206 initiates a proposed funding transaction between a first participant of a first shard and a second participant of a second shard, wherein initiating the proposed funding transaction comprises locking specified number of tokens, and wherein the specified number of tokens includes number of tokens proposed by the two participants. The cross-shard payment channel formation module 2206 exchanges balance proofs to validate the locked tokens. The cross-shard payment channel formation module 2206 confirms the proposed funding transaction between the first participant and the second participant by securing the locked tokens for a defined time period. The cross-shard payment channel formation module 2206 communicates formation of CSPC transaction on each of the first shard and the second shard, indicating the successful formation of the CSPC. The cross shard payment channel termination module 2208 enables initiation of a withdrawal request by one of the first participant and the second participant, indicating unlocking of a specified amount of tokens. The cross shard payment channel termination module 2208 enables sharing and validation of Merkle Proofs for withdrawal transactions to prove the authenticity and legitimacy of the withdrawal request. The cross shard payment channel termination module 2208 enables release of the locked tokens based on validated proofs, following one of a predefined block distance and challenge period. The cross shard payment channel termination module 2208 allows the first and the second participant to challenge malicious withdrawal attempts, using Merkle Proofs to demonstrate proof of rejection.
According to the embodiments herein, the cross chain payment channel formation module 2210 initiates one or more proposed funding transactions on the first blockchain network and the second blockchain network involving a plurality of participants, locking specified amounts of tokens. The cross chain payment channel formation module 2210 enables exchange of one or more balance proofs to validate the locked tokens on the first blockchain network and the second blockchain network. The cross chain payment channel formation module 2210 confirms the proposed one or more proposed funding transactions in the first blockchain network and the second blockchain network, securing the locked funds for a predefined time period. The cross chain payment channel formation module 2210 enables communication of a “CCPC Formed” transaction on each of the first and the second blockchain networks, indicating the successful formation of the CCPC. The cross chain payment channel termination module 2212 enables initiation of a withdrawal request by a participant on both the first and second blockchain networks, for unlocking the specified amounts of tokens. The cross chain payment channel termination module 2212 enables sharing and validation of Merkle Proofs for withdrawal transactions to prove the authenticity and legitimacy of the withdrawal request on both the first and second blockchain networks. Blockchain systems should support Turing-complete smart contracts which shall later be used to verify proof showing the locking of tokens in the other blockchain. The smart contract handling the CCPC stores block headers of the other blockchain with the help of relay nodes. Block headers of the other chain are maintained on smart contracts from both blockchains. In cross chain payment channel protocol, the relay node system sends across the merkle root information from one chain to the other. The cross chain payment channel termination module 2212 enables release of the locked tokens based on validated proofs, following one of a predefined block distance, or challenge period. The cross chain payment channel termination module 2212 allows the one or more participants to challenge malicious or fraudulent withdrawal attempts, using Merkle Proofs to demonstrate proof of rejection.
The Cross-Shard Payment Channel protocol is implemented by adding an L2CS (Layer 2 Cross-Shard) API layer on top of the existing Web3 Library which interacts with Ethereum nodes. Since there does not exist any open source implementation available of standard sharding protocol, the L2CS API is designed to emulate sharding on existing Go-Ethereum like implementation.
Two different independent networks of Go-Quorum nodes are running that are maintaining two different blockchains. Both networks of nodes are running on the same physical machine. Each network has a total of 5 nodes. Due to its block finality property, the consensus mechanism used here is IBFT (Istanbul Byzantine Fault Tolerant), which is a modified PBFT algorithm. Each node owns an account on its respective blockchain, and each account is sufficiently funded right from the genesis. Each node exposes its own API via an HTTP server which is consumed by Web3 Library. This setup is illustrated in
This implementation assumes that both nodes involved in the payment channel have access to both shards. Hence, each instance of L2CS stays connected to two nodes. One node is the self-node while the other node is a node from the other shard to look at the status of Cross Shard Channel Contract in the other shard. The L2CS API is written in Node.js and is implemented as REST API. L2CS API provides functions such as createChannel( ), fundChanel( ), confirmChannel( ), and so on. Now, the actual shard node is supposed to communicate with the L2CS API directly rather than using Web3 to interact with the geth node. Hence, the L2CS API in a way becomes a part of the protocol. For any two nodes interested in forming a payment channel, each would have to communicate using an instance of L2CS API. This architecture is illustrated in
There is no notion of sharding in the existing implementation of Go-Quorum/Go-Ethereum. Hence, for the experimental implementation, L2CS emulates sharding. In the actual implementation of sharding the geth nodes would need to store headers of other shards in order to verify any transaction using only Merkle proof, so that tokens from other shards can be added to the current shard. This notion is discussed in the sharding Model section in chapter 3. Since there is no such provision in existing Ethereum implementation, this is emulated by assuming the existence of an account that has infinite tokens, which can only be used by the L2CS program to represent funds from other shards.
This section gives details about each API endpoint that a shard node would need to interact with L2CS. Three major endpoints are discussed in their dedicated sections below. Minor endpoints for requesting trivial details about self-node are as discussed in the miscellaneous section. The sequence of calling these endpoints is as shown in
Participants interested in forming the payment channel shares their account's public address with each other. As one receives the public address of their partner, they can make a createChannel( ) call to the L2CS API. Upon receiving this request, L2CS internally compiles a Cross Shard Channel solidity contract using the solc library. After the compilation, it deploys the contract which has a 0 balance initialized for both partners.
Once the cross-shard channel contract is deployed on the blockchain, each participant can put their funds by making a payment to that contract by calling the fundChannel( ) function of the smart contract. The L2CS API simplifies this by exposing this endpoint named the same as fundChannel( ), where the node can simply pass the argument as the desired amount they want to lock in the channel, and the rest is taken care of by L2CS internally. After the successful execution of this call by both participants, only one end of the payment channel is funded for both contracts.
After both of them have locked their funds into the smart contract, both of them can now prove to each other's shard that their partner has locked their funds too. Hence, they would share their contract address with each other. L2CS will take their partner's contract address as input and would internally use the node in the partner's shard to look at the state variables of that smart contract and match the account address and verify if it is funded with a non-zero positive balance. Once it is confirmed, L2CS internally uses that infinite account representing funds from other shards to fund the smart contract in its own shard, but at their partner's end of the channel.
Other than the main endpoints discussed earlier, L2CS has other minor endpoints which are used in the intermediate stages of the channel formation phase.
fetchContractStatus( ): Returns the balance status of both ends in their own shard's cross-shard channel contract. If it fails to fetch the contract status due to various reasons, it sends an INTERNAL SERVER ERROR response.
The embodiments disclosed herein can be implemented through at least one software program running on at least one hardware device and performing network management functions to control the network elements. The network elements shown in FIG. 22 include blocks which can be at least one of a hardware device, or a combination of hardware device and software module.
The embodiment disclosed herein describes a formation and termination mechanisms for a general-purpose Cross-Chain Payment Channel (CCPC) protocol and a general-purpose Cross-Shard Payment Channel (CSPC) protocol. Therefore, it is understood that the scope of the protection is extended to such a program and in addition to a computer readable means having a message therein, such computer readable storage means contain program code means for implementation of one or more steps of the method, when the program runs on a server or mobile device or any suitable programmable device. The method is implemented in at least one embodiment through or together with a software program written in e.g., Very high speed integrated circuit Hardware Description Language (VHDL) another programming language, or implemented by one or more VHDL or several software modules being executed on at least one hardware device. The hardware device can be any kind of portable device that can be programmed. The device may also include means which could be e.g., hardware means like e.g., an ASIC, or a combination of hardware and software means, e.g., an ASIC and an FPGA, or at least one microprocessor and at least one memory with software modules located therein. The method embodiments described herein could be implemented partly in hardware and partly in software. Alternatively, the invention may be implemented on different hardware devices, e.g., using a plurality of CPUs. [If this para is not applicable, remove it]
The foregoing description of the specific embodiments will so fully reveal the general nature of the embodiments herein that others can, by applying current knowledge, readily modify and/or adapt for various applications such specific embodiments without departing from the generic concept, and, therefore, such adaptations and modifications should and are intended to be comprehended within the meaning and range of equivalents of the disclosed embodiments. It is to be understood that the phraseology or terminology employed herein is for the purpose of description and not of limitation. Therefore, while the embodiments herein have been described in terms of embodiments and examples, those skilled in the art will recognize that the embodiments and examples disclosed herein can be practiced with modification within the scope of the embodiments as described herein.
Number | Date | Country | Kind |
---|---|---|---|
202321032553 | May 2023 | IN | national |