A blockchain remaining resource mapping and cross-shard consensus method
By building a virtual computing layer and a consensus protocol for contribution proof in blockchain, the problems of insufficient resources and high concurrent transactions are solved, resource combination sharding and cross-shashing transaction processing are realized, and blockchain is improved Performance and scalability.
Patent Information
- Application Number
- CN202211685985.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-12-27
AI Technical Summary
Traditional blockchain platforms are prone to performance degradation and downtime in the case of high concurrent transactions, and sharding technology leads to insufficient resources and waste of computing resources, which cannot meet the high concurrency needs.
Build a virtual computing layer in the blockchain, and proof consensus protocols through resource mapping and contribution degree, realize resource combination sharding and cross-shash transaction processing, and optimize resource allocation and consensus process.
It improves the computing efficiency and performance of blockchain, avoids resource waste, meets the needs of high concurrent transactions, and realizes the decentralized expansion of blockchain.
Smart Images

Figure CN116016184B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain and sharding technology, and in particular to a blockchain residual resource mapping and cross-sharding consensus method. Background Art
[0002] Traditional blockchain platforms typically consist of a single blockchain, encompassing multiple business types and enabling electronic transactions across them. However, if a large number of transactions are initiated simultaneously, this can significantly impact blockchain performance and even cause platform downtime, a significant factor hindering the widespread adoption of blockchain technology.
[0003] Sharding technology is currently being used to address the performance and scalability issues facing blockchains. Sharding, when applied to blockchains, is equivalent to breaking down all pending tasks within the blockchain network and grouping nodes across the network. Each group simultaneously processes one of these tasks, transforming the system from a single node handling all network tasks to multiple groups of nodes processing them simultaneously. However, inefficient sharding can lead to insufficient resources for blockchain nodes to meet computing requirements, necessitating resharding within the blockchain network and resulting in inefficient blockchain data processing. Furthermore, when shards perform cross-shard consensus on blockchain transactions, since the information stored on each shard is disjoint, nodes on different shards must communicate ledger status during transaction verification. This cross-shard information exchange consumes significant computing resources and time, leading to insufficient blockchain throughput and computing resources, making it impossible to meet the high concurrency requirements of blockchain systems. Summary of the Invention
[0004] To solve at least one of the above technical problems, the present invention proposes a blockchain remaining resource mapping and cross-shard consensus method.
[0005] The purpose of the present invention is achieved through the following technical solutions:
[0006] The present invention provides a blockchain residual resource mapping and cross-shard consensus method. A virtual computing layer for residual resource mapping of each node is constructed in the blockchain. The virtual computing layer obtains and stores the computing resource size of each node in the blockchain shard. When a shard fails in operation or is reconfigured, the resource combination sharding is performed according to the operation or reset needs combined with the stored computing resource size of each node. After sharding, a unified consensus mechanism is established within each shard. When information interaction across shards is required, a consensus protocol based on proof of contribution is used to process cross-shard transactions.
[0007] As a further improvement, the contribution proof-based consensus protocol first constructs contribution rules and designates at least two nodes with high contribution rankings to form a verification committee according to the contribution rules. Among them, the node with the highest contribution is the leader of this round of transactions, handling internal shard transactions and cross-shard transactions. The remaining designated nodes are verification nodes for this round of transactions, and the remaining undesignated nodes are ordinary nodes for this round of transactions.
[0008] As a further improvement, the resource combination and slicing steps of the virtual computing layer are as follows:
[0009] S11. When entering the blockchain service, the estimated remaining resource size of all nodes in the blockchain and the index identifier of the corresponding node for identification are obtained through the shard calculation function and temporarily stored. All nodes wait for shard allocation;
[0010] S12. When a shard fails or is reconfigured, based on the current computing resource status of each shard and the estimated remaining resource size of the corresponding nodes in each shard, the nodes with the largest estimated remaining computing resources are reallocated to the shard with the overloaded computing load according to the index identifier of each node;
[0011] S13. The blockchain node service in the blockchain network matches all nodes of the blockchain according to the needs of each shard. The remaining nodes that are not individually assigned will give priority to joining the shard closest to them.
[0012] As a further improvement, in step S11, the shard calculation function first obtains the actual resource size of each node in each shard and establishes an index identifier based on the corresponding identity identifier, and then estimates the resources required for each node in the shard to complete the current transaction, and subtracts the estimated resource size from the actual resource size to obtain the estimated remaining resource size.
[0013] As a further improvement, the contribution rule is: in the first round of transaction negotiation, a shard leader of the transaction is randomly selected through a verifiable random function; after each subsequent round of consensus, the corresponding contribution value is obtained according to the work intensity of each node role.
[0014] As a further improvement, when obtaining the corresponding contribution value based on the work intensity of each node role, the contribution value of the leader is lower than that of the verification node; the contribution value of the verification node is calculated based on the time sequence of each vote in the committee; the contribution value of the ordinary node is calculated based on the intensity of participating in the transaction processing within the shard.
[0015] As a further improvement, the leader can propose a block containing the local shard for the current transaction, or propose a cross-shard block, and the proposal of a cross-shard block includes the process of waiting for acceptance, acceptance and submission.
[0016] As a further improvement, the process for the leader to propose a cross-shard block is as follows:
[0017] S21, waiting for acceptance: The blockchain user sends the created cross-shard block to the leader. The leader receives the cross-shard block, marks the conflicting parts of the transaction, and sends it to the verification node to verify the transaction. The leader then broadcasts the transaction to all relevant input shards of the blockchain.
[0018] S22, Acceptance Phase: After all nodes in the relevant input shards receive the message from the leader, they identify the blocks with transaction conflicts in their own shards based on the transaction list in the received block. They randomly accept one block with transaction conflicts and reject the others. They then run the consensus algorithm on their local input shards to verify the transaction. If the transaction is valid, the input shard returns the verification result to the leader. The leader then compares the messages returned by all relevant input shards with the verification results of the verification nodes.
[0019] S23, Commit phase: When the message returned by the input shard is the same as the verification result of the verification node, the leader will send the acceptance message to all relevant output shards, and the output shards will create the output object, and the transaction is completed; otherwise, the leader will broadcast the abort message to all relevant input shards, the current node fails to write and sends a rollback message, aborting the transaction.
[0020] The present invention provides a blockchain residual resource mapping and cross-shard consensus method, which constructs a virtual computing layer for the residual resource mapping of each node in the blockchain. The virtual computing layer obtains and stores the computing resource size of each node in the blockchain shard. When a shard fails or a shard is reconfigured, the resource combination sharding is performed according to the computing or reset needs combined with the stored computing resource size of each node. After sharding, a unified consensus mechanism is established within each shard. When information interaction across shards is required, a consensus protocol based on proof of contribution is used to process cross-shard transactions. The present invention sets up a virtual operation layer, maps the remaining resources of each node in the blockchain to the virtual operation layer, and performs resource combination and sharding according to the actual parameters of each node and the blockchain transaction requirements to meet different computing requirements. During the operation of the blockchain system, if the shard fails to operate, it is passive re-sharding; shard reconfiguration is because the shard needs more resources and actively requests re-sharding from the system. After the transaction enters the blockchain service, the estimated remaining resource size of each node is stored in the virtual operation layer. When re-sharding is required, the estimated remaining resource size of each node in the virtual operation layer is directly called to complete fast shard allocation, avoiding multiple sharding, improving computing efficiency and avoiding resource waste. At the same time, it solves the problem of insufficient throughput and computing resources in traditional blockchains due to the large amount of computing resources and time required for the consensus process, while maintaining the decentralization of the blockchain and achieving on-chain expansion, meeting the high concurrency requirements of blockchain system transactions, and improving the performance and scalability of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 This is a flow chart of slicing the virtual computing layer according to the remaining resource mapping in an embodiment of the present invention;
[0022] Figure 2 This is a consensus flow chart for processing cross-shard blocks in an embodiment of the present invention;
[0023] Figure 3 Schematic diagram of the consensus protocol for processing cross-shard blocks in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features therein can be combined with each other unless there is a conflict.
[0025] Combine Figure 1As shown, the embodiment of the present invention provides a blockchain remaining resource mapping and cross-shard consensus method, constructs a virtual operation layer for the remaining resource mapping of each node in the blockchain system, and the virtual operation layer obtains the data of all nodes in the blockchain for logical operations. At the same time, the virtual operation layer provides shard grouping for all nodes. The virtual operation layer obtains the computing resource size of each node in the blockchain shard and stores it. When a shard fails to operate or a shard is reconfigured, the resource combination sharding is performed according to the operation or reset needs combined with the stored computing resource size of each node. Sharding is to decompose all pending tasks in the blockchain network, group the nodes of the entire network, and each group is a shard. Each shard processes a decomposed task at the same time, thus changing from a single node processing all tasks of the entire network to multiple shards processing in parallel at the same time, significantly reducing the communication, calculation and storage of each node, and improving the performance of the blockchain system. Specifically, the resource combination sharding steps of the virtual operation layer are as follows:
[0026] S11. When entering the blockchain service, the estimated remaining resource size of all nodes in the blockchain and the index identifier of the corresponding node used for identity identification are obtained through the shard calculation function and temporarily stored. All nodes wait for shard allocation. The shard calculation function first obtains the actual resource size of each node in each shard and establishes an index identifier based on the corresponding identity identifier. Then, the resources required for each node in the shard to complete the current transaction are estimated. The estimated remaining resource size is subtracted from the actual resource size.
[0027] S12. When a shard fails or undergoes a shard reconfiguration, based on the current state of each shard's computing resources and the estimated remaining resources of the corresponding nodes in each shard, nodes with the highest estimated remaining computing resources are reassigned to the shard with the overloaded computing load according to the node's index. A shard failure is a passive resharding; a shard reconfiguration is a proactive request to the system for a shard that requires more resources.
[0028] S13. The blockchain node service in the blockchain network matches all nodes of the blockchain according to the requirements of each shard. The remaining nodes that are not individually assigned will give priority to joining the shard closest to them. After the transaction enters the blockchain service, the estimated remaining resource size of each node is stored in the virtual operation layer. When re-sharding is required, the estimated remaining resource size of each node in the virtual operation layer can be directly called to complete the fast shard allocation.
[0029] After sharding, each shard implements a unified consensus mechanism. When cross-shard information exchange is required, a Proof of Contribution consensus protocol is used to process cross-shard transactions. This Proof of Contribution consensus protocol first establishes a contribution rule. Specifically, in the first round of transaction negotiation, a shard leader is randomly selected using a verifiable random function. After each subsequent consensus round, each node's contribution value is determined based on its workload. The verifiable random function generates a public and private key pair using a key function. Taking the private key and a random seed as input, it outputs a pseudo-random number and a corresponding proof. Anyone can verify that the pseudo-random number was generated by the private key holder using the public key corresponding to the private key and the proof. Then, according to the contribution rule, at least two nodes with the highest contribution rankings are designated to form a verification committee. The node with the highest contribution becomes the leader for this round of transactions, handling both intra-shard and cross-shard transactions. The remaining designated nodes serve as validation nodes for this round of transactions, while the remaining undesignated nodes serve as ordinary nodes for this round of transactions. The contribution value is determined based on the workload of each node role. Specifically, the leader's contribution value is lower than that of the validator, ensuring the liquidity of each node role. The contribution value of the validator node is calculated based on the chronological order of each vote in the committee, which not only alleviates blocking issues in the verification process but also improves the parallel efficiency of the validator node's verification execution. The contribution value of ordinary nodes is calculated based on the intensity of their participation in transaction processing within the shard. The contribution rule can redistribute the roles of various nodes, ensuring the liquidity of each node role, while maintaining decentralization and preventing malicious nodes from continuing to act maliciously.
[0030] As a further preferred embodiment, the leader can propose a block containing the local shard for the current transaction. The blocks within the local shard adopt a common consensus mechanism. It can also propose a cross-shard block. Figure 2 and Figure 3 As shown in the figure, the process of proposing a cross-shard block includes waiting for acceptance, acceptance, and submission, as follows:
[0031] S21, waiting for acceptance: The blockchain user sends the created cross-shard block to the leader. The leader receives the cross-shard block and marks the conflicting parts of the transaction. It then sends it to the verification node to verify the transaction. The leader then broadcasts the transaction to all relevant input shards of the blockchain. Input shards represent the shards that can be written to the transaction block.
[0032] S22, Acceptance phase: After all nodes in the relevant input shards receive the message from the leader, they identify the blocks with transaction conflicts in their own shards based on the transaction list in the received block. They then randomly accept a block with transaction conflicts and reject the others. This ensures that among all the blocks with transaction conflicts, only one block can receive an Accept message, while the others only receive Reject messages. The nodes will stop submitting conflicting blocks and submit non-conflicting blocks in the same round. A consensus algorithm is run on the local input shard to verify the transaction. The consensus algorithm includes one of Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Proof of Activity (POA), Practical Byzantine Fault Tolerance (PBFT), or Delegated Byzantine Fault Tolerance (DBFT). The consensus algorithm of this embodiment adopts the Practical Byzantine Fault Tolerance algorithm. If the transaction is valid, the input shard returns the verification result to the leader. The leader compares the messages returned by all relevant input shards with the verification results of the verification node.
[0033] S23, Commit phase: When the message returned by the input shard is the same as the verification result of the verification node, the leader will send the acceptance message to all relevant output shards, and the output shard will create the output object, and the transaction is completed. The output shard represents the shard that can read the transaction block; otherwise, the leader will broadcast the abort message to all relevant input shards, the current node fails to write and sends a rollback message to abort the transaction.
[0034] The present invention sets up a virtual operation layer, maps the remaining resources of each node in the blockchain to the virtual operation layer, and performs resource combination and sharding according to the actual parameters of each node and the blockchain transaction requirements to meet different computing requirements. During the operation of the blockchain system, if the shard fails to operate, it is passive re-sharding; shard reconfiguration is because the shard needs more resources and actively requests re-sharding from the system. After the transaction enters the blockchain service, the estimated remaining resource size of each node is stored in the virtual operation layer. When re-sharding is required, the estimated remaining resource size of each node in the virtual operation layer is directly called to complete fast shard allocation, avoiding multiple sharding, improving computing efficiency and avoiding resource waste. At the same time, it solves the problem of insufficient throughput and computing resources in traditional blockchains due to the large amount of computing resources and time required for the consensus process, while maintaining the decentralization of the blockchain and achieving on-chain expansion, meeting the high concurrency requirements of blockchain system transactions, and improving the performance and scalability of the blockchain.
[0035] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0036] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.
Claims
1. A blockchain remaining resource mapping and cross-shard consensus method, It is characterized in that A virtual computing layer is constructed in the blockchain for mapping the remaining resources of each node. The virtual computing layer obtains and stores the computing resource size of each node in the blockchain shard. When a shard fails to operate or is reconfigured, the resource combination shard is performed according to the operation or reset needs combined with the stored computing resource size of each node. After sharding, a unified consensus mechanism is implemented within each shard. When cross-shard information interaction is required, a consensus protocol based on proof of contribution is used to process cross-shard transactions. The contribution proof-based consensus protocol first constructs contribution rules, and designates at least two nodes with the highest contribution rankings to form a verification committee according to the contribution rules, among which the node with the highest contribution is the leader of this round of transactions, handling internal shard transactions and cross-shard transactions, the remaining designated nodes are the verification nodes of this round of transactions, and the remaining undesignated nodes are ordinary nodes of this round of transactions; the contribution rule is: in the first round of transaction negotiation, a shard leader of the transaction is randomly selected through a verifiable random function; after each subsequent round of consensus, the corresponding contribution value is obtained according to the work intensity of each node role; The resource combination and slicing steps of the virtual computing layer are as follows: S11. When entering the blockchain service, the estimated remaining resource size of all nodes in the blockchain and the index identifier of the corresponding node for identity identification are obtained through the shard calculation function and temporarily stored, and all nodes wait for shard allocation; S12. When a shard fails in operation or is reconfigured, based on the computing resource status of each shard and the estimated remaining resource size of the corresponding node in each shard, the node with the largest estimated remaining computing resource is reallocated to the shard with overloaded computing load according to the index identifier of each node; S13. The blockchain node service in the blockchain network matches all nodes of the blockchain according to the needs of each shard. The remaining nodes that are not individually assigned will give priority to joining the shard closest to them.
2. According to the blockchain remaining resource mapping and cross-shard consensus method described in claim 1, It is characterized in that In step S11, the shard calculation function first obtains the actual resource size of each node in each shard and establishes an index identifier based on the corresponding identity identifier, and then estimates the resources required for each node in the shard to complete the current transaction, and subtracts the estimated resource size from the actual resource size to obtain the estimated remaining resource size.
3. According to the blockchain remaining resource mapping and cross-shard consensus method according to claim 2, It is characterized in that When obtaining the corresponding contribution value according to the work intensity of each node role, the contribution value of the leader is lower than that of the verification node; the contribution value of the verification node is calculated in combination with the time sequence of each vote in the committee; the contribution value of the ordinary node is calculated in combination with the intensity of participating in the transaction processing within the shard.
4. According to the blockchain remaining resource mapping and cross-shard consensus method described in claim 3, It is characterized in that The leader can propose a block containing the local shard for the current transaction, or a cross-shard block. The cross-shard block proposal includes the process of waiting for acceptance, acceptance, and submission.
5. According to the blockchain remaining resource mapping and cross-shard consensus method described in claim 4, It is characterized in that The process of the leader proposing a cross-shard block is as follows: S21, waiting for acceptance stage: The blockchain user sends the created cross-shard block to the leader. After the leader receives the cross-shard block and marks the places where the transaction conflicts, it sends it to the verification node to verify the transaction. Then the leader broadcasts the transaction to all relevant input shards of the blockchain; S22, acceptance phase: After the nodes in all relevant input shards receive the message from the leader, according to the transaction list in the received block, each relevant input shard identifies the block with transaction conflicts in the shard, randomly accepts a block with transaction conflicts and rejects other blocks, and runs the consensus algorithm in the local input shard to verify the transaction. If the transaction is valid, the input shard returns the verification result to the leader, and the leader compares the messages returned by all relevant input shards with the verification results of the verification nodes; S23, Commit phase: When the message returned by the input shard is the same as the verification result of the verification node, the leader will send the acceptance message to all relevant output shards, and the output shards will create output objects, and the transaction is completed; otherwise, the leader will broadcast the abort message to all relevant input shards, the current node fails to write and sends a rollback message to abort the transaction.
