WO2023231338A1 - State data submission method, node, and blockchain system - Google Patents

State data submission method, node, and blockchain system Download PDF

Info

Publication number
WO2023231338A1
WO2023231338A1 PCT/CN2022/135279 CN2022135279W WO2023231338A1 WO 2023231338 A1 WO2023231338 A1 WO 2023231338A1 CN 2022135279 W CN2022135279 W CN 2022135279W WO 2023231338 A1 WO2023231338 A1 WO 2023231338A1
Authority
WO
WIPO (PCT)
Prior art keywords
contract
transaction
node
execution
transactions
Prior art date
Application number
PCT/CN2022/135279
Other languages
French (fr)
Chinese (zh)
Inventor
林鹏
Original Assignee
蚂蚁区块链科技(上海)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蚂蚁区块链科技(上海)有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2023231338A1 publication Critical patent/WO2023231338A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • G06F16/2386Bulk updating operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • G06Q20/102Bill distribution or payments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/22Payment schemes or models
    • G06Q20/223Payment schemes or models based on the use of peer-to-peer networks

Definitions

  • the embodiments of this specification belong to the field of blockchain technology, and particularly relate to a state data submission method, a node and a blockchain system.
  • Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • data blocks are combined into a chained data structure in a chronological manner and are cryptographically guaranteed to be an untamperable and unforgeable distributed ledger. Due to the characteristics of blockchain, such as decentralization, non-tamperable information, and autonomy, blockchain has also received more and more attention and applications.
  • the purpose of the present invention is to provide a state data submission method, node and blockchain system.
  • a state data submission method is provided, which is executed by a first node in a blockchain system, where the first node includes a control process and N computing processes.
  • the method includes: the control process obtains M transaction groups, the M transaction groups are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, wherein M is greater than N, and the pre-execution read and write sets are obtained by grouping the multiple transactions.
  • Executing the read-write set involves several contract parameters;
  • the control process sends P first transaction groups involving contract parameters of the first contract among the M transaction groups to the first process among the N processes;
  • the first process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract.
  • Each group of contract status data includes one or more contract parameters of the first contract.
  • the status value of the contract status of the first contract is submitted based on the contract status data of the P group.
  • a first node in a blockchain system where the first node includes a control process and N computing processes.
  • the control process obtains M transaction groups, and the M transaction groups are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, where M is greater than N, and the pre-execution The read-write set involves several contract parameters;
  • the control process sends the P first transaction groups involving the contract parameters of the first contract among the M transaction groups to the first process among the N processes;
  • the A process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract.
  • Each group of contract status data includes one or more contract parameters of the first contract. The status value is used to submit the contract status of the first contract based on the P group contract status data.
  • a blockchain system including a first node and a second node.
  • the second node is used to send the pre-execution read and write sets of multiple transactions to the first node, and the pre-execution read and write sets involve several contract parameters;
  • the first node controls the process based on the The respective pre-execution read-write sets of the multiple transactions are grouped to obtain M transaction groups, and the P first transaction groups involving the contract parameters of the first contract among the M transaction groups are sent.
  • the set contract status data includes respective status values of one or more contract parameters of the first contract, and the contract status of the first contract is submitted based on the P set of contract status data.
  • transactions involving the same contract account are executed by the same calculation process, so that any two calculation processes that execute multiple transactions belonging to a certain block in parallel will not generate contract status data involving the same contract account, thus
  • This allows multiple computing processes to submit their respective contract status data in parallel, which is conducive to faster generation of blocks containing multiple transactions.
  • a single computing process can concurrently execute each transaction in its corresponding multiple transaction groups, and can more quickly complete the execution of the transactions in each transaction group it receives, thereby accelerating the generation of blocks.
  • Figure 1 is a schematic diagram of a blockchain system provided as an example in the embodiment of this specification.
  • Figure 2 is a schematic structural diagram of blockchain data storage provided as an example in the embodiment of this specification.
  • Figure 3 is a schematic structural diagram of any two nodes in the blockchain system provided as an example in the embodiment of this specification;
  • Figure 4 is a flow chart of a method for submitting status data provided in the embodiment of this specification
  • Figure 5 is a schematic structural diagram of a blockchain node provided in the embodiment of this specification.
  • FIG. 1 is a schematic diagram of an exemplary blockchain system provided in the embodiment of this specification.
  • the blockchain system is a distributed network established through multiple nodes (Node), which includes communication between any two nodes at the application layer through a peer-to-peer (P2P) network. Connection, for example, any two nodes among the nodes n1 to n5 contained therein can realize communication connection at the application layer through the P2P network.
  • the blockchain system uses a decentralized (or multi-centered) distributed ledger constructed by a chain block structure, which is stored on each node (or most nodes, such as consensus) in the distributed blockchain network.
  • each node of the blockchain system runs a blockchain program.
  • the consensus mechanism is used to ensure that all loyal nodes have the same transactions, thereby ensuring that all loyal nodes have the same If the execution results of the transaction are consistent, the transaction is packaged into blocks and the world state is updated based on the execution results of the same transaction.
  • the current mainstream consensus mechanisms include but are not limited to: Proof of Work (POW), Proof of Stake (POS), Practical Byzantine Fault Tolerance (PBFT) algorithm, Honey Badger Byzantine Fault Tolerance ( HoneyBadgerBFT) algorithm and so on.
  • POW Proof of Work
  • POS Proof of Stake
  • PBFT Practical Byzantine Fault Tolerance
  • HoneyBadgerBFT Honey Badger Byzantine Fault Tolerance
  • Accounts in the blockchain system are usually divided into two types: user account/externally owned account (Externally owned account) and contract account (contract account); the contract account is used to store smart contract code and the values of related states in the smart contract code. , which can usually only be activated by calling an external account.
  • the design of external accounts and contract accounts is actually the mapping of account addresses to account status.
  • the status of an account can usually include, but is not limited to, nonce, balance, storage_Root, codeHash and other fields. Nonce and balance exist in both external accounts and contract accounts, while the codeHash and storage_Root attributes are usually only valid on contract accounts. Among the aforementioned fields, nonce represents the counter.
  • For external accounts it represents the number of transactions sent from the account address; for contract accounts, it represents the number of contracts created by the account.
  • Balance represents the number of digital resources owned by the corresponding external account.
  • storage_Root represents the hash of the root node of an MPT (Merkle Patricia Tree) tree. The MPT is used to organize the storage of state variables of contract accounts.
  • codeHash represents the hash value of the smart contract code.
  • contract accounts it is the hashed and stored code of the smart contract.
  • For external accounts it does not include smart contracts, so it can be an empty string/all 0 characters. string.
  • MPT is a tree structure that combines Merkle Tree (Merkle Tree) and Patricia Tree (Compressed Prefix Tree, a more space-saving Trie tree, dictionary tree).
  • Merkle Tree the Merkle tree algorithm calculates a Hash value for each transaction, and then connects the two to calculate the Hash again, all the way to the top-level Merkle root.
  • Ethereum uses an improved MPT tree, such as a 16-fork tree structure, which is usually referred to as an MPT tree.
  • the data structure of the Ethereum MPT tree includes a state trie.
  • the state tree contains the key and value pair corresponding to the storage content of each account in Ethereum.
  • the "key" in the state tree can be a 160bits identifier (the address of an Ethereum account).
  • This account address is distributed in the storage starting from the root node of the state tree to the leaf nodes.
  • the "values" in the state tree are generated by encoding the Ethereum account information (using the Recursive-Length Prefix encoding (RLP) method).
  • RLP Recursive-Length Prefix encoding
  • the values include nonce and balance; for contract accounts, the values include nonce, balance, codehash, storage_Root, etc.
  • Contract accounts are used to store status related to smart contracts. After the smart contract is deployed in the blockchain system, a corresponding contract account will be generated. This contract account generally has some states, which are defined by the state variables in the smart contract and generate new values when the smart contract is created and executed.
  • the smart contract usually refers to a contract defined in digital form in a blockchain environment that can automatically execute terms. Once an event triggers a clause in the contract (execution conditions are met), the code can be executed automatically.
  • the relevant status of the contract is stored in the storage trie, and the hash value of the root node of the storage tree is stored in the above-mentioned storage_Root, thereby locking all the status of the contract to the contract account through hash.
  • the storage tree is also an MPT tree structure, which stores the key-value mapping from state addresses to state values.
  • the address of a state is stored from the root node of the storage tree to the leaf nodes, and the value of a state is stored in a leaf node.
  • the block header of a single block can include several fields, such as the previous block hash previous_Hash (PrevHash in the figure, or called the parent hash), the random number Nonce (in some blockchain systems This Nonce is not a random number, or the Nonce in the block header is not enabled in some blockchain systems), timestamp Timestamp, block number BlockNum, state root hash State_Root, transaction root hash Transaction_Root, receipt root hash Receipt_Root, etc. .
  • the PrevHash in the block header of the next block (such as block N+1) points to the previous block (such as block N), which is the hash value of the previous block.
  • state_root is the hash value of the root of the MPT tree composed of the status of all accounts in the current block, that is, the point pointing to state_root is a state tree in the form of MPT.
  • the root node of this MPT tree can be an extension node (Extension Node) or a branch node (Branch Node).
  • Extension Node Extension Node
  • Branch Node branch node
  • What is stored in state_root is generally the hash value of this root node.
  • a part of the value of each node from the root node of this MPT to the leaf node can be concatenated in order to form an account address and serve as a key.
  • the account information stored in the leaf node is the value corresponding to the account address, thus forming a key-value Key-value pairs.
  • the key can be sha3 (Address), which is the hash value of the account address (the hash algorithm uses the sha3 algorithm, for example), and its stored value value can be rlp (Account), which is the rlp encoding of the account information.
  • the account information can be a four-tuple consisting of [nonce, balance, storage_root, codeHash]. As mentioned before, for external accounts, there are generally only two items, nonce and balance, and the storage_root and codeHash fields store empty strings/all 0 strings by default. For contract accounts, contract accounts can include nonce, balance, storage_root, codeHash, etc.
  • Leaf Node From the extension node/branch node of the root node to the leaf node of each account, there may be several branch nodes and extension nodes in the middle.
  • this storage_Root points to another tree in the form of MPT, which stores the data of state variables involved in contract execution.
  • the tree in MPT form pointed to by this storage_Root is a storage tree, that is, the hash value of the root node of the storage tree.
  • this storage tree also stores key-value pairs.
  • a part of the data stored on the path from the root node to the leaf node is connected to form the key, and the value is stored in the leaf node.
  • this storage tree can also be a tree in the form of MPT, which can generally be a 16-fork tree, that is, for a branch node, it can have up to 16 child nodes, which may include extension nodes and/or leaf nodes.
  • For an extension node it generally can have one child node, which can be a branch node.
  • This storage tree can be up to 64 levels deep.
  • the status data generated after nodes in the blockchain system complete the execution of multiple transactions belonging to a certain block may include Contract status data related to the storage trie and world state data related to the state trie. Therefore, when a node submits state data, it usually needs to submit the contract state data first to obtain the storage_root of the contract account, then update the storage_root of the relevant contract account in the state trie, and submit the obtained world state data to obtain the state_root of the state tree.
  • Figure 3 is a schematic structural diagram of any two nodes (for example, node n1 as the master node/second node and node n2 as the slave node/first node) in the blockchain system provided as an example in the embodiment of this specification. Both node n1 and node n2 can run multiple processes to provide multiple services. For example, as shown in Figure 3, node n1 and node n2 can each run access processes for providing access services and caching services.
  • the process refers to a running activity of a program with certain independent functions in the application on a data collection. That is, a process is a process in the computer that is carried out by the CPU sequentially executing instructions in the application program, and each process is created when it is created. Allocate its own memory address space.
  • the multiple processes in node n1 may be multiple processes in multiple computing devices or virtual computing nodes, and the multiple processes in node n2 may be multiple processes in multiple computing devices or virtual computing nodes.
  • the solutions provided by the embodiments of this specification are not limited to the master-slave architecture blockchain system.
  • the access process can be used to receive transactions from the user device, and then the access process calls the cache process to add the received transactions to the pending transaction queue for caching.
  • the pre-execution process of node n2 can call the cache process to read its cached transactions in order from the pending transaction queue and verify the transaction, such as verifying the signature of the user device on the transaction and sending the verified transaction Returned to the cache process.
  • node n2 can broadcast the verified transactions stored in its cache process to the network processes of other nodes through its network process; furthermore, the transactions from node n1 received by node n1 through its network process can be added to the waiting list by its cache process cache. in the transaction queue for processing. Therefore, the pending transaction queue cached by the cache process of node n1 through its memory includes not only transactions received through its access process, but also transactions received from other nodes through its network process.
  • the pre-execution process of node n1 can also call the cache process to sequentially read its cached transactions from the pending transaction queue, and at least verify transactions from user devices connected to node n1.
  • the pre-execution process of node n2 can also pre-execute the transactions it receives in sequence from the cache process to obtain the pre-execution information of the transaction.
  • the pre-execution information includes, for example, the pre-execution read set, the pre-execution write set and the execution of the transaction.
  • the amount of digital resources/computing resources that need to be consumed i.e. resource consumption information).
  • the pre-execution process of node n1 can also return the pre-execution information of this batch of transactions to the cache process after each completion of the pre-execution of a batch of transactions, so that it can be cached in the transaction queue to be agreed upon. It should be noted that part of the status data can also be cached in the memory of the cache process of node n1; for any transaction pre-executed by the pre-execution process of node n1, during the process of pre-execution of any transaction , the pre-execution process can first call the cache process to query whether its cached status data includes the status value of any variable to be read. If so, obtain the status value of the arbitrary variable returned by the cache process.
  • the pre-execution process can Call the stored procedure to query the state value of this arbitrary variable from the state data submitted to the state database.
  • its cache process can also update the cache based on the pre-execution read and write set it receives. Process cached state data.
  • the pre-execution process can sequentially read transactions from the pending transaction queue cached by the cache process and pre-execute them, the cache process can also pre-execute them based on its cached pending transactions.
  • the queue caches in its memory the pre-execution sequence of multiple transactions pre-executed by the pre-execution process.
  • the pre-execution read set contains several unique keys (keys), and also includes the key values (values) corresponding to each of the aforementioned keys read from the submitted world state.
  • the pre-execution write set also contains a number of unique keys (keys), as well as the key values (values) corresponding to each of the aforementioned keys that are expected to be submitted; in addition, if a transaction deletes a certain key in the world state, the pre-execution write set will Executing the write set will also record the corresponding mark for the deleted key.
  • the pre-executed transaction is a contract call transaction used to call a smart contract
  • its pre-execution read and write set may not only contain state parameters related to external accounts, but may also involve contracts related to the smart contract. Several contract parameters related to the status.
  • node n1 sequentially pre-executes transactions Tx1 ⁇ transaction Tx5.
  • transactions Tx1 and transaction Tx2 are contract call transactions for calling smart contract C1 initiated by external account A1 and external account A2 respectively.
  • smart contract C1 corresponds to contract account B1;
  • transaction Tx3 is a transfer transaction initiated by external account A1 and directed to external account A3
  • transaction Tx4 is a transfer transaction initiated by external account A4 and directed to external account A5
  • transaction Tx5 is an external account A transfer transaction initiated by A6 to external account A7.
  • Node n1 pre-executes transactions Tx1 to Tx5 through its pre-execution process, and may obtain the respective pre-execution information of transactions Tx1 to Tx5 as shown in Table 1 below.
  • k1 represents the key of the balance of the external account A1
  • k2 represents the key of a certain state parameter under the contract account B1
  • k3 represents the key of the balance of the external account A2
  • k4 represents the contract.
  • the key of a certain state parameter under account B1, k5 ⁇ k9 in turn represent the keys of the balance under external account A3 ⁇ external account A7.
  • v11, v12, v13 and v21 ⁇ v92 respectively represent the values of their corresponding keys. It should be noted that since transaction Tx3 is executed after transaction Tx1, the value of k1 in the pre-execution read set of transaction Tx3 is the value of k1 in the pre-execution write set of transaction Tx1.
  • the consensus process of node n1 can call its cache process to sequentially read multiple transactions and their related data from the transaction queue to be agreed upon to generate a consensus proposal, where the consensus proposal can include, for example, the corresponding predetermined data of the multiple transactions.
  • Execution information, the consensus order of the multiple transactions (the consensus order of the multiple transactions is the same as the pre-execution order of the multiple transactions), and the multiple transactions or the respective instruction information of the multiple transactions (for example, the multiple transactions their respective summary values).
  • the conditions for the consensus process of node n1 to call its cache process may include but are not limited to calling the cache process according to a fixed time step, calling the cache process when the amount of transaction data cached by the cache process reaches a predetermined size, or The cache process is called when a predetermined number of pre-executed transactions cached by the cache process reaches a predetermined number, and so on.
  • the consensus process of node n1 can also send consensus proposals to the respective network processes of other nodes (such as node n2) participating in consensus on the consensus proposal through its network process, so as to communicate with the respective consensus processes of other nodes through its consensus process.
  • the consensus proposals it generates are subject to consensus.
  • node n1 can also calculate the grouping information corresponding to the multiple transactions based on the pre-execution information of each of the multiple transactions indicated by the consensus proposal, and carry the grouping information in the consensus proposal in order to participate in the consensus proposal.
  • Other nodes that propose consensus can group the aforementioned multiple transactions based on this grouping information.
  • the control process submits part or all of the pre-execution information of each of the aforementioned multiple transactions to the storage service as the state data of the corresponding block, and then obtains the state root used to generate the corresponding block and generates a state root containing the state root and the aforementioned multiple Transaction block.
  • node n2 may, during the process of consensus on the consensus proposal generated by node n1, or after reaching consensus on the consensus proposal generated by node n1, read the aforementioned plurality of consensus proposals from the consensus proposal through its consensus process and/or control process. Pre-execution information of each transaction, and then group the multiple transactions based on the pre-execution information of each transaction to obtain M transaction groups (M is greater than 1); or read the grouping of the aforementioned multiple transactions from the consensus proposal information and group the aforementioned multiple transactions based on the grouping information to obtain M transaction groups.
  • the consensus process of node n2 can calculate the grouping information based on the pre-execution information of each of the aforementioned multiple transactions, and send the grouping information, the aforementioned multiple transactions and their respective corresponding pre-execution read and write sets to the node n2. control process; then the control process of node n2 divides the aforementioned multiple transactions into M transaction groups based on the grouping information, and the control process of node n2 performs task scheduling on the N computing processes in node n2.
  • any two transactions in any two transaction groups do not conflict with each other. Any two transactions do not conflict with each other. Specifically, any two transactions do not have one of the following situations: the pre-execution read set of one transaction and the pre-execution write set of another transaction include the same key, the pre-execution write set of one transaction and Another transaction's pre-execution write set includes the same key. For any two transactions that conflict, they need to be divided into the same transaction group. In other words, if the pre-execution write sets of any two transactions contain the same key, it is considered that any two transactions Conflict transactions access the same parameters and conflict exists.
  • any two transactions need to be divided into the same transaction group; if the pre-execution read set of one of the two transactions is included in the pre-execution write set of the other transaction,
  • the same key means that any two transactions are considered to have accessed the same parameters and there is a conflict.
  • the any two transactions need to be divided into the same transaction group.
  • the aforementioned multiple transactions can be divided into M transaction groups. Usually, the grouping information can be determined according to the location of any two different transactions.
  • the aforementioned multiple transactions are grouped by the requirement that any two transactions in the group do not access the same parameters (that is, do not contain the same key).
  • the grouping situation may include, for example: transaction Tx1 and transaction Tx3 are divided into transaction group 1, transaction Tx2 is divided into transaction group 2, and transaction Tx4 and transaction Tx5 are divided respectively. Go to transaction group 3 and transaction group 4.
  • node n2 can be grouped into M transactions and execute multiple transactions in the M transaction groups in parallel through the N computing processes it runs. However, if any two transactions executed in parallel by any two computing processes involve the same contract account/smart contract, then when node n2 submits the status data generated in the process of generating the block, in view of the The status data may involve contract parameters of the same smart contract. A single computing process cannot submit the status data it obtains independently and needs to merge and submit the status data obtained by each of the N computing processes.
  • FIG 4 is a flow chart of a status data submission method provided in the embodiment of this specification.
  • This method can be executed by any blockchain node in the blockchain system, for example, by other blockchain nodes (slave nodes) that are not serving as consensus proposal nodes (master nodes), whether as master nodes or
  • the blockchain nodes of the slave nodes can each be implemented as any device, platform, device or device cluster with computing/processing capabilities.
  • the blockchain node will be described in detail by mainly taking the node n1 as the master node and the node n2 as the slave node to cooperate, so that the node n2 specifically implements each method step in the method through the multiple processes it contains.
  • the process of implementing the method is shown in Figure 4.
  • the status data submission method executed by node n2 currently serving as a slave node may include but is not limited to the following steps 42 to 46.
  • Step 42 The control process obtains M transaction groups.
  • M transaction groups can be obtained by grouping multiple transactions based on their respective pre-execution read and write sets. M is usually greater than N and the pre-execution read and write sets of at least some of the multiple transactions are Executing read and write sets may each involve several contract parameters related to one or more smart contracts.
  • the various ways in which the control process obtains the aforementioned M transaction groups can be found in the previous section and will not be described again here.
  • Step 44 The control process sends the P first transaction packets involving the contract parameters of the first contract among the M transaction packets to the first process among the N processes.
  • the control process sends the P first transaction packets involving the contract parameters of the first contract among the M transaction packets to the first process among the N processes.
  • the control process of node n2 can, for example, send two transaction packets such as transaction group 1 and transaction group 2 as the aforementioned P first transaction groups to the calculation process 1 (i.e., the first process) of node n2, and transfer the transaction Group 3 is sent to calculation process 2, and transaction group 4 is sent to calculation process 3, so that calculation process 1 to calculation process 3 execute the transactions in the transaction groups they respectively received in parallel.
  • step 46 the first process executes each transaction in the P first transaction groups and obtains P sets of contract status data of the first contract.
  • Each set of contract status data includes one or more contract parameters of the first contract. respective status values, and submit the contract status of the first contract based on the P group contract status data.
  • the computing process can serially execute the transactions in each transaction group it receives.
  • the computing process 1 can sequentially execute the transactions Tx1, transaction Tx2, and transaction Tx3 in the transaction group 1 and transaction group 2 it receives through a single worker thread.
  • the computing process can concurrently execute the transactions in each transaction group it receives through multiple threads in order to complete the execution of the transactions in each transaction group it receives more quickly; for example, computing process 1 can run worker threads 1 and 1 concurrently.
  • Working thread 2 and working thread 1 sequentially execute transaction Tx1 and transaction Tx3 in transaction group 1 to obtain a set of status data involving smart contract C1.
  • This set of contract status data includes, for example, the status of the contract parameters represented by k2 in smart contract C1.
  • the worker thread 2 executes the transaction Tx2 in the transaction group 2 to obtain another set of contract status data related to the smart contract C1.
  • the set of contract status data includes, for example, the status value of the contract parameter represented by k4 in the smart contract C1.
  • the computing process can collect the status data obtained by executing the transactions in each transaction group it receives through the same storage object; for example, the computing process 1 can collect the transaction Tx1 it executes through the same storage object.
  • the execution read-write set specifically includes execution read set and execution write set.
  • the execution write set of transaction Tx1 ⁇ transaction Tx3 is the status data obtained by computing process 1 when executing transaction Tx1 ⁇ transaction Tx3. .
  • the state data obtained by the calculation process may include world state data related to the state tree and contract state data related to the storage tree.
  • the key-value pairs k2-v21 and k4-v41 are obtained by calculation process 1.
  • the contract status data, specifically the key-value pairs k2-v21 and k4-v41 are the contract status data of smart contract C1/contract account B1 obtained by calculation process 1.
  • the state data obtained by the calculation process only includes world state data related to the state tree, it can directly submit the world state data it obtained; if the state data obtained by the calculation process contains both world state data and involves at least one The contract status data of the smart contract, then the computing process needs to first submit the contract status of at least one smart contract it obtains, for example, send the P group of status data it obtains to the storage process, and the storage process updates the P group of status data based on the P group of status data.
  • the contract state tree i.e., storage tree
  • the contract state tree i.e., storage tree
  • the stored process corresponds to updating some state parameters in the state tree.
  • the computing process After the computing process completes the execution of any first transaction among the P first transaction groups it receives, it can correspondingly obtain the execution read-write set of the first transaction, and further determine the execution read-write set of the first transaction and Whether the pre-execution read and write sets of the first transaction are consistent.
  • the calculation process can update the contract status of the first contract based on the P groups of contract status data it obtains. .
  • the master node of the blockchain system can be replaced and then reinitiated through a process similar to the above. Execution of multiple transactions mentioned above.
  • control process can also call the storage process to submit the updated status tree and each storage tree to complete the status tree. is updated and obtained for the state root, and then the control process generates the corresponding block based on the state root and the aforementioned multiple transactions.
  • transactions involving the same contract account are executed by the same calculation process, so that any two calculation processes that execute multiple transactions belonging to a certain block in parallel will not generate contract status data involving the same contract account.
  • This allows multiple computing processes to submit their respective contract status data in parallel, which is conducive to faster generation of blocks containing multiple transactions.
  • a single computing process can concurrently execute each transaction in its corresponding multiple transaction groups, and can more quickly complete the execution of the transactions in each transaction group it receives, thereby accelerating the generation of blocks.
  • the embodiments of this specification also provide a first node in the blockchain system.
  • the first node includes a control process 52 and N calculation processes 54 .
  • the control process 52 obtains M transaction groups, which are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, where M is greater than N, and the pre-execution read and write sets are obtained by grouping the multiple transactions.
  • Executing the read-write set involves several contract parameters; the control process 52 sends the P first transaction packets involving the contract parameters of the first contract among the M transaction packets to the first process among the N processes; so The first process executes each transaction in the P first transaction groups and obtains P sets of contract status data of the first contract.
  • Each set of contract status data includes one or more contract parameters of the first contract.
  • Respective status values submit the contract status of the first contract based on the P group contract status data.
  • the first process concurrently executes each of the transactions in the P first transaction groups according to the P first transaction groups.
  • the first node also includes a storage process 56; the first process sends the P group contract status data to the storage process 56, so that the storage process 56 is based on the P sets of contract status data update the contract status tree of the first contract.
  • control process 52 obtains M transaction packets based on the packet information from the second node in the blockchain system.
  • the first node also includes a first consensus process 58; the first consensus process 58 receives the respective predetermined values of the multiple transactions from the second node in the blockchain system. Execute a read-write set, and group the multiple transactions based on the pre-execution read-write set to obtain the M transaction groups.
  • the first process after executing any first transaction in the P first transaction groups, the first process obtains the executed read-write set of the first transaction and determines the Whether the execution read-write set of a transaction is consistent with the pre-execution read-write set of the first transaction; the first process determines whether the execution read-write set of each transaction in the P first transaction groups is consistent with its pre-execution read-write set. In the case where the execution read and write sets are consistent, the contract status of the first contract is updated based on the P group contract status data.
  • the embodiments of this specification also provide a blockchain system, including a first node and a second node, wherein: the second node is used to send a message to the first node.
  • Pre-execution read and write sets of multiple transactions respectively, the pre-execution read and write sets involve several contract parameters; the first node uses its control process to perform pre-execution read and write sets of the multiple transactions based on the respective pre-execution read and write sets of the multiple transactions.
  • Transactions are grouped to obtain M transaction groups, and P first transaction groups involving contract parameters of the first contract among the M transaction groups are sent to the first process among its N processes, where M is greater than N;
  • the first process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract.
  • Each group of contract status data includes one or more of the first contract. respective status values of the contract parameters, and submit the contract status of the first contract based on the P group contract status data.
  • the second node includes a pre-execution process and a cache process
  • the cache process stores stateful data in its memory
  • the plurality of transactions include the first transaction.
  • the cache process is used to send the multiple transactions to the pre-execution process, and the multiple transactions are received by the first node and stored in the memory of the cache process.
  • the pre-execution process is used to pre-execute the multiple transactions and generate pre-execution read and write sets of the multiple transactions, specifically for reading the status of the first variable during the process of pre-executing the first transaction. value, in the case where the memory of the cache process stores the first state value of the first variable, the first state value is received from the cache process, and the first state value is generated based on the first state value.
  • a pre-execution read-write set of a transaction is also used to store the pre-execution read-write set of the multiple transactions and the pre-execution sequence of the multiple transactions in the memory of the cache process, based on the A pre-execution read-write set of multiple transactions updates the state data stored in the cache process' memory.
  • the second node further includes a second consensus process.
  • the cache process is also used to send the pre-execution read-write sets and pre-execution sequences of the multiple transactions to the second consensus process.
  • the second consensus process is used to generate a consensus proposal and send the consensus proposal to the first consensus process in the first node.
  • the consensus proposal includes the pre-execution read and write sets of the multiple transactions and their Consensus order, the consensus order is the pre-execution order.
  • These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
  • Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • compact disc read-only memory CD-ROM
  • DVD digital versatile disc
  • Magnetic tape magnetic tape storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
  • program modules may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • Finance (AREA)
  • Data Mining & Analysis (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A state data submission method, a node, and a blockchain system. The method is executed by a first node in a blockchain system, the first node comprising a control process and N computing processes. The method comprises: the control process acquires M transaction groups, the M transaction groups being obtained by grouping a plurality of transactions on the basis of respective pre-execution read-write sets of the plurality of transactions, M being greater than N, and the pre-execution read-write sets relating to a plurality of contract parameters; the control process transmits to a first process of the N processes P first transaction groups relating to contract parameters of a first contract in the M transaction groups; the first process executes each transaction in the P first transaction groups to obtain P groups of contract state data of the first contract, each group of contract state data comprising respective state values of one or more contract parameters of the first contract; and on the basis of the P groups of contract state data, the contract state of the first contract is submitted.

Description

状态数据的提交方法、节点和区块链***State data submission method, node and blockchain system
本申请要求于2022年5月30日提交中国国家知识产权局、申请号为202210602795.8、申请名称为“状态数据的提交方法、节点和区块链***”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requests the priority of the Chinese patent application submitted to the State Intellectual Property Office of China on May 30, 2022, with application number 202210602795.8 and the application name "State data submission method, node and blockchain system", and its entire contents incorporated herein by reference.
技术领域Technical field
本说明书实施例属于区块链技术领域,尤其涉及一种状态数据的提交方法、节点和区块链***。The embodiments of this specification belong to the field of blockchain technology, and particularly relate to a state data submission method, a node and a blockchain system.
背景技术Background technique
区块链(Blockchain)是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链***中按照时间顺序将数据区块以顺序相连的方式组合成链式数据结构,并以密码学方式保证的不可篡改和不可伪造的分布式账本。由于区块链具有去中心化、信息不可篡改、自治性等特性,区块链也受到人们越来越多的重视和应用。Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. In the blockchain system, data blocks are combined into a chained data structure in a chronological manner and are cryptographically guaranteed to be an untamperable and unforgeable distributed ledger. Due to the characteristics of blockchain, such as decentralization, non-tamperable information, and autonomy, blockchain has also received more and more attention and applications.
发明内容Contents of the invention
本发明的目的在于提供一种状态数据的提交方法、节点和区块链***。The purpose of the present invention is to provide a state data submission method, node and blockchain system.
第一方面,提供了一种状态数据的提交方法,由区块链***中的第一节点执行,所述第一节点包括控制进程和N个计算进程。方法包括:所述控制进程获取M个交易分组,所述M个交易分组通过基于多个交易各自的预执行读写集对所述多个交易进行分组而得到,其中M大于N,所述预执行读写集涉及若干合约参数;所述控制进程将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给所述N个进程中的第一进程;所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,基于所述P组合约状态数据提交所述第一合约的合约状态。In the first aspect, a state data submission method is provided, which is executed by a first node in a blockchain system, where the first node includes a control process and N computing processes. The method includes: the control process obtains M transaction groups, the M transaction groups are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, wherein M is greater than N, and the pre-execution read and write sets are obtained by grouping the multiple transactions. Executing the read-write set involves several contract parameters; the control process sends P first transaction groups involving contract parameters of the first contract among the M transaction groups to the first process among the N processes; The first process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract. Each group of contract status data includes one or more contract parameters of the first contract. The status value of the contract status of the first contract is submitted based on the contract status data of the P group.
第二方面,提供了一种区块链***中的第一节点,所述第一节点包括控制进程和N个计算进程。其中:所述控制进程获取M个交易分组,所述M个交易分组通过基于多个交易各自的预执行读写集对所述多个交易进行分组而得到,其中M大于N,所 述预执行读写集涉及若干合约参数;所述控制进程将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给所述N个进程中的第一进程;所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,基于所述P组合约状态数据提交所述第一合约的合约状态。In a second aspect, a first node in a blockchain system is provided, where the first node includes a control process and N computing processes. Wherein: the control process obtains M transaction groups, and the M transaction groups are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, where M is greater than N, and the pre-execution The read-write set involves several contract parameters; the control process sends the P first transaction groups involving the contract parameters of the first contract among the M transaction groups to the first process among the N processes; the A process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract. Each group of contract status data includes one or more contract parameters of the first contract. The status value is used to submit the contract status of the first contract based on the P group contract status data.
第三方面,提供了一种区块链***,包括第一节点和第二节点。其中:所述第二节点用于向所述第一节点发送多个交易各自的预执行读写集,所述预执行读写集涉及若干合约参数;所述第一节点通过其控制进程基于所述多个交易各自的预执行读写集对所述多个交易进行分组以得到M个交易分组,并将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给其N个进程中的第一进程,其中M大于N;通过所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,并基于所述P组合约状态数据提交所述第一合约的合约状态。In the third aspect, a blockchain system is provided, including a first node and a second node. Wherein: the second node is used to send the pre-execution read and write sets of multiple transactions to the first node, and the pre-execution read and write sets involve several contract parameters; the first node controls the process based on the The respective pre-execution read-write sets of the multiple transactions are grouped to obtain M transaction groups, and the P first transaction groups involving the contract parameters of the first contract among the M transaction groups are sent. Give it the first process among N processes, where M is greater than N; execute each transaction in the P first transaction groups through the first process, and obtain P groups of contract status data of the first contract, each time The set contract status data includes respective status values of one or more contract parameters of the first contract, and the contract status of the first contract is submitted based on the P set of contract status data.
上述实施例中,涉及相同合约账户的交易由相同的计算进程执行,使得并行执行属于某个区块的多个交易的任意两个计算进程不会产生涉及相同的合约账户的合约状态数据,从而使得多个计算进程可以并行提交其各自获得的合约状态数据,有利于更为快速的生成包含该多个交易的区块。此外单个计算进程可以并发执行与其对应的多个交易分组中的各个交易,可以更为快速的完成对其接收的各个交易分组中的交易的执行,进而加速区块的生成。In the above embodiment, transactions involving the same contract account are executed by the same calculation process, so that any two calculation processes that execute multiple transactions belonging to a certain block in parallel will not generate contract status data involving the same contract account, thus This allows multiple computing processes to submit their respective contract status data in parallel, which is conducive to faster generation of blocks containing multiple transactions. In addition, a single computing process can concurrently execute each transaction in its corresponding multiple transaction groups, and can more quickly complete the execution of the transactions in each transaction group it receives, thereby accelerating the generation of blocks.
附图说明Description of the drawings
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of this specification more clearly, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some of the embodiments recorded in this specification. , for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative labor.
图1为本说明书实施例中示例性提供的区块链***的示意图;Figure 1 is a schematic diagram of a blockchain system provided as an example in the embodiment of this specification;
图2为本说明书实施例中示例性提供的区块链数据存储的结构示意图;Figure 2 is a schematic structural diagram of blockchain data storage provided as an example in the embodiment of this specification;
图3为本说明书实施例中示例性提供的区块链***中任意两个节点的结构示意图;Figure 3 is a schematic structural diagram of any two nodes in the blockchain system provided as an example in the embodiment of this specification;
图4为本说明书实施例中提供的一种状态数据的提交方法的流程图;Figure 4 is a flow chart of a method for submitting status data provided in the embodiment of this specification;
图5为本说明书实施例中提供的一种区块链节点的结构示意图。Figure 5 is a schematic structural diagram of a blockchain node provided in the embodiment of this specification.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described The embodiments are only some of the embodiments of this specification, but not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts should fall within the scope of protection of this specification.
图1为本说明书实施例中示例性提供的区块链***的示意图。如图1所示,区块链***是通过多个节点(Node)来建立的分布式网络,其包含任意两个节点间通过点对点(Peer-to-Peer,P2P)网络实现在应用层的通信连接,例如其包含的节点n1~节点n5中的任意两个节点间均可通过P2P网络实现在应用层的通信连接。区块链***利用链式区块结构构造的去中心化(或称为多中心化)的分布式账本,保存于分布式的区块链网络中的每个节点(或大多节点上,如共识节点)上,因此区块链***需要解决去中心化(或多中心化)的多个节点上各自的账本数据的一致性和正确性的问题。鉴于此,区块链***的每个节点上都运行着区块链程序,在一定容错需求的设计下,通过共识(consensus)机制保证所有忠诚节点具有相同的交易,从而保证所有忠诚节点对相同交易的执行结果一致,将交易打包成区块并基于相同交易的执行结果更新世界状态。其中当前主流的共识机制包括但不限于:工作量证明(Proof of Work,POW)、股权证明(Proof of Stake,POS)、实用拜占庭容错(Practical Byzantine Fault Tolerance,PBFT)算法,蜜獾拜占庭容错(HoneyBadgerBFT)算法等等。Figure 1 is a schematic diagram of an exemplary blockchain system provided in the embodiment of this specification. As shown in Figure 1, the blockchain system is a distributed network established through multiple nodes (Node), which includes communication between any two nodes at the application layer through a peer-to-peer (P2P) network. Connection, for example, any two nodes among the nodes n1 to n5 contained therein can realize communication connection at the application layer through the P2P network. The blockchain system uses a decentralized (or multi-centered) distributed ledger constructed by a chain block structure, which is stored on each node (or most nodes, such as consensus) in the distributed blockchain network. node), so the blockchain system needs to solve the problem of consistency and correctness of the respective ledger data on multiple decentralized (or multi-centered) nodes. In view of this, each node of the blockchain system runs a blockchain program. Under the design of certain fault-tolerance requirements, the consensus mechanism is used to ensure that all loyal nodes have the same transactions, thereby ensuring that all loyal nodes have the same If the execution results of the transaction are consistent, the transaction is packaged into blocks and the world state is updated based on the execution results of the same transaction. Among them, the current mainstream consensus mechanisms include but are not limited to: Proof of Work (POW), Proof of Stake (POS), Practical Byzantine Fault Tolerance (PBFT) algorithm, Honey Badger Byzantine Fault Tolerance ( HoneyBadgerBFT) algorithm and so on.
区块链***中的账户通常被划分为用户账户/外部账户(Externally owned account)和合约账户(contract account)两种类型;其中合约账户用于存储智能合约代码以及智能合约代码中相关状态的值,其通常只能通过外部账户进行调用激活。外部账户和合约账户的设计实际上是账户地址到账户状态的映射。账户的状态通常可以包括但不限于nonce、balance、storage_Root、codeHash等字段,其中nonce、balance在外部账户和合约账户中都存在,而codeHash和storage_Root属性通常仅在合约账户上有效。前述的各个字段中,nonce表征计数器,对于外部账户而言其代表从账户地址发送的交易的数量;对于合约账户而言其代表账户创建的合约数量。balance表征对应的外部账户拥有的数字资源的数量。storage_Root表征一个MPT(Merkle Patricia Tree)树根节点的哈希,该MPT用于对合约账户的状态变量的存储进行组织。codeHash表征智能合约代码的哈希值,对于合约账户而言其是智能合约被哈希计算并存储的代码,对于外部账户而言 由于不包括智能合约,因此其可以是空字符串/全0字符串。Accounts in the blockchain system are usually divided into two types: user account/externally owned account (Externally owned account) and contract account (contract account); the contract account is used to store smart contract code and the values of related states in the smart contract code. , which can usually only be activated by calling an external account. The design of external accounts and contract accounts is actually the mapping of account addresses to account status. The status of an account can usually include, but is not limited to, nonce, balance, storage_Root, codeHash and other fields. Nonce and balance exist in both external accounts and contract accounts, while the codeHash and storage_Root attributes are usually only valid on contract accounts. Among the aforementioned fields, nonce represents the counter. For external accounts, it represents the number of transactions sent from the account address; for contract accounts, it represents the number of contracts created by the account. Balance represents the number of digital resources owned by the corresponding external account. storage_Root represents the hash of the root node of an MPT (Merkle Patricia Tree) tree. The MPT is used to organize the storage of state variables of contract accounts. codeHash represents the hash value of the smart contract code. For contract accounts, it is the hashed and stored code of the smart contract. For external accounts, it does not include smart contracts, so it can be an empty string/all 0 characters. string.
MPT是结合了Merkle Tree(默克尔树)和Patricia Tree(压缩前缀树,一种更节省空间的Trie树,字典树)的一种树形结构。Merkle Tree,默克尔树算法对每个交易都计算一个Hash值,然后两两连接再次计算Hash,一直到最顶层的Merkle根。以太坊中采用改进的MPT树,例如是16叉树的结构,通常也简称为MPT树。其中以太坊MPT树的数据结构包括状态树(state trie)。状态树中包含以太坊中每个账户所对应的存储内容的键值对(key and value pair)。状态树中的“键”可以是一个的160bits标识符(以太坊账户的地址),这个账户地址分布于从状态树的根节点开始到叶子节点的存储中。状态树中的“值”是通过对以太坊账户的信息进行编码(使用递归长度字典编码(Recursive-Length Prefix encoding,RLP)方法)生成的。如前所述,对于外部账户而言,值包括nonce和balance;对于合约账户而言,值包括nonce、balance、codehash和storage_Root等等。MPT is a tree structure that combines Merkle Tree (Merkle Tree) and Patricia Tree (Compressed Prefix Tree, a more space-saving Trie tree, dictionary tree). Merkle Tree, the Merkle tree algorithm calculates a Hash value for each transaction, and then connects the two to calculate the Hash again, all the way to the top-level Merkle root. Ethereum uses an improved MPT tree, such as a 16-fork tree structure, which is usually referred to as an MPT tree. The data structure of the Ethereum MPT tree includes a state trie. The state tree contains the key and value pair corresponding to the storage content of each account in Ethereum. The "key" in the state tree can be a 160bits identifier (the address of an Ethereum account). This account address is distributed in the storage starting from the root node of the state tree to the leaf nodes. The "values" in the state tree are generated by encoding the Ethereum account information (using the Recursive-Length Prefix encoding (RLP) method). As mentioned before, for external accounts, the values include nonce and balance; for contract accounts, the values include nonce, balance, codehash, storage_Root, etc.
合约账户用于存储智能合约相关的状态。智能合约在区块链***中完成部署后,会产生一个对应的合约账户。这个合约账户一般会具有一些状态,这些状态由智能合约中状态变量所定义并在智能合约创建、执行时产生新的值。所述的智能合约通常是指在区块链环境中以数字形式定义的能够自动执行条款的合约。一旦某个事件触发合约中的条款(满足执行条件),代码即可以自动执行。在区块链中,合约的相关状态保存在存储树(storage trie)中,存储树根节点的hash值即存储于上述storage_Root中,从而将该合约的所有状态通过hash锁定到该合约账户下。存储树也是一个MPT树形结构,存储了状态地址到状态值的key-value映射。从存储树的根节点到叶子节点存储有一个状态的地址,一个叶子节点中存储一个状态的值。Contract accounts are used to store status related to smart contracts. After the smart contract is deployed in the blockchain system, a corresponding contract account will be generated. This contract account generally has some states, which are defined by the state variables in the smart contract and generate new values when the smart contract is created and executed. The smart contract usually refers to a contract defined in digital form in a blockchain environment that can automatically execute terms. Once an event triggers a clause in the contract (execution conditions are met), the code can be executed automatically. In the blockchain, the relevant status of the contract is stored in the storage trie, and the hash value of the root node of the storage tree is stored in the above-mentioned storage_Root, thereby locking all the status of the contract to the contract account through hash. The storage tree is also an MPT tree structure, which stores the key-value mapping from state addresses to state values. The address of a state is stored from the root node of the storage tree to the leaf nodes, and the value of a state is stored in a leaf node.
请参见图2示例性提供的区块链数据存储的结构示意图。如图2所示,单个区块的区块头中可以包括若干字段,例如上一区块哈希previous_Hash(图中的PrevHash,或称为父hash),随机数Nonce(在一些区块链***中这个Nonce不是随机数,或者在一些区块链***中不启用区块头中的Nonce),时间戳Timestamp,区块号BlockNum,状态根哈希State_Root,交易根哈希Transaction_Root,收据根哈希Receipt_Root等。其中,下一区块(如区块N+1)的区块头中的PrevHash指向上一区块(如区块N),即为上一区块的hash值。通过这种方式,区块链上通过区块头实现了下一区块对上一区块的锁定。需要特别说明的是,state_root是当前区块中所有账户的状态组成的MPT树的根的哈希值,即指向state_root的为一棵MPT形式的状态树。这个MPT树的根节点可以为一 个扩展节点(Extension Node)或一个分支节点(Branch Node),state_root中存储的一般为这个根节点的hash值。从这个MPT的根节点到叶子节点中每个节点的一部分值按照顺序串联起来可以构成账户地址并作为key,叶子节点中存储的账户信息为这个账户地址对应的value,这样,构成了key-value键值对。key可以是sha3(Address),即账户地址的hash值(hash算法例如采用sha3算法),其存储的值value可以为rlp(Account),即账户信息的rlp编码。其中账户信息可以是[nonce,balance,storage_root,codeHash]构成的四元组。如前所述,对于外部账户来说,一般只有nonce和balance两项,而storage_root、codeHash字段默认存储空字符串/全0字符串。对于合约账户来说,合约账户可以包括nonce,balance,storage_root,codeHash等等。此外不论是外部账户还是合约账户,其账户信息一般都位于一个单独的叶子节点(Leaf Node)中。从根节点的扩展节点/分支节点到每个账户的叶子节点,可能中间会经过若干个分支节点以及扩展节点。Please refer to Figure 2 for an exemplary structural diagram of blockchain data storage. As shown in Figure 2, the block header of a single block can include several fields, such as the previous block hash previous_Hash (PrevHash in the figure, or called the parent hash), the random number Nonce (in some blockchain systems This Nonce is not a random number, or the Nonce in the block header is not enabled in some blockchain systems), timestamp Timestamp, block number BlockNum, state root hash State_Root, transaction root hash Transaction_Root, receipt root hash Receipt_Root, etc. . Among them, the PrevHash in the block header of the next block (such as block N+1) points to the previous block (such as block N), which is the hash value of the previous block. In this way, the next block locks the previous block through the block header on the blockchain. It should be noted that state_root is the hash value of the root of the MPT tree composed of the status of all accounts in the current block, that is, the point pointing to state_root is a state tree in the form of MPT. The root node of this MPT tree can be an extension node (Extension Node) or a branch node (Branch Node). What is stored in state_root is generally the hash value of this root node. A part of the value of each node from the root node of this MPT to the leaf node can be concatenated in order to form an account address and serve as a key. The account information stored in the leaf node is the value corresponding to the account address, thus forming a key-value Key-value pairs. The key can be sha3 (Address), which is the hash value of the account address (the hash algorithm uses the sha3 algorithm, for example), and its stored value value can be rlp (Account), which is the rlp encoding of the account information. The account information can be a four-tuple consisting of [nonce, balance, storage_root, codeHash]. As mentioned before, for external accounts, there are generally only two items, nonce and balance, and the storage_root and codeHash fields store empty strings/all 0 strings by default. For contract accounts, contract accounts can include nonce, balance, storage_root, codeHash, etc. In addition, whether it is an external account or a contract account, its account information is generally located in a separate leaf node (Leaf Node). From the extension node/branch node of the root node to the leaf node of each account, there may be several branch nodes and extension nodes in the middle.
对于状态树中的单个合约账户来说,其storage_Root指向另一棵同为MPT形式的树,其中存储了合约执行涉及的状态变量(state variable)的数据。这个storage_Root指向的MPT形式的树为存储树,即存储树的根节点的hash值。一般的,这个存储树存储的也是key-value键值对。从根节点到叶子节点的路径上存储的一部分数据连起来构成key,叶子节点中存储value。前面提到,这个存储树也可以是MPT形式的树,一般可以是16叉树,即对于分支节点而言,其最多可以有16个孩子节点,其中可能包括扩展节点和/或叶子节点。而对于扩展节点而言,其一般可以有1个孩子节点,其可以是分支节点。这棵存储树最多可以有64层的深度。For a single contract account in the state tree, its storage_Root points to another tree in the form of MPT, which stores the data of state variables involved in contract execution. The tree in MPT form pointed to by this storage_Root is a storage tree, that is, the hash value of the root node of the storage tree. Generally, this storage tree also stores key-value pairs. A part of the data stored on the path from the root node to the leaf node is connected to form the key, and the value is stored in the leaf node. As mentioned earlier, this storage tree can also be a tree in the form of MPT, which can generally be a 16-fork tree, that is, for a branch node, it can have up to 16 child nodes, which may include extension nodes and/or leaf nodes. For an extension node, it generally can have one child node, which can be a branch node. This storage tree can be up to 64 levels deep.
参照前文相关于存储树(storage trie)和状态树(state trie)的描述不难发现,区块链***中的节点完成执行属于某个区块的多个交易后产生的状态数据,可能包括与storage trie相关的合约状态数据以及与state trie相关的世界状态数据。因此节点提交状态数据的过程中,通常需要先提交合约状态数据以获得合约账户的storage_root,进而更新state trie中相关合约账号的storage_root,并提交其获得的世界状态数据以获得状态树的state_root。Referring to the previous descriptions of storage trie and state trie, it is not difficult to find that the status data generated after nodes in the blockchain system complete the execution of multiple transactions belonging to a certain block may include Contract status data related to the storage trie and world state data related to the state trie. Therefore, when a node submits state data, it usually needs to submit the contract state data first to obtain the storage_root of the contract account, then update the storage_root of the relevant contract account in the state trie, and submit the obtained world state data to obtain the state_root of the state tree.
图3为本说明书实施例中示例性提供的区块链***中任意两个节点(例如作为主节点/第二节点的节点n1和作为从节点/第一节点的节点n2)的结构示意图。节点n1和节点n2中均可运行多个进程以提供多种服务,例如参照图3所示,节点n1和节点n2均可各自运行用于提供接入服务的接入进程、用于提供缓存服务的缓存进程、用于提供预执行 服务的预执行进程、用于提供网络服务的网络进程、用于提供共识服务的共识进程、用于提供区块管理服务的控制进程(或者表述为区块管理进程)和用于提供存储服务的存储进程;此外作为从节点的节点n2还可以运行用于提供计算服务的多个计算进程。其中进程指是应用中具有一定独立功能的程序关于一个数据集合的一次运行活动,即进程是计算机中通过由CPU顺序执行应用程序中的指令而进行的一个过程,而每个进程在创建时被分配自己的内存地址空间。节点n1中的多个进程可以为多个计算设备或虚拟计算节点中的多个进程,节点n2中的多个进程可以为多个计算设备或虚拟计算节点中的多个进程。此外需要说明的是本说明书实施例提供的方案并不局限于主从架构的区块链***。Figure 3 is a schematic structural diagram of any two nodes (for example, node n1 as the master node/second node and node n2 as the slave node/first node) in the blockchain system provided as an example in the embodiment of this specification. Both node n1 and node n2 can run multiple processes to provide multiple services. For example, as shown in Figure 3, node n1 and node n2 can each run access processes for providing access services and caching services. The cache process, the pre-execution process used to provide pre-execution services, the network process used to provide network services, the consensus process used to provide consensus services, the control process used to provide block management services (or expressed as block management process) and a storage process used to provide storage services; in addition, node n2 as a slave node can also run multiple computing processes used to provide computing services. The process refers to a running activity of a program with certain independent functions in the application on a data collection. That is, a process is a process in the computer that is carried out by the CPU sequentially executing instructions in the application program, and each process is created when it is created. Allocate its own memory address space. The multiple processes in node n1 may be multiple processes in multiple computing devices or virtual computing nodes, and the multiple processes in node n2 may be multiple processes in multiple computing devices or virtual computing nodes. In addition, it should be noted that the solutions provided by the embodiments of this specification are not limited to the master-slave architecture blockchain system.
接入进程可以用于接收来自用户设备的交易,进而由接入进程调用缓存进程实现将其接收的交易加入待处理的交易队列中进行缓存。The access process can be used to receive transactions from the user device, and then the access process calls the cache process to add the received transactions to the pending transaction queue for caching.
节点n2的预执行进程可以调用缓存进程来实现从待处理的交易队列中按顺序读取其缓存的交易并对该交易进行验证,例如验证用户设备对该交易的签名,并将经验证的交易返回给缓存进程。此外节点n2可以通过其网络进程向其余节点的网络进程广播其缓存进程中存储的经验证的交易;进而节点n1通过其网络进程接收的来自节点n1的交易,可以由其缓存进程缓存加入到待处理的交易队列中。由此节点n1的缓存进程通过其内存缓存的待处理的交易队列,不仅包括通过其接入进程接收的交易,还包括通过其网络进程接收的来自其它节点的交易。The pre-execution process of node n2 can call the cache process to read its cached transactions in order from the pending transaction queue and verify the transaction, such as verifying the signature of the user device on the transaction and sending the verified transaction Returned to the cache process. In addition, node n2 can broadcast the verified transactions stored in its cache process to the network processes of other nodes through its network process; furthermore, the transactions from node n1 received by node n1 through its network process can be added to the waiting list by its cache process cache. in the transaction queue for processing. Therefore, the pending transaction queue cached by the cache process of node n1 through its memory includes not only transactions received through its access process, but also transactions received from other nodes through its network process.
节点n1的预执行进程也可以调用缓存进程来实现从待处理的交易队列中按顺序读取其缓存的交易,并至少对来自与节点n1连接的用户设备的交易进行验证。此外节点n2的预执行进程还可以对其从缓存进程按顺序接收的交易进行预执行以得到该交易的预执行信息,其中预执行信息例如包括预执行读集、预执行写集以及执行该交易所需消耗的数字资源/计算资源的数量(即资源消费信息)。进而节点n1的预执行进程还可以在其每完成对一批交易的预执行后,将该批交易的预执行信息返回给缓存进程以缓存到待共识的交易队列中进行缓存。需要特别说明的是,节点n1的缓存进程的内存中还可以缓存有部分状态数据;对于由节点n1的预执行进程预执行的任一交易而言,在对该任一交易进行预执行的过程中,预执行进程可以首先调用缓存进程查询其缓存的状态数据中是否包括将要读取的任意变量的状态值,如果是则获得缓存进程返回的该任意变量的状态值,如果否则预执行进程可以调用存储进程从已提交到状态数据库的状态数据中查询该任意变量的状态值。此外还需要特别说明的是,由于节点n1的预执 行进程会将其预执行的交易的预执行信息返回给缓存进程,因而其缓存进程还可以基于其接收的预执行读写集对应更新该缓存进程缓存的状态数据。此外还需要特别说明的是,由于预执行进程可以按顺序从缓存进程缓存的待处理的交易队列中依次读取交易并对其进行预执行,因而缓存进程还可以基于其缓存的待处理的交易队列在其内存中对应缓存由预执行进程预执行的多个交易的预执行顺序。The pre-execution process of node n1 can also call the cache process to sequentially read its cached transactions from the pending transaction queue, and at least verify transactions from user devices connected to node n1. In addition, the pre-execution process of node n2 can also pre-execute the transactions it receives in sequence from the cache process to obtain the pre-execution information of the transaction. The pre-execution information includes, for example, the pre-execution read set, the pre-execution write set and the execution of the transaction. The amount of digital resources/computing resources that need to be consumed (i.e. resource consumption information). Furthermore, the pre-execution process of node n1 can also return the pre-execution information of this batch of transactions to the cache process after each completion of the pre-execution of a batch of transactions, so that it can be cached in the transaction queue to be agreed upon. It should be noted that part of the status data can also be cached in the memory of the cache process of node n1; for any transaction pre-executed by the pre-execution process of node n1, during the process of pre-execution of any transaction , the pre-execution process can first call the cache process to query whether its cached status data includes the status value of any variable to be read. If so, obtain the status value of the arbitrary variable returned by the cache process. If not, the pre-execution process can Call the stored procedure to query the state value of this arbitrary variable from the state data submitted to the state database. In addition, it should be noted that since the pre-execution process of node n1 will return the pre-execution information of its pre-executed transactions to the cache process, its cache process can also update the cache based on the pre-execution read and write set it receives. Process cached state data. In addition, it should be noted that since the pre-execution process can sequentially read transactions from the pending transaction queue cached by the cache process and pre-execute them, the cache process can also pre-execute them based on its cached pending transactions. The queue caches in its memory the pre-execution sequence of multiple transactions pre-executed by the pre-execution process.
预执行读集中包含若干唯一键(key),还包括从已提交的世界状态中读取的与前述各个key相对应的键值(value)。预执行写集中也包含若干唯一键(key),还包括期望提交的与前述各个key相对应的键值(value);此外如果某个交易对世界状态中的某个key进行删除处理,则预执行写集中还会对被删除的key记录相应的标记。需要特别说明的是,如果被预执行的交易是用于调用智能合约的合约调用交易,则其预执行读写集中可能不仅仅包含与外部账户相关的状态参数,还可能涉及与智能合约的合约状态相关的若干合约参数。The pre-execution read set contains several unique keys (keys), and also includes the key values (values) corresponding to each of the aforementioned keys read from the submitted world state. The pre-execution write set also contains a number of unique keys (keys), as well as the key values (values) corresponding to each of the aforementioned keys that are expected to be submitted; in addition, if a transaction deletes a certain key in the world state, the pre-execution write set will Executing the write set will also record the corresponding mark for the deleted key. It should be noted that if the pre-executed transaction is a contract call transaction used to call a smart contract, its pre-execution read and write set may not only contain state parameters related to external accounts, but may also involve contracts related to the smart contract. Several contract parameters related to the status.
下面示例性描述节点n1依次对交易Tx1~交易Tx5进行预执行的过程,其中假设交易Tx1和和交易Tx2为用于外部账户A1和外部账户A2分别发起的用于调用智能合约C1的合约调用交易,并且假设智能合约C1对应合约账户B1;此外假设交易Tx3是外部账户A1发起的指向外部账户A3的转账交易,交易Tx4是外部账户A4发起的指向外部账户A5的转账交易,交易Tx5是外部账户A6发起的指向外部账户A7的转账交易。节点n1通过其预执行进程对交易Tx1~交易Tx5进行预执行,可能获得如下表1中示例的交易Tx1~交易Tx5各自的预执行信息。The following is an exemplary description of the process in which node n1 sequentially pre-executes transactions Tx1 ~ transaction Tx5. It is assumed that transactions Tx1 and transaction Tx2 are contract call transactions for calling smart contract C1 initiated by external account A1 and external account A2 respectively. , and assume that smart contract C1 corresponds to contract account B1; in addition, assume that transaction Tx3 is a transfer transaction initiated by external account A1 and directed to external account A3, transaction Tx4 is a transfer transaction initiated by external account A4 and directed to external account A5, and transaction Tx5 is an external account A transfer transaction initiated by A6 to external account A7. Node n1 pre-executes transactions Tx1 to Tx5 through its pre-execution process, and may obtain the respective pre-execution information of transactions Tx1 to Tx5 as shown in Table 1 below.
交易trade 预执行读集Pre-execution read set 预执行写集Pre-execution write set
交易Tx1Transaction Tx1 k1=v11,k2=v21k1=v11, k2=v21 k1=v12,k2=v22k1=v12, k2=v22
交易Tx2Transaction Tx2 k3=v31,k4=v41k3=v31, k4=v41 k3=v32,k4=v42k3=v32, k4=v42
交易Tx3Transaction Tx3 k1=v12,k5=v51k1=v12, k5=v51 k1=v13,k5=v52k1=v13, k5=v52
交易Tx4Transaction Tx4 k6=v61,k7=v71k6=v61, k7=v71 k6=v62,k7=v72k6=v62, k7=v72
交易Tx5Transaction Tx5 k8=v81,k9=v91k8=v81, k9=v91 k8=v82,k9=v92k8=v82, k9=v92
表1Table 1
对于前述表1中示例性提供的各个参数,例如k1表征外部账户A1的balance的key,k2表征合约账户B1下的某个状态参数的key,k3表征外部账户A2的balance的key,k4表征合约账户B1下的某个状态参数的key,k5~k9依次表征外部账户A3~外部账户A7下的balance的key。其中v11、v12、v13以及v21~v92分别表征其各自对应的key的值。需要 特别说明的是,由于交易Tx3在交易Tx1之后执行,因此交易Tx3的预执行读集中k1的值为交易Tx1的预执行写集中k1的值。For each parameter provided as an example in Table 1, for example, k1 represents the key of the balance of the external account A1, k2 represents the key of a certain state parameter under the contract account B1, k3 represents the key of the balance of the external account A2, and k4 represents the contract. The key of a certain state parameter under account B1, k5 ~ k9, in turn represent the keys of the balance under external account A3 ~ external account A7. Among them, v11, v12, v13 and v21~v92 respectively represent the values of their corresponding keys. It should be noted that since transaction Tx3 is executed after transaction Tx1, the value of k1 in the pre-execution read set of transaction Tx3 is the value of k1 in the pre-execution write set of transaction Tx1.
节点n1的共识进程可以调用其缓存进程,从待共识的交易队列中按顺序读取多个交易以及其相关数据来生成共识提议,其中该共识提议中例如可以包括该多个交易各自对应的预执行信息、该多个交易的共识顺序(该多个交易的共识顺序与该多个交易的预执行顺序相同),以及该多个交易或者该多个交易各自的指示信息(例如该多个交易各自的摘要值)。需要特别说明的是,节点n1的共识进程调用其缓存进程的条件,可以包括但不限于按照固定时间步长调用缓存进程、通过缓存进程缓存的交易的数据量达到预定大小时调用缓存进程,或者通过缓存进程缓存的经预执行的交易达到预定数量时调用缓存进程等等。进而,节点n1的共识进程还可以通过其网络进程,向参与对共识提议进行共识的其余节点(例如节点n2)各自的网络进程发送共识提议,以便通过其共识进程与其余节点各自的共识进程对其生成的共识提议进行共识。此外需要特别说明的是,节点n1还可以基于共识提议所指示的多个交易各自的预执行信息,计算该多个交易对应的分组信息,并将该分组信息携带于共识提议中,以便参与对共识提议进行共识的其它节点可以基于该分组信息对前述多个交易进行分组。The consensus process of node n1 can call its cache process to sequentially read multiple transactions and their related data from the transaction queue to be agreed upon to generate a consensus proposal, where the consensus proposal can include, for example, the corresponding predetermined data of the multiple transactions. Execution information, the consensus order of the multiple transactions (the consensus order of the multiple transactions is the same as the pre-execution order of the multiple transactions), and the multiple transactions or the respective instruction information of the multiple transactions (for example, the multiple transactions their respective summary values). It should be noted that the conditions for the consensus process of node n1 to call its cache process may include but are not limited to calling the cache process according to a fixed time step, calling the cache process when the amount of transaction data cached by the cache process reaches a predetermined size, or The cache process is called when a predetermined number of pre-executed transactions cached by the cache process reaches a predetermined number, and so on. Furthermore, the consensus process of node n1 can also send consensus proposals to the respective network processes of other nodes (such as node n2) participating in consensus on the consensus proposal through its network process, so as to communicate with the respective consensus processes of other nodes through its consensus process. The consensus proposals it generates are subject to consensus. In addition, it should be noted that node n1 can also calculate the grouping information corresponding to the multiple transactions based on the pre-execution information of each of the multiple transactions indicated by the consensus proposal, and carry the grouping information in the consensus proposal in order to participate in the consensus proposal. Other nodes that propose consensus can group the aforementioned multiple transactions based on this grouping information.
对共识提议达成共识后,由于节点n1和节点n2各自从与其连接的用户设备接收的交易,均由节点n1的缓存进程按照接收顺序将其加入待处理的交易队列,并由节点n1的预执行进程按顺序对待处理的交易队列中的各交易进行预执行,因此节点n1的共识进程可以按照前述多个交易的预执行顺序/共识顺序将前述多个交易的预执行信息发送至其控制进程,由控制进程将前述多个交易各自的预执行信息部分或全部的作为相应区块的状态数据提交到存储服务,进而获得用于生成相应区块的状态根并生成包含该状态根以及前述多个交易的区块。After reaching a consensus on the consensus proposal, since the transactions received by node n1 and node n2 respectively from the user devices connected to them are added to the pending transaction queue in the order of reception by the cache process of node n1, and pre-executed by node n1 The process pre-executes each transaction in the transaction queue to be processed in order, so the consensus process of node n1 can send the pre-execution information of the aforementioned multiple transactions to its control process according to the pre-execution order/consensus order of the aforementioned multiple transactions. The control process submits part or all of the pre-execution information of each of the aforementioned multiple transactions to the storage service as the state data of the corresponding block, and then obtains the state root used to generate the corresponding block and generates a state root containing the state root and the aforementioned multiple Transaction block.
节点n2例如可以在对节点n1生成的共识提议进行共识的过程中,或者在对节点n1生成的共识提议达成共识之后,通过其共识进程和/或控制进程从该共识提议中读取前述多个交易各自的预执行信息,进而基于该多个交易各自的预执行信息对该多个交易进行分组以得到M个交易分组(M大于1);或者从共识提议中读取前述多个交易的分组信息并基于该分组信息对前述多个交易进行分组以得到M个交易分组。更具体地,例如可以由节点n2的共识进程基于前述多个交易各自的预执行信息计算分组信息,并将分组信息、前述多个交易以及其各自对应的预执行读写集发送至节点n2的控制进程;进而由节点n2的控制进程基于分组信息将前述多个交易划分为M个交易分组,并由节 点n2的控制进程对节点n2中的N个计算进程进行任务调度。For example, node n2 may, during the process of consensus on the consensus proposal generated by node n1, or after reaching consensus on the consensus proposal generated by node n1, read the aforementioned plurality of consensus proposals from the consensus proposal through its consensus process and/or control process. Pre-execution information of each transaction, and then group the multiple transactions based on the pre-execution information of each transaction to obtain M transaction groups (M is greater than 1); or read the grouping of the aforementioned multiple transactions from the consensus proposal information and group the aforementioned multiple transactions based on the grouping information to obtain M transaction groups. More specifically, for example, the consensus process of node n2 can calculate the grouping information based on the pre-execution information of each of the aforementioned multiple transactions, and send the grouping information, the aforementioned multiple transactions and their respective corresponding pre-execution read and write sets to the node n2. control process; then the control process of node n2 divides the aforementioned multiple transactions into M transaction groups based on the grouping information, and the control process of node n2 performs task scheduling on the N computing processes in node n2.
获得前述M个交易分组的过程中,需要确保位于任意两个交易分组中的任意两个交易互不冲突。任意两个交易互不冲突具体是指任意两个交易不存在如下情况之一:一个交易的预执行读集与另一个交易的预执行写集中包括相同的key、一个交易的预执行写集和另一个交易的预执行写集中包括相同的key。而对于存在冲突的任意两个交易,则其需要被划分到相同的交易分组中,换而言之即如果该任意两个交易各自的预执行写集中包含相同的key,即认为该任意两个冲突交易访问了相同的参数而存在冲突,该任意两个交易需要被划分到相同的交易分组;如果该任意两个交易中的一个交易的预执行读集与另一个交易的预执行写集中包含相同的key,即认为该任意两个交易访问了相同的参数而存在冲突,该任意两个交易需要被划分到相同的交易分组。在另一种可能的实施方式中,为了高效的实现确定出前述多个交易的分组信息或者说高效的完成将前述多个交易划分为M个交易分组,通常可以按照位于任意两个不同的交易分组中的任意两个交易不访问相同参数(即不包含相同的key)的要求来对前述多个交易进行分组。这样,对于前述示例的交易Tx1~交易Tx5,其分组情况例如可能包括:交易Tx1和交易Tx3被划分到交易分组1中,交易Tx2被划分到交易分组2中,交易Tx4和交易Tx5各自被划分到交易分组3和交易分组4中。In the process of obtaining the aforementioned M transaction groups, it is necessary to ensure that any two transactions in any two transaction groups do not conflict with each other. Any two transactions do not conflict with each other. Specifically, any two transactions do not have one of the following situations: the pre-execution read set of one transaction and the pre-execution write set of another transaction include the same key, the pre-execution write set of one transaction and Another transaction's pre-execution write set includes the same key. For any two transactions that conflict, they need to be divided into the same transaction group. In other words, if the pre-execution write sets of any two transactions contain the same key, it is considered that any two transactions Conflict transactions access the same parameters and conflict exists. Any two transactions need to be divided into the same transaction group; if the pre-execution read set of one of the two transactions is included in the pre-execution write set of the other transaction, The same key means that any two transactions are considered to have accessed the same parameters and there is a conflict. The any two transactions need to be divided into the same transaction group. In another possible implementation, in order to efficiently determine the grouping information of the aforementioned multiple transactions or to efficiently complete the aforementioned multiple transactions, the aforementioned multiple transactions can be divided into M transaction groups. Usually, the grouping information can be determined according to the location of any two different transactions. The aforementioned multiple transactions are grouped by the requirement that any two transactions in the group do not access the same parameters (that is, do not contain the same key). In this way, for the transactions Tx1 to Tx5 in the aforementioned example, the grouping situation may include, for example: transaction Tx1 and transaction Tx3 are divided into transaction group 1, transaction Tx2 is divided into transaction group 2, and transaction Tx4 and transaction Tx5 are divided respectively. Go to transaction group 3 and transaction group 4.
节点n2具体可以按照M个交易分组,通过其运行的N个计算进程并行执行该M个交易分组中的多个交易。然而由任意两个计算进程并行执行的任意两个交易如果涉及相同的合约账户/智能合约,那么节点n2在提交其生成区块的过程中产生的状态数据时,鉴于N个计算进程各自获得的状态数据可能涉及相同的智能合约的合约参数,单个计算进程并不能独立的完成提交其获得的状态数据而需要对该N个计算进程各自获得的状态数据进行合并提交。Specifically, node n2 can be grouped into M transactions and execute multiple transactions in the M transaction groups in parallel through the N computing processes it runs. However, if any two transactions executed in parallel by any two computing processes involve the same contract account/smart contract, then when node n2 submits the status data generated in the process of generating the block, in view of the The status data may involve contract parameters of the same smart contract. A single computing process cannot submit the status data it obtains independently and needs to merge and submit the status data obtained by each of the N computing processes.
图4为本说明书实施例中提供的一种状态数据的提交方法的流程图。该方法可以由区块链***中的任一区块链节点执行,例如由并未作为共识提议节点(主节点)的其它区块链节点(从节点)执行,其中无论是作为主节点或是从节点的区块链节点,均可各自实现为任何具有计算/处理能力的装置、平台、设备或设备集群。下文中将主要以作为主节点的节点n1与作为从节点的节点n2相协作,使得节点n2通过其包含的多个进程来具体实现该方法中的各个方法步骤为例,详细描述区块链节点实现如图4中所示的方法的过程。如图4所示,由当前作为从节点的节点n2执行的状态数据提交方法可以包括但不限于如下步骤42~步骤46。Figure 4 is a flow chart of a status data submission method provided in the embodiment of this specification. This method can be executed by any blockchain node in the blockchain system, for example, by other blockchain nodes (slave nodes) that are not serving as consensus proposal nodes (master nodes), whether as master nodes or The blockchain nodes of the slave nodes can each be implemented as any device, platform, device or device cluster with computing/processing capabilities. In the following, the blockchain node will be described in detail by mainly taking the node n1 as the master node and the node n2 as the slave node to cooperate, so that the node n2 specifically implements each method step in the method through the multiple processes it contains. The process of implementing the method is shown in Figure 4. As shown in Figure 4, the status data submission method executed by node n2 currently serving as a slave node may include but is not limited to the following steps 42 to 46.
步骤42,控制进程获取M个交易分组。其中如前所述的是M个交易分组具体可以通过基于多个交易各自的预执行读写集对多个交易进行分组而得到,M通常大于N而且该多个交易中的至少部分交易的预执行读写集可能分别涉及与一个或多个智能合约相关的若干合约参数。此外控制进程获得前述M个交易分组的各种方式可以参见前文,此处不再赘述。Step 42: The control process obtains M transaction groups. As mentioned above, M transaction groups can be obtained by grouping multiple transactions based on their respective pre-execution read and write sets. M is usually greater than N and the pre-execution read and write sets of at least some of the multiple transactions are Executing read and write sets may each involve several contract parameters related to one or more smart contracts. In addition, the various ways in which the control process obtains the aforementioned M transaction groups can be found in the previous section and will not be described again here.
步骤44,控制进程将M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给N个进程中的第一进程。换而言之即对于M个交易分组中的任意两个交易分组,如果该任意两个分组中的任意两个交易涉及相同的智能合约,例如该任意两个交易分组中的任意两个交易请求调用相同的智能合约,则该任意两个交易分组需要被控制进程调度至相同的计算进程。Step 44: The control process sends the P first transaction packets involving the contract parameters of the first contract among the M transaction packets to the first process among the N processes. In other words, for any two transaction groups among M transaction groups, if any two transactions in any two groups involve the same smart contract, such as any two transaction requests in any two transaction groups, If the same smart contract is called, any two transaction groups need to be scheduled by the control process to the same calculation process.
参见前文示例的交易Tx1~交易Tx5的分组情况,由于交易分组1和交易分组2中的交易Tx1和交易Tx2分别涉及智能合约C1(即第一合约)中不同合约参数(k2和k4各自表征的合约参数),节点n2的控制进程例如可以将交易分组1和交易分组2等两个交易分组作为前述的P个第一交易分组发送至节点n2的计算进程1(即第一进程),将交易分组3发送至计算进程2,将交易分组4发送至计算进程3,使得计算进程1~计算进程3并行执行其各自接收的交易分组中的交易。Refer to the grouping situation of transactions Tx1 ~ transaction Tx5 in the previous example. Since transaction Tx1 and transaction Tx2 in transaction group 1 and transaction group 2 respectively involve different contract parameters (k2 and k4 respectively represent) in smart contract C1 (i.e. the first contract), Contract parameters), the control process of node n2 can, for example, send two transaction packets such as transaction group 1 and transaction group 2 as the aforementioned P first transaction groups to the calculation process 1 (i.e., the first process) of node n2, and transfer the transaction Group 3 is sent to calculation process 2, and transaction group 4 is sent to calculation process 3, so that calculation process 1 to calculation process 3 execute the transactions in the transaction groups they respectively received in parallel.
具体地,在步骤46,第一进程执行P个第一交易分组中的各个交易,获得第一合约的P组合约状态数据,每组合约状态数据中包括第一合约的一个或多个合约参数各自的状态值,并基于P组合约状态数据提交第一合约的合约状态。Specifically, in step 46, the first process executes each transaction in the P first transaction groups and obtains P sets of contract status data of the first contract. Each set of contract status data includes one or more contract parameters of the first contract. respective status values, and submit the contract status of the first contract based on the P group contract status data.
计算进程可以串行执行其接收的各个交易分组中的交易,例如计算进程1可以通过单个工作线程依次执行其接收的交易分组1和交易分组2中的交易Tx1、交易Tx2和交易Tx3。或者计算进程可以通过多线程并发的执行其接收的各个交易分组中的交易,以便更为快速的完成执行其接收的各个交易分组中的交易;例如计算进程1中可以并发的运行工作线程1和工作线程2,工作线程1依次执行交易分组1中的交易Tx1和交易Tx3以得到1组涉及智能合约C1的状态数据,该组合约状态数据例如包括智能合约C1中由k2表征的合约参数的状态值;工作线程2执行交易分组2中的交易Tx2以得到涉及智能合约C1的另一组合约状态数据,该组合约状态数据例如包括智能合约C1中由k4表征的合约参数的状态值。需要特别说明的是,计算进程可以通过相同的存储对象来搜集其通过执行其接收的各个交易分组中的交易以获得的状态数据;例如计算进程1可以通过相同的存储对象搜集到其执行交易Tx1~交易Tx3所获得的执行读写集,执行读写集具体包 括执行读集和执行写集,交易Tx1~交易Tx3的执行写集也就是计算进程1执行交易Tx1~交易Tx3以得到的状态数据。此外参见前文相关于存储树和状态数的描述可见,计算进程获得的状态数据可能包含与状态树相关的世界状态数据和与存储树相关的合约状态数据,例如交易Tx1调用智能合约C1时,可能需要计算因执行交易Tx1而消耗的数字资源,进而交易Tx1的执行写集将会包含用于修改发起交易Tx1的外部账户A1的Balance字段的键值对(例如前述表1中的k1=v11),该键值对即属于计算进程1获得的世界状态数据;此外继续参见前文所述交易Tx1和交易Tx2可能涉及相同智能合约C1,即涉及相同合约账户B1下的由k2和k4分别表征的合约参数,交易Tx1和交易Tx2各自的执行写集中可能与其各自的预执行写集包含相同的键值对k2-v21、k4-v41,键值对k2-v21、k4-v41即属于计算进程1获得的合约状态数据,具体地说键值对k2-v21、k4-v41是计算进程1获得的智能合约C1/合约账户B1的合约状态数据。The computing process can serially execute the transactions in each transaction group it receives. For example, the computing process 1 can sequentially execute the transactions Tx1, transaction Tx2, and transaction Tx3 in the transaction group 1 and transaction group 2 it receives through a single worker thread. Or the computing process can concurrently execute the transactions in each transaction group it receives through multiple threads in order to complete the execution of the transactions in each transaction group it receives more quickly; for example, computing process 1 can run worker threads 1 and 1 concurrently. Working thread 2 and working thread 1 sequentially execute transaction Tx1 and transaction Tx3 in transaction group 1 to obtain a set of status data involving smart contract C1. This set of contract status data includes, for example, the status of the contract parameters represented by k2 in smart contract C1. value; the worker thread 2 executes the transaction Tx2 in the transaction group 2 to obtain another set of contract status data related to the smart contract C1. The set of contract status data includes, for example, the status value of the contract parameter represented by k4 in the smart contract C1. It should be noted that the computing process can collect the status data obtained by executing the transactions in each transaction group it receives through the same storage object; for example, the computing process 1 can collect the transaction Tx1 it executes through the same storage object. ~The execution read-write set obtained by transaction Tx3. The execution read-write set specifically includes execution read set and execution write set. The execution write set of transaction Tx1~transaction Tx3 is the status data obtained by computing process 1 when executing transaction Tx1~transaction Tx3. . In addition, referring to the previous description of storage trees and state numbers, it can be seen that the state data obtained by the calculation process may include world state data related to the state tree and contract state data related to the storage tree. For example, when transaction Tx1 calls smart contract C1, it may It is necessary to calculate the digital resources consumed by executing transaction Tx1, and the execution write set of transaction Tx1 will contain the key-value pair used to modify the Balance field of the external account A1 that initiated transaction Tx1 (for example, k1=v11 in the aforementioned Table 1) , this key-value pair belongs to the world state data obtained by calculation process 1; in addition, continue to refer to the above mentioned transaction Tx1 and transaction Tx2, which may involve the same smart contract C1, that is, the contracts represented by k2 and k4 under the same contract account B1 Parameters, the respective execution write sets of transaction Tx1 and transaction Tx2 may contain the same key-value pairs k2-v21 and k4-v41 as their respective pre-execution write sets. The key-value pairs k2-v21 and k4-v41 are obtained by calculation process 1. The contract status data, specifically the key-value pairs k2-v21 and k4-v41 are the contract status data of smart contract C1/contract account B1 obtained by calculation process 1.
涉及相同的智能合约的交易由相同的计算进程执行,则N个计算进程各自获得的状态数据中不会涉及相同智能合约/合约账户的合约状态数据,因而节点n2的N个计算进程可以互不影响的并行提交其各自获得的状态数据。更具体地,如果计算进程获得的状态数据仅包括与状态树相关的世界状态数据,则其可以直接提交其获得的世界状态数据;如果计算进程获得的状态数据同时包含世界状态数据和涉及至少一个智能合约的合约状态数据,则该计算进程需要先提交其获得的至少一个智能合约的合约状态,例如将其获得的P组状态数据发送至存储进程,由存储进程基于该P组状态数据更新该至少一个智能合约的合约状态树(即存储树),获得该至少一个智能合约各自的存储根;进而合并提交至少一个智能合约各自的存储根以及该计算进程获得的世界状态数据至存储进程,由存储进程对应更新状态树中的部分状态参数。Transactions involving the same smart contract are executed by the same computing process, so the status data obtained by each of the N computing processes will not involve the contract status data of the same smart contract/contract account, so the N computing processes of node n2 can be independent of each other. The affected parallels commit their respective obtained state data. More specifically, if the state data obtained by the calculation process only includes world state data related to the state tree, it can directly submit the world state data it obtained; if the state data obtained by the calculation process contains both world state data and involves at least one The contract status data of the smart contract, then the computing process needs to first submit the contract status of at least one smart contract it obtains, for example, send the P group of status data it obtains to the storage process, and the storage process updates the P group of status data based on the P group of status data. The contract state tree (i.e., storage tree) of at least one smart contract obtains the respective storage roots of the at least one smart contract; and then merges and submits the respective storage roots of at least one smart contract and the world state data obtained by the calculation process to the storage process. The stored process corresponds to updating some state parameters in the state tree.
计算进程在完成执行其接收的P个第一交易分组中的任一第一交易之后,可以对应获得该第一交易的执行读写集,进而还可以确定该第一交易的执行读写集与该第一交易的预执行读写集是否一致。当P个第一交易分组中的每个交易各自的执行读写集与其预执行读写集都一致的情况下,该计算进程可以基于其获得的P组合约状态数据更新第一合约的合约状态。特别需要说明的是,如果P个交易分组中存在某个交易的的执行读写集与其预执行读写集不一致,则可以更换区块链***的主节点,进而通过与前述相似的过程重新发起对前述多个交易的执行。After the computing process completes the execution of any first transaction among the P first transaction groups it receives, it can correspondingly obtain the execution read-write set of the first transaction, and further determine the execution read-write set of the first transaction and Whether the pre-execution read and write sets of the first transaction are consistent. When the execution read-write set of each transaction in the P first transaction groups is consistent with its pre-execution read-write set, the calculation process can update the contract status of the first contract based on the P groups of contract status data it obtains. . In particular, if there is a transaction in P transaction groups whose execution read-write set is inconsistent with its pre-execution read-write set, the master node of the blockchain system can be replaced and then reinitiated through a process similar to the above. Execution of multiple transactions mentioned above.
节点n2的N个计算进程均完成提交其各自获得的状态数据到存储进程后,还可以由控制进程对存储进程进行调用来对其更新的状态树和各个存储树进行提交操作,完 成对状态树的更新并获得用于状态根,进而由控制进程基于该状态根和前述多个交易生成相应的区块。After the N computing processes of node n2 have completed submitting their respective obtained status data to the storage process, the control process can also call the storage process to submit the updated status tree and each storage tree to complete the status tree. is updated and obtained for the state root, and then the control process generates the corresponding block based on the state root and the aforementioned multiple transactions.
前述各个方法实施例中,涉及相同合约账户的交易由相同的计算进程执行,使得并行执行属于某个区块的多个交易的任意两个计算进程不会产生涉及相同合约账户的合约状态数据,从而使得多个计算进程可以并行提交其各自获得的合约状态数据,有利于更为快速的生成包含该多个交易的区块。此外单个计算进程可以并发执行与其对应的多个交易分组中的各个交易,可以更为快速的完成对其接收的各个交易分组中的交易的执行,进而加速区块的生成。In each of the aforementioned method embodiments, transactions involving the same contract account are executed by the same calculation process, so that any two calculation processes that execute multiple transactions belonging to a certain block in parallel will not generate contract status data involving the same contract account. This allows multiple computing processes to submit their respective contract status data in parallel, which is conducive to faster generation of blocks containing multiple transactions. In addition, a single computing process can concurrently execute each transaction in its corresponding multiple transaction groups, and can more quickly complete the execution of the transactions in each transaction group it receives, thereby accelerating the generation of blocks.
与前述方法实施例基于相同的构思,本说明书实施例中还提供了一种区块链***中第一节点。如图5所示,所述第一节点包括控制进程52和N个计算进程54。其中:所述控制进程52获取M个交易分组,所述M个交易分组通过基于多个交易各自的预执行读写集对所述多个交易进行分组而得到,其中M大于N,所述预执行读写集涉及若干合约参数;所述控制进程52将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给所述N个进程中的第一进程;所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,基于所述P组合约状态数据提交所述第一合约的合约状态。Based on the same concept as the foregoing method embodiments, the embodiments of this specification also provide a first node in the blockchain system. As shown in FIG. 5 , the first node includes a control process 52 and N calculation processes 54 . Wherein: the control process 52 obtains M transaction groups, which are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, where M is greater than N, and the pre-execution read and write sets are obtained by grouping the multiple transactions. Executing the read-write set involves several contract parameters; the control process 52 sends the P first transaction packets involving the contract parameters of the first contract among the M transaction packets to the first process among the N processes; so The first process executes each transaction in the P first transaction groups and obtains P sets of contract status data of the first contract. Each set of contract status data includes one or more contract parameters of the first contract. Respective status values submit the contract status of the first contract based on the P group contract status data.
在一种可能的实施方式中,所述第一进程按照所述P个第一交易分组并发执行所述P个第一交易分组中的各个所述交易。In a possible implementation manner, the first process concurrently executes each of the transactions in the P first transaction groups according to the P first transaction groups.
在一种可能的实施方式中,所述第一节点还包括存储进程56;所述第一进程将所述P组合约状态数据发送给所述存储进程56,使所述存储进程56基于所述P组合约状态数据更新所述第一合约的合约状态树。In a possible implementation, the first node also includes a storage process 56; the first process sends the P group contract status data to the storage process 56, so that the storage process 56 is based on the P sets of contract status data update the contract status tree of the first contract.
在一种可能的实施方式中,所述控制进程52基于来自所述区块链***中的第二节点的分组信息获取M个交易分组。In a possible implementation, the control process 52 obtains M transaction packets based on the packet information from the second node in the blockchain system.
在一种可能的实施方式中,所述第一节点还包括第一共识进程58;所述第一共识进程58从所述区块链***中的第二节点接收所述多个交易各自的预执行读写集,基于所述预执行读写集对所述多个交易进行分组以得到所述M个交易分组。In a possible implementation, the first node also includes a first consensus process 58; the first consensus process 58 receives the respective predetermined values of the multiple transactions from the second node in the blockchain system. Execute a read-write set, and group the multiple transactions based on the pre-execution read-write set to obtain the M transaction groups.
在一种可能的实施方式中,所述第一进程在执行所述P个第一交易分组中的任一第一交易之后,得到所述第一交易的执行读写集,并确定所述第一交易的执行读写集与所述第一交易的预执行读写集是否一致;所述第一进程在确定所述P个第一交易分 组中的每个交易各自的执行读写集与其预执行读写集都一致的情况中,基于所述P组合约状态数据更新所述第一合约的合约状态。In a possible implementation, after executing any first transaction in the P first transaction groups, the first process obtains the executed read-write set of the first transaction and determines the Whether the execution read-write set of a transaction is consistent with the pre-execution read-write set of the first transaction; the first process determines whether the execution read-write set of each transaction in the P first transaction groups is consistent with its pre-execution read-write set. In the case where the execution read and write sets are consistent, the contract status of the first contract is updated based on the P group contract status data.
与前述方法实施例基于相同的构思,本说明书实施例中还提供了一种区块链***,包括第一节点和第二节点,其中:所述第二节点用于向所述第一节点发送多个交易各自的预执行读写集,所述预执行读写集涉及若干合约参数;所述第一节点通过其控制进程基于所述多个交易各自的预执行读写集对所述多个交易进行分组以得到M个交易分组,并将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给其N个进程中的第一进程,其中M大于N;通过所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,并基于所述P组合约状态数据提交所述第一合约的合约状态。Based on the same concept as the foregoing method embodiments, the embodiments of this specification also provide a blockchain system, including a first node and a second node, wherein: the second node is used to send a message to the first node. Pre-execution read and write sets of multiple transactions respectively, the pre-execution read and write sets involve several contract parameters; the first node uses its control process to perform pre-execution read and write sets of the multiple transactions based on the respective pre-execution read and write sets of the multiple transactions. Transactions are grouped to obtain M transaction groups, and P first transaction groups involving contract parameters of the first contract among the M transaction groups are sent to the first process among its N processes, where M is greater than N; The first process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract. Each group of contract status data includes one or more of the first contract. respective status values of the contract parameters, and submit the contract status of the first contract based on the P group contract status data.
在一种可能的实施方式中,所述第二节点包括预执行进程和缓存进程,所述缓存进程的内存中存储有状态数据,所述多个交易中包括第一交易。所述缓存进程用于将所述多个交易发送给所述预执行进程,所述多个交易由所述第一节点接收并存储到所述缓存进程的内存中。所述预执行进程用于预执行所述多个交易,生成所述多个交易的预执行读写集,具体用于在预执行所述第一交易的过程中将要读取第一变量的状态值时,在所述缓存进程的内存存储有所述第一变量的第一状态值的情况中,从所述缓存进程接收所述第一状态值,基于所述第一状态值生成所述第一交易的预执行读写集;所述缓存进程还用于在所述缓存进程的内存中存储所述多个交易的预执行读写集和所述多个交易的预执行顺序,基于所述多个交易的预执行读写集更新所述缓存进程的内存中存储的状态数据。In a possible implementation, the second node includes a pre-execution process and a cache process, the cache process stores stateful data in its memory, and the plurality of transactions include the first transaction. The cache process is used to send the multiple transactions to the pre-execution process, and the multiple transactions are received by the first node and stored in the memory of the cache process. The pre-execution process is used to pre-execute the multiple transactions and generate pre-execution read and write sets of the multiple transactions, specifically for reading the status of the first variable during the process of pre-executing the first transaction. value, in the case where the memory of the cache process stores the first state value of the first variable, the first state value is received from the cache process, and the first state value is generated based on the first state value. A pre-execution read-write set of a transaction; the cache process is also used to store the pre-execution read-write set of the multiple transactions and the pre-execution sequence of the multiple transactions in the memory of the cache process, based on the A pre-execution read-write set of multiple transactions updates the state data stored in the cache process' memory.
在一种可能的实施方式中,所述第二节点还包括第二共识进程。所述缓存进程还用于将所述多个交易的预执行读写集和预执行顺序发送给所述第二共识进程。所述第二共识进程用于生成共识提议,并将所述共识提议发送给所述第一节点中的第一共识进程,所述共识提议包括所述多个交易的预执行读写集及其共识顺序,所述共识顺序为所述预执行顺序。In a possible implementation, the second node further includes a second consensus process. The cache process is also used to send the pre-execution read-write sets and pre-execution sequences of the multiple transactions to the second consensus process. The second consensus process is used to generate a consensus proposal and send the consensus proposal to the first consensus process in the first node. The consensus proposal includes the pre-execution read and write sets of the multiple transactions and their Consensus order, the consensus order is the pre-execution order.
虽然本说明书一个或多个实施例提供了如实施例或流程图所述的方法操作步骤,但基于常规或者无创造性的手段可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多步骤执行顺序中的一种方式,不代表唯一的执行顺序。在实际中的装置或终端产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执 行(例如并行处理器或者多线程处理的环境,甚至为分布式数据处理环境)。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、产品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、产品或者设备所固有的要素。在没有更多限制的情况下,并不排除在包括所述要素的过程、方法、产品或者设备中还存在另外的相同或等同要素。例如若使用到第一,第二等词语用来表示名称,而并不表示任何特定的顺序。Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-inventive means. The sequence of steps listed in the embodiment is only one way of executing the sequence of many steps, and does not represent the only execution sequence. When the actual device or terminal product is executed, it can be executed sequentially or in parallel according to the methods shown in the embodiments or figures (such as a parallel processor or multi-thread processing environment, or even a distributed data processing environment). The terms "comprises," "comprises" or any other variation thereof are intended to cover a non-exclusive inclusion such that a process, method, product or apparatus including a list of elements includes not only those elements but also others not expressly listed elements, or also elements inherent to the process, method, product or equipment. Without further limitation, it does not exclude the presence of additional identical or equivalent elements in a process, method, product or apparatus including the stated elements. For example, if the words "first" and "second" are used to express names, they do not indicate any specific order.
本发明是参照根据本发明实施例的方法、装置(***)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce a use A device for realizing the functions specified in one process or multiple processes of the flowchart and/or one block or multiple blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions The device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储 器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储、石墨烯存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information. Information may be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory. (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape, magnetic tape storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、***或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It should be understood by those skilled in the art that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本本说明书一个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。One or more embodiments of this specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于***实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本说明书的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。Each embodiment in this specification is described in a progressive manner. The same and similar parts between the various embodiments can be referred to each other. Each embodiment focuses on its differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For relevant details, please refer to the partial description of the method embodiment. In the description of this specification, reference to the terms "one embodiment," "some embodiments," "an example," "specific examples," or "some examples" or the like means that specific features are described in connection with the embodiment or example. , structures, materials or features are included in at least one embodiment or example of this specification. In this specification, the schematic expressions of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the specific features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and combine different embodiments or examples and features of different embodiments or examples described in this specification unless they are inconsistent with each other.
以上所述仅为本说明书一个或多个实施例的实施例而已,并不用于限制本本说明书一个或多个实施例。对于本领域技术人员来说,本说明书一个或多个实施例可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进 等,均应包含在权利要求范围之内。The above descriptions are only examples of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. To those skilled in the art, various modifications and changes may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification shall be included in the scope of the claims.

Claims (15)

  1. 一种状态数据提交方法,由区块链***中的第一节点执行,所述第一节点包括控制进程和N个计算进程,方法包括:A state data submission method is executed by the first node in the blockchain system. The first node includes a control process and N calculation processes. The method includes:
    所述控制进程获取M个交易分组,所述M个交易分组通过基于多个交易各自的预执行读写集对所述多个交易进行分组而得到,其中M大于N,所述预执行读写集涉及若干合约参数;The control process acquires M transaction groups, which are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, where M is greater than N, and the pre-execution read and write sets are The set involves several contract parameters;
    所述控制进程将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给所述N个进程中的第一进程;The control process sends P first transaction packets involving contract parameters of the first contract among the M transaction packets to the first process among the N processes;
    所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,基于所述P组合约状态数据提交所述第一合约的合约状态。The first process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract. Each group of contract status data includes one or more contracts of the first contract. The respective status values of the parameters are used to submit the contract status of the first contract based on the P group contract status data.
  2. 根据权利要求1所述的方法,所述第一进程按照所述P个第一交易分组并发执行所述P个第一交易分组中的各个所述交易。According to the method of claim 1, the first process concurrently executes each of the transactions in the P first transaction groups according to the P first transaction groups.
  3. 根据权利要求1所述的方法,所述第一节点还包括存储进程;所述基于所述P组合约状态数据提交所述第一合约的合约状态,包括:将所述P组合约状态数据发送给所述存储进程,使所述存储进程基于所述P组合约状态数据更新所述第一合约的合约状态树。The method according to claim 1, the first node further includes a storage process; the submitting the contract status of the first contract based on the P group contract status data includes: sending the P group contract status data Give the storage process to update the contract status tree of the first contract based on the P group contract status data.
  4. 根据权利要求1所述的方法,所述控制进程获取M个交易分组,包括:所述控制进程基于来自所述区块链***中的第二节点的分组信息获取M个交易分组。According to the method of claim 1, the control process obtains M transaction groupings, including: the control process obtains M transaction groupings based on grouping information from the second node in the blockchain system.
  5. 根据权利要求1所述的方法,所述第一节点还包括第一共识进程;所述方法还包括:所述第一共识进程从所述区块链***中的第二节点接收所述多个交易各自的预执行读写集,基于所述预执行读写集对所述多个交易进行分组以得到所述M个交易分组。The method of claim 1, the first node further comprising a first consensus process; the method further comprising: the first consensus process receiving the plurality of nodes from a second node in the blockchain system. Each transaction's pre-execution read-write set is used to group the multiple transactions based on the pre-execution read-write set to obtain the M transaction groups.
  6. 根据权利要求5所述的方法,所述第一进程在执行所述P个第一交易分组中的任一第一交易之后,得到所述第一交易的执行读写集,并确定所述第一交易的执行读写集与所述第一交易的预执行读写集是否一致;所述基于所述P组合约状态数据提交所述第一合约的合约状态,包括:在确定所述P个第一交易分组中的每个交易各自的执行读写集与其预执行读写集都一致的情况中,基于所述P组合约状态数据更新所述第一合约的合约状态。According to the method of claim 5, after the first process executes any first transaction in the P first transaction groups, it obtains the execution read and write set of the first transaction and determines the first transaction. Whether the execution read-write set of a transaction is consistent with the pre-execution read-write set of the first transaction; submitting the contract status of the first contract based on the P sets of contract status data includes: determining the P sets of contract status data When the execution read-write set of each transaction in the first transaction group is consistent with its pre-execution read-write set, the contract status of the first contract is updated based on the contract status data of the P group.
  7. 一种区块链***中的第一节点,所述第一节点包括控制进程和N个计算进程, 其中:A first node in a blockchain system, the first node includes a control process and N computing processes, where:
    所述控制进程用于获取M个交易分组,所述M个交易分组通过基于多个交易各自的预执行读写集对所述多个交易进行分组而得到,其中M大于N,所述预执行读写集涉及若干合约参数;The control process is used to obtain M transaction groups, which are obtained by grouping the multiple transactions based on their respective pre-execution read and write sets, where M is greater than N, and the pre-execution The read-write set involves several contract parameters;
    所述控制进程将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给所述N个进程中的第一进程;The control process sends P first transaction packets involving contract parameters of the first contract among the M transaction packets to the first process among the N processes;
    所述第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,基于所述P组合约状态数据提交所述第一合约的合约状态。The first process executes each transaction in the P first transaction groups to obtain P groups of contract status data of the first contract. Each group of contract status data includes one or more contracts of the first contract. The respective status values of the parameters are used to submit the contract status of the first contract based on the P group contract status data.
  8. 根据权利要求7所述的第一节点,所述第一进程按照所述P个第一交易分组并发执行所述P个第一交易分组中的各个所述交易。According to the first node of claim 7, the first process concurrently executes each of the transactions in the P first transaction groups according to the P first transaction groups.
  9. 根据权利要求7所述的第一节点,所述第一节点还包括存储进程;所述第一进程将所述P组合约状态数据发送给所述存储进程,使所述存储进程基于所述P组合约状态数据更新所述第一合约的合约状态树。The first node according to claim 7, the first node further comprising a storage process; the first process sends the P group contract status data to the storage process, so that the storage process is based on the P The contract status tree of the first contract is updated by combining the contract status data.
  10. 根据权利要求7所述的第一节点,所述控制进程基于来自所述区块链***中的第二节点的分组信息获取M个交易分组。According to the first node of claim 7, the control process obtains M transaction groupings based on grouping information from the second node in the blockchain system.
  11. 根据权利要求7所述的第一节点,所述第一节点还包括共识进程;所述共识进程从所述区块链***中的第二节点接收所述多个交易各自的预执行读写集,基于所述预执行读写集对所述多个交易进行分组以得到所述M个交易分组。The first node according to claim 7, the first node further comprising a consensus process; the consensus process receives respective pre-execution read and write sets of the plurality of transactions from the second node in the blockchain system. , group the multiple transactions based on the pre-execution read and write set to obtain the M transaction groups.
  12. 根据权利要求11所述的第一节点,所述第一进程在执行所述P个第一交易分组中的任一第一交易之后,得到所述第一交易的执行读写集,并确定所述第一交易的执行读写集与所述第一交易的预执行读写集是否一致;所述第一进程在确定所述P个第一交易分组中的每个交易各自的执行读写集与其预执行读写集都一致的情况中,基于所述P组合约状态数据更新所述第一合约的合约状态。According to the first node of claim 11, after executing any first transaction in the P first transaction groups, the first process obtains the execution read-write set of the first transaction and determines the execution read-write set of the first transaction. Whether the execution read-write set of the first transaction is consistent with the pre-execution read-write set of the first transaction; the first process determines the execution read-write set of each transaction in the P first transaction groups. In the case where both its pre-execution read and write sets are consistent, the contract status of the first contract is updated based on the P group contract status data.
  13. 一种区块链***,包括第一节点和第二节点,其中:A blockchain system including a first node and a second node, wherein:
    所述第二节点用于向所述第一节点发送多个交易各自的预执行读写集,所述预执行读写集涉及若干合约参数;The second node is configured to send respective pre-execution read and write sets of multiple transactions to the first node, where the pre-execution read and write sets involve several contract parameters;
    所述第一节点通过其控制进程基于所述多个交易各自的预执行读写集对所述多个交易进行分组以得到M个交易分组,并将所述M个交易分组中涉及第一合约的合约参数的P个第一交易分组发送给其N个进程中的第一进程,其中M大于N;通过所述 第一进程执行所述P个第一交易分组中的各个交易,获得所述第一合约的P组合约状态数据,每组合约状态数据中包括所述第一合约的一个或多个合约参数各自的状态值,并基于所述P组合约状态数据提交所述第一合约的合约状态。The first node uses its control process to group the multiple transactions based on their respective pre-execution read and write sets to obtain M transaction groups, and the first contract is involved in the M transaction groups. P first transaction groups of contract parameters are sent to the first process among its N processes, where M is greater than N; through the first process, each transaction in the P first transaction groups is executed to obtain the P sets of contract status data of the first contract. Each set of contract status data includes the respective status values of one or more contract parameters of the first contract, and the first contract is submitted based on the P sets of contract status data. Contract status.
  14. 根据权利要求13所述的区块链***,所述第二节点包括预执行进程和缓存进程,所述缓存进程的内存中存储有状态数据,所述多个交易中包括第一交易;According to the blockchain system of claim 13, the second node includes a pre-execution process and a cache process, state data is stored in the memory of the cache process, and the plurality of transactions include the first transaction;
    所述缓存进程用于将所述多个交易发送给所述预执行进程,所述多个交易由所述第一节点接收并存储到所述缓存进程的内存中;The cache process is used to send the multiple transactions to the pre-execution process, and the multiple transactions are received by the first node and stored in the memory of the cache process;
    所述预执行进程用于预执行所述多个交易,生成所述多个交易的预执行读写集,具体用于在预执行所述第一交易的过程中将要读取第一变量的状态值时,在所述缓存进程的内存存储有所述第一变量的第一状态值的情况中,从所述缓存进程接收所述第一状态值,基于所述第一状态值生成所述第一交易的预执行读写集;The pre-execution process is used to pre-execute the multiple transactions and generate pre-execution read and write sets of the multiple transactions, specifically for reading the status of the first variable during the process of pre-executing the first transaction. value, in the case where the memory of the cache process stores the first state value of the first variable, the first state value is received from the cache process, and the first state value is generated based on the first state value. A pre-execution read and write set of a transaction;
    所述缓存进程还用于在所述缓存进程的内存中存储所述多个交易的预执行读写集和所述多个交易的预执行顺序,基于所述多个交易的预执行读写集更新所述缓存进程的内存中存储的状态数据。The cache process is also used to store the pre-execution read and write sets of the multiple transactions and the pre-execution sequences of the multiple transactions in the memory of the cache process, based on the pre-execution read and write sets of the multiple transactions. Updates the state data stored in the cache process's memory.
  15. 根据权利要求14所述的区块链***,所述第二节点还包括第二共识进程;所述缓存进程还用于将所述多个交易的预执行读写集和预执行顺序发送给所述第二共识进程;所述第二共识进程用于生成共识提议,并将所述共识提议发送给所述第一节点中的第一共识进程,所述共识提议包括所述多个交易的预执行读写集及其共识顺序,所述共识顺序为所述预执行顺序。According to the blockchain system of claim 14, the second node further includes a second consensus process; the cache process is also used to send the pre-execution read-write set and pre-execution sequence of the multiple transactions to all transactions. The second consensus process; the second consensus process is used to generate a consensus proposal and send the consensus proposal to the first consensus process in the first node, where the consensus proposal includes the predetermined information of the multiple transactions. Execute the read-write set and its consensus sequence, and the consensus sequence is the pre-execution sequence.
PCT/CN2022/135279 2022-05-30 2022-11-30 State data submission method, node, and blockchain system WO2023231338A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210602795.8A CN115129727A (en) 2022-05-30 2022-05-30 State data submission method, node and block chain system
CN202210602795.8 2022-05-30

Publications (1)

Publication Number Publication Date
WO2023231338A1 true WO2023231338A1 (en) 2023-12-07

Family

ID=83377180

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135279 WO2023231338A1 (en) 2022-05-30 2022-11-30 State data submission method, node, and blockchain system

Country Status (2)

Country Link
CN (1) CN115129727A (en)
WO (1) WO2023231338A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422468A (en) * 2023-12-18 2024-01-19 安徽中科晶格技术有限公司 Method, equipment and storage medium for parallelizing contract link contracts based on DAG model

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115129727A (en) * 2022-05-30 2022-09-30 蚂蚁区块链科技(上海)有限公司 State data submission method, node and block chain system
CN116308772B (en) * 2022-12-16 2023-10-13 蚂蚁区块链科技(上海)有限公司 Transaction distribution method, node and blockchain system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200052884A1 (en) * 2018-08-13 2020-02-13 International Business Machines Corporation Parallel transaction validation and block generation in a blockchain
CN111932257A (en) * 2020-08-18 2020-11-13 工银科技有限公司 Block chain parallelization processing method and device
US20210318859A1 (en) * 2020-04-13 2021-10-14 International Business Machines Corporation Optimization of execution of smart contracts
CN113743941A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method for executing transaction in block chain, block chain and main node
CN113743943A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method for executing transaction in block chain, main node and slave node
CN113743950A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method for performing transactions in a blockchain, blockchain node and blockchain
CN115129727A (en) * 2022-05-30 2022-09-30 蚂蚁区块链科技(上海)有限公司 State data submission method, node and block chain system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200052884A1 (en) * 2018-08-13 2020-02-13 International Business Machines Corporation Parallel transaction validation and block generation in a blockchain
US20210318859A1 (en) * 2020-04-13 2021-10-14 International Business Machines Corporation Optimization of execution of smart contracts
CN111932257A (en) * 2020-08-18 2020-11-13 工银科技有限公司 Block chain parallelization processing method and device
CN113743941A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method for executing transaction in block chain, block chain and main node
CN113743943A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method for executing transaction in block chain, main node and slave node
CN113743950A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method for performing transactions in a blockchain, blockchain node and blockchain
CN115129727A (en) * 2022-05-30 2022-09-30 蚂蚁区块链科技(上海)有限公司 State data submission method, node and block chain system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422468A (en) * 2023-12-18 2024-01-19 安徽中科晶格技术有限公司 Method, equipment and storage medium for parallelizing contract link contracts based on DAG model
CN117422468B (en) * 2023-12-18 2024-03-29 安徽中科晶格技术有限公司 Method, equipment and storage medium for parallelizing contract link contracts based on DAG model

Also Published As

Publication number Publication date
CN115129727A (en) 2022-09-30

Similar Documents

Publication Publication Date Title
WO2023231338A1 (en) State data submission method, node, and blockchain system
US9460185B2 (en) Storage device selection for database partition replicas
Fu et al. A fair comparison of message queuing systems
WO2023231339A1 (en) Transaction execution method and node in blockchain system, and blockchain system
US9489443B1 (en) Scheduling of splits and moves of database partitions
Armbrust et al. Scads: Scale-independent storage for social computing applications
CN111338766A (en) Transaction processing method and device, computer equipment and storage medium
US10146814B1 (en) Recommending provisioned throughput capacity for generating a secondary index for an online table
US10102230B1 (en) Rate-limiting secondary index creation for an online table
Esteves et al. Quality-of-service for consistency of data geo-replication in cloud computing
US9875270B1 (en) Locking item ranges for creating a secondary index from an online table
US10635650B1 (en) Auto-partitioning secondary index for database tables
US10158709B1 (en) Identifying data store requests for asynchronous processing
US10013449B1 (en) Validating and non-validating secondary indexes for a table in a non-relational data store
US10747739B1 (en) Implicit checkpoint for generating a secondary index of a table
WO2023231336A1 (en) Method for executing transaction and blockchain node
CN108153859B (en) A kind of effectiveness order based on Hadoop and Spark determines method parallel
WO2016014333A1 (en) Distributing and processing streams over one or more networks for on-the-fly schema evolution
Le et al. Dynastar: Optimized dynamic partitioning for scalable state machine replication
US20220300323A1 (en) Job Scheduling Method and Job Scheduling Apparatus
US11132367B1 (en) Automatic creation of indexes for database tables
Vilaça et al. A correlation-aware data placement strategy for key-value stores
Matri et al. Týr: blob storage meets built-in transactions
US9898614B1 (en) Implicit prioritization to rate-limit secondary index creation for an online table
Nurain et al. An in-depth study of map reduce in cloud environment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22944639

Country of ref document: EP

Kind code of ref document: A1