WO2023207080A1 - 一种区块链中的数据处理方法及区块链节点 - Google Patents

一种区块链中的数据处理方法及区块链节点 Download PDF

Info

Publication number
WO2023207080A1
WO2023207080A1 PCT/CN2022/135354 CN2022135354W WO2023207080A1 WO 2023207080 A1 WO2023207080 A1 WO 2023207080A1 CN 2022135354 W CN2022135354 W CN 2022135354W WO 2023207080 A1 WO2023207080 A1 WO 2023207080A1
Authority
WO
WIPO (PCT)
Prior art keywords
world state
proof
blockchain
transaction
transactions
Prior art date
Application number
PCT/CN2022/135354
Other languages
English (en)
French (fr)
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 WO2023207080A1 publication Critical patent/WO2023207080A1/zh

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/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
    • 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
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • 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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the embodiments of this specification belong to the field of blockchain technology, and particularly relate to a data processing method and blockchain node in a blockchain.
  • 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 chain data structure in a sequential manner according to time sequence, and cryptography is used to ensure that the data cannot be tampered with or forged. 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 data storage on the first-layer network (Layer1) can be reduced through the second-layer network (Layer2) solution to improve the scalability and throughput of Layer1.
  • the embodiments of this specification are intended to provide a data processing method and a blockchain node in a blockchain that can increase the overall expansion of the blockchain network without limiting the number of participants and having unlimited data compression ratios.
  • the first aspect of this specification provides a data processing method in a blockchain.
  • the method is executed by a first node in the first blockchain.
  • the method includes:
  • the first proof is used to prove that the first world state is based on the second world state.
  • the second aspect of this specification provides a blockchain node, including:
  • the processing unit is configured to execute transactions in N transaction sets sequentially in chronological order, N ⁇ 1, and the execution of the transactions in the N transaction sets causes the status of the M first accounts to change, M ⁇ 1;
  • An acquisition unit configured to acquire the signature information of each first account on its status
  • the processing unit is further configured to generate a first certificate based on the tree root of the first world state, the tree root of the second world state, and M pieces of the signature information.
  • the first certificate is used to prove that the first world state is Generated after executing N transactions in the transaction set on the basis of the second world state, where the second world state is the world state before executing N transactions in the transaction set;
  • a storage unit configured to store the tree root of the first world state and the first proof into the second blockchain.
  • the third aspect of this specification provides a blockchain system, including: a first blockchain and a second blockchain, wherein the first node in the first blockchain is used in the first aspect of the embodiment of this specification.
  • the second blockchain is used to store the tree root of the first world state and the first proof transmitted by the first node.
  • a fourth aspect of this specification provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed in a computing device, the computing device executes the method described in the first aspect.
  • a fifth aspect of this specification provides a computing device, including a memory and a processor.
  • a computer program is stored in the memory.
  • the processor executes the computer program, the method described in the first aspect is implemented.
  • a state transition certificate can be generated in a blockchain based on the signature information of the account that caused the state change to its own asset information, and the conversion certificate and the latest The root of the world state tree is transferred to another blockchain for storage. This achieves no limit on the number of participants, has the same security as Layer 1, and has unlimited data compression ratio, bringing unlimited possibilities to the overall expansion of the blockchain network.
  • Figure 1 is a schematic diagram of data transmission based on status channels in an embodiment of this specification
  • Figure 2 is a schematic network diagram of a blockchain network in an embodiment of this specification
  • Figure 3 is a simplified version of the state tree schematic diagram in an embodiment of this specification.
  • Figure 4 is a schematic flow chart of a data transmission method in a blockchain according to an embodiment of this specification
  • Figure 5 is a schematic structural diagram of a blockchain node in an embodiment of this specification.
  • Figure 6 is a schematic diagram of the architecture of a blockchain system in an embodiment of this specification.
  • the Layer2 solution refers to off-chain expansion, which is to establish a second-layer transaction network outside the main chain, so it is called “Layer2".
  • the main chain can be called “Layer1”.
  • transactions can be executed in Layer2 and transaction-related data can be stored in Layer1.
  • solutions such as State Channel and Rollup can be used in Layer 2 solutions.
  • the state channel scheme taking the transaction between Alice and Bob as an example, as shown in Figure 1, it can be described as the following steps: First, Alice and Bob each store a sum of money in the smart contract on Layer1, and record the The balances of the two people are: ⁇ Alice: 10 yuan, Bob: 5 yuan ⁇ . Then, a transaction can occur between Alice and Bob. For example, Alice wants to pay Bob a transaction of 2 yuan, so they update their balances to: ⁇ Alice: 8 yuan, Bob: 7 yuan, Date: XXX ⁇ , And both of them signed the balance distribution plan.
  • Bob wants to pay Alice another 3 yuan, so they update their balances to: ⁇ Alice: 11 yuan, Bob: 4 yuan, Date: XXX ⁇ , and both of them signed the balance distribution plan.
  • Bob wants to pay Alice another 3 yuan, so they update their balances to: ⁇ Alice: 11 yuan, Bob: 4 yuan, Date: XXX ⁇ , and both of them signed the balance distribution plan.
  • Bob intends to withdraw the balance
  • Bob can submit the balance distribution plan with the signatures of both parties to the smart contract in the blockchain. After the signature verification is passed, the smart contract will follow the latest The balance is settled by the transfer between the two parties. From this, it can be seen that the state channel scheme has almost unlimited compression ratio.
  • Alice and Bob can theoretically make unlimited transactions off the chain (infinite different balance allocation schemes), and finally settle one transaction on the chain. Yes, and the smart contracts in the blockchain can be settled faithfully according to the latest balance distribution plan, that is, the security of Layer2's two-way payment channel is guaranteed by Layer1.
  • the participants are easily restricted, because the update of the balance distribution scheme requires the signature of everyone, so it is unlikely that there will be too many participants, otherwise the complexity will increase exponentially.
  • a world state tree is used to store account status off-chain.
  • users’ transactions can be collected off-chain and each transaction executed.
  • a new world state tree can be generated.
  • all transactions, state transition proofs, root of the original world state and root of the latest world state can be packaged and submitted to the chain.
  • the smart contract on the chain verifies the state transition and proves that Proof passes, the new state can be written to the chain in the future.
  • the smart contract on the chain does not need to independently verify the legality of each transaction. It only needs to verify whether the state transition proves that Proof is valid, which reduces resource consumption on the chain.
  • the participants no longer need to be specifically limited to a certain range; at the same time, ZK Rollup based on zero-knowledge proof has the same security as Layer1, and its state transition proof completely relies on mathematical proof and Layer1's state.
  • the state transition proof Proof in Rollup needs to package and compress all transactions, and in order to fully reflect the original transactions and state transition proof Proof, its compression ratio will have a certain upper limit.
  • the embodiment of this specification provides a data processing method in the blockchain, which combines the state channel solution and the Rollup solution.
  • Layer 2 it processes its own asset information based on the account that produces the state change.
  • the signature information generates a state transition proof, and transmits the transition proof and the root of the latest world state tree to Layer 1, achieving the goal of not limiting the number of participants, having the same security as Layer 1, and having unlimited
  • the data compression ratio brings unlimited possibilities to the overall expansion of the blockchain network.
  • FIG. 2 is a schematic architectural diagram of a blockchain network provided in the embodiment of this specification.
  • this blockchain contains, for example, 10 nodes.
  • Each node can be any device, server or device cluster with computing and processing capabilities.
  • the connections between nodes schematically represent P2P (Peer to Peer, point-to-point) connections.
  • each node in the blockchain can generate the same state in the blockchain by executing the same transaction, and each node in the blockchain can store the same state database.
  • FIG. 2 shows that the blockchain includes 10 nodes, the embodiments of this description 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.
  • 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 Ethereum is to initiate a transaction pointing to the smart contract address, allowing each node in the Ethereum network to run the smart contract code in a distributed manner.
  • smart contracts can also be set by the system in the genesis block. This type of contract is generally called a system contract.
  • system contract some blockchain data structures, parameters, attributes and methods can be set in the system contract.
  • 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 2.
  • 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.
  • 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. Among them, contract accounts can be used to store status related to smart contracts. Once an event triggers the terms in the smart 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.
  • External accounts can be understood as user accounts, such as Ethereum owner accounts.
  • the design of external accounts and contract accounts is actually the mapping of account addresses to account status.
  • the status of the account usually includes fields such as nonce, balance, storage_root, codeHash, etc. Nonce and balance exist in both external accounts and contract accounts.
  • the codeHash and storage_root attributes are generally only valid on contract accounts.
  • nonce can be understood as a counter; for external accounts, this number represents the number of transactions sent from the account address; for contract accounts, it is the number of contracts created by the account.
  • Balance can be understood as the account balance.
  • storage_root can be understood as the hash of the root node of an MPT tree.
  • codeHash can be understood as the hash value of the smart contract code; for contract accounts, this is the hashed and stored code of the smart contract; for external accounts, since smart contracts are not included, the codeHash field can generally be an empty string/ A string of all zeros.
  • MPT's full name is Merkle Patricia Tree, which 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 the Ethereum network.
  • 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 and storage_root.
  • RLP Recursive-Length Prefix encoding
  • Figure 3 is a simplified version of the state tree diagram.
  • There are several external accounts in the blockchain system such as the respectively numbered external account 1, external account 2,... in Figure 3.
  • there are several contract accounts in the blockchain system such as the respectively numbered contract account 1, contract account 2,... in Figure 3.
  • These external accounts and contract accounts and their information contents are organized in the form of an MPT tree, for example, to form a state tree.
  • the state_root in the block header stores the hash value of the root node of this MPT tree.
  • three nodes in total, node 1, node 2, and node 3 are used to schematically represent the form of the MPT tree. Specifically, they can represent the extended nodes and branch nodes in the MPT tree.
  • the blockchain network shown in Figure 2 can be composed of a main chain and two side chains. Different side chains can be associated with different businesses. For example, side chain a can be associated with Alipay-related payment services, side chain b can be associated with bank-related storage services, etc. Smart contracts can be configured in both the main chain and the side chain.
  • the main chain shown in Figure 2 can be understood as Layer 1 described above, and the side chain can be understood as Layer 2 described above. It can be understood that although two side chains are shown in Figure 2, the embodiments of this specification are not limited thereto, but may include other numbers of side chains. In addition, the number of nodes in the side chain and the number of nodes in the main chain can also be other numbers, and the embodiments of this specification do not limit this.
  • FIG. 4 is a schematic flowchart of a data processing method in a blockchain provided in the embodiment of this specification.
  • the data processing method in the blockchain mainly involves side chains, main chains and user terminals that log in with accounts.
  • the account involved in the user terminal logged in with an account may be an account corresponding to the business related to the side chain.
  • the account may be the user's Alipay account.
  • the timing for the side chain shown in Figure 4 to submit data to the main chain is once every F transactions.
  • the data processing method in this blockchain can include the following steps:
  • node A in the side chain collects F transactions, F ⁇ 1.
  • the corresponding transaction can be sent to node A in the side chain.
  • node A can collect the transactions corresponding to each account.
  • the value of F can be preset, such as 100, 200, etc.
  • node A after receiving the transaction, node A can verify the legality of the transaction.
  • the transaction may include the transaction content and the digital signature generated by the initiator based on its own account private key, and node A can verify the digital signature in the received transaction through the initiator's corresponding account public key to determine The received zone transactions have not been tampered with during the transmission process, improving the security of blockchain transactions.
  • node A in the side chain executes F transactions, generates a new world state tree, and determines E accounts that produce state changes based on the original world state tree and the new world state tree.
  • node A in the side chain collects F transactions, it can execute these F transactions in chronological order, that is, batch process the collected transactions.
  • the world state tree T1 in the side chain i.e., the original world state tree
  • the world state tree T2 i.e., the new world state tree
  • the world state tree T1 may be the latest world state tree obtained between executing F transactions.
  • the world state tree T2 can be stored in the side chain.
  • node A After obtaining the world state tree T2, node A can determine the E accounts that have a state change after executing F transactions based on the world state tree T1 and the world state tree T2, E ⁇ 1. For example, the world state tree T1 and the world state tree T2 can be compared to determine the E accounts that cause state changes. In addition, when executing a transaction, each account that has a status change can also be recorded to obtain E accounts.
  • node A in the side chain generates a state transition proof P1 based on F transactions, the root of the world state tree T1 and the root of the world state tree T2.
  • the state transition proof P1 is used to prove the root of the world state tree T2. is correct.
  • node A after obtaining the world state tree T2, node A can generate a state transition proof P1 based on F transactions, the root of the world state tree T1, and the root of the world state tree T2.
  • the state transition proof P1 is used to prove that the change from the original world state to the new world state is correct; that is to say, the state transition proof P1 can be used to prove that the new world state is executed based on the original world state. Generated after F transactions.
  • node A can process F transactions, the root of world state tree T1 and the root of world state tree T2 based on zero-knowledge proof algorithms, such as zk-stark algorithm, zk-SNARKs algorithm, etc. Prove P1 by generating a state transition.
  • node A can call the prove function in the smart contract in the side chain, and use F transactions, the root of the world state tree T1 and the root of the world state tree T2 as the input of the prove function to obtain the result from Prove that the function output state transition proves P1.
  • the proof function can be obtained from a pre-compiled gate circuit.
  • the input of the gate circuit may be F transactions, the root of the world state tree T1 and the root of the world state tree T2, and the output of the gate circuit may be the state transition proof P1.
  • the gate circuit may be, but is not limited to, a PLONK circuit.
  • node A in the side chain sends a request to obtain the signature information of each account on its status to the terminal logged in to each of the E accounts.
  • the request includes the state transition certificate P1.
  • node A in the side chain after node A in the side chain obtains the state transition certificate P1, it can obtain the signature information of each of the E accounts on their respective states. This signature information can represent the corresponding account's recognition of changes in asset information within it.
  • node A may send a request for obtaining the signature information of each account on its status to the terminal logged in to each of the E accounts.
  • the request may include state transition proof P1.
  • the terminal logged in to each of the E accounts sends corresponding signature information to node A in the side chain.
  • the terminal logged in to each of the E accounts can learn from the state transition proof P1 carried in the request that the original world state is changed to the new world state. is correct.
  • each of the E accounts can sign its own asset information to obtain the corresponding signature information. And, transmit the signature information to node A by logging in to a terminal with an account, so that node A obtains E pieces of signature information.
  • node A obtains E pieces of signature information it can delete the F transactions it executed to save storage space.
  • node A in the side chain generates a state transition proof P2 based on the E signature information, the tree root of the original world state and the tree root of the new world state tree.
  • the state transition proof P2 is used to prove that the original world state to the new world state is correct.
  • node A can verify the E signature information, the root of the world state tree T1 (i.e., the original world state tree) and the world state tree T2 (i.e., the new world state tree) based on the aforementioned zero-knowledge proof algorithm.
  • the tree root is processed to generate a state transition proof P2.
  • the state transition proof P2 can be used to prove that the transition from the original world state to the new world state is correct; that is to say, the state transition proof P2 can be used to prove that the new world state is based on the original world state. Generated after executing F transactions.
  • node A can call the prove function in the smart contract in the side chain, and use E signature information, the root of the world state tree T1 and the root of the world state tree T2 as the input of the proof function to Prove P2 by outputting the state transition of the proof function.
  • the proof function can be obtained from a pre-compiled gate circuit.
  • the proof function may be, but is not limited to, the same function as the aforementioned function that generates the state transition proof P1.
  • node A in the side chain submits the tree root of the new world state and the state transition proof P2 to the main chain.
  • node A after node A obtains the state transition proof P2, it can submit the tree root of the new world state and the state transition proof P2 to the main chain for storage by the main chain.
  • the main chain after the main chain obtains the tree root of the new world state and the state transition proof P2, it can verify the correctness of the state transition proof P2.
  • the nodes in the main chain can call the verification function in the smart contract in the main chain, and verify the root of the world state tree T1 (i.e., the original world state) and the world state tree T2 (i.e., the new world state).
  • the tree root of the world state) and the state transition proof P2 are processed to verify the correctness of the state transition proof P2.
  • the main chain can Make sure the new world state obtained in the side chain is correct.
  • the verification function can also be obtained from a pre-compiled gate circuit.
  • the gate circuit required to verify the function and the gate circuit required to prove the function may be the same gate circuit.
  • the data processing method in the blockchain provided in this embodiment combines the state channel solution and the Rollup solution.
  • the state is generated based on the signature information of the account that generated the state change on its own asset information.
  • Conversion proof and transmits the conversion proof and the root of the latest world state tree to Layer1, realizing that there is no limit on the number of participants, and because the amount of data in the signature information is small, it can have unlimited data compression ratio , which brings unlimited possibilities to the overall expansion of the blockchain network.
  • the security of this solution is also high.
  • the timing for the side chain shown in Figure 4 to submit data to the main chain is not only submitted once every F transactions are executed, but also submitted once every N transaction sets are executed, N ⁇ 2; Among them, each transaction set can include F transactions.
  • the data submitted to the main chain after executing N transaction sets can include: the root of the world state tree obtained after executing N transactions and the latest generated state transition proof. This latest state transition proof can be used to prove that the world state obtained before executing N transaction sets to the world state obtained after executing N transaction sets is correct.
  • node A in the side chain can execute transactions in N transaction sets in chronological order.
  • node A in the side chain can, after each transaction in a transaction set, be generated based on the state transition certificate generated last time, the signature information of the account that caused the state change in this execution of the transaction, and the generated transaction after this execution of the transaction.
  • the tree root of the new world state and the tree root of the latest world state obtained before this execution of the transaction generate a new state transition proof. This new state transition proof can be used to prove that the latest world state between the transactions in the first transaction set of N transaction sets to the new world state obtained by executing the transaction this time is correct.
  • the state transition proof P12 can be obtained based on the signature information of the account that caused the state change after the transaction was executed, the world state before the transaction was executed, the world state after the transaction was executed, and the state transition proof P11.
  • the state transition proof P13 can be obtained based on the signature information of the account that caused the state change after the transaction was executed, the world state before the transaction was executed, the world state after the transaction was executed, and the state transition proof P12. .
  • the state transition proof P14 can be obtained based on the signature information of the account that caused the state change after the transaction was executed, the world state before the transaction was executed, the world state after the transaction was executed, and the state transition proof P13. .
  • the state transition proof P14 can be used to prove that the latest world state before executing the first transaction set to the world state obtained after executing the fourth transaction set is correct; that is to say, the state transition proof P14 can be used to prove that The new world state is generated after executing 4 transaction sets based on the latest world state before executing the first transaction set.
  • the embodiments of this specification also provide a blockchain node.
  • FIG. 5 is a schematic structural diagram of a blockchain node provided in the embodiment of this specification.
  • the blockchain node 500 includes: a processing unit 510, an acquisition unit 520 and a storage unit 530.
  • the processing unit 510 is configured to execute transactions in N transaction sets sequentially in chronological order, N ⁇ 1, and the execution of transactions in N transaction sets causes the status of M first accounts to change, M ⁇ 1;
  • the obtaining unit 520 is configured to obtain the signature information of each first account on its status
  • the processing unit 510 is also configured to generate a first proof based on the tree root of the first world state, the tree root of the second world state, and M pieces of signature information.
  • the first proof is used to prove that the first world state is in the second world state. is generated after executing transactions in N transaction sets, and the second world state is the world state before executing transactions in N transaction sets;
  • the storage unit 530 is configured to store the tree root and the first proof of the first world state into the second blockchain.
  • the processing unit 510 is also configured to: input the tree root of the first world state, the tree root of the second world state, and M pieces of signature information into the preset proof function to generate the first prove.
  • the processing unit 510 is also configured to: execute the transactions in the Nth transaction set;
  • the obtaining unit 520 is also configured to obtain signature information of Q first accounts
  • the processing unit 510 is also configured to: based on the signature information of the Q first accounts, the second proof generated through the (N-1)th transaction set, the tree root of the first world state, and the tree root of the third world state, Generate the first proof, and the second proof is used to prove that the third world state is generated after executing the transactions in the (N-1)th transaction set based on the world state obtained by executing the (N-2)th transaction set,
  • the third world state is the world state obtained by executing the transactions in the (N-1)th transaction set.
  • processing unit 510 is also configured to:
  • the N transaction sets include the first transaction set, and the execution of the transactions included in the first transaction set causes the status of the S first accounts to change, 1 ⁇ S ⁇ M;
  • the processing unit 510 is also configured to: generate a third proof based on the transactions included in the first transaction set, the fourth world state, and the fifth world state.
  • the fourth world state is the world state obtained after executing the transactions in the first transaction set.
  • the fifth world state is the latest world state obtained before executing the transactions in the first transaction set, and the third proof is used to prove that the fourth world state is generated by executing the transactions in the first transaction set on the basis of the fifth world state;
  • the installation also includes:
  • a communication unit (not shown in the figure) configured to send a first request for obtaining signature information to the terminal corresponding to each of the S first accounts, where the first request includes a third certificate;
  • the communication unit is further configured to obtain the signature information returned by the terminal corresponding to each of the S first accounts.
  • the embodiments of this specification also provide a blockchain system.
  • FIG. 6 is a schematic architectural diagram of a blockchain system provided in the embodiment of this specification.
  • the blockchain system 600 includes a first blockchain 610 and a second blockchain 620.
  • the first node in the first blockchain 610 is used to implement the aforementioned method
  • the second blockchain is used to store the tree root and the first proof of the first world state transmitted by the first node.
  • the first blockchain 610 can be the side chain shown in Figure 4
  • the second blockchain 620 can be the main chain described in Figure 4
  • the first node can be the node described in Figure 4 A.
  • the second blockchain is also used to input the tree root of the first world state, the tree root of the second world state, and the first proof into a preset verification function to verify the correctness of the first proof.
  • 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.
  • 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.
  • 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 specification 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)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Databases & Information Systems (AREA)
  • Finance (AREA)
  • Computer Security & Cryptography (AREA)
  • General Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Bioethics (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本说明书实施例中提供了一种区块链中的数据处理方法及区块链节点。该方法由第一区块链中的第一节点执行,包括:依时间顺序依次执行N个交易集合中的交易,N个交易集合中的交易的执行使得M个第一账户的状态变化;获取每个第一账户对其状态的签名信息;根据第一世界状态的树根、第二世界状态的树根、M个签名信息,生成第一证明,第一证明用于证明第一世界状态是在第二世界状态的基础上执行N个交易集合中的交易后生成,第二世界状态为执行N个交易集合中的交易前的世界状态;将第一世界状态的树根和第一证明存储到第二区块链中。该方法在提升区块链网络的整体扩容时,可以不限制参与方数量,且拥有无限的数据压缩比。

Description

一种区块链中的数据处理方法及区块链节点
本申请要求于2022年4月28日提交中国国家知识产权局、申请号为2022104625124、申请名称为“一种区块链中的数据处理方法及区块链节点”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本说明书实施例属于区块链技术领域,尤其涉及一种区块链中的数据处理方法及区块链节点。
背景技术
区块链(Blockchain)是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链系统中按照时间顺序将数据区块以顺序相连的方式组合成链式数据结构,并以密码学方式保证数据不可篡改和不可伪造。由于区块链具有去中心化、信息不可篡改、自治性等特性,区块链也受到人们越来越多的重视和应用。
目前,区块链网络中所有的交易及状态数据都需要在所有节点中同步并存储,其存储成本远大于传统数据库的存储成本。因此,将所有数据全部存储于一个区块链网络是不现实的。一般的,可以通过二层网络(Layer2)的方案减少一层网络(Layer1)上的数据存储,以提升Layer1的扩展性及吞吐量。
发明内容
本说明书实施例旨在提供一种区块链中的数据处理方法及区块链节点,在提升区块链网络的整体扩容时,可以不限制参与方数量,且拥有无限的数据压缩比。
为实现上述目的,本说明书第一方面提供一种区块链中的数据处理方法,所述方法由第一区块链中的第一节点执行,所述方法包括:
依时间顺序依次执行N个交易集合中的交易,N≥1,所述N个交易集合中的交易的执行使得M个第一账户的状态变化,M≥1;
获取每个所述第一账户对其状态的签名信息;
根据第一世界状态的树根、第二世界状态的树根、M个所述签名信息,生成第一证明,所述第一证明用于证明第一世界状态是在第二世界状态的基础上执行N个所述交易集合中的交易后生成,所述第二世界状态为执行N个所述交易集合中的交易前的世界状态;
将所述第一世界状态的树根和所述第一证明存储到第二区块链中。
本说明书第二方面提供一种区块链节点,包括:
处理单元,配置为依时间顺序依次执行N个交易集合中的交易,N≥1,所述N个交易集合中的交易的执行使得M个第一账户的状态变化,M≥1;
获取单元,配置为获取每个所述第一账户对其状态的签名信息;
所述处理单元,还配置为根据第一世界状态的树根、第二世界状态的树根、M个所述签名信息,生成第一证明,所述第一证明用于证明第一世界状态是在第二世界状态的基础上执行N个所述交易集合中的交易后生成,所述第二世界状态为执行N个所述交易集合中的交易前的世界状态;
存储单元,配置为将所述第一世界状态的树根和所述第一证明存储到第二区块链中。
本说明书第三方面提供一种区块链系统,包括:第一区块链和第二区块链,其中,所述第一区块链中的第一节点用于本说明书实施例第一方面中提供的方法,所述第二区块链用于存储所述第一节点传输的所述第一世界状态的树根和所述第一证明。
本说明书第四方面提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算设备中执行时,计算设备执行上述第一方面所述的方法。
本说明书第五方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时,实现上述第一方面所述的方法。
通过本说明书一个或多个实施例中提供的方法及节点,可以在一个区块链中通过基于产生状态变化的账户对其自身资产信息的签名信息生成状态转换证明,并将该转换证明和最新的世界状态树的树根传输至另一个区块链中存储。由此实现了不限制参与方数量,以及拥有与Layer1一样的安全性,且拥有无限的数据压缩比,为区块链网络的整体扩容带来无限的可能。
附图说明
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本说明书一实施例中基于状态通道的数据传输示意图;
图2是本说明书一实施例中区块链网络的网络示意图;
图3是本说明书一实施例中的一个简化版的状态树示意图;
图4是本说明书一实施例中一种区块链中的数据传输方法的流程示意图;
图5是本说明书一实施例中一种区块链节点的结构示意图;
图6为本说明书一实施例中一种区块链系统的架构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。
示例性的,Layer2方案是指在链下扩容,其是在主链之外建立第二层交易网络,因此称为“Layer2”。其中,主链可以称之为“Layer1”。在Layer2方案中,可以在Layer2中执行交易,并在Layer1中存储与交易相关的数据。一般的,在Layer2的方案中可以采用状态通道(State Channel)和Rollup等方案。
其中,对于状态通道方案,以Alice和Bob间进行交易为例,如图1所示,可以描述为以下步骤:首先,Alice和Bob在Layer1上的智能合约中各存储一笔钱,分别记录了两人的余额:{Alice:10元,Bob:5元}。接着,Alice和Bob之间可以发生交易,比如:Alice要向Bob支付一笔2元的交易,于是他们将两人余额更新为:{Alice:8元,Bob:7元,Date:XXX},并且两人都对这个余额分配方案进行了签名。之后,Bob又要向Alice支付3元,于是他们将两人余额更新为:{Alice:11元,Bob:4元,Date:XXX},并且两人都对这个余额分配方案进行了签名。如此往复,只要Alice和Bob支付的金额在通道中的余额够用,他们彼此之间又一直很配合进行签名,他们可以一直这样支付。最后,当 两者中的一个,比如Bob打算取出余额,此时,Bob可以将带有两方签名的余额分配方案提交至区块链中的智能合约,智能合约在签名验证通过后按照最新的余额为两方转账完成结算。由此,可以看出状态通道的方案几乎有无限的压缩比,Alice和Bob理论上可以在链下做可以无限笔交易(无限个不同的余额分配方案),并最终在链上结算一笔即可,且区块链中的智能合约可以忠实的按照最新的余额分配方案进行结算,即Layer2的双向支付通道的安全性由Layer1保证。但采用状态通道的方案时,参与方容易受限,因为余额分配方案的更新需要所有人的签名,那么就不太可能有太多的参与方,否则复杂度将成几何倍数增加。
对于Rollup方案,其工作原理是:在链下进行计算,并在链上存储计算结果。一般是在链下利用一个世界状态树存储账户状态。同时,可以在链下收集用户的交易,以及执行每个交易。当交易执行完成后可以产生一个新的世界状态树。接着,可以根据原始世界状态的树根、最新的世界状态的树根和所有的交易,以及利用零知识证明算法,比如:zk-stark算法、zk-snark算法等,生成一个用于证明链下状态转移是正确的状态转换证明Proof。最后,可以将所有的交易、状态转换证明Proof、原始世界状态的树根和最新的世界状态的树根一起打包并提交至链上。其中,链上的智能合约校验状态转换证明Proof通过后,可以将来新的状态写入到链上。此时,链上的智能合约不需要单独校验每笔交易的合法性,只需要校验状态转换证明Proof是否有效,降低了链上的资源消耗。可以看出,在Rollup的方案中对参与方不再需要特定的限定在某一个范围;同时,基于零知识证明的ZKRollup具有与Layer1相同的安全性,其状态转换证明完全依赖数学证明及Layer1的状态。但由于Rollup中的状态转换证明Proof是需要对所有的交易进行打包压缩,而为了完整的体现原始交易及状态转换证明Proof,这使得其压缩比会有一定的上限。
鉴于以上问题,本说明书实施例中提供了一种区块链中的数据处理方法,其将状态通道的方案和Rollup的方案相结合,在Layer2中通过基于产生状态变化的账户对其自身资产信息的签名信息生成状态转换证明,并将该转换证明和最新的世界状态树的树根传输至Layer1中,实现了可以不限制参与方数量,以及可以拥有与Layer1一样的安全性,且拥有无限的数据压缩比,为区块链网络的整体扩容带来无限的可能。
示例性的,图2为本说明书实施例中提供的一种区块链网络的架构示意图。如图2所示,该区块链中例如包含10个节点。每个节点均可以是任何具有计算、处理能力的装置、服务器或设备集群等。节点之间的连线示意性的表示P2P(Peer to Peer,点对点)连接。
这些节点上可存储全量的账本,即存储全部区块和全部账户的状态。其中,区块链中的每个节点可通过执行相同的交易而产生区块链中的相同的状态,区块链中的每个节点可存储相同的状态数据库。可以理解,图2中虽然示出了区块链中包括10个节点,本说明书实施例不限于此,而是可以包括其他数目的节点。具体是,区块链中包含的节点可以满足拜占庭容错(Byzantine Fault Tolerance,BFT)要求。所述的拜占庭容错要求可以理解为在区块链内部可以存在拜占庭节点,而区块链对外不体现拜占庭行为。一般的,一些拜占庭容错算法中要求节点个数大于(3f+1),f为拜占庭节点个数,例如实用拜占庭容错算法PBFT(Practical Byzantine Fault Tolerance)。
区块链领域中的交易可以指在区块链中执行并记录在区块链中的任务单元。交易中 通常包括发送字段(From)、接收字段(To)和数据字段(Data)。其中,在交易为转账交易的情况中,From字段表示发起该交易(即发起对另一个账户的转账任务)的账户地址,To字段表示接收该交易(即接收转账)的账户地址,Data字段中包括转账金额。在交易调用区块链中的智能合约的情况中,From字段表示发起该交易的账户地址,To字段表示交易所调用的合约的账户地址,Data字段中包括调用合约中的函数名、及对该函数的传入参数等数据,以用于在交易执行时从区块链中获取该函数的代码并执行该函数的代码。
区块链中可提供智能合约的功能。区块链上的智能合约是在区块链系统上可以被交易触发执行的合约。智能合约可以通过代码的形式定义。在以太坊中调用智能合约,是发起一笔指向智能合约地址的交易,使得以太坊网络中每个节点分布式地运行智能合约代码。需要说明的是,除了可以由用户创建智能合约,也可以在创世块中由系统设置智能合约。这类合约一般称为系统合约。一般的,系统合约中可以设置一些区块链的数据结构、参数、属性和方法。此外,具有系统管理员权限的账户可以创建系统级的合约,或者修改系统级的合约(简称为系统合约)。其中,所述系统合约可用于在区块链中增加不同业务的数据的数据结构。
在部署合约的场景中,例如,Bob将一个包含创建智能合约信息(即部署合约)的交易发送到如图2所示的区块链中,该交易的data字段包括待创建的合约的代码(如字节码或者机器码),交易的to字段为空,以表示该交易用于部署合约。节点间通过共识机制达成一致后,确定合约的合约地址“0x6f8ae93…”,各个节点在状态数据库中添加与该智能合约的合约地址对应的合约账户,分配与该合约账户对应的状态存储,并将合约代码保存在该合约的状态存储中,从而合约创建成功。
在调用合约的场景中,例如,Bob将一个用于调用智能合约的交易发送到如图2所示的区块链中,该交易的from字段是交易发起方(即Bob)的账户的地址,to字段中的“0x6f8ae93…”代表了被调用的智能合约的地址,交易的data字段包括调用智能合约的方法和参数。在区块链中对该交易进行共识之后,区块链中的各个节点可分别执行该交易,从而分别执行该合约,基于该合约的执行更新状态数据库。
另外,智能合约在区块链上完成部署后,会产生一个对应的合约账户。这个合约账户一般会具有一些状态,这些状态由智能合约中状态变量所定义并在智能合约创建、执行时产生新的值。其中,合约账户可以用于存储智能合约相关的状态。一旦某个事件触发智能合约中的条款(满足执行条件),代码即可以自动执行。在区块链中,合约的相关状态保存在存储树(storage trie)中,存储树根节点的hash值即存储于上述storage_root中,从而将该合约的所有状态通过hash锁定到该合约账户下。存储树也是一个MPT树形结构,存储了状态地址到状态值的key-value映射。从存储树的根节点到叶子节点存储有一个状态的地址,一个叶子节点中存储一个状态的值。
此外,在区块链系统中还可以涉及若干外部账户。外部账户可以理解为是用户的账户,例如以太币拥有者账户。外部账户和合约账户的设计,实际上是账户地址到账户状态的映射。账户的状态通常包括nonce、balance、storage_root、codeHash等字段。nonce、balance在外部账户和合约账户中都存在。codeHash和storage_root属性一般仅在合约账户上有效。其中,nonce可以理解为计数器;对于外部账户,这个数字代表从账户地址发送的交易数量;对于合约账户,是账户创建的合约数量。balance可以理解为是账户余 额。storage_root可以理解为是一个MPT树根节点的哈希,这个MPT树对合约账户的状态变量的存储进行组织。codeHash可以理解为是智能合约代码的哈希值;对于合约账户,这是智能合约被哈希计算并存储的代码;对于外部账户,由于不包括智能合约,因此codeHash字段一般可以是空字符串/全0字符串。
MPT全称为Merkle Patricia Tree,是结合了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。
示例性的,图3是一个简化版的状态树示意图。区块链系统中存在若干外部账户,例如图3中分别编号的外部账户1、外部账户2,…。此外,区块链系统中存在若干合约账户,例如图3中的分别编号的合约账户1,合约账户2,…。这些外部账户和合约账户及其信息内容例如通过MPT树的形式组织,构成状态树。区块头中的state_root存储这个MPT树的根节点的hash值。图3中以节点1、节点2、节点3共三个节点来示意性的表示MPT树的形式,具体的,可以表示MPT树中的扩展节点、分支节点。
继续参阅图2,图2中所示的区块链网络可以由一个主链和两个侧链构成。不同的侧链可以与不同的业务相关联,例如,侧链a可以与支付宝相关的支付业务关联,侧链b可以与银行相关的存储业务关联等。主链和侧链中均可以配置有智能合约。图2中所示的主链可以理解为上文所描述的Layer1,侧链可以理解为上文所描述的Layer2。可以理解,图2中虽然示出了两个侧链,但本说明书实施例不限于此,而是可以包括其他数目的侧链。另外,对于侧链中的节点数量和主链中的节点数量,也可以是其他数量,本说明书实施例对此不做限定。
示例性的,图4为本说明书实施例中提供的一种区块链中的数据处理方法的流程示意图。其中,该区块链中的数据处理方法主要涉及侧链、主链和登陆有账号的用户终端。登录有账号的用户终端中所涉及的账户可以是与侧链相关的业务对应的账户,例如,当侧链是与支付宝相关的支付业务相关时,账户可以是用户的支付宝的账户。图4中所示的侧链向主链提交数据的时机是:每执行F个交易提交一次。
如图4所示,该区块链中的数据处理方法可以包括以下步骤:
在S402,侧链中的节点A收集F个交易,F≥1。
本实施例中,登录有账号的用户终端在发生业务(比如:转账业务等)后,可以将相应的交易发生至侧链中的节点A,这样,节点A即可以收集到各个账户对应的交易。示 例性的,F的值可以预先设定,比如100,200等。
在一些实施例中,节点A接收到交易后,可以对该交易进行合法性验证。比如,交易中可以包括交易内容和发起方基于自身的账户私钥所生成的数字签名,而节点A通过该发起方对应的账户公钥可以对接收到的交易中的数字签名进行验证,以确定接收到的区交易在传输过程中没有被篡改,提高区块链交易的安全性。
在S404,侧链中的节点A执行F个交易,生成新的世界状态树,以及,由原始的世界状态树和新的世界状态树,确定出产生状态变化的E个账户。
本实施例中,侧链中的节点A收集到F个交易后,可以依时间顺序依次执行这F个交易,即对其收集到的交易进行批量处理。其中,节点A在执行后,侧链中的世界状态树T1(即原始的世界状态树)可以变换为世界状态树T2(即新的世界状态树)。示例性的,世界状态树T1可以是执行F个交易之间最新获得的一个世界状态树。另外,在生成世界状态树T2后,侧链中可以存储该世界状态树。
在得到世界状态树T2后,节点A可以根据世界状态树T1和世界状态树T2,确定出在执行F个交易后产生状态变化的E个账户,E≥1。示例性的,可以将世界状态树T1和世界状态树T2进行对比,以确定出产生状态变化的E个账户。另外,也可以在执行交易时,记录各个产生状态变化的账户,以得到E个账户。
在S406,侧链中的节点A根据F个交易、世界状态树T1的树根和世界状态树T2的树根,生成状态转换证明P1,状态转换证明P1用于证明世界状态树T2的树根是正确的。
本实施例中,在得到世界状态树T2后,节点A可以根据F个交易、世界状态树T1的树根和世界状态树T2的树根,生成状态转换证明P1。其中,状态转换证明P1用于证明由原始的世界状态到新的世界状态是正确的;也即是说,状态转换证明P1可以用于证明新的世界状态是在原始的世界状态的基础上执行F个交易后生成。
在一些实施例中,节点A可以基于零知识证明算法,比如zk-stark算法、zk-SNARKs算法等,对F个交易、世界状态树T1的树根和世界状态树T2的树根进行处理,以生成状态转换证明P1。示例性的,节点A可以调用侧链中智能合约内的证明(prove)函数,并将F个交易、世界状态树T1的树根和世界状态树T2的树根作为证明函数的输入,以由证明函数输出状态转换证明P1。其中,证明函数可以是由预先编译的门电路得到。示例性的,门电路的输入可以是F个交易、世界状态树T1的树根和世界状态树T2的树根,门电路的输出可以是状态转换证明P1。其中,门电路可以但不限于为PLONK电路。
在S408,侧链中的节点A分别向登录有E个账户中每个账户的终端发送用于获取每个账户对其状态的签名信息的请求,请求中包括状态转换证明P1。
本实施例中,侧链中的节点A在获取到状态转换证明P1后,可以获取E个账户中每个账户对其各自状态的签名信息。该签名信息可以表示相应的账户对其内资产信息变动的认可。其中,节点A在获取E个账户中每个账户的签名信息时,其可以分别向登录有E个账户中每个账户的终端发送用于获取每个账户对其状态的签名信息的请求。该请求中可以包括状态转换证明P1。
在S410,登录有E个账户中每个账户的终端均向侧链中的节点A发送相应的签名信息。
本实施例中,登录有E个账户中每个账户的终端在获取到节点A发送的请求后,均 可以由该请求中携带的状态转换证明P1获知到由原始的世界状态到新的世界状态是正确的。同时,E个账户中每个账户均可以对其自身的资产信息进行签名,以得到相应的签名信息。以及,通过登录有账号的终端将签名信息传输至节点A,以使得节点A获取到E个签名信息。在一些实施例中,节点A在获取到E个签名信息后,可以删除其执行的F个交易,以节省存储空间。
在S412,侧链中的节点A根据E个签名信息、原始的世界状态的树根和新的世界状态树的树根,生成状态转换证明P2,状态转换证明P2用于证明由原始的世界状态到新的世界状态是正确的。
本实施例中,节点A可以基于前述的零知识证明算法,对E个签名信息、世界状态树T1(即原始世界状态树)的树根和世界状态树T2(即新的世界状态树)的树根进行处理,以生成状态转换证明P2。其中,状态转换证明P2可以用于证明由原始的世界状态到新的世界状态是正确的;也即是说,状态转换证明P2可以用于证明新的世界状态是在原始的世界状态的基础上执行F个交易后生成。示例性的,节点A可以调用侧链中智能合约内的证明(prove)函数,并将E个签名信息、世界状态树T1的树根和世界状态树T2的树根作为证明函数的输入,以由证明函数输出状态转换证明P2。其中,证明函数可以是由预先编译的门电路得到。示例性的,该证明函数可以但不限于与前述生成状态转换证明P1的函数相同。
在S414,侧链中的节点A将新的世界状态的树根和状态转换证明P2提交至主链。
本实施例中,节点A获取到状态转换证明P2后,可以将新的世界状态的树根和状态转换证明P2提交至主链,以由主链进行存储。
在一些实施例中,主链获取到新的世界状态的树根和状态转换证明P2后,可以对验证状态转换证明P2的正确性。其中,在验证时,主链中的节点可以调用主链中智能合约内的验证(verify)函数,并对世界状态树T1(即原始的世界状态)的树根、世界状态树T2(即新的世界状态)的树根和状态转换证明P2进行处理,以验证状态转换证明P2的正确性。应理解的是,由于状态转换证明P2是用于证明由原始的世界状态到新的世界状态是正确的,因此,当主链通过验证函数验证出状态转换证明P2是正确的时,主链则可以确定出侧链中得到的新的世界状态是正确的。示例性的,验证函数也可以是由预先编译的门电路得到。示例性的,验证函数所需的门电路与证明函数所需的门电路可以是同一门电路。
由此,本实施例中提供的区块链中的数据处理方法,将状态通道的方案和Rollup的方案相结合,在Layer2中通过基于产生状态变化的账户对其自身资产信息的签名信息生成状态转换证明,并将该转换证明和最新的世界状态树的树根传输至Layer1中,实现了可以不限制参与方的数量,且由于签名信息的数据量很小,因此可以具有无限的数据压缩比,这为区块链网络的整体扩容带来无限的可能。另外,由于所有的状态转换都依赖零知识证明,因此该方案的安全性也较高。
在一些实施例中,图4中所示的侧链向主链提交数据的时机除了是每执行F个交易提交一次之外,还可以是每执行N个交易集合后提交一次,N≥2;其中,每个交易集合中均可以包括F个交易。其中,在执行N个交易集合后提交至主链上的数据可以包括:执行 N个交易后获得的世界状态树的树根和最新生成的状态转换证明。该最新的状态转换证明可以用于证明由执行N个交易集合之前的世界状态到执行N个交易集合之后得到的世界状态是正确的。
其中,侧链中的节点A可以依时间顺序依次执行N个交易集合中的交易。另外,侧链中的节点A可以在每执行一个交易集合中的交易后,均可以根据前次生成的状态转换证明、本次执行交易产生状态变化的账户的签名信息、本次执行交易后生成的新的世界状态的树根、本次执行交易之前最新获取到的世界状态的树根,生成一个新的状态转换证明。该新的状态转换证明可以用于证明由执行N个交易集合中的第一个交易集合中的交易之间的最新的世界状态到本次执行交易得到的新的世界状态是正确的。
举例来说,若N=4,执行第1个交易集合后,可以基于执行交易后产生状态变化的账户的签名信息、本次执行交易前的世界状态和本次执行交易后的世界状态,得到状态转换证明P11。执行第2个交易集合后,可以基于执行交易后产生状态变化的账户的签名信息、本次执行交易前的世界状态、本次执行交易后的世界状态、状态转换证明P11,得到状态转换证明P12。执行第3个交易集合后,可以基于执行交易后产生状态变化的账户的签名信息、本次执行交易前的世界状态、本次执行交易后的世界状态、状态转换证明P12,得到状态转换证明P13。执行第4个交易集合后,可以基于执行交易后产生状态变化的账户的签名信息、本次执行交易前的世界状态、本次执行交易后的世界状态、状态转换证明P13,得到状态转换证明P14。状态转换证明P14可以用于证明由执行第1个交易集合之前的最新的世界状态到执行第4个交易集合之后得到的世界状态是正确的;也即是说,状态转换证明P14可以用于证明新的世界状态是在执行第1个交易集合之前的最新的世界状态的基础上执行4个交易集合后生成。
与前述方法实施例基于相同的构思,本说明书实施例中还提供了一种区块链节点。
示例性的,图5为本说明书实施例中提供的一种区块链节点的结构示意图。如图5所示,该区块链节点500包括:处理单元510、获取单元520和存储单元530。其中,处理单元510,配置为依时间顺序依次执行N个交易集合中的交易,N≥1,N个交易集合中的交易的执行使得M个第一账户的状态变化,M≥1;
获取单元520,配置为获取每个第一账户对其状态的签名信息;
处理单元510,还配置为根据第一世界状态的树根、第二世界状态的树根、M个签名信息,生成第一证明,第一证明用于证明第一世界状态是在第二世界状态的基础上执行N个交易集合中的交易后生成,第二世界状态为执行N个交易集合中的交易前的世界状态;
存储单元530,配置为将第一世界状态的树根和第一证明存储到第二区块链中。
在一些实施例中,当N=1时,处理单元510,还配置为:将第一世界状态的树根、第二世界状态的树根、M个签名信息输入预设证明函数,生成第一证明。
在一些实施例中,当N≥2时,
处理单元510,还配置为:执行第N个交易集合中的交易;
获取单元520,还配置为获取Q个第一账户的签名信息;
处理单元510,还配置为:根据Q个第一账户的签名信息、通过第(N-1)个交易集合生成的第二证明、第一世界状态的树根、第三世界状态的树根,生成第一证明,第二证 明用于证明第三世界状态是在执行第(N-2)个交易集合得到的世界状态的基础上执行第(N-1)个交易集合中的交易后生成,第三世界状态为执行第(N-1)个交易集合中的交易得到的世界状态。
在一些实施例中,处理单元510,还配置为:
将Q个第一账户的签名信息、第二证明、第一世界状态的树根、第三世界状态的树根输入预设证明函数,生成第一证明。
在一些实施例中,N个交易集合中包括第一交易集合,第一交易集合所包含的交易的执行使得S个第一账户的状态变化,1≤S≤M;
处理单元510,还配置为:根据第一交易集合包含的交易、第四世界状态和第五世界状态,生成第三证明,第四世界状态为执行第一交易集合中的交易后得到的世界状态,第五世界状态为执行第一交易集合中的交易之前最新得到的世界状态,第三证明用于证明第四世界状态是在第五世界状态的基础上执行第一交易集合中交易生成;
装置还包括:
通信单元(图中未示出),配置为向S个第一账户中每个账户对应的终端均发送用于获取签名信息的第一请求,第一请求中包括第三证明;
通信单元,还配置为获取S个第一账户中每个账户对应的终端返回的签名信息。
应当理解的是,上述装置用于执行上述实施例中的方法,装置中相应的程序模块,其实现原理和技术效果与上述方法中的描述类似,该装置的工作过程可参考上述方法中的对应过程,此处不再赘述。
与前述方法实施例基于相同的构思,本说明书实施例中还提供了一种区块链系统。
示例性的,图6为本说明书实施例中提供的一种区块链系统的架构示意图。如图6所示,该区块链系统600包括第一区块链610和第二区块链620。其中,第一区块链610中的第一节点用于实现前述的方法,第二区块链用于存储第一节点传输的第一世界状态的树根和第一证明。示例性的,第一区块链610可以为图4中所示的侧链,第二区块链620可以为图4中所描述的主链,第一节点可以为图4中所描述的节点A。
在一些实施例中,第二区块链还用于将第一世界状态的树根、第二世界状态的树根、第一证明输入预设的验证函数,以验证第一证明的正确性。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多 种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为服务器系统。当然,本申请不排除随着未来计算机技术的发展,实现上述实施例功能的计算机例如可以为个人计算机、膝上型计算机、车载人机交互设备、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
虽然本说明书一个或多个实施例提供了如实施例或流程图所述的方法操作步骤,但基于常规或者无创造性的手段可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多步骤执行顺序中的一种方式,不代表唯一的执行顺序。在实际中的装置或终端产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执行(例如并行处理器或者多线程处理的环境,甚至为分布式数据处理环境)。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、产品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、产品或者设备所固有的要素。在没有更多限制的情况下,并不排除在包括所述要素的过程、方法、产品或者设备中还存在另外的相同或等同要素。例如若使用到第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本说明书一个或多个时可以把各模块的功能在同一个或多个软件和/或硬件中实现,也可以将实现同一功能的模块由多个子模块或子单元的组合实现等。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可 以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
本发明是参照根据本发明实施例的方法、装置(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储、石墨烯存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本本说明书一 个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本说明书的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。
以上所述仅为本说明书一个或多个实施例的实施例而已,并不用于限制本本说明书一个或多个实施例。对于本领域技术人员来说,本说明书一个或多个实施例可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在权利要求范围之内。

Claims (14)

  1. 一种区块链中的数据处理方法,所述方法由第一区块链中的第一节点执行,所述方法包括:
    依时间顺序依次执行N个交易集合中的交易,N≥1,所述N个交易集合中的交易的执行使得M个第一账户的状态变化,M≥1;
    获取每个所述第一账户对其状态的签名信息;
    根据第一世界状态的树根、第二世界状态的树根、M个所述签名信息,生成第一证明,所述第一证明用于证明第一世界状态是在第二世界状态的基础上执行N个所述交易集合中的交易后生成,所述第二世界状态为执行N个所述交易集合中的交易前的世界状态;
    将所述第一世界状态的树根和所述第一证明存储到第二区块链中。
  2. 根据权利要求1所述的方法,其中,N=1,所述根据第一世界状态的树根、第二世界状态的树根、M个所述签名信息,生成第一证明,包括:
    将所述第一世界状态的树根、所述第二世界状态的树根、M个所述签名信息输入预设证明函数,生成所述第一证明。
  3. 据权利要求1所述的方法,其中,N≥2,所述根据第一世界状态的树根、第二世界状态的树根、M个所述签名信息,生成第一证明,包括:
    执行第N个交易集合中的交易,以及,获取Q个所述第一账户的签名信息;
    根据Q个所述第一账户的签名信息、通过第(N-1)个交易集合生成的第二证明、所述第一世界状态的树根、所述第三世界状态的树根,生成所述第一证明,所述第二证明用于证明所述第三世界状态是在执行第(N-2)个交易集合得到的世界状态的基础上执行所述第(N-1)个交易集合中的交易后生成,所述第三世界状态为执行所述第(N-1)个交易集合中的交易得到的世界状态。
  4. 根据权利要求3所述的方法,其中,根据Q个所述第一账户的签名信息、通过第(N-1)个交易集合生成的第二证明、所述第一世界状态的树根、所述第三世界状态的树根,生成所述第一证明,包括:
    将Q个所述第一账户的签名信息、所述第二证明、所述第一世界状态的树根、所述第三世界状态的树根输入预设证明函数,生成所述第一证明。
  5. 根据权利要求1至4任一项所述的方法,其中,N个所述交易集合中包括第一交易集合,所述第一交易集合所包含的交易的执行使得S个所述第一账户的状态变化,1≤S≤M,所述获取每个所述第一账户对其状态的签名信息,包括:
    根据所述第一交易集合所包含的交易、第四世界状态和第五世界状态,生成第三证明,所述第四世界状态为执行所述第一交易集合中的交易后得到的世界状态,所述第五世界状态为执行所述第一交易集合中的交易之前最新得到的世界状态,所述第三证明用于证明所述第四世界状态是在所述第五世界状态的基础上执行所述第一交易集合中交易生成;
    向S个所述第一账户中每个账户对应的终端均发送用于获取所述签名信息的第一请求,所述第一请求中包括所述第三证明;
    获取S个所述第一账户中每个账户对应的终端返回的签名信息。
  6. 一种区块链节点,包括:
    处理单元,配置为依时间顺序依次执行N个交易集合中的交易,N≥1,所述N个交易集合中的交易的执行使得M个第一账户的状态变化,M≥1;
    获取单元,配置为获取每个所述第一账户对其状态的签名信息;
    所述处理单元,还配置为根据第一世界状态的树根、第二世界状态的树根、M个所述签名信息,生成第一证明,所述第一证明用于证明第一世界状态是在第二世界状态的基础上执行N个所述交易集合中的交易后生成,所述第二世界状态为执行N个所述交易集合中的交易前的世界状态;
    存储单元,配置为将所述第一世界状态的树根和所述第一证明存储到第二区块链中。
  7. 根据权利要求6所述的区块链节点,其中,当N=1时,所述处理单元,还配置为:
    将所述第一世界状态的树根、所述第二世界状态的树根、M个所述签名信息输入预设证明函数,生成所述第一证明。
  8. 据权利要求6所述的区块链节点,其中,当N≥2时,所述处理单元,还配置为:执行第N个交易集合中的交易;
    所述获取单元,还配置为获取Q个所述第一账户的签名信息;
    所述处理单元,还配置为:根据Q个所述第一账户的签名信息、通过第(N-1)个交易集合生成的第二证明、所述第一世界状态的树根、所述第三世界状态的树根,生成所述第一证明,所述第二证明用于证明所述第三世界状态是在执行第(N-2)个交易集合得到的世界状态的基础上执行所述第(N-1)个交易集合中的交易后生成,所述第三世界状态为执行所述第(N-1)个交易集合中的交易得到的世界状态。
  9. 根据权利要求8所述的区块链节点,其中,所述处理单元,还配置为:
    将Q个所述第一账户的签名信息、所述第二证明、所述第一世界状态的树根、所述第三世界状态的树根输入预设证明函数,生成所述第一证明。
  10. 根据权利要求5至7任一项所述的区块链节点,其中,N个所述交易集合中包括第一交易集合,所述第一交易集合所包含的交易的执行使得S个所述第一账户的状态变化,1≤S≤M;
    所述处理单元,还配置为:根据所述第一交易集合包含的交易、第四世界状态和第五世界状态,生成第三证明,所述第四世界状态为执行所述第一交易集合中的交易后得到的世界状态,所述第五世界状态为执行所述第一交易集合中的交易之前最新得到的世界状态,所述第三证明用于证明所述第四世界状态是在所述第五世界状态的基础上执行所述第一交易集合中交易生成;
    所述装置还包括:
    通信单元,配置为向S个所述第一账户中每个账户对应的终端均发送用于获取所述签名信息的第一请求,所述第一请求中包括所述第三证明;
    所述通信单元,还配置为获取S个所述第一账户中每个账户对应的终端返回的签名信息。
  11. 一种区块链系统,包括:第一区块链和第二区块链,其中,所述第一区块链中的第一节点用于执行权利要求1至5任一项所述的方法,所述第二区块链用于存储所述第一节点传输的所述第一世界状态的树根和所述第一证明。
  12. 根据权利要求11所述的区块链系统,其中,所述第二区块链还用于将第一世界状态的树根、第二世界状态的树根、所述第一证明输入预设的验证函数,以验证所述第一证明的正确性。
  13. 一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算设备中执行时,计算设备执行权利要求1至5任一项所述的方法。
  14. 一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时,实现权利要求1至5任一项所述的方法。
PCT/CN2022/135354 2022-04-28 2022-11-30 一种区块链中的数据处理方法及区块链节点 WO2023207080A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210462512.4A CN114780640A (zh) 2022-04-28 2022-04-28 一种区块链中的数据处理方法及区块链节点
CN202210462512.4 2022-04-28

Publications (1)

Publication Number Publication Date
WO2023207080A1 true WO2023207080A1 (zh) 2023-11-02

Family

ID=82435479

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135354 WO2023207080A1 (zh) 2022-04-28 2022-11-30 一种区块链中的数据处理方法及区块链节点

Country Status (2)

Country Link
CN (1) CN114780640A (zh)
WO (1) WO2023207080A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114780640A (zh) * 2022-04-28 2022-07-22 蚂蚁区块链科技(上海)有限公司 一种区块链中的数据处理方法及区块链节点
CN116634025B (zh) * 2023-07-25 2023-12-29 武汉趣链数字科技有限公司 一种确定交易顺序的方法、设备、系统和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021068728A1 (zh) * 2019-10-10 2021-04-15 深圳前海微众银行股份有限公司 一种区块的状态树的生成和链上数据验证的方法及装置
CN113269543A (zh) * 2021-05-24 2021-08-17 缀初网络技术(上海)有限公司 一种用于区块链的多层混合交易扩容系统及方法
CN113988865A (zh) * 2021-12-29 2022-01-28 国网电子商务有限公司 电力结算隐私保护方法及装置
CN114298842A (zh) * 2021-12-31 2022-04-08 深圳前海微众银行股份有限公司 应用于区块链的dapp的状态数据的管理方法及装置
CN114297304A (zh) * 2021-12-29 2022-04-08 迅鳐成都科技有限公司 一种产品信息区块链交易存储方法、服务器及可读介质
CN114780640A (zh) * 2022-04-28 2022-07-22 蚂蚁区块链科技(上海)有限公司 一种区块链中的数据处理方法及区块链节点

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021068728A1 (zh) * 2019-10-10 2021-04-15 深圳前海微众银行股份有限公司 一种区块的状态树的生成和链上数据验证的方法及装置
CN113269543A (zh) * 2021-05-24 2021-08-17 缀初网络技术(上海)有限公司 一种用于区块链的多层混合交易扩容系统及方法
CN113988865A (zh) * 2021-12-29 2022-01-28 国网电子商务有限公司 电力结算隐私保护方法及装置
CN114297304A (zh) * 2021-12-29 2022-04-08 迅鳐成都科技有限公司 一种产品信息区块链交易存储方法、服务器及可读介质
CN114298842A (zh) * 2021-12-31 2022-04-08 深圳前海微众银行股份有限公司 应用于区块链的dapp的状态数据的管理方法及装置
CN114780640A (zh) * 2022-04-28 2022-07-22 蚂蚁区块链科技(上海)有限公司 一种区块链中的数据处理方法及区块链节点

Also Published As

Publication number Publication date
CN114780640A (zh) 2022-07-22

Similar Documents

Publication Publication Date Title
US12008015B2 (en) Import and export in blockchain environments
WO2023207080A1 (zh) 一种区块链中的数据处理方法及区块链节点
TWI706276B (zh) 一種區塊鏈資料處理方法、裝置、處理設備及系統
CN111213340B (zh) 选择用于密码功能的证明委托并使其安全
US11477271B2 (en) Load balancing in blockchain environments
CN111461723B (zh) 基于区块链的数据处理系统及方法、装置
WO2020211484A1 (zh) 数据处理方法、装置、区块链客户端和区块链节点
US20210083856A1 (en) Improved hardware security module management
EP3841489A1 (en) Dag based methods and systems of transaction processing in a distributed ledger
WO2022121538A1 (zh) 基于区块链的数据同步方法、系统及相关设备
WO2022161181A1 (zh) 基于区块链的数据处理的方法、装置及电子设备
TW202008272A (zh) 區塊鏈交易方法及裝置、電子設備
US11201870B2 (en) Using commit tokens to coordinate permissions submissions to address transaction conflict in blockchain systems
CN111066047A (zh) 实现基于区块链的工作流
WO2020108054A1 (zh) 一种基于多个区块链网络的数据存证方法及系统
WO2023185059A1 (zh) 一种共识方法和区块链节点
WO2023231337A1 (zh) 在区块链中执行交易的方法、区块链的主节点和从节点
CN113821817B (zh) 基于区块链的数据处理方法、装置、设备及系统
WO2023109520A1 (zh) 基于区块链的随机数生成方法及装置
WO2024001032A1 (zh) 在区块链系统中执行交易的方法、区块链系统和节点
WO2023185042A1 (zh) 直连通道的建立方法及装置
WO2024066007A1 (zh) 区块链系统中的交易执行方法、共识节点和区块链系统
WO2023160093A1 (zh) 区块链的节点入网及装置和电子设备
CN114785800B (zh) 跨链通信方法、装置、存储介质及计算设备
CN112579343B (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: 22939894

Country of ref document: EP

Kind code of ref document: A1