WO2024001032A1 - 在区块链系统中执行交易的方法、区块链系统和节点 - Google Patents
在区块链系统中执行交易的方法、区块链系统和节点 Download PDFInfo
- Publication number
- WO2024001032A1 WO2024001032A1 PCT/CN2022/135476 CN2022135476W WO2024001032A1 WO 2024001032 A1 WO2024001032 A1 WO 2024001032A1 CN 2022135476 W CN2022135476 W CN 2022135476W WO 2024001032 A1 WO2024001032 A1 WO 2024001032A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- execution
- contract
- consensus
- preset type
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1059—Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
Definitions
- the embodiments of this specification belong to the field of blockchain technology, and in particular relate to a method of executing transactions in a blockchain system, a blockchain system, and nodes.
- 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 master node in order to speed up the execution of transactions in the blockchain, the master node pre-executes multiple transactions and obtains the variable access information of the multiple transactions, so that the slave node can execute multiple transactions in parallel based on the variable access information. , to speed up transaction execution.
- the purpose of the present invention is to provide a solution for executing transactions in a blockchain, which can improve the transaction execution speed.
- a first aspect of this specification provides a method for executing transactions in a blockchain system.
- the blockchain system includes a master node and a plurality of slave nodes.
- the method is executed by the master node and includes:
- the pre-execution of the first transaction is terminated and the first information is recorded. Used to indicate that the first transaction includes a call to a preset type of contract, where the execution of the preset type of contract relies on data generated by consensus;
- the consensus proposal is sent to at least some slave nodes, and the consensus proposal is reached with the at least some slave nodes.
- the second aspect of this specification provides a method for executing transactions in a blockchain system.
- the blockchain system includes a master node and a slave node.
- An account list of a preset type of contract is stored in the blockchain system.
- the execution of the preset type of contract relies on the data generated by consensus, and the method is executed by the slave node, including:
- a consensus proposal for the first block is received from the master node.
- the consensus proposal includes first information of the first transaction.
- the first information is used to indicate that the first transaction includes the first transaction of a preset type. Contract call;
- the first transaction After consensus is reached, when executing the first transaction, it is determined that the first transaction includes a call to a preset type of contract, and the first transaction does not involve accounts other than accounts included in the list. When, the execution of the first transaction is completed.
- the list of accounts storing contracts of a preset type in the blockchain system includes a list of accounts storing contracts of a preset type in multiple nodes in the blockchain system.
- the third aspect of this specification provides a master node in the blockchain, including:
- a pre-execution unit configured to terminate the pre-execution of the first transaction when it is determined that the first transaction includes a call to a first contract of a preset type after starting the pre-execution of the first transaction, wherein, the The execution of preset types of contracts relies on data generated by consensus;
- a consensus unit configured to generate a consensus proposal for the first block, the consensus proposal including the first information of the first transaction, the first information being used to indicate that the first transaction includes a preset type of Calling the contract; sending the consensus proposal to at least some slave nodes of the blockchain, and reaching consensus on the consensus proposal with the at least some slave nodes.
- the fourth aspect of this specification provides a slave node in a blockchain.
- the blockchain stores an account list of a preset type of contract.
- the execution of the preset type of contract relies on data generated by consensus, so
- the slave nodes include:
- a consensus unit configured to receive a consensus proposal of the first block from the master node of the blockchain, the consensus proposal including first information of the first transaction, the first information being used to indicate the first transaction including calling a first contract of a preset type; performing consensus on the consensus proposal with the master node and at least some other slave nodes;
- An execution unit configured to, after reaching consensus, when executing the first transaction, determine that the first transaction includes a call to a preset type of contract, and the first transaction does not involve other than those included in the list. When the account is outside the account, the execution of the first transaction is completed.
- the fifth aspect of this specification provides a blockchain, including a master node and multiple slave nodes.
- the blockchain stores an account list of a preset type of contract.
- the execution of the preset type of contract relies on consensus. generated data,
- the master node is configured to terminate the pre-execution of the first transaction when it is determined that the first transaction includes a call to the first contract of the preset type after starting the pre-execution of the first transaction; generate a third A consensus proposal for a block, the consensus proposal includes the first information of the first transaction, the first information is used to indicate that the first transaction includes a call to a preset type of contract; the The consensus proposal is sent to at least some slave nodes, and the consensus proposal is reached with the at least some slave nodes;
- the slave node is used to receive the consensus proposal from the master node, and conduct consensus on the consensus proposal with the master node and at least some other slave nodes; after the consensus is reached, when executing the first transaction , when it is determined that the first transaction includes a call to a preset type of contract and the first transaction does not involve accounts other than the accounts included in the list, the execution of the first transaction is completed.
- a sixth aspect of this specification provides a computer-readable storage medium on which a computer program is stored.
- the computer program is executed in a computer, the computer is caused to execute the method described in the first aspect or the second aspect.
- a seventh aspect of this specification provides a computing device, including a memory and a processor.
- the memory stores executable code.
- the processor executes the executable code, it implements the first aspect or the second aspect. method.
- Figure 1 is a block chain architecture diagram in the embodiment of this specification.
- FIG. 2 is a schematic diagram of the consensus process in the PBFT consensus algorithm
- Figure 3 shows the blockchain structure diagram in the embodiment of this specification
- Figure 4 is a flow chart of a method for executing transactions in the embodiment of this specification
- Figure 5 is an architectural diagram of a master node in a blockchain in an embodiment of this specification
- Figure 6 is an architectural diagram of a slave node in a blockchain in an embodiment of this specification.
- Figure 1 shows the blockchain architecture diagram in the embodiment of this specification.
- the blockchain includes, for example, a total of 6 nodes including master node 1, slave node 2 to slave node 5.
- the connections between nodes schematically represent P2P (Peer to Peer, point-to-point) connections.
- P2P Peer to Peer, point-to-point
- These nodes store the entire ledger, which stores the status of all blocks and all accounts.
- each node in the blockchain generates the same state in the blockchain by executing the same transaction, and each node in the blockchain stores the same state database.
- the master node 1 can be responsible for receiving transactions from the client and initiating a consensus proposal to each slave node.
- the consensus proposal includes, for example, multiple transactions in the block to be formed (such as block B1) and each Transaction submission order and other information. After the nodes in the blockchain successfully reach consensus on the consensus proposal, each node can execute the multiple transactions according to the submission order in the consensus proposal, thereby generating block B1.
- the blockchain shown in FIG. 1 is only exemplary, and the embodiments of this specification are not limited to application to the blockchain shown in FIG. 1 , and may also be applied to a blockchain system including sharding, for example.
- FIG. 1 shows that the blockchain includes 6 nodes
- the embodiments of this specification are not limited to this, and may include other numbers of nodes.
- the nodes included in the blockchain can meet Byzantine Fault Tolerance (BFT) requirements.
- BFT Byzantine Fault Tolerance
- the mentioned Byzantine fault tolerance requirements can be understood as meaning that Byzantine nodes can exist within the blockchain, but the blockchain does not reflect Byzantine behavior externally.
- some Byzantine fault-tolerant algorithms require the number of nodes to be greater than 3f+1, where f is the number of Byzantine nodes, such as the Practical Byzantine Fault Tolerance algorithm PBFT (Practical Byzantine Fault Tolerance).
- Transactions in the blockchain field can refer to task units that are executed and recorded in the blockchain. Transactions usually include sending fields (From), receiving fields (To) and data fields (Data). Among them, when the transaction is a transfer transaction, the From field represents the account address that initiated the transaction (that is, initiated a transfer task to another account), the To field represents the account address that received the transaction (that is, received the transfer), and the Data field Include transfer amount.
- the From field indicates the account address that initiated the transaction
- the To field indicates the account address of the contract called by the exchange
- the Data field includes the function name in the calling contract and the corresponding Data such as the incoming parameters of the function are used to obtain the code of the function from the blockchain and execute the code of the function when the transaction is executed.
- Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system. Smart contracts can be defined in the form of code. Calling a smart contract in the blockchain is to initiate a transaction pointing to the smart contract address, allowing each node in the blockchain to run the smart contract code in a distributed manner. It should be noted that in addition to smart contracts that can be created by users, smart contracts can also be set by the system in the genesis block. This type of contract is generally called a creation contract. Generally, some blockchain data structures, parameters, properties and methods can be set in the genesis contract. In addition, accounts with system administrator rights can create system-level contracts or modify system-level contracts (referred to as system contracts). Among them, the system contract can be used to add data structures for different business data in the blockchain.
- Bob sends a transaction containing information about creating a smart contract (i.e., deploying the contract) to the blockchain as shown in Figure 1.
- the data field of the transaction includes the code of the contract to be created (such as bytecode or machine code), the to field of the transaction is empty to indicate that the transaction is used to deploy the contract.
- the contract address "0x6f8ae93" of the contract is determined.
- Each node adds the contract account corresponding to the contract address of the smart contract in the state database, allocates the state storage corresponding to the contract account, and stores The contract code is saved in the state storage of the contract, so the contract is created successfully.
- each node in the blockchain can execute the transaction respectively, thereby executing the contract respectively, and update the status database based on the execution of the contract.
- blockchain nodes can implement a block-granular consensus mechanism. For example, after a node (such as a unique node) generates a block, if the generated block is recognized by other nodes, the records of other nodes will be the same. block.
- a transaction-granularity consensus mechanism can be implemented between blockchain nodes. For example, after a node (such as a unique node) obtains a blockchain transaction, if the blockchain transaction is recognized by other nodes, Each node that recognizes the blockchain transaction can add the blockchain transaction to the latest block maintained by itself, and ultimately ensure that each node generates the same latest block.
- the consensus mechanism is a mechanism for blockchain nodes to reach a consensus across the entire network on block information (or block data), which can ensure that the latest blocks are accurately added to the blockchain.
- the current mainstream consensus mechanisms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) ) algorithm, etc.
- PW Proof of Work
- POS Proof of Stake
- DPOS Delegated Proof of Stake
- PBFT Practical Byzantine Fault Tolerance
- the consensus success of the consensus proposal is usually determined after a preset number of nodes reach an agreement on the consensus data (ie, consensus proposal).
- f malicious nodes can be tolerated. That is to say, when 2f + 1 nodes among the N consensus nodes reach an agreement, the consensus can be determined to be successful.
- Figure 2 is a schematic diagram of the consensus process in the PBFT consensus algorithm.
- the complete consensus process can be divided into four stages: Request, Pre-Prepare, Prepare and Commit.
- a blockchain includes four consensus nodes, node n1 - node n4, where node n1 is, for example, the master node, and node n2 - node n4, for example, are slave nodes.
- the user of the blockchain can send a request to the node n1 through its user device, and the request is, for example, in the form of a blockchain transaction.
- Node n1 can receive multiple transactions from one or more user devices and store the received transactions in a transaction queue.
- node n1 can take out multiple transactions belonging to a block from the transaction queue, generate a consensus proposal for the multiple transactions, and broadcast the consensus proposal and node n1's signature on the consensus proposal to other consensus nodes ( That is, node n2 - node n4), so that the consensus node continues to consensus on the block.
- the consensus proposal may include, for example, the transaction body of the multiple transactions and the execution order of the multiple transactions and other information.
- node n1 receives the signatures of node n2 and node n3, it verifies that the signatures of node n2 and node n3 are correct signatures of the consensus proposal, then it is determined that the preparation phase is completed, and node n2 is After receiving the signature of node n3 and the signature of node n1 in the preparation phase and passing the verification, it is determined that the preparation phase is completed.
- each consensus node signs the consensus proposal in the submission phase and sends it to each other consensus node.
- each consensus node can confirm that the submission phase is completed and the consensus success. For example, after receiving and verifying the signatures of the submission phase of node n2 and node n3, node n1 determines that the submission phase is completed. Therefore, node n1 can update the world state based on the execution results obtained by executing the multiple transactions, generate and store the Blocks of multiple transactions (such as block B1), and return the execution results of multiple transactions to the user device. Similarly, after determining that the submission phase is completed, node n2 and node n3 execute the multiple transactions, generate and store block B1, and update the world state based on the execution results of the multiple transactions.
- nodes n1-node n4 can still achieve successful consensus on the consensus proposal and complete the execution of the block even if there is a malicious node.
- the blockchain node can execute transactions in parallel through multiple processes in a single machine.
- the blockchain node can be deployed in a server cluster and execute transactions in parallel through multiple servers.
- the blockchain node first divides multiple transactions into multiple transaction groups according to the accounts accessed by the transactions. Each transaction group does not access the same account, so that each transaction group can be executed in parallel.
- a smart contract is called in a transaction, the variables accessed in the transaction cannot be predicted before the transaction is executed, so multiple transactions cannot be effectively grouped, and transactions cannot be executed in parallel.
- multiple transactions can be pre-executed by the master node to obtain respective pre-execution read and write sets of the multiple transactions, and based on the pre-execution read and write sets Write sets divide multiple transactions into multiple groups so that each slave node can execute multiple transactions in parallel according to multiple groups.
- FIG 3 shows a structural diagram of the master node 1 and slave nodes (for example, slave node 2) of the blockchain provided by the embodiment of this specification.
- the master node 1 includes a pre-execution module 11, a conflict detection module 12 and a consensus module 13, and the slave node 2 includes a consensus module 22 and a calculation module 23.
- Masternode 1 can for example be connected to a client so that multiple transactions can be received from the client.
- the pre-execution module 11 pre-executes the transaction and obtains the pre-execution read and write set of the transaction.
- the pre-execution read and write set includes a pre-execution read set and a pre-execution write set.
- the pre-execution read set can specifically be the key-value pairs of read variables generated during the pre-execution transaction.
- the pre-execution write set can specifically be Key-value pairs of written variables generated during the pre-execution transaction.
- the master node 1 can maintain a pre-execution status set, and the pre-execution module 11 can read the status values of variables from the pre-execution status set or the status database when pre-executing a transaction. After pre-executing the transaction, the pre-execution module 11 can update the pre-execution status set according to the pre-execution read and write set of the transaction.
- the pre-execution module 11 may include multiple pre-execution sub-modules, such as the pre-execution sub-module 111 and the pre-execution sub-module 112. These two pre-execution sub-modules can pre-execute transactions in parallel.
- the conflict detection module 12 includes a pre-execution status set and a pre-execution transaction set, wherein the master node 1 stores the pre-execution status set and the pre-execution transaction set in the memory for use by the conflict detection module 12 .
- the conflict detection module 12 performs pre-execution conflict detection on each transaction serially.
- the conflict detection module 12 detects whether there is a conflict between the pre-execution read set of the transaction and the write set of the transaction that has been pre-executed. If the value of a certain variable in the pre-execution read set of the transaction is inconsistent with the variable in the pre-execution status set If the values are different, it can be determined that there is a conflict. If it is determined that there is no conflict, the conflict detection module 12 updates the status in the pre-execution write set of the transaction to the pre-execution status set, and arranges the transaction sequence into the pre-execution transaction set.
- the consensus module 13 obtains multiple previously recorded sequential transactions from the pre-execution transaction set.
- the consensus module 13 can group the multiple transactions according to their respective pre-execution read and write sets to obtain multiple transaction groups. , there are no conflicting transactions between each transaction group.
- the situation where there are conflicting transactions between two transaction groups usually includes the following situations: the transaction in the first transaction group reads the first variable (that is, the first transaction group reads the first variable), and the second transaction group writes The first variable; the first trading group writes the first variable, the second trading group writes the first variable; the first trading group reads the first variable and writes the first variable, and the second trading group writes the first variable; The first transaction group reads the first variable and writes the first variable, and the second transaction group reads the first variable and writes the first variable. Among them, if two transaction groups read the same variables, it can be considered that there is no conflicting transaction. Generally, in order to simplify the solution, the consensus module 13 can group multiple transactions according to the requirement that the same variables are not accessed between each transaction group
- the master node 1 initiates a consensus proposal to the consensus module (for example, the consensus module 22) of each slave node, where the consensus proposal includes the multiple transactions and the arrangement of the multiple transactions in the pre-execution transaction set. The order, the grouped results of the multiple transactions, and the pre-execution read and write set of each transaction. It can be understood that the master node can also broadcast the multiple transactions to the slave nodes, so that the multiple transactions may not be included in the consensus proposal.
- the consensus module for example, the consensus module 22
- the computing module 23 in the slave node can execute the multiple transactions in parallel according to groups.
- the computing module 23 of the slave node 2 includes multiple execution sub-modules (the figure schematically shows the execution sub-module 232, the execution sub-module 233 and the execution sub-module 234).
- each execution sub-module can verify the correctness of the grouping based on the obtained execution read-write set of the transaction and the pre-execution read-write set of each transaction, thereby verifying whether the master node is doing evil.
- the contracts called by these transactions may rely on data generated through consensus during the execution process.
- the data generated through consensus may not necessarily be the first through the current execution.
- Consensus generation of a block for example, the consensus may be a consensus on a block before the first block (eg, a previous block).
- the data generated through consensus include, for example, the execution time of the current block, the hash of the latest block, the height of the current block, random numbers generated through consensus, etc., when the time gap between pre-execution and actual execution is large. , these data are uncertain during pre-execution, that is to say, the data cannot be obtained during pre-execution, so these transactions cannot be executed correctly during pre-execution.
- contracts that rely on data generated through consensus during execution are set as preset types of contracts.
- these contract accounts can be recorded into the preset type contract list in the blockchain when the contract is deployed. , to indicate that the contract is a default type of contract.
- the embodiment of this specification provides a transaction execution solution.
- the master node determines that the transaction calls a preset type of contract when pre-executing a transaction, it terminates the pre-execution of the transaction, that is, it will not update based on the pre-execution result of the transaction.
- Pre-execution status and record relevant information indicating that the transaction includes a call to a preset type contract to be sent to the slave node.
- the masternode can determine how to execute the transaction based on the relevant information about the transaction. Specifically, if the transaction does not involve accounts other than the preset type of contract, the transaction will be executed.
- the transaction involves accounts other than the preset type of contract, the transaction will not be carried out or will not be completed.
- the transaction is executed to ensure the consistency of the status of the accounts in the pre-execution state set except for the preset type of contracts and the status of the accounts in the state database except for the preset type of contracts.
- the slave node can similarly determine how to execute the transaction after verifying the relevant information. In this way, when pre-executing and executing transactions, the preset type of contract is isolated from other accounts, so that transactions involving other accounts can still be executed in parallel, thereby improving transaction execution efficiency.
- step S401 the master node 1 pre-executes a transaction and determines whether the transaction includes a call to a preset type of contract.
- Master node 1 can pre-execute the transaction immediately after receiving a transaction.
- the preset type of contract when a contract developer deploys the above-mentioned preset type of contract to the blockchain, the preset type of contract can be deployed by calling the system contract in the transaction, and the blockchain node executes the preset type of contract.
- the account of the newly deployed contract can be recorded in the default type contract list in the contract status of the system contract. Therefore, when pre-executing or executing a transaction, the blockchain node can determine whether the contract called in the transaction is a preset type contract based on the default type contract list in the contract status of the system contract.
- a preset type interface list is preset in the contract state of the system contract in the blockchain, and the execution of the preset type interface relies on data generated by consensus. Therefore, when pre-executing or executing a transaction, the blockchain node can determine whether the interface in the contract called by the transaction is a preset type interface based on the preset type interface list in the contract status of the system contract, thereby determining the transaction call Whether the contract is a default type of contract.
- the pre-execution sub-module 111 or 112 in master node 1 first determines whether the transaction Tx1 calls a preset type of contract, that is, determines the contract account in the To field of the transaction Tx1 Whether the corresponding contract C1 is a default type of contract.
- a preset type contract list is stored in the blockchain as mentioned above
- the pre-execution sub-module can read the preset type contract list and determine whether the contract C1 called by the transaction Tx1 is in the preset type contract list. , in the case where it is determined that the contract C1 called by the transaction Tx1 is in the default type contract list, it is determined that the transaction Tx1 includes a call to the default type contract.
- the pre-execution sub-module executes the interface called in the contract C1, it can determine whether the interface is pre-set based on the preset type interface list. Set the type interface to determine whether contract C1 is a default type contract.
- the master node 1 can execute step S403, terminate the pre-execution of the transaction Tx1, and discard the generated pre-execution read-write set of the transaction Tx1, that is, not based on the transaction Tx1.
- the pre-execution read-write set updates the pre-execution status set in Figure 3 and generates relevant information of transaction Tx1, which is used to indicate that transaction Tx1 includes a call to a preset type of contract.
- the master node 1 can record the identification of the transaction Tx1 in a separate transaction group, such as the group G1, as the relevant information of the transaction Tx1.
- the group G1 is used to store the information including the preset type.
- first-type transactions transactions that include invocations of contracts of a preset type
- second-type transactions transactions that do not include invocations of contracts of a preset type
- first type of transaction and the second type of transaction are processed separately, and the variable status involved in the preset type of contract is not maintained in the pre-execution state set, thereby eliminating the need for pre-execution of the first type of transaction.
- the resulting inconsistency between pre-execution status and execution status are processed separately, and the variable status involved in the preset type of contract is not maintained in the pre-execution state set, thereby eliminating the need for pre-execution of the first type of transaction.
- the resulting inconsistency between pre-execution status and execution status are examples of the variable status involved in the preset type of contract.
- the pre-execution sub-module 111 or 112 in the master node 1 pre-executes the transaction Tx2, if it is determined that the contract C2 called by the transaction Tx2 is not a preset type of contract, the pre-execution sub-module will be executed during the process of pre-executing the transaction Tx2.
- contract C2 calls contract C3
- master node 1 also determines whether contract C3 is a preset type contract. If it is determined that contract C3 is a preset type contract, it is determined that transaction Tx2 includes a call to the preset type contract, that is, it is determined Transaction Tx2 includes cross-contract calls to preset type contracts. Therefore, transaction Tx2 is the first type of transaction.
- the master node 1 can execute step S403, terminate the pre-execution of the transaction Tx2, and discard the generated pre-execution read-write set of the transaction Tx2, that is, not based on the transaction Tx2.
- the pre-execution read-write set updates the pre-execution status set in Figure 3 and generates relevant information of transaction Tx2. This relevant information is used to indicate that transaction Tx2 includes a call to a preset type of contract.
- the master node 1 can record the identification of the above-mentioned transaction Tx1 in the group G2, which is used to record transactions that directly call a preset type of contract, and record the identification of the transaction Tx2 in the group G3.
- this group G3 is used to record transactions that call preset type contracts across contracts.
- the pre-execution sub-module 111 or 112 in the master node 1 pre-executes the transaction Tx3 and determines that the transaction Tx3 does not include a call to a preset type of contract according to the above process, it can determine that the transaction Tx3 is a second type of transaction, so that it can Step S405 is executed to complete the pre-execution of transaction Tx3 and generate the pre-execution read and write set of transaction Tx3.
- the master node 1 can record the identification of the transaction Tx3 into the group G4, and store the pre-execution read and write set of the transaction Tx3 accordingly.
- the group G4 is used to record transactions that do not include calls to contracts of preset types.
- the master node 1 may serially pre-execute multiple received transactions.
- master node 1 when master node 1 is pre-executing a transaction, when the value of any variable is read from the pre-execution state set or the state database in Figure 3, the key of the read variable is recorded in the read cache of the transaction set in the memory. Value pairs, when writing the value of any variable, record the key-value pair of the written variable in the write cache of the transaction, and after the pre-execution is completed, the transaction can be obtained based on the read cache and write cache of the transaction pre-execution read-write set.
- master node 1 when master node 1 reads a variable (such as variable A) during the pre-execution of transaction Tx3, master node 1 first determines whether the value of variable A is stored in the write cache of transaction Tx3. If the value of variable A is stored, value, the value of variable A can be read directly from the write cache. In the case where it is determined that the value of variable A is not stored in the write cache, it is determined whether the value of variable A is stored in the read cache of the transaction. If the value of variable A is stored, the value of variable A can be read from the read cache. . When it is determined that the value of variable A is not stored in the read cache, it is determined whether the value of variable A is stored in the pre-execution state set.
- a variable such as variable A
- the value of variable A can be read from the pre-execution state set. .
- the value of variable A may be read from the state database. That is to say, during the process of pre-execution of the transaction, the priority of the master node 1 to read the variables is: transaction write cache > transaction read cache > pre-execution status set > status database. This can ensure that the reads during the pre-execution process are The value of the variable taken is the latest value of the variable.
- the master node 1 After pre-executing each transaction as described above, the master node 1 obtains the pre-execution read and write set of each second type transaction and the relevant information of each first type transaction.
- the pre-execution read and write set includes a read set and a write set, wherein the read set includes key-value pairs (key-values) of variables read when pre-executing the transaction, and the pre-execution write set includes a pre-execution write set. A key-value pair for the variable written when this transaction is executed.
- the read set of the pre-execution read and write set may include the version number of the variable read when the transaction is pre-executed, and the write set may include the version number of the variable written.
- the blockchain node may write to different variables based on the values of the variables read during the execution of the contract called by the transaction. For example, when the value of the read variable is 1, write 10 to variable a, when the value of the read variable is 2, write 20 to variable b, and so on. Therefore, for a transaction that calls a contract, the blockchain node must execute the transaction to determine the variables read and written by the transaction, thereby obtaining the read and write set of the transaction. To this end, the master node 1 obtains the pre-execution read and write set of each transaction by pre-executing each of the multiple transactions. The pre-execution process is basically the same as the process of executing the transaction.
- the difference is that the pre-execution of the pair of transactions is Execution is the execution process that takes place before consensus, and the execution of transactions is the execution process that takes place after consensus. And the pre-execution result of the pre-execution transaction is only used to update the pre-execution state set, not to update the world state, while the execution result of the execution transaction is used to update the world state.
- the master node 1 can pre-execute multiple transactions received at the same time in parallel through multiple pre-execution sub-modules.
- the master node 1 performs pre-execution conflict detection on each transaction serially after pre-executing each transaction.
- master node 1 when master node 1 performs pre-execution conflict detection on transaction Tx3, it first determines whether the pre-execution status set includes variables (for example, variable A) in the pre-execution read set of transaction Tx3. If not, it is similarly determined whether other variables in the pre-execution read set of transaction Tx3 are included in the pre-execution state set.
- variables for example, variable A
- the pre-execution status set does not include all variables in the pre-execution read set of transaction Tx3, that is, the previous transaction that has been pre-execution conflict detected has not read or written the variables accessed by this transaction, then the pre-execution of transaction Tx3 can be determined There is no conflict between the read set and the pre-execution status set, that is, it is determined that the pre-execution of the transaction Tx3 does not conflict with the previous transactions that have undergone pre-execution conflict detection.
- master node 1 determines whether the value of variable A in the pre-execution read set is consistent with the value of variable A in the pre-execution status set. If they are consistent, it means that the variable read by transaction Tx3 The value of A is the latest status of variable A during pre-execution.
- master node 1 determines that the value read for each variable in the pre-execution read set of transaction Tx3 is the latest state in the pre-execution process, it can be determined that there is no conflict between the pre-execution read set and the pre-execution status set of transaction Tx3.
- master node 1 determines that the value of variable A in the pre-execution read set of transaction Tx3 is inconsistent with the value of variable A in the pre-execution state set, it means that the value of variable A read by transaction Tx3 is not the latest state in the pre-execution process, so , it can be determined that there is a conflict between the pre-execution read set and the pre-execution status set of transaction Tx3. In the case where it is determined that a conflict exists, the master node 1 can re-pre-execute the transaction Tx3.
- the master node 1 determines that there is no conflict between the pre-execution read set and the pre-execution status set of transaction Tx3, it updates the pre-execution status set and the pre-execution transaction set based on the pre-execution read and write set of transaction Tx3.
- master node 1 updates the values of variables read or written in the pre-execution read-write set of transaction Tx3 to the pre-execution state set, so that the pre-execution state set records the latest values of each variable during the pre-execution process. state.
- the master node 1 sequentially records the transaction Tx3 into the pre-execution transaction set, for example, records the transaction at the end position (ie, the last position) of the pre-execution transaction set. That is to say, the order of the transactions recorded in the pre-execution transaction set reflects the order of conflict detection of each transaction, and there is no conflict between each recorded transaction and the previously recorded transaction.
- the pre-execution transaction set is, for example, in the form of a sequence table or a queue.
- step S407 master node 1 generates a consensus proposal.
- the consensus proposal may include information related to multiple first-type transactions, the arrangement order of the multiple first-type transactions, pre-execution read-write sets of multiple second-type transactions, the Pre-execution sequence for multiple Type 2 transactions.
- the relevant information of the plurality of first type transactions is, for example, group G1, or may be group G2 and group G3.
- the arrangement order of the plurality of first-type transactions may, for example, be determined based on the reception order of each first-type transaction, for subsequent serial execution of at least part of the plurality of first-type transactions in accordance with the arrangement order. .
- the consensus proposal may also include transaction bodies of the plurality of first type transactions and the plurality of second type transactions. It can be understood that the master node 1 can also broadcast the transaction bodies of the plurality of first type transactions and the plurality of second type transactions to each slave node in the form of broadcast, so that these may not be included in the consensus proposal.
- the transaction body of the transaction may also include transaction bodies of the plurality of first type transactions and the plurality of second type transactions.
- the master node 1 can use the consensus module 13 to perform multiple transactions based on the read variable key (key) and the written variable key included in the pre-execution read and write set of each second type transaction.
- the second type of transactions is grouped. As mentioned above, this grouping can prevent transactions in different transaction groups from accessing the same variables. This access includes read operations and write operations. When the grouping conditions are met, there will be no conflicting transactions between various transaction groups. Therefore, individual trading groups can be executed in parallel.
- the consensus proposal may include relevant information of multiple first-type transactions, the arrangement order of the multiple first-type transactions, pre-execution read-write sets of multiple second-type transactions, the multiple The pre-execution sequence of the second type transactions, and the grouping results of multiple second type transactions.
- step S409 master node 1 sends the consensus proposal to at least some slave nodes (including slave node 2) to achieve consensus on the consensus proposal in the blockchain.
- slave node 2 For this consensus process, please refer to the description of Figure 2 above, and will not be described again here.
- step S411 the master node 1 executes the first type of transaction based on the relevant information of the first type of transaction.
- the master node 1 pre-executes the second type transaction based on the pre-execution state set, so that the state read by the second type transaction is the correct world state.
- the master node 1. Trust its own pre-execution results. Therefore, the pre-execution read-write set of the second type of transaction can be directly used as the execution read-write set of the second type of transaction. That is, there is no need to execute the second type of transaction and can be directly based on the second type of transaction.
- the transaction's pre-execution read-write set updates the state in the state database.
- the master node 1 For the first type of transaction, since the master node 1 has not completed the pre-execution of the first type of transaction, it needs to execute the first type of transaction based on the relevant information of the first type of transaction.
- the master node 1 when executing a transaction, obtains the identification of each first type transaction recorded in the group G1.
- the master node 1 can serially execute multiple first-type transactions in the group G1 in accordance with the order in the consensus proposal.
- a type of transaction, the group G1 includes, for example, the above-mentioned transaction Tx1 and transaction Tx2.
- master node 1 when executing transaction Tx1, master node 1 first determines whether transaction Tx1 calls a preset type contract. After determining that transaction Tx1 calls a preset type contract, it determines whether transaction Tx1 also involves non-default type accounts.
- the preset type of accounts may include external accounts and contract accounts in addition to the preset type of contract list.
- the master node 1 can continue to execute the transaction Tx1. Specifically, during the execution of contract C1 called by transaction Tx1, master node 1 obtains the data generated through consensus and executes contract C1 based on the data. The consensus can be on the first block that is currently unexecuted.
- the master node After completing the execution of transaction Tx1, the master node obtains the execution read-write set of transaction Tx1, and can update the world state in the state database based on the execution read-write set of transaction Tx1. In this case, since transaction Tx1 only involves preset type contracts and not non-default type contracts, the execution of transaction Tx1 will not affect the world state of the variables in the pre-execution state set, and will not cause pre- The execution status is inconsistent with the execution status.
- group G1 also includes transaction Tx4.
- master node 1 determines that transaction Tx4 calls the default type of contract C4, and when executing contract C4, determines that contract C4 involves a non-default type of account, such as a contract C4 includes updates to the status of external accounts, or contract C4 calls a non-default type of contract, then master node 1 terminates the execution of transaction Tx4.
- contract Tx4 involves both a default type of contract and a non-default type of account
- contract Tx4 if contract Tx4 is executed, it will affect the world state of the variables in the pre-execution state set (i.e., non-default type of account) , will cause inconsistency between the pre-execution state and the execution state. Therefore, the execution of transaction Tx4 is terminated to avoid such a situation.
- transaction Tx2 in group G1 when master node 1 executes transaction Tx2 and determines that transaction Tx2 does not call a contract of the preset type, it can directly determine that the contract called by transaction Tx2 must have called a contract of a non-preset type (i.e. Cross-contract call), that is, the transaction Tx2 involves both a preset type of contract and a non-default type of account. Refer to the statement above for the transaction Tx4, so the execution of the transaction Tx2 can be terminated.
- a non-preset type i.e. Cross-contract call
- the master node 1 when executing a transaction, obtains the identification of each first-type transaction recorded in the group G2 and the group G3. For each transaction in group G2, master node 1 can refer to the execution of the above-mentioned transaction Tx1 and transaction Tx4. For each transaction in group G3, since each transaction in group G3 involves a preset type of contract , also involves non-default type contracts, so master node 1 may not execute all transactions in group G3.
- step S413 after the consensus is completed, slave node 2 executes multiple second type transactions in parallel.
- the consensus proposal includes multiple pre-execution read and write sets of the second type of transactions
- the slave node 2 can perform multiple pre-execution read and write sets of the second type of transactions based on the multiple pre-execution read and write sets of the second type of transactions.
- the second type transactions are grouped so that the plurality of second type transactions can be executed in parallel based on the grouping results.
- slave node 2 serially executes multiple transactions in the transaction group in accordance with the pre-execution order of the multiple transactions in the transaction group.
- the consensus proposal also includes grouping results of multiple second-type transactions, so that slave node 2 can directly execute multiple second-type transactions in parallel based on the grouping results.
- slave node 2 After executing each second type transaction, slave node 2 obtains the execution read-write set of the transaction.
- the execution read-write set includes the execution read set and the execution write set, where the execution read set is read during the execution of the transaction.
- the execution write set is the status value of the variable written during the execution of the transaction.
- Slave node 2 can also compare whether the pre-execution read-write set and the execution read-write set of the transaction are consistent. If they are inconsistent, it can be determined that the master node is evil.
- the slave node 2 After the slave node 2 completes the execution of a group of transactions, it generates the group's execution read-write set based on the execution read-write set of each transaction in the group.
- the consensus proposal may also include the group's pre-execution read-write set. , thus, the slave node 2 can determine whether the master node is evil by comparing the pre-execution read-write set and the execution read-write set of the group.
- step S415 slave node 2 executes the first type of transaction and determines whether the first type of transaction calls a preset type contract.
- Slave node 2 can execute the first type of transaction in parallel while executing the second type of transaction.
- the slave node 2 may serially execute multiple first-type transactions according to the order in which the multiple first-type transactions are arranged in the consensus proposal.
- the consensus proposal includes group G1, and group G1 includes transaction Tx1, transaction Tx2, and transaction Tx4. Similar to the master node executing the first type of transaction above, when the slave node 2 executes the transaction Tx1, it determines that the transaction Tx1 calls the default type of contract C1. Therefore, the slave node 2 executes step S421 to determine whether the transaction Tx1 involves non-preset type of account. After determining that the transaction Tx1 does not involve an account of a non-default type, the slave node 2 executes step S425 to complete the execution of the transaction Tx1.
- step S417 determines whether the transaction Tx2 calls the default type across contracts. contract. Slave node 2 calls contract C3 during the execution of contract C2 and determines that contract C3 is a preset type of contract, so slave node 2 executes step S419 to terminate the execution of transaction Tx2. If slave node 2 determines in step S417 that transaction Tx2 does not call a preset type of contract across contracts, it means that transaction Tx2 does not include a call to a preset type of contract. Therefore, contract Tx2 should be a second type of transaction, not the first. Type transaction, master node 1 provides wrong transaction type information, therefore, slave node 2 can determine that the master node is evil.
- step S421 determines whether the transaction Tx4 involves an account other than the default type. After determining that the transaction Tx4 involves a non-preset type of account, the slave node 2 executes step S423 to terminate the execution of the transaction Tx4.
- the consensus proposal includes group G2 and group G3.
- Group G2 includes, for example, transactions Tx1 and transaction Tx4, and group G3 includes, for example, transaction Tx2.
- Slave node 2 can execute transactions in group G2 and group G3 in parallel.
- slave node 2 executes each transaction in group G2, it first executes step S415, then executes step S421, and then executes step S423 or step S425 to verify whether group G2 in the consensus proposal is correct.
- slave node 2 When executing each transaction in group G3, slave node 2 first performs step S415 and then performs step S417 to verify whether group G3 in the consensus proposal is correct.
- Figure 5 is an architectural diagram of a master node in a blockchain in an embodiment of this specification, including:
- the pre-execution unit 51 is configured to terminate the pre-execution of the first transaction when it is determined that the first transaction includes a call to a first contract of a preset type after starting the pre-execution of the first transaction, wherein, The execution of the above-mentioned preset types of contracts relies on the data generated by consensus;
- Consensus unit 52 configured to generate a consensus proposal for the first block, the consensus proposal including the first information of the first transaction, the first information being used to indicate that the first transaction includes a pair of preset types. Invoke the contract; send the consensus proposal to at least some slave nodes of the blockchain, and conduct consensus on the consensus proposal with the at least some slave nodes.
- FIG. 6 is an architectural diagram of a slave node in a blockchain in an embodiment of this specification.
- the blockchain stores an account list of a preset type of contract.
- the execution of the preset type of contract depends on Data generated by consensus, the slave nodes include:
- Consensus unit 61 configured to receive a consensus proposal of the first block from the master node of the blockchain, where the consensus proposal includes first information of the first transaction, where the first information is used to indicate the first
- the transaction includes a call to a first contract of a preset type; consensus on the consensus proposal with the master node and at least some other slave nodes;
- Execution unit 62 is configured to, after consensus is reached, when executing the first transaction, determine that the first transaction includes a call to a preset type of contract, and the first transaction does not involve anything other than the list including The execution of the first transaction is completed when the account is outside the account.
- PLD Programmable Logic Device
- FPGA Field Programmable Gate Array
- HDL Hardware Description Language
- the controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers.
- controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
- the controller in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
- the systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
- a typical implementation device is a server system.
- the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, or a personal digital assistant. , media player, navigation device, email device, game console, tablet, wearable device, or a combination of any of these devices.
- the functions are divided into various modules and described separately.
- the functions of each module can be implemented in the same or multiple software and/or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. .
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
- 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)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
Claims (17)
- 一种在区块链系统中执行交易的方法,所述区块链系统包括主节点和多个从节点,所述方法由所述主节点执行,包括:在开始预执行第一交易之后,在确定所述第一交易包括对预设类型的第一合约的调用时,终止对所述第一交易的预执行,记录第一信息,所述第一信息用于指示所述第一交易中包括对预设类型的合约的调用,其中,所述预设类型的合约的执行依赖于共识生成的数据;生成第一区块的共识提议,所述共识提议中包括所述第一信息;将所述共识提议发送给至少部分从节点,与所述至少部分从节点进行对所述共识提议的共识。
- 根据权利要求1所述的方法,所述确定所述第一交易包括对预设类型的合约的调用包括:确定所述第一交易调用所述预设类型的第一合约,所述第一信息用于指示所述第一交易调用所述预设类型的合约。
- 根据权利要求2所述的方法,所述区块链系统中存储有预设类型的合约的账户列表,所述方法还包括:在共识达成之后,在执行所述第一交易时,在确定所述第一交易不涉及除所述列表包括的账户之外的账户时,完成对所述第一交易的执行。
- 根据权利要求3所述的方法,所述方法还包括:在执行所述第一交易时,在确定所述第一交易涉及除所述列表包括的账户之外的账户时,终止对所述第一交易的执行。
- 根据权利要求1所述的方法,所述确定所述第一交易包括对预设类型的第一合约的调用包括:在确定所述第一交易调用第二合约之后预执行所述第一交易,在预执行所述第二合约的过程中确定所述第二合约调用所述第一合约,所述第一信息用于指示所述第一交易涉及非预设类型的合约和所述预设类型的合约,其中所述第一合约为非预设类型的合约,所述方法还包括:在执行所述第一区块时,根据所述第一信息不进行对所述第一交易的执行。
- 根据权利要求1所述的方法,还包括,在开始预执行第二交易之后,在确定所述第二交易不包括对预设类型的合约的调用时,完成对所述第二交易的预执行,得到所述第二交易的预执行读写集,记录所述第二交易的预执行顺序,所述共识提议中还包括多个所述第二交易的预执行读写集和预执行顺序。
- 根据权利要求6所述的方法,完成对所述第二交易的预执行包括:基于预执行状态集预执行所述第二交易,所述方法还包括:在预执行完第二交易之后,对所述第二交易进行如下处理:确定所述第二交易的预执行读集是否与所述预执行状态集存在冲突,其中,在确定不存在冲突的情况中,基于所述第二交易的预执行读写集更新所述预执行状态集,将所述第二交易顺序记录到预执行交易集合中,作为所述第二交易的预执行顺序。
- 根据权利要求7所述的方法,其中,所述确定所述第二交易的预执行读集是否与所述预执行状态集存在冲突包括,确定所述预执行状态集中是否包括所述第二交易的预执行读集中的变量,在确定所述预执行状态集中包括所述变量的情况中,确定所述预执行状态集中的所述变量的值与所述预执行读集中的所述变量的值是否一致,如果不一致,则确定所述第二交易的预执行读集与所述预执行状态集存在冲突。
- 根据权利要求1所述的方法,其中,所述确定所述第一交易包括对预设类型的第一合约的调用包括,在预执行所述第一交易的过程中确定所述第一合约中调用预设接口,所述预设接口的执行依赖于共识生成的数据。
- 一种在区块链系统中执行交易的方法,所述区块链系统包括主节点和从节点,所述区块链系统中存储有预设类型的合约的账户列表,所述预设类型的合约的执行依赖于共识生成的数据,所述方法由所述从节点执行,包括:从所述主节点接收第一区块的共识提议,所述共识提议中包括第一交易的第一信息,所述第一信息用于指示所述第一交易中包括对预设类型的第一合约的调用;与所述主节点和其他至少部分从节点进行对所述共识提议的共识;在共识达成之后,在执行所述第一交易时,在确定所述第一交易包括对预设类型的合约的调用、且所述第一交易不涉及除所述列表包括的账户之外的账户时,完成对所述第一交易的执行。
- 根据权利要求10所述的方法,还包括:在执行所述第一交易时,在确定所述第一交易涉及除所述列表包括的账户之外的账户时,终止对所述第一交易的执行。
- 根据权利要求11所述的方法,所述第一信息用于指示:所述第一交易中包括对预设类型的第一合约的调用,且所述第一交易涉及除所述列表包括的账户之外的账户,所述方法还包括:在确定所述第一信息正确时,终止对所述第一交易的执行。
- 根据权利要求10或11所述的方法,所述共识提议中还包括多个第二交易的预执行读写集,所述方法还包括:根据所述多个第二交易的预执行读写集对所述多个第二交易分组,根据所述分组结果并行执行所述多个第二交易。
- 一种区块链系统中的主节点,包括:预执行单元,用于在开始预执行第一交易之后,在确定所述第一交易包括对预设类型的第一合约的调用时,终止对所述第一交易的预执行,其中,所述预设类型的合约的执行依赖于共识生成的数据;共识单元,用于生成第一区块的共识提议,所述共识提议中包括所述第一交易的第一信息,所述第一信息用于指示所述第一交易中包括对预设类型的合约的调用;将所述共识提议发送给所述区块链系统的至少部分从节点,与所述至少部分从节点进行对所述共识提议的共识。
- 一种区块链系统中的从节点,所述区块链系统中存储有预设类型的合约的账户列表,所述预设类型的合约的执行依赖于共识生成的数据,所述从节点包括:共识单元,用于从所述区块链系统的主节点接收第一区块的共识提议,所述共识提议中包括第一交易的第一信息,所述第一信息用于指示所述第一交易中包括对预设类型的第一合约的调用;与所述主节点和其他至少部分从节点进行对所述共识提议的共识;执行单元,用于在共识达成之后,在执行所述第一交易时,在确定所述第一交易包括对预设类型的合约的调用、且所述第一交易不涉及除所述列表包括的账户之外的账户时,完成对所述第一交易的执行。
- 一种区块链系统,包括主节点和多个从节点,所述区块链系统中存储有预设类型的合约的账户列表,所述预设类型的合约的执行依赖于共识生成的数据,所述主节点用于在开始预执行第一交易之后,在根据所述列表确定所述第一交易包括对所述预设类型的第一合约的调用时,终止对所述第一交易的预执行;生成第一区块的共识提议,所述共识提议中包括所述第一交易的第一信息,所述第一信息用于指示所述第一交易中包括对预设类型的合约的调用;将所述共识提议发送给至少部分从节点,与所述至少部分从节点进行对所述共识提议的共识;所述从节点用于从所述主节点接收所述共识提议,与所述主节点和其他至少部分从节点进行对所述共识提议的共识;在共识达成之后,在执行所述第一交易时,在根据所述列表确定所述第一交易包括对预设类型的合约的调用、且所述第一交易不涉及除所述列表包括的账户之外的账户时,完成对所述第一交易的执行。
- 一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行权利要求1-13中任一项的所述的方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210753256.4 | 2022-06-29 | ||
| CN202210753256.4A CN115150409B (zh) | 2022-06-29 | 2022-06-29 | 在区块链系统中执行交易的方法、区块链系统、节点及计算机可读存储介质 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2024001032A1 true WO2024001032A1 (zh) | 2024-01-04 |
Family
ID=83410900
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/135476 Ceased WO2024001032A1 (zh) | 2022-06-29 | 2022-11-30 | 在区块链系统中执行交易的方法、区块链系统和节点 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN115150409B (zh) |
| WO (1) | WO2024001032A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114022275A (zh) * | 2021-10-18 | 2022-02-08 | 润联软件系统(深圳)有限公司 | 基于区块链的区块链转账交易方法及相关设备 |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115150409B (zh) * | 2022-06-29 | 2024-07-12 | 蚂蚁区块链科技(上海)有限公司 | 在区块链系统中执行交易的方法、区块链系统、节点及计算机可读存储介质 |
| CN115766038A (zh) * | 2022-11-30 | 2023-03-07 | 蚂蚁区块链科技(上海)有限公司 | 区块链中的交易发送方法和区块链节点 |
| CN116668001B (zh) * | 2023-05-31 | 2026-04-17 | 蚂蚁区块链科技(上海)有限公司 | 区块链中的交易处理方法和区块链节点 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190334726A1 (en) * | 2018-04-30 | 2019-10-31 | Dell Products L.P. | Blockchain-based method and system for immutable resource allocation in a cloud computing environment |
| CN112734586A (zh) * | 2021-01-27 | 2021-04-30 | 国网信息通信产业集团有限公司 | 基于区块链的数据处理方法及系统 |
| CN113743941A (zh) * | 2021-11-04 | 2021-12-03 | 支付宝(杭州)信息技术有限公司 | 一种在区块链中执行交易的方法、区块链和主节点 |
| CN114547203A (zh) * | 2022-02-25 | 2022-05-27 | 蚂蚁区块链科技(上海)有限公司 | 执行交易的方法、区块链、主节点和从节点 |
| CN115150409A (zh) * | 2022-06-29 | 2022-10-04 | 蚂蚁区块链科技(上海)有限公司 | 在区块链系统中执行交易的方法、区块链系统和节点 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11070360B2 (en) * | 2018-08-13 | 2021-07-20 | International Business Machines Corporation | Parallel transaction validation and block generation in a blockchain |
| JP7394211B2 (ja) * | 2019-08-19 | 2023-12-07 | 杭州趣鏈科技有限公司 | スマートコントラクトの並行実行の方法、装置、機器、及び媒体 |
| CN110659907B (zh) * | 2019-09-24 | 2021-11-12 | 北京海益同展信息科技有限公司 | 用于执行智能合约的方法和装置 |
| CN111240831A (zh) * | 2019-12-31 | 2020-06-05 | 陕西医链区块链集团有限公司 | 区块链中交易并行执行方法、装置、电子设备、存储介质 |
| CN112527800B (zh) * | 2020-12-18 | 2022-07-22 | 山大地纬软件股份有限公司 | 树形链式账本结构、高性能并行共识方法及系统 |
-
2022
- 2022-06-29 CN CN202210753256.4A patent/CN115150409B/zh active Active
- 2022-11-30 WO PCT/CN2022/135476 patent/WO2024001032A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190334726A1 (en) * | 2018-04-30 | 2019-10-31 | Dell Products L.P. | Blockchain-based method and system for immutable resource allocation in a cloud computing environment |
| CN112734586A (zh) * | 2021-01-27 | 2021-04-30 | 国网信息通信产业集团有限公司 | 基于区块链的数据处理方法及系统 |
| CN113743941A (zh) * | 2021-11-04 | 2021-12-03 | 支付宝(杭州)信息技术有限公司 | 一种在区块链中执行交易的方法、区块链和主节点 |
| CN114547203A (zh) * | 2022-02-25 | 2022-05-27 | 蚂蚁区块链科技(上海)有限公司 | 执行交易的方法、区块链、主节点和从节点 |
| CN115150409A (zh) * | 2022-06-29 | 2022-10-04 | 蚂蚁区块链科技(上海)有限公司 | 在区块链系统中执行交易的方法、区块链系统和节点 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114022275A (zh) * | 2021-10-18 | 2022-02-08 | 润联软件系统(深圳)有限公司 | 基于区块链的区块链转账交易方法及相关设备 |
| CN114022275B (zh) * | 2021-10-18 | 2025-10-21 | 润联软件系统(深圳)有限公司 | 基于区块链的区块链转账交易方法及相关设备 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115150409A (zh) | 2022-10-04 |
| CN115150409B (zh) | 2024-07-12 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2023231336A1 (zh) | 执行交易的方法和区块链节点 | |
| WO2023231337A1 (zh) | 在区块链中执行交易的方法、区块链的主节点和从节点 | |
| CN114827165B (zh) | 对多个交易进行分组的方法和区块链节点 | |
| CN114936256B (zh) | 在区块链中执行交易的方法和区块链节点 | |
| CN115150409B (zh) | 在区块链系统中执行交易的方法、区块链系统、节点及计算机可读存储介质 | |
| WO2024001024A1 (zh) | 在区块链系统中执行交易的方法、区块链系统和节点 | |
| CN114547203B (zh) | 执行交易的方法、区块链、主节点和从节点 | |
| WO2023185059A1 (zh) | 一种共识方法和区块链节点 | |
| WO2024092932A1 (zh) | 交易执行方法和区块链节点 | |
| WO2024001025A1 (zh) | 一种预执行缓存数据清理方法和区块链节点 | |
| WO2023160083A1 (zh) | 执行交易的方法、区块链、主节点和从节点 | |
| TW201918878A (zh) | 任務執行的方法及裝置 | |
| US20250342469A1 (en) | Transaction execution methods, nodes, and blockchain systems | |
| CN116032756A (zh) | 基于区块链更新应用程序的配置信息的方法和区块链节点 | |
| WO2023231335A1 (zh) | 在区块链中执行交易的方法及区块链的主节点 | |
| WO2026092570A1 (zh) | 跨链系统中的跨链转移资源的方法、系统及装置 | |
| CN115098595A (zh) | 区块链系统中的节点分组方法和区块链节点 | |
| WO2025025436A1 (zh) | 基于区块链系统的数据管理方法和区块链节点 | |
| WO2024244342A1 (zh) | 区块链中的交易处理方法和区块链节点 | |
| WO2023240933A1 (zh) | 一种基于区块链的分布式应用部署方法及装置 | |
| CN117273924A (zh) | 交易执行方法及装置和电子设备 | |
| CN116366666A (zh) | 区块链系统中的链状态更新方法和区块链节点 | |
| CN116166342A (zh) | 业务处理方法、装置、设备及存储介质 | |
| CN115865365B (zh) | 基于区块链的分账处理方法、装置及系统 | |
| CN116305311A (zh) | 区块链系统中验证读写集的方法和装置 |
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: 22949112 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22949112 Country of ref document: EP Kind code of ref document: A1 |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22949112 Country of ref document: EP Kind code of ref document: A1 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23/06/2025) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22949112 Country of ref document: EP Kind code of ref document: A1 |