Block chain cross-fragmentation method based on under-chain payment technology
By setting up a cross-shash transaction pool and smart contract inspection mechanism under the chain, the poor scalability and node evil problems of blockchain networks in cross-shash transactions are solved, and more efficient and reliable cross-shash transaction processing is achieved. , improving the overall scalability of blockchain.
Patent Information
- Application Number
- CN202411029871.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-03
AI Technical Summary
Traditional blockchain networks have poor scalability when handling large-scale transactions, resulting in network congestion and delay, especially when cross-shash transactions, which affects the efficiency of actual applications.
Using the blockchain cross-sanding method based on off-chain payment technology, by setting up a cross-sanding transaction pool under the chain, nodes can freely conduct cross-sanding transactions within the quota of mortgage points within one epoch cycle, avoiding real-time broadcast transactions Information: Unified transaction information processing at the end of epoch, and use smart contracts and inspection mechanisms to prevent nodes from committing evil.
Improve the efficiency and reliability of blockchain cross-sanded transactions, reduce the system communication burden, enhance processing capabilities, avoid the communication burden caused by the entire network broadcast of each cross-sanded transaction in the traditional way, and prevent nodes from Doing evil improves the scalability of the system.
Smart Images

Figure CN119070997A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and specifically belongs to a blockchain cross-sharding method based on off-chain payment technology. Background Art
[0002] The development of blockchain technology has made significant progress in various fields, but one of the main challenges it faces is the limitation of scalability. As the number of users and transaction volume increases, traditional blockchain networks are often unable to effectively handle large-scale transactions and are prone to network congestion and delays. This poor scalability problem seriously affects the feasibility and efficiency of blockchain technology in practical applications.
[0003] In order to solve the problem of poor scalability of blockchain, sharding technology has gradually become the focus of research and application in recent years. Sharding technology divides the entire blockchain network into multiple independent shards, so that each shard only needs to process part of the transactions, thereby improving the network's processing capacity and throughput.
[0004] However, there are many mature methods for processing intra-shard transactions, but there is a lack of discussion on processing cross-shard transactions. Cross-shard transactions refer to transactions involving multiple different shards, which will bring a series of complexities and delays in the traditional sharding architecture. Therefore, in order to effectively process cross-shard transactions, this patent introduces off-chain payment technology and establishes a cross-shard transaction pool off-chain. By performing transaction settlement and clearing in the transaction pool, it avoids the traditional method of broadcasting the entire network every time a cross-shard transaction occurs, which causes communication burden and data loss to the entire blockchain network, thereby improving the efficiency and reliability of blockchain cross-shard transactions.
[0005] After searching, the application publication number CN116012164B is a blockchain cross-shard transaction method based on virtual accounts. Accounts in the blockchain are evenly distributed to each shard according to the account address, and corresponding virtual accounts are established in the shards to which they are not allocated. In the present invention, all accounts are evenly distributed to each shard, and virtual accounts are created in other shards for each main account. All transaction processes can be processed in one round of consensus and one shard without being decomposed into multiple sub-transactions, reducing the workload of storage and communication of each node.
[0006] Patent CN116012164B first distributes the account address equally to each shard, and then establishes a virtual account in the unallocated shards, which means that the number of nodes in each shard is the same as the number of nodes in the original blockchain. This approach will increase the complexity of the system and lose the meaning of sharding to a certain extent. However, this patent adopts off-chain payment technology. Within one cycle, nodes can freely conduct cross-shard transactions within the amount of mortgage points without real-time broadcasting of transaction content. Transactions are processed uniformly after one cycle, which can also achieve the purpose of reducing the system communication burden and increasing the processing capacity of cross-shard transactions. Summary of the invention
[0007] The present invention aims to solve the above problems of the prior art. A blockchain cross-sharding method based on off-chain payment technology is proposed. The technical solution of the present invention is as follows:
[0008] A blockchain cross-sharding method based on off-chain payment technology comprises the following steps:
[0009] Construct a scalable blockchain model based on Layer1+Layer2; the scalable blockchain model based on Layer1+Layer2 includes two layers, Layer1 and Layer2. Layer1 represents the on-chain solution for blockchain scalability, that is, the sharding technology is used to improve the parallel processing capability of intra-Tx transactions, thereby improving the scalability of blockchain; Layer2 represents the off-chain solution for blockchain scalability, that is, the off-chain payment technology is used to improve the processing capability of inter-Tx cross-shard transactions, thereby improving the scalability of blockchain;
[0010] A blockchain cross-shard method based on off-chain payment technology is designed. The cross-shard method is implemented by setting up an Inter-Tx pool cross-shard transaction pool under the chain; the incentive mechanism of the blockchain is set as a reward point. At the beginning of an epoch cycle, each node pledges points in the Inter-Tx Pool corresponding to the shard where it is located. In this epoch, the node can freely perform inter-Tx within the pledged amount. In this process, the node does not broadcast transaction information, but saves valid transaction information with signatures of both parties to the transaction as a transaction certificate. At the end of an epoch, each node broadcasts all valid inter-Tx transaction information that occurred in this epoch and the point status of each Inter-Tx Pool at that time; in the next epoch, the nodes in the blockchain network check the legitimacy and validity of the transaction based on the broadcast information. The malicious nodes will be punished, and the nodes that detect the malicious behavior will be rewarded; finally, the transaction information will be put on the chain after the check is correct; after the end of the next epoch, each node can choose to redeem the points in the Inter-TxPool, or choose to continue to store them in the Inter-Tx Pool as the pledge points for participating in inter-Tx in the next epoch.
[0011] Furthermore, the scalable blockchain model based on Layer1+Layer2 specifically includes: in Layer1, when a node enters the blockchain network, the system will distribute a pair of public and private keys to each node, and then use the public key as a seed to generate an address Add for inter-Tx use and Add lock ; Then, the blockchain network is divided into several shards through random rules. The shards are represented by Shard#x, where x represents the shard number. There are several nodes in each shard. After the sharding is completed, each node establishes its identity by broadcasting its public key and the shard number of its shard to the entire network. In Layer2, an Inter-Tx Pool is set up for each shard. The Inter-Tx Pool stores User, Add use 、Add lock Data structure; the public key PK of the node is stored in User x , the PK of each node x Is unique and is the node's identifier; Add use Indicates the address where the node stores transaction points for inter-Tx, m x Indicates that the node is in Add use The number of points in; Add lock Indicates the address of the transaction points locked by the smart contract when the storage node initiates the transaction as the transaction initiator, n xIndicates that the node is in Add lock The number of points in .
[0012] Furthermore, the blockchain cross-sharding method based on off-chain payment is implemented by mortgaging points in the Inter-Tx Pool, specifically including the following steps: (1) mortgaging points in the Inter-Tx Pool; (2) the transaction initiator initiates inter-Tx; (3) the smart contract determines the legality of the transaction; (4) the transaction receiver checks the transaction; (5) broadcasting the transaction information of inter-Tx; (6) checking the inter-Tx of the previous epoch; (7) redeeming the mortgaged points in the Inter-Tx pool.
[0013] Furthermore, the step (1) of pledging points in the Inter-Tx Pool specifically includes: the nodes in each shard are expected to participate in the transfer of points of inter-Tx as transaction initiators in the next epoch. At the beginning of the next epoch, each node pledges points in its corresponding Inter-Tx Pool. At this time, the node Add use The number of points in is equal to the number of points pledged, Add lock The number of points in the Inter-TxPool is equal to 0. The points pledged are valid by the node signature. Whether to pledge points and the number of pledged points follow the principle of voluntariness. After the node pledges points and signs, it broadcasts the status of each point pledged in the Inter-TxPool to the entire network. Points pledged in the Inter-Tx Pool can only be used for inter-Tx, and the pledged points can only be redeemed after being locked for 2 epochs.
[0014] If a node pledges points at the beginning of an epoch and redeems points at the end of the next epoch, this is a collective behavior to maintain the smooth operation of the system, so only a small amount of fees caused by routing forwarding need to be paid, which can be points. Of course, the node can also pledge points during the current epoch and redeem them during the two locked epochs. use The operation of pledging points, mortgaging points and redeeming points will cause the number of points in the Inter-Tx Pool to change. The change of the points of the node in the transaction pool and the current status of the transaction pool need to be broadcasted to the whole network. If there is not enough incentive, other nodes have no motivation to forward. Therefore, it costs a higher fee to perform mortgaging points and redeeming points during the epoch. Therefore, rational nodes will pledge sufficient points in the Inter-Tx Pool at the beginning of an epoch and try to minimize the operations of mortgaging points and redeeming points during the point lock period. This will reduce the routing overhead caused by the change of the points status of the broadcasting node in the transaction pool to a certain extent and avoid network congestion.
[0015] Further, the specific process of the transaction initiator initiating an inter-Tx in step (2) includes: describing a certain inter-Tx that occurs between two nodes in different shards; the transaction initiator constructs transaction information and sends the transaction information to the transaction recipient; assume that the number of points mortgaged by the transaction initiator u1 in the Inter-Tx Pool at the beginning of the current epoch is X; the transaction initiator u1 initiates a transfer of x points to the transaction recipient u2. At this time, the number of points added by u1 in the Inter-Tx Pool is m, and the number of points added in use is n, and X = m + n; the transaction information constructed by the transaction initiator is: lock PK
[0016]
[0017] PK u1 —>PK u2 = x indicates that the transaction initiator u1 initiates a transaction to transfer x points to the transaction recipient u2; PK u1 : Add use = m - x indicates that the remaining available points of the transaction initiator u1 in Add use are m - x; PK u1 : Add lock = n + x indicates that the currently locked points of the transaction initiator u1 in Add lock are n + x; Sig u1 indicates that the transaction initiator u1 signs the transaction with SK u1 (private key).
[0018] Further, the specific process of the smart contract determining the legality of the transaction in step (3) includes: after the transaction initiator u1 initiates a transaction, the smart contract is triggered; the contract logic is: first, check whether the number of points m in u1Add use is greater than the transaction amount x. If m >= x, then lock the transaction amount x, and the lock-up period is the remaining time of this epoch plus the next epoch, and return an approval message to the transaction recipient; if no valid transaction information with the signatures of both parties is broadcast by both parties during the lock-up period, it means the transaction fails, and x is automatically unlocked after the lock-up period, and the Add use of the transaction sender is returned; if m < x, then the transaction fails, and the smart contract returns a rejection message to the transaction recipient.
[0019] Furthermore, the step (4) the transaction recipient checks the transaction specifically includes: if the transaction recipient receives the transaction information sent by the transaction initiator and the check pass information returned by the smart contract, then the transaction information sent by the transaction initiator is checked, including the address information, the transaction points, and the signature information; after the check is correct, the transaction recipient signs the transaction information with its own private key and sends it to the transaction initiator;
[0020]
[0021] Sig u2 Indicates that the transaction receiver u2 uses SK u2 (private key) to sign the transaction; transactions signed by both the transaction initiator and the transaction recipient are called valid transactions. Both parties will save the valid transaction information as proof of successful transaction;
[0022] If the transaction recipient receives the transaction information sent by the transaction initiator and the check failure information returned by the smart contract, the transaction will not be processed.
[0023] Furthermore, the step (5) of broadcasting inter-Tx transaction information specifically includes: within an epoch, many inter-Tx may occur between any nodes of any shard. At the end of this epoch, all nodes broadcast all valid inter-Tx transaction information packaged in the previous epoch, package outgoing transactions and incoming transactions separately in chronological order, and broadcast their final status of integration in the Inter-Tx Pool, including Add use and Add lock The number of points will be transferred into the transaction and included in Add use middle.
[0024] Furthermore, the step (6) of checking the inter-Tx of the previous epoch specifically includes: checking the inter-Tx of the previous epoch specifically includes: each node has the right to check the information broadcast by others, and after the nodes in the blockchain network receive the valid transaction information of the inter-Tx in the previous epoch broadcasted by other nodes and their respective integral status in the Inter-Tx Pool; in the next epoch, the node verifies the validity of the signature in the valid transaction information with the public keys of the transaction parties based on the received valid transaction information, and after the verification is correct, checks whether the transaction amount of all inter-Tx that occurred in the previous epoch of the node and the final integral status in the Inter-Tx Pool are consistent based on the broadcasted valid transaction information and the integral status in the Inter-Tx Pool, and it must satisfy X-n+(r1+r2+...)=m; X represents the number of points pledged by the node in the Inter-Tx Pool at the beginning of the current epoch, and m represents the number of points pledged by the node in Add use The number of points in Add lock The integral number in r x Indicates the transaction amount of the node's xth incoming transaction;
[0025] In this process, if a node is found to have engaged in malicious behavior, the points obtained by the node through the malicious behavior will become invalid. These points will become rewards for the node that detects the malicious behavior, and the malicious node will be prohibited from participating in inter-Tx in the next epoch. After the verification is completed, the entire blockchain network updates the ledger information in the Inter-Tx pool and puts the inter-Tx that occurred in the previous epoch on the chain.
[0026] Furthermore, the step (7) of redeeming the mortgage points in the Inter-Tx pool specifically includes: after the inter-Tx of the previous epoch is checked for an epoch, at the end of the current epoch, each node can choose to redeem the points mortgaged in the Inter-Tx Pool at the beginning of the previous epoch, or choose to continue to store them in the Inter-Tx Pool as mortgage points for the next epoch.
[0027] The advantages and beneficial effects of the present invention are as follows:
[0028] 1. Improve the scalability of blockchain. We use sharding technology in Layer 1. The intra-Tx of each shard is processed in the shard and has nothing to do with other shards. This improves the parallel processing capability of intra-Tx in the blockchain network, thereby improving the scalability of blockchain. We use off-chain payment technology in Layer 2 to process inter-Tx. In an epoch, nodes can freely perform inter-Tx within the amount of mortgage points in the Inter-Tx Pool. In the epoch, nodes do not broadcast inter-Tx transaction information. Instead, at the end of this epoch, each node broadcasts all packaged inter-Tx and account points status of the Inter-Tx Pool that occurred in this epoch. The remaining nodes only need to verify the legitimacy of the transaction through the valid transaction information and account points status broadcast by the node. This method can avoid the communication burden caused by the need to broadcast the entire network each time inter-Tx in the traditional method, and improve the system's ability to handle inter-Tx.
[0029] 2. Use smart contracts and introduce inspection mechanisms to prevent nodes from doing evil. This patent uses smart contracts to automatically check the account points balance of the transaction initiator after the transaction initiator initiates inter-Tx, ensuring that the account points balance of the transaction initiator is greater than the transaction amount, and locks the points involved in the transaction to ensure that the transaction recipient can get the transaction points after passing the inspection to prevent double-spending attacks; during the epoch, the node will not broadcast the transaction information of inter-Tx in real time, but will broadcast all transaction information at the end of this epoch, so this patent introduces a verification mechanism. In the next epoch, all nodes can verify the legitimacy of the inter-Tx that occurred in the previous epoch based on the valid transaction information of inter-Tx broadcast by other nodes and the final points status in the Inter-Tx Pool. If a node is found to be evil, the points obtained by the evil node through evil means will belong to the node that detected the evil behavior, and the evil node will be banned from participating in inter-Tx in the next epoch. In this way, on the one hand, nodes can be encouraged to check the evil behavior of other nodes, and on the other hand, nodes can be prevented from doing evil to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a general framework diagram of the method of providing a preferred embodiment of the present invention;
[0031] Figure 2 It is an explanatory diagram of the system operation cycle of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and in detail describe the technical solutions in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention, and the embodiments assume that the reward points in the incentive mechanism are a token.
[0033] The technical solution of the present invention to solve the above technical problems is:
[0034] The embodiment of the present invention demonstrates the implementation process of cross-shard transactions between multiple shards. Assume an application scenario: Node d in Shard#2 transfers 10 tokens to Node a in Shard#1, and Node a in Shard#1 transfers 20 tokens to Node g in Shard#3.
[0035] A blockchain cross-sharding method based on off-chain payment technology specifically includes the following steps:
[0036] (1) Pledge points in the Inter-Tx Pool; (2) The transaction initiator initiates inter-Tx; (3) The smart contract determines the legality of the transaction; (4) The transaction receiver checks the transaction; (5) Broadcast inter-Tx transaction information; (6) Check the inter-Tx of the previous epoch; (7) Redeem the pledged points in the Inter-Tx pool.
[0037] (1) Pledge points in Inter-Tx Pool
[0038] At the beginning of the epoch, node a in Shard#1, node d in Shard#2, and node g in Shard#3 pledge 80, 100, and 120 tokens in their respective Inter-Tx Pools, and broadcast them to the entire network. use The number of tokens in m a =80, Add lock The number of tokens n in a = 0. dNodeAdd use The number of tokens in m d =100, Add lock The number of tokens n in d = 0. gNodeAdd use The number of tokens in m g =120, Add lock The number of tokens n in g =0.
[0039] The following describes the process of transferring 10 tokens from node d in Shard#2 to node a in Shard#1:
[0040] (2) The transaction initiator initiates inter-Tx
[0041] Node d, as the transaction initiator, constructs transaction information:
[0042]
[0043] Node d initiates a transaction to transfer 10 tokens to node a. At this time, node d adds use The number of tokens is 90, Add lock The number of tokens in is 10. Node D constructs the transaction and sends it to Node A.
[0044] (3) Smart contracts determine the legality of transactions
[0045] After the d node initiates a transaction, the smart contract is triggered, and the contract checks the d node Add use The number of tokens in m d =100, transaction amount x d =10, satisfying m d >x d , then the transaction amount 10 is sent to the Add lock , and lock the transaction amount 10 for the remaining time of this epoch plus the next epoch, and return a check pass message to node a.
[0046] (4) The transaction recipient checks the transaction
[0047] After receiving the transaction information sent by the transaction initiator node b and the check pass information returned by the smart contract, the transaction receiver node a checks the transaction information sent by node b, including address information, transaction amount, signature, etc. After verification, node a signs the transaction information with its own private key and sends it to node b.
[0048]
[0049] Node A and Node B will save the valid transaction information signed by both parties as proof of successful transaction.
[0050] The following describes the process of transferring 20 tokens from node a in Shard#1 to node g in Shard#3:
[0051] The process of transferring 20 tokens from node a to node g is similar to the process of transferring 10 tokens from node d to node a, including the transaction initiator initiating inter-Tx, the smart contract determining the legitimacy of the transaction, and the transaction receiver checking the transaction process. The valid transaction information of transferring 20 tokens from node a to node g is:
[0052]
[0053]
[0054] (5) Broadcast inter-Tx transaction information
[0055] At the end of this epoch, nodes a, d, and g broadcast all their valid inter-Tx transaction information in the previous epoch, and broadcast their respective integral status in the Inter-Tx Pool.
[0056] Contents broadcast by node a:
[0057] Incoming transaction:
[0058]
[0059] Transfer out transaction:
[0060]
[0061] Points status in Inter-Tx Pool: Add use The number of tokens in m a =70, Add lock The number of tokens n in a =20.
[0062] Contents of d-node broadcast:
[0063] Transfer out transaction:
[0064]
[0065] Points status in Inter-Tx Pool: d node Add use The number of tokens in m d =90, Add lock The number of tokens n in d =10.
[0066] Contents of the g node broadcast:
[0067] Incoming transaction:
[0068]
[0069] Points status in Inter-Tx Pool: g node Add use The number of tokens in m g =140, Add lock The number of tokens n ing =0.
[0070] (6) Check the inter-Tx of the previous epoch
[0071] Here we describe the process of node b in Shard#1 checking the inter-Tx of the previous epoch. The checking process of other nodes is similar to that of node b. After node b receives the valid transaction information of inter-Tx in the previous epoch broadcasted by a, d, and g and their respective integral status in the Inter-Tx Pool, it is assumed that node b checks node a first. The number of tokens pledged by node a in the Inter-Tx Pool at the beginning of the current epoch is X. a =80, node a had one incoming transaction and one outgoing transaction in the previous epoch. Node b checks the validity of the transaction using the public keys of both parties to the transaction based on the valid transaction information broadcast by node a. After verification, it calculates the transaction amount of the incoming transaction r1=10 and the transaction amount of the outgoing transaction n' a = 20, and then compare the calculated transaction amount with the points status in the broadcast Inter-Tx Pool. lock The number of tokens n in a =20, calculated n' a =20, n' a =n a , the result is correct. According to the formula X-n+(r1+r2+...)=m, a =80, n' a =20, r1=10 into the formula, and we get m' a =70. Add broadcast by node a use The number of tokens in m a =70, m' a =m a The result is correct. So far, all inter-Tx checks of node a in the previous epoch have been completed, and the subsequent check process of node b on node d and node g is similar. After all nodes are checked, the entire blockchain network updates the account information in the Inter-Tx pool.
[0072] (7) Redeem the mortgage points in the Inter-Tx pool
[0073] After the inter-Tx of the previous epoch has been checked for an epoch, at the end of the current epoch, each node can choose to redeem the points pledged in the Inter-Tx Pool at the beginning of the previous epoch, or choose to continue to store them in the Inter-Tx Pool as pledged points for the next epoch.
[0074] Blockchain is a chain data structure that combines data blocks in a chronological order, and cryptographically ensures that data blocks cannot be tampered with or forged. Each block in the blockchain is linked to the previous block by including the encrypted hash of the previous block immediately before it in the blockchain. Each block also includes a timestamp, an encrypted hash of the block, and one or more transactions. Transactions that have been verified by the nodes of the blockchain network are hashed and form a Merkle tree. In the Merkle tree, the data at the leaf node is hashed, and for each branch of the Merkle tree, all hash values of the branch are cascaded at the root of the branch. The above process is performed on the Merkle tree until the root node of the entire Merkle tree. The root node of the Merkle tree stores hash values representing all the data in the Merkle tree. When a hash value claims to be a transaction stored in a Merkle tree, it can be quickly verified by determining whether the hash value is consistent with the structure of the Merkle tree.
[0075] A blockchain network is a network of computing nodes used to manage, update, and maintain one or more blockchain structures. In this specification, a blockchain network may include a public blockchain network, a private blockchain network, or a consortium blockchain network.
[0076] In a public blockchain network, the consensus process is controlled by the nodes of the consensus network. For example, there may be thousands of entities collaborating in a public blockchain network, each operating at least one node in the public blockchain network. Therefore, a public blockchain network can be considered a public network of participating entities. In some examples, a majority of entities (nodes) must sign each block in order and add the signed blocks to the blockchain of the blockchain network. Examples of public blockchain networks may include specific peer-to-peer payment networks.
[0077] Public blockchain networks support public transactions. Public transactions are shared between all nodes within a public blockchain network and are stored in a global blockchain. A global blockchain is a blockchain that is replicated across all nodes. In order to reach consensus (e.g., agree to add a block to the blockchain), a consensus protocol is implemented within a public blockchain network. Examples of consensus protocols include, but are not limited to: proof-of-work (POW), proof-of-stake (POS), and proof-of-authority (POA).
[0078] Private blockchain networks are provided for specific entities. The read and write permissions of each node in a private blockchain network are strictly controlled. Therefore, private blockchain networks are also often called permissioned networks, which restrict who is allowed to participate in the network and the level of network participation (for example, only in certain transaction scenarios). In private blockchain networks, various types of access control mechanisms can be used (for example, existing participants vote on adding new entities, regulators control permissions, etc.).
[0079] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
[0080] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0081] The above embodiments should be understood to be only used to illustrate the present invention and not to limit the protection scope of the present invention. After reading the contents of the present invention, technicians can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A blockchain cross-sharding method based on off-chain payment technology, characterized in that: The following steps are involved: Construct a scalable blockchain model based on Layer1+Layer2; the scalable blockchain model based on Layer1+Layer2 includes two layers, Layer1 and Layer2. Layer1 represents the on-chain solution for blockchain scalability, that is, the sharding technology is used to improve the parallel processing capability of intra-Tx transactions, thereby improving the scalability of blockchain; Layer2 represents the off-chain solution for blockchain scalability, that is, the off-chain payment technology is used to improve the processing capability of inter-Tx cross-shard transactions, thereby improving the scalability of blockchain; A blockchain cross-sharding method based on off-chain payment technology is designed. The cross-sharding method is implemented by setting up an Inter-Tx pool cross-shard transaction pool under the chain; the incentive mechanism of the blockchain is set as a reward point. At the beginning of an epoch cycle, each node pledges points in the Inter-Tx Pool corresponding to the shard where it is located. In this epoch, the node freely performs inter-Tx within the pledged amount. In this process, the node does not broadcast transaction information, but saves valid transaction information with signatures of both parties to the transaction as a transaction certificate. At the end of an epoch, each node broadcasts all valid inter-Tx transaction information that occurred in this epoch and the point status of each Inter-Tx Pool at that time; in the next epoch, the nodes in the blockchain network check the legitimacy and validity of the transaction according to the broadcast information, and the malicious nodes will be punished, and the nodes that detect the malicious behavior will be rewarded; finally, the transaction information is put on the chain after the check is correct; after the end of the next epoch, each node can choose to redeem the points in the Inter-TxPool, or choose to continue to store them in the Inter-Tx Pool as the pledge points for participating in inter-Tx in the next epoch.
2. According to claim 1, a blockchain cross-sharding method based on off-chain payment technology is characterized in that: The scalable blockchain model based on Layer1+Layer2 specifically includes: in Layer1, when a node enters the blockchain network, the system will distribute a pair of public and private keys to each node, and then use the public key as a seed to generate an address Add for inter-Tx. use and Add lock ; Then, the blockchain network is divided into several shards through random rules. The shards are represented by Shard#x, where x represents the shard number. There are several nodes in each shard. After the sharding is completed, each node establishes its identity by broadcasting its public key and the shard number of its shard to the entire network. In Layer2, an Inter-Tx Pool is set up for each shard. The Inter-Tx Pool stores User, Add use 、Add lock Data structure; the public key PK of the node is stored in User x , the PK of each node x Is unique and is the node's identifier; Add use Indicates the address where the node stores transaction points for inter-Tx, m x Indicates that the node is in Add use The number of points in; Add lock Indicates the address of the transaction points locked by the smart contract when the storage node initiates the transaction as the transaction initiator, n x Indicates that the node is in Add lock The number of points in .
3. According to claim 1, a blockchain cross-sharding method based on off-chain payment technology is characterized in that: The blockchain cross-sharding method based on off-chain payment is implemented by mortgaging points in the Inter-Tx Pool, and specifically includes the following steps: (1) mortgaging points in the Inter-Tx Pool; (2) the transaction initiator initiates inter-Tx; (3) the smart contract determines the legality of the transaction; (4) the transaction receiver checks the transaction; (5) broadcasting the transaction information of inter-Tx; (6) checking the inter-Tx of the previous epoch; (7) redeeming the mortgaged points in the Inter-Tx pool.
4. A blockchain cross-sharding method based on off-chain payment according to claim 3, characterized in that: The step (1) of pledging points in the Inter-Tx Pool specifically includes: the nodes in each shard are expected to participate in the transfer of points of inter-Tx as transaction initiators in the next epoch. At the beginning of the next epoch, each node pledges points in its corresponding Inter-Tx Pool. At this time, the node Add use The number of points in is equal to the number of points pledged, Add lock The number of points in the Inter-Tx Pool is equal to 0. The points pledged are valid after the node signature. Whether to pledge points and the number of pledged points follow the principle of voluntariness. After the node pledges points and signs, it broadcasts the status of its pledged points in the Inter-Tx Pool to the entire network. The points pledged in the Inter-Tx Pool can only be used for inter-Tx, and the pledged points can only be redeemed after being locked for 2 epochs. If a node pledges points at the beginning of an epoch and redeems points at the end of the next epoch, this is a collective behavior to maintain the smooth operation of the system, so only a small amount of fees caused by routing forwarding needs to be paid, which can be points; of course, the node can also pledge points during the current epoch and redeem them during the two locked epochs. use The operations of pledging points, pledging points and redeeming points will cause the number of points in the Inter-Tx Pool to change. The changes in the number of points of the node in the transaction pool and the current status of the transaction pool need to be broadcast to the entire network. If there is not enough incentive, other nodes have no motivation to forward. Therefore, it is necessary to pay higher fees for pledging points and redeeming points during the epoch. Therefore, rational nodes will pledge sufficient points in the Inter-Tx Pool at the beginning of an epoch and try to minimize the operations of pledging points and redeeming points during the point lock period. This will reduce the routing overhead caused by the change of the point status of the broadcast node in the transaction pool to a certain extent and avoid network congestion.
5. According to claim 3, a blockchain cross-sharding method based on off-chain payment technology is characterized in that: The step (2) initiating inter-Tx by the transaction initiator specifically includes: describing an inter-Tx that occurs between two nodes in different shards; the transaction initiator constructs transaction information and sends the transaction information to the transaction recipient; assuming that the number of points pledged by the transaction initiator u1 in the Inter-Tx Pool at the beginning of the current epoch is X; the transaction initiator u1 initiates the transfer of x points to the transaction recipient u2, at which time u1 Add use The integral number is m, Add lock The number of points in is n, X = m + n; the transaction information constructed by the transaction initiator is: PK u1 —>PK u2 =x means that the transaction initiator u1 initiates a transaction to transfer x points to the transaction receiver u2; PK u1 :Add use =mx indicates that the transaction initiator u1 is in Add use The remaining available points in PK are mx; u1 :Add lock =n+x means that the transaction initiator u1 adds lock The current locked points are n+x; Sig u1 Indicates that the transaction initiator u1 uses SK u1 (Private key) to sign the transaction.
6. A blockchain cross-sharding method based on off-chain payment according to claim 3, characterized in that: The determination of the legality of the transaction by the smart contract in step (3) specifically includes: After the transaction initiator u1 initiates a transaction, the smart contract is triggered; the contract logic is as follows: First, check whether the integral m in u1 Add use is greater than the transaction amount x. If m >= x, lock the transaction amount x, and the lock-up period is the remaining time of this epoch plus the next epoch, and return a passed inspection message to the transaction recipient; If no valid transaction information with the signatures of both parties is broadcast by both parties during the lock-up period, it means the transaction fails. After the lock-up period, x is automatically unlocked, and the Add use of the transaction sender is returned; If m < x, the transaction fails, and the smart contract returns a failed inspection message to the transaction recipient.
7. A blockchain cross-sharding method based on off-chain payment according to claim 3, characterized in that: The step (4) the transaction recipient checks the transaction specifically includes: if the transaction recipient receives the transaction information sent by the transaction initiator and the check pass information returned by the smart contract, then the transaction information sent by the transaction initiator is checked, including the address information, the transaction points, and the signature information; after the check is correct, the transaction recipient signs the transaction information with his own private key and sends it to the transaction initiator; Sig u2 Indicates that the transaction receiver u2 uses SK u2 (private key) to sign the transaction; transactions signed by both the transaction initiator and the transaction recipient are called valid transactions. Both parties will save the valid transaction information as proof of successful transaction; If the transaction recipient receives the transaction information sent by the transaction initiator and the check failure information returned by the smart contract, the transaction will not be processed.
8. According to claim 3, a blockchain cross-sharding method based on off-chain payment is characterized in that: The step (5) of broadcasting inter-Tx transaction information specifically includes: within an epoch, many inter-Tx may occur between any nodes of any shard. At the end of this epoch, all nodes broadcast all valid inter-Tx transaction information packaged in the previous epoch, package outgoing transactions and incoming transactions separately in chronological order, and broadcast their final status of integration in the Inter-Tx Pool, including Add use and Add lock The number of points will be transferred into the transaction and included in Add use middle.
9. A blockchain cross-sharding method based on off-chain payment according to claim 3, characterized in that: The step (6) of checking the inter-Tx of the previous epoch specifically includes: each node has the right to check the information broadcast by others. After the nodes in the blockchain network receive the valid transaction information of the inter-Tx in the previous epoch broadcast by other nodes and their respective integral status in the Inter-Tx Pool; in the next epoch, the node verifies the validity of the signature in the valid transaction information with the public keys of the transaction parties based on the received valid transaction information. After the verification is correct, the transaction amount of all inter-Tx that occurred in the previous epoch of the node and the final integral status in the Inter-Tx Pool are checked based on the broadcast valid transaction information and the integral status in the Inter-Tx Pool to see whether they are consistent, and X-n+(r1+r2+...)=m must be satisfied; X represents the number of points pledged by the node in the Inter-Tx Pool at the beginning of the current epoch, and m represents the number of points pledged by the node in the Add use The number of points in Add lock The integral number in r x Indicates the transaction amount of the node's xth incoming transaction; In this process, if a node is found to have engaged in malicious behavior, the points obtained by the node through the malicious behavior will become invalid. These points will become rewards for the node that detects the malicious behavior, and the malicious node will be prohibited from participating in inter-Tx in the next epoch. After the verification is completed, the entire blockchain network updates the ledger information in the Inter-Tx pool and puts the inter-Tx that occurred in the previous epoch on the chain.
10. A blockchain cross-sharding method based on off-chain payment according to claim 3, characterized in that: The step (7) of redeeming the mortgage points in the Inter-Tx pool specifically includes: after the inter-Tx of the previous epoch is checked for an epoch, at the end of the current epoch, each node can choose to redeem the points mortgaged in the Inter-Tx Pool at the beginning of the previous epoch, or choose to continue to store them in the Inter-Tx Pool as mortgage points for the next epoch.
