WO2024124952A1 - 一种区块链数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 - Google Patents
一种区块链数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 Download PDFInfo
- Publication number
- WO2024124952A1 WO2024124952A1 PCT/CN2023/114284 CN2023114284W WO2024124952A1 WO 2024124952 A1 WO2024124952 A1 WO 2024124952A1 CN 2023114284 W CN2023114284 W CN 2023114284W WO 2024124952 A1 WO2024124952 A1 WO 2024124952A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- consensus
- local
- block
- node
- main chain
- 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
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/40—Network security protocols
Definitions
- the present application relates to the field of blockchain technology, and in particular to a blockchain data processing method, device, equipment, computer-readable storage medium, and computer program product.
- the business nodes in the business network need to rely on the consensus nodes deployed in the core consensus network to perform transaction packaging and block consensus. Therefore, the business nodes deployed in the business network of a single blockchain system do not participate in block consensus themselves, but serve as a ledger synchronization tool for a single chain involved in the single blockchain system.
- the consensus nodes e.g., packaging nodes
- a business node e.g., business node A
- a business node in the business network synchronizes from the single chain of the core consensus network to the corresponding block, it will not only synchronize the ledger data of transactions related to itself, but also synchronize the ledger data of transactions related to other business parties, thereby affecting the security and privacy of transaction data on the chain.
- the embodiments of the present application provide a blockchain data processing method, apparatus, device, computer-readable storage medium, and computer program product, which can improve the security and privacy of on-chain transaction data.
- the embodiment of the present application provides a blockchain data processing method, which is executed by a local consensus node in a local consensus network, wherein the local consensus network is deployed in a business network of a multi-layer chain network, and a core consensus network independent of the business network is also deployed in the multi-layer chain network, wherein the core consensus network includes a core consensus node; the method includes:
- the local consensus transaction, the main chain binding height and the main chain read data set are packaged into a local consensus block, wherein the local consensus transaction refers to a business transaction executed in the local consensus network, and the main chain binding height is the block height of the first global consensus block, which is obtained from the core consensus when packaging the local consensus transaction.
- the main chain read data set is synchronized to the main chain of the identification node, the main chain read data set is cleared from the first global contract state and is used to execute the local consensus transaction, and the first global contract state is the read data set read when executing the global consensus transaction in the first global consensus block;
- the local verification node Broadcasting the local consensus block to the local verification node, the local verification node is used to obtain the voting consensus result corresponding to the transaction execution result of the local consensus transaction when the synchronized block height is greater than or equal to the main chain binding height and the synchronized read data set is consistent with the main chain read data set, and the local verification node is a consensus node in the local consensus network other than the local consensus node;
- the local consensus block is chained to the local consensus subchain corresponding to the local consensus network, and the local consensus block is written into the local consensus ledger database.
- the embodiment of the present application provides a blockchain data processing method, which is executed by a core consensus node in a core consensus network; the core consensus network is deployed in a multi-layer chain network; a business network independent of the core consensus network in the multi-layer chain network is deployed with a local consensus network, and the local consensus network includes a local consensus node, and the method includes:
- the main chain synchronization request carries the block height of a third global consensus block
- the third global consensus block is a global consensus block synchronized from the main chain by the local consensus node before synchronizing to the first global consensus block
- the first global contract state is a set of read data read when executing a global consensus transaction in the first global consensus block;
- the first global consensus block and the first global contract state are returned to the local consensus node, and the local consensus node is used to package the local consensus transaction, the main chain binding height and the main chain read data set into a local consensus block based on the block height of the first global consensus block and the first global contract state, and when a consensus is reached on the local consensus block based on the local consensus network, the local consensus block is chained to the local consensus network.
- the embodiment of the present application provides a first blockchain data processing device, which runs on a local consensus node in a local consensus network, wherein the local consensus network is deployed in a business network of a multi-layer chain network, wherein a core consensus network independent of the business network is also deployed in the multi-layer chain network, wherein the core consensus network includes a core consensus node, and wherein the first blockchain data processing device includes:
- a packaging module configured to package a local consensus transaction, a main chain binding height, and a main chain read data set into a local consensus block, wherein the local consensus transaction refers to a business transaction executed in the local consensus network, the main chain binding height is the block height of a first global consensus block, the first global consensus block is synchronized from the main chain of the core consensus node when packaging the local consensus transaction, the main chain read data set is cleared from a first global contract state and is used to execute the local consensus transaction, and the first global contract state is a read data set read when executing a global consensus transaction in the first global consensus block;
- a consensus module configured to broadcast the local consensus block to a local verification node, wherein the local verification node is used to obtain a voting consensus result corresponding to a transaction execution result of the local consensus transaction when the synchronized block height is greater than or equal to the main chain binding height and the synchronized read data set is consistent with the main chain read data set, and the local verification node is a consensus node other than the local consensus node in the local consensus network;
- the processing module is configured to, when it is determined that a consensus is reached based on the voting consensus result returned by the local verification node, chain the local consensus block to the local consensus subchain corresponding to the local consensus network, and write the local consensus block into the local consensus ledger database.
- the embodiment of the present application provides a second blockchain data processing device, which runs on a core consensus node in a core consensus network, and the core consensus network is deployed in a multi-layer chain network; the business network in the multi-layer chain network is deployed with a local consensus network, and the local consensus network is constructed by a core consensus node in the core consensus network that is independent of the business network; the second blockchain data processing device includes:
- An acquisition module is configured to acquire a main chain synchronization request sent by a local consensus node, wherein the main chain synchronization request carries a block height of a third global consensus block;
- the third global consensus block is a global consensus block synchronized from the main chain by the local consensus node before synchronizing to the first global consensus block;
- a determination module is configured to determine, from the main chain, a global consensus block whose block height is greater than the block height of the third global consensus block as a first global consensus block that has not been synchronized to the local consensus node;
- the acquisition module is further configured to acquire a first global contract state of the first global consensus block from the main chain;
- the first global contract state is a set of read data read when executing a global consensus transaction in the first global consensus block;
- a data return module is configured to return the first global consensus block and the first global contract state to the local consensus node, and the local consensus node is used to package the local consensus transaction, the main chain binding height and the main chain read data set into a local consensus block based on the block height of the first global consensus block and the first global contract state, and when a consensus is reached on the local consensus block based on the local consensus network, the local consensus block is chained to the local consensus network.
- An embodiment of the present application provides an electronic device for blockchain data processing, the electronic device including a memory and a processor, the memory being connected to the processor, the memory being used to store a computer program, and the processor being used to call the computer program so that the electronic device executes the blockchain data processing method applied to a local consensus node provided in the embodiment of the present application, or so that the electronic device executes the blockchain data processing method applied to a core consensus node provided in the embodiment of the present application.
- An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
- the computer program is loaded and executed by a processor so that an electronic device executes the blockchain data processing method applied to a local consensus node provided in an embodiment of the present application, or so that an electronic device executes the blockchain data processing method applied to a core consensus node provided in an embodiment of the present application.
- An embodiment of the present application provides a computer program product, which includes a computer program or computer executable instructions.
- the computer program or computer executable instructions are executed by a processor, the blockchain data processing method applied to a local consensus node provided in the embodiment of the present application is implemented, or the blockchain data processing method applied to a core consensus node provided in the embodiment of the present application is implemented.
- the local consensus block to be on-chain can establish an association relationship with the main chain through the main chain binding height and the main chain read data set, and perform block consensus through the local consensus block and the local verification node in the local consensus network, and when it is determined that the block consensus is reached, the local consensus block is on-chain to the local consensus sub-chain, and the local consensus block is written to the local consensus ledger database independent of the main chain sub-ledger database.
- the block consensus of the local consensus block can be achieved in the local consensus network, and the local consensus block that has reached the block consensus can be written into the local consensus ledger database.
- the transaction data involved in the transactions executed in the local consensus network can be stored in the associated local consensus sub-chain to achieve hierarchical independent management of the transaction data of the business transactions of each business party, and achieve the isolation of different business data, thereby improving the security and privacy of on-chain transaction data.
- FIG1 is a schematic diagram of the architecture of a multi-layer chain network provided in an embodiment of the present application.
- FIG2 is a schematic diagram of a block consensus scenario based on a local consensus network provided in an embodiment of the present application
- FIG3 is a flow chart of a blockchain data processing method provided in an embodiment of the present application.
- FIG4 is a schematic diagram of a proposed block provided in an embodiment of the present application.
- FIG5 is a schematic diagram of a data review scenario provided in an embodiment of the present application.
- FIG6a is a schematic diagram of a blockchain framework based on a multi-layer chain network provided in an embodiment of the present application
- FIG6b is a schematic diagram of another blockchain framework based on a multi-layer chain network provided in an embodiment of the present application.
- FIG7 is a flowchart of a blockchain data processing method provided in an embodiment of the present application.
- FIG8 is a schematic diagram of an interaction of a block consensus provided by an embodiment of the present application.
- FIG9 is a flow chart of a blockchain data processing method provided in an embodiment of the present application.
- FIG10 is a schematic diagram of a hierarchical structure of a blockchain network
- FIG11 is a schematic diagram of the structure of a multi-layer blockchain network provided in an embodiment of the present application.
- FIG12 is a schematic diagram of the structure of a local consensus node provided in an embodiment of the present application.
- FIG13 is a flow chart of a multi-layer blockchain data processing process provided by an embodiment of the present application.
- FIG14 is a flow chart of a multi-layer blockchain data processing method provided in an embodiment of the present application.
- FIG15 is a schematic diagram of a process of archiving account data according to an embodiment of the present application.
- FIG16 is a flow chart of a ledger data archiving process provided in an embodiment of the present application.
- FIG17 is a flow chart of a ledger data archiving process provided in an embodiment of the present application.
- FIG18 is a flow chart of a multi-layer blockchain data processing method provided in an embodiment of the present application.
- FIG19 is a flow chart of a multi-layer blockchain data processing method provided in an embodiment of the present application.
- FIG20 is a schematic diagram of the structure of a blockchain data processing device provided in an embodiment of the present application.
- FIG21 is a schematic diagram of the structure of a blockchain data processing device provided in an embodiment of the present application.
- FIG22 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
- Figure 23 is a schematic diagram of a blockchain data processing system provided in an embodiment of the present application.
- FIG. 1 is a schematic diagram of the architecture of a multi-layer chain network provided in an embodiment of the present application.
- the multi-layer chain network architecture can be applied to a blockchain-based data system (hereinafter referred to as a blockchain system), such as a blockchain electronic bill system.
- the blockchain network corresponding to the blockchain data system can be a multi-layer chain network, which includes a business network and a core consensus network, the business network is in a public network, and the core consensus network is in a private network (for example, a private cloud); in addition, one or more independent local consensus networks can be deployed in the business network.
- the local consensus network in the business network can be represented as the local consensus network 100a, 100b, ... shown in FIG. 1 , only two local consensus networks are exemplified here, and the number of local consensus networks is not limited here, and the core consensus network can be represented as the core consensus network 200a shown in FIG. 1 .
- local consensus network 100a In the local consensus network 100a shown in FIG1 , multiple local consensus nodes are deployed, and local consensus nodes 10a, 10b, 10c, and 10d are exemplarily shown.
- the number of local consensus nodes deployed in the local consensus network 100a is not limited here. As business needs change, the number of local consensus nodes can change continuously.
- the local consensus nodes in the local consensus network 100a have a block consensus function and can maintain a local consensus subchain associated with the local consensus network 100a.
- the blockchain jointly maintained by multiple local consensus nodes in the local consensus network 100a is a local consensus subchain 10e.
- the business network also includes one or more local business nodes that have a network connection relationship with the local consensus network 100a, and local business nodes 30a, 30b, 30c, 30d, 30e, 30f, 30g, ..., 30n are exemplarily shown.
- the number of local business nodes is not limited here.
- the local consensus subchain in the local consensus network 100a is a blockchain independently managed by business party A, and the local business node that has a network connection relationship with the local consensus network 100a is the local business node corresponding to business party A.
- the local business node that has a network connection relationship with the local consensus network 100a can submit pending business transactions (such as business transaction A) to the local consensus node in the local consensus network 100a, and the local consensus node in the local consensus network 100a packages the business transaction A into the local consensus block A; finally, after reaching a block consensus for the local consensus block A in the local consensus network 100a, the local consensus node in the local consensus network 100a links the local consensus block A to the local consensus subchain 10e.
- business transactions such as business transaction A
- the local consensus network 100b shown in FIG1 multiple local consensus nodes are deployed, and local consensus nodes 11a, 11b, 11c, and 11d are exemplarily shown.
- the number of local consensus nodes deployed in the local consensus network 100b is not limited here. As business needs change, the number of local consensus nodes can change continuously.
- the local consensus nodes in the local consensus network 100b have a block consensus function and can maintain a local consensus subchain associated with the local consensus network 100b.
- the blockchain jointly maintained by multiple local consensus nodes in the local consensus network 100b is a local consensus subchain 11e.
- the business network also includes one or more local business nodes that have a network connection relationship with the local consensus network 100b, and local business nodes 31a, 31b, 31c, 31d, 31e, 31f, 31g, ..., 31n are exemplarily shown.
- the number of local business nodes is not limited here.
- the local consensus subchain in the local consensus network 100b is a blockchain independently managed by business party B, and the local business node that has a network connection relationship with the local consensus network 100b is the local business node corresponding to business party B.
- the local business node that has a network connection relationship with the local consensus network 100b can submit pending business transactions (such as business transaction B) to the local consensus node in the local consensus network 100b, and the local consensus node in the local consensus network 100b packages the business transaction B into the local consensus block B; finally, after reaching a block consensus on the local consensus block B in the local consensus network 100b, the local consensus node in the local consensus network 100b links the local consensus block B to the local consensus subchain 11e.
- business transactions such as business transaction B
- the core consensus network 200a as shown in FIG1 , multiple core consensus nodes are deployed, and core consensus nodes 20a, 20b, 20c, and 20d are exemplarily shown.
- the number of core consensus nodes deployed in the core consensus network 200a is not limited here, and the number of core consensus nodes can change continuously as business needs change.
- the blockchain jointly maintained by multiple core consensus nodes in the core consensus network 200a is the main chain 20e. It is understandable that the local consensus nodes in each local consensus network can synchronize the global consensus block on the main chain from the main chain. It is understandable that the local consensus network is created through the core consensus node.
- the business object (such as the business party) can send a registration transaction and a configuration transaction for the local consensus subchain to the core consensus node to activate the local consensus network, and enable the creation of the genesis block in the local consensus subchain on the local consensus node to start the local consensus subchain, thereby completing the creation of the local consensus network and the local consensus subchain.
- the local consensus node is the global business node corresponding to the core consensus node.
- the local consensus node can not only synchronize the data on the main chain through the core consensus node, but also generate business transactions and send them to the core consensus node.
- the local consensus node can perform transaction aggregation processing on the transaction execution results corresponding to the local consensus transactions in the local consensus network, obtain transaction aggregation information, and generate an information chain transaction carrying the transaction aggregation information, and finally send the information chain transaction to the core consensus node, which writes the information chain transaction to the main chain.
- the business transactions processed in the core consensus network are called global consensus transactions
- the business transactions processed in the local consensus network are called local consensus transactions.
- Global consensus transactions and local consensus transactions can be different.
- the consensus mechanism for local consensus blocks extracted by the embodiment of the present application is used to realize the consensus and chain of local consensus blocks in the local consensus network, so as to realize that some global consensus transactions that can only be processed by core consensus nodes in the core consensus network are moved to the local consensus network and executed by local consensus nodes; that is, the global consensus transactions moved to the local consensus network are used as local consensus transactions, and the transaction data involved in the local consensus transaction is written into the local consensus subchain; in this way, not only the security of transaction data involved in local consensus transactions can be improved, but also the business processing load can be shared by the local consensus network for the core consensus network, reducing the data confusion and stability on the main chain.
- the set of read data required to be read when executing local consensus transactions can be partly from the data cleared from the main chain, such as the local consensus node can clear the global contract status data from the main chain, and the global contract status data can refer to the set of read data read when calling the global consensus on the main chain to execute the global consensus transaction. Therefore, when executing local consensus transactions, the data on the main chain can be referenced to reuse the contract status data on the main chain.
- the core consensus node is used to reach a consensus in the core consensus network where the corresponding main chain is located, and the local consensus node is used to reach a consensus in the local consensus network where the corresponding local consensus subchain is located.
- the core consensus network or any local consensus network has the same principle of writing the transaction data involved in the business transaction into the corresponding blockchain account book (for example, a distributed database).
- the process of writing the transaction data in the local consensus network into the corresponding blockchain account book can be that the client sends the transaction data to a local business node, and then the transaction data is passed between the local business nodes in the local consensus network in a relay manner until the designated local consensus node in the local consensus network (for example, the local consensus node 10a in the local consensus network 100a) receives the transaction data.
- the local consensus node packs the transaction data into a block so that it can be used for subsequent block consensus with other local consensus nodes, so that after the block consensus is passed, the local consensus block that has passed the consensus can be written into the distributed database of the local consensus network (for example, the local consensus network 100a) where it is located.
- blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism and encryption algorithm, which is used to organize data in chronological order and encrypt it into a ledger to make it impossible to be tampered with or forged, and can also verify, store and update data.
- a decentralized database each node in the database stores the same blockchain, and the blockchain network divides the nodes into core nodes and light nodes (such as SPV nodes); wherein the core node is used to reach a consensus on the entire blockchain network, that is, the core node is a consensus node in the blockchain network.
- the process of writing transaction data into an account book (e.g., a local account book) in a blockchain network includes: the client sends the transaction data to the light node, and then the transaction data is passed between the light nodes in the blockchain network in a relay manner until the consensus node receives the transaction data, and the consensus node then packs the transaction data into a block so that it can be subsequently reached with other consensus nodes.
- the consensus is passed, at least one block carrying the transaction data can be written to the distributed database in parallel through the storage layer, which can break through the limitations of the blockchain structure of the blockchain from the root, and can effectively improve the storage efficiency of data storage.
- the consensus node in the core consensus network is a core consensus node (the core consensus node 20a in the core consensus network 200a shown in Figure 1).
- the consensus nodes in the local consensus network are both core nodes with block consensus capabilities in the local consensus network and light nodes in the business network that can clear transaction data from the main chain (as shown in the local consensus node 11a in the local consensus network 100b in Figure 1).
- the blockchain system can include smart contracts, which are a kind of code executed by each node (including consensus node) of the blockchain system in the blockchain system, and any logic can be executed and the result can be obtained through the smart contract.
- smart contracts which are a kind of code executed by each node (including consensus node) of the blockchain system in the blockchain system, and any logic can be executed and the result can be obtained through the smart contract.
- the smart contract deployed on the blockchain in response to the transaction service request, the smart contract deployed on the blockchain is called, and then the data node or light node on the blockchain can send the transaction service request to the consensus node to call the smart contract running in each consensus node to execute the transaction service.
- the blockchain can include one or more smart contracts, which can be distinguished by the contract call address, contract identification number (Identity Document, ID) or contract name, and the transaction service request initiated by the client can also carry the contract call address or contract identification number or contract name of the smart contract to specify the smart contract to be run.
- the smart contract specified by the client is a contract that needs to read data (i.e., a business contract)
- each consensus node will give priority to accessing the local cache in the storage layer to read the data.
- each consensus node will verify whether the transaction execution results are consistent with each other (that is, reach a consensus).
- the transaction execution results can be stored in their respective local caches and local storages, and the transaction execution results of the above-mentioned transaction business can be returned to the client.
- the local cache here is the system memory created in the storage layer
- the local storage here is the hard disk space created in the storage layer for data storage. In this way, when a consensus node goes down or the system fails, the data in the system memory will not disappear, which will cause the phenomenon of being unable to read the data. That is, the consensus node can also read the data through the local storage in the storage layer.
- any two blockchain nodes in any consensus network can form a peer-to-peer (P2P) network, and the peer-to-peer network can adopt the P2P protocol, wherein the P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol.
- P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol.
- TCP Transmission Control Protocol
- any device such as a server, a terminal, etc. can join and become a blockchain node, wherein each blockchain node can include a hardware layer, an intermediate layer, an operating system layer, and an application layer.
- the embodiment of the present application can bind a blockchain node to any type of business party (for example, any individual user, any enterprise, any institution, etc.) that accesses the blockchain network, so that the blockchain network composed of these blockchain nodes is collectively referred to as a consortium chain network. Therefore, the local consensus nodes 10a, 10b, etc. shown in Figure 1 can have a one-to-one correspondence with the corresponding business parties (i.e., the entity objects in the corresponding business scenarios) to be connected to the consortium chain network.
- the business scenarios here can include electronic bill scenarios, social scenarios, etc.
- the target business in the corresponding business scenario may specifically include electronic bill business, social business, credit business, credit business, etc., and the specific businesses in the corresponding business scenario will not be listed one by one here. Therefore, the embodiment of the present application can be applied to any business scenario where a blockchain network can be deployed, and the above-mentioned blockchain data system can also be adapted to the business scenario of a specific application.
- the business transactions executed on the local consensus network and the business parties initiating the business transactions may be different. That is, the local consensus network can be created based on different types of business parties. For example, the business parties can be divided according to the region, and the business parties in different regions access the local consensus networks corresponding to their respective regions. For example, the main chain can be used to store transaction data related to the national bill business.
- the business party in region A can access the local consensus network A corresponding to region A to perform bill business transactions related to region A in the local consensus network A (such as performing bill lottery business related to region A in region A).
- the local consensus subchain in the local consensus network A can be used to store transaction data related to the bill business of region A; the business party in region B can access the local consensus network corresponding to region B to perform bill business transactions related to region B in the local consensus network (such as performing bill lottery business related to region B in region B).
- the local consensus subchain in the local consensus network B can be used to store transaction data related to the bill business of region B.
- a local consensus subchain independent of the main chain and dedicated to serving various business parties can be built for various business parties.
- Business transactions related to each business party can be conducted in the local consensus networks corresponding to each business party, and the transaction data involved in the business transactions related to each business party can be packaged and uploaded to the local consensus sub-chain associated with each business party, so as to achieve the security, privacy and data isolation of transaction data.
- Figure 2 is a schematic diagram of a block consensus scenario based on a local consensus network provided by an embodiment of the present application.
- a consensus mechanism for local consensus blocks is proposed.
- a block consensus for local consensus blocks that are different from the global consensus blocks on the main chain can be achieved in the local consensus network, and after reaching a block consensus, the block is chained, so that the local consensus network has a local consensus subchain that is different from the main chain, and the local consensus blocks on the local consensus subchain are associated with the main chain, so as to facilitate the management of the local consensus subchain by the main chain.
- the local consensus node proposed in the embodiment of the present application can be any local consensus node in Figure 1 (such as the local consensus node 10a in the local consensus network 100a, or the local consensus node 10b, or the local consensus node 10c).
- the block consensus and chain-up process of the local consensus block can be: the local consensus node obtains the cached local consensus transaction from the transaction pool to package the obtained local consensus transaction into the proposed block.
- the main chain binding height and the main chain read data set can be obtained from the main chain sub-ledger database of the local consensus node, and the main chain binding height and the main chain read data set, as well as the local consensus transaction, are packaged into the proposed block.
- the proposed block containing the main chain binding height, the main chain read data set and the local consensus transaction can be used as the local consensus block to be consensused.
- the local consensus block is broadcast to the local verification nodes in the local consensus network.
- the local verification node can audit the main chain binding height and the main chain read data set in the local consensus block, and when the data audit is successful, it can vote on the transaction execution result obtained by executing the local consensus transaction to obtain the voting consensus result.
- the local consensus node receives the voting consensus result returned by the local verification node. When it is determined that the block consensus is reached based on the voting consensus result, it indicates that the consensus process of the local consensus block is completed.
- the local consensus block can be chained to the maintained local consensus sub-chain, and the local consensus block can be written into the local consensus ledger database independent of the main chain sub-ledger database.
- the main chain read data set refers to the data that needs to be read from the main chain when executing local consensus transactions.
- the global contract status of the global consensus business contract For example, the global contract status of the global consensus business contract.
- the local consensus block can be associated with the main chain, so that the main chain read data set can be referenced when executing the local consensus transaction in the local consensus block, and the main chain binding height enables each consensus node (that is, the local consensus node and the local verification node) to verify the consistency of the main chain read data set when performing data audit on the main chain read data set, so as to ensure that the transaction execution results of the local consensus transaction executed based on the main chain read data set are consistent.
- the process of block consensus can be: data auditing of the main chain binding height and the main chain read data set in the local consensus block, executing the local consensus transaction in the local consensus block to obtain the transaction execution result when the data audit is successful, and mutually verifying the transaction execution results obtained by each consensus node (that is, the block consensus result) with other consensus nodes, when it is determined that there are a certain number of consensus nodes that have obtained transaction execution results that are consistent with the transaction execution results obtained by itself, generating a voting consensus result indicating that the transaction results are consistent (that is, performing voting consensus), when receiving the voting consensus results returned by other consensus nodes, and determining that there are a certain number of voting consensus results in the current voting consensus results that indicate that the transaction results are consistent, it is determined that the block consensus is reached, and
- the local consensus node 10a uses the transaction execution result obtained by executing the local consensus transaction as the first transaction result, and obtains the transaction execution results obtained by the local consensus nodes 10b to 10d, and uses the transaction execution results obtained by the local consensus nodes 10b to 10d as the second transaction result.
- the first transaction result and the second transaction result are compared. If it is determined that there are a certain number of second transaction results that are the same as the first transaction result, it means that the transaction execution results are consistent. At this time, a voting consensus result indicating a vote in favor is generated.
- the local consensus node 10a obtains the voting consensus results obtained by the local consensus nodes 10b to 10d. If the number of results indicating a vote in favor among the voting consensus results obtained by the local consensus nodes 10a to 10d reaches a certain number, it means that a block consensus has been reached.
- each local consensus node when it is conducting block consensus, it will not only conduct data review on the main chain binding height and the main chain read data set, but also vote on the transaction execution results, and determine whether to reach a block consensus based on the voting consensus results obtained and received by itself.
- the local consensus nodes 10b, 10c and 10d are local verification nodes; and for the local consensus node 10b, the local consensus nodes 10a, 10c and 10d are local verification nodes; and for the local consensus node 10c, the local consensus nodes 10b, 10a and 10d are local verification nodes; and for the local consensus node 10d, the local consensus nodes 10b, 10c and 10a are local verification nodes; local consensus nodes 10a-10d will all vote on the local consensus nodes in the local consensus nodes.
- the main chain binding height and the main chain read data set are used for data audit, and when the data audit is successful, the transaction execution result obtained by executing the local consensus transaction (the transaction execution result refers to the block consensus result obtained by performing block consensus on the local consensus block) is voted on to obtain the voting consensus result, and the voting consensus result is sent to the remaining local consensus nodes respectively (for example, the local consensus node 10a sends the voting consensus result to the local consensus nodes 10b to 10d).
- the local consensus nodes 10a to 10d will determine whether the block consensus is reached based on their own voting consensus results and the received voting consensus results, and when it is determined that the block consensus is reached, the local consensus block will be put on the chain to realize the construction of the local consensus sub-chain.
- the local consensus node may include: local sub-chain consensus RPC (Re mote Procedure Call, remote procedure call) component 2-1, local sub-chain consensus component 2-2, local chain transaction execution component 2-3, local consensus ledger database 2-4, main chain consensus RPC component 2-5, main chain forwarding and chaining component 2-6, main chain clearing and synchronization component 2-7, main chain contract status reading component 2-8, main chain sub-ledger database 2-9.
- the local consensus node includes two parts (part 1 corresponds to 2-1 to 2-4 shown in Figure 2, and part 2 corresponds to 2-5 to 2-9 shown in Figure 2).
- Part 1 is used to receive local consensus transactions, package local consensus transactions into local consensus blocks, and perform block consensus and chaining on local consensus blocks;
- Part 2 is used to synchronize the main chain data, and clear the main chain data related to itself from the synchronized main chain data (such as the global contract state required to be referenced from the main chain when executing local consensus transactions), and can also generate business transactions that need to be executed by the main chain and forward them to the chain.
- the local consensus ledger database 2-4 and the main chain sub-ledger database 2-9 are independent of each other.
- the local consensus node 10a can synchronize the global consensus block on the main chain and the global contract state associated with the global consensus block from the core consensus node in the core consensus network 200a (for example, any one of the core consensus node 20a, core consensus node 20b, core consensus node 20c and core consensus node 20d) through the main chain clearing synchronization component 2-7, and write the synchronized main chain data into the main chain sub-ledger database 2-9.
- the core consensus node in the core consensus network 200a for example, any one of the core consensus node 20a, core consensus node 20b, core consensus node 20c and core consensus node 20d
- the local consensus node 10a can synchronize the main chain through the core consensus node 20c in the core consensus network 200a; when the local consensus node 10a generates a business transaction to be uploaded to the main chain, it can trigger the main chain consensus RPC component 2-5 to call the main chain forwarding component 2-6 to forward the business transaction to be uploaded to the main chain to the core consensus node 20c, and the core consensus node 20c writes the business transaction received from the main chain forwarding component 2-6 to the main chain.
- the main chain consensus RPC component 2-5 can perform transaction verification on the business transaction to be uploaded to the main chain, and call the main chain forwarding component 2-6 through the main chain consensus RPC component 2-5 to forward the verified business transaction to the core consensus node 20c.
- the local consensus node 10a when receiving a local consensus transaction, can call the local sub-chain consensus RPC component 2-1 to verify the local consensus transaction and put it into the transaction pool, and call the local sub-chain consensus component 2-2 through the local sub-chain consensus RPC component 2-1 to obtain the cached local consensus transaction from the transaction pool, and the local sub-chain consensus component 2-2 will package the obtained local consensus transaction into the proposal block.
- the main chain contract state number reading component 2-8 can be called through the local sub-chain consensus component 2-2 to obtain the main chain binding height and the main chain read data set from the main chain sub-ledger database 2-9, and the local sub-chain consensus component 2-2 will package the obtained main chain binding height and the main chain read data set into the proposal block.
- the proposal block is the local consensus block to be agreed upon.
- the local consensus block is state-bound with the main chain through the main chain binding height, and the main chain is referenced by the main chain read data set.
- the local sub-chain consensus component 2-2 performs block consensus on the local consensus block
- the local consensus block can be broadcast to the local verification nodes (such as local consensus nodes 10b to 10d) in the local consensus network, so that the local consensus node 10a and the local consensus nodes 10b to 10d can vote on the local consensus block.
- the local consensus node 10a can perform data audit on the main chain binding height and the main chain read data set in the local consensus block through the local sub-chain consensus component 2-2, and perform block consensus on the local consensus block to obtain the block consensus result when the data audit is successful, and perform voting consensus based on the block consensus result to obtain the voting consensus result.
- the local consensus node 10a can receive the voting consensus result returned by the local consensus nodes 10b to 10d, and when it is determined that the block consensus is reached based on its own voting consensus result and the voting consensus result returned by the local consensus nodes 10b to 10d, the local consensus block is chained to the local consensus sub-chain corresponding to the local consensus network, and the local consensus block is written into the main chain sub-ledger database 2-9, for example, the local sub-chain consensus component 2-2 can write the local consensus block into the main chain sub-ledger database 2-9, or the local chain transaction execution component 2-3 can write the local consensus block into the main chain sub-ledger database 2-9. It can be understood that if the data audit is unsuccessful, the execution of block consensus on the local consensus block is terminated. The subsequent process of identification.
- the local consensus node 10a performs block consensus on the local consensus block to obtain the block consensus result, including: calling the local chain transaction execution component 2-3 through the local sub-chain consensus component 2-2 to execute the local consensus transaction in the local consensus block to obtain the transaction execution result, and using the transaction execution result as the block consensus result.
- the local chain transaction execution component 2-3 executes the local consensus transaction, it can call the local consensus business contract to read the main chain read data set in the local consensus block, and execute the local consensus transaction through the read main chain read data set to achieve data reference for the main chain.
- the local consensus node 10a can mutually verify with other local consensus nodes through the local sub-chain consensus component 2-2 whether the block consensus results are consistent (for example, whether there are a certain number of block consensus results that are the same as the block consensus results obtained by the local consensus node 10a, if so, it means that a consensus is reached), if a consensus is reached, a voting consensus result indicating a vote in favor is generated, and if a consensus is not reached, a voting consensus result indicating a vote against is generated.
- the core consensus nodes and local consensus nodes involved in the embodiments of the present application may be electronic devices, which may be independent physical servers, or server clusters or distributed systems composed of multiple physical servers. They may also be cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
- cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
- a prompt interface or pop-up window may be displayed.
- the prompt interface or pop-up window is used to prompt the business object that it is currently collecting data such as invoice assets, and after obtaining the confirmation operation of the business object on the prompt interface or pop-up window, the relevant steps of data acquisition are started, otherwise it ends.
- business data of users and other business objects may be involved (for example, when executing local consensus transactions in local consensus blocks, depending on the local consensus transactions, it may involve the need to obtain invoicing information, credit information, tax refund information, the company's income and expenditure, corporate qualifications and other information).
- local consensus transactions in local consensus blocks, depending on the local consensus transactions, it may involve the need to obtain invoicing information, credit information, tax refund information, the company's income and expenditure, corporate qualifications and other information.
- the following describes the process of block consensus on local consensus blocks in a local consensus network.
- FIG. 3 is a flow chart of a blockchain data processing method provided by an embodiment of the present application.
- the method can be executed by a local consensus node in the local consensus network mentioned above.
- the local consensus node can be any local consensus node in the local consensus network 100a shown in FIG. 1 .
- the method includes the following steps S301 to S303, and each step is described below.
- the local consensus transaction refers to the business transaction executed in the local consensus network.
- the main chain binding height is the block height of the first global consensus block.
- the first global consensus block is synchronized from the main chain of the core consensus node when packaging the local consensus transaction.
- the main chain read data set is cleared from the first global contract state and is used to execute the local consensus transaction.
- the first global contract state is the read data set read when executing the global consensus transaction in the first global consensus block.
- the local consensus node can obtain the cached local consensus transactions from the transaction pool and package the local consensus transactions into the proposal block.
- the proposal block includes block data such as the block header and the packaged transaction list.
- the block height of the global consensus block synchronized from the main chain can be obtained from the main chain sub-ledger database, and the block height synchronized at this time is used as the main chain binding height.
- the local consensus node can also obtain the main chain read data set associated with the currently packaged local consensus transaction from the synchronized global consensus block.
- the main chain read data set refers to the data that needs to be read from the main chain when executing the local consensus transaction, such as the contract status associated with the global consensus business contract.
- the local consensus node can package the main chain binding height and the main chain read data set, as well as the local consensus transaction, into the proposal block to obtain a proposal block associated with the main chain.
- Figure 4 is a schematic diagram of a proposal block provided in an embodiment of the present application; wherein, the proposal block 4-1 may include block header data 4-11 (such as block height, proposer, random number, timestamp and other data), a transaction list 4-12 of a local consensus transaction (such as including transaction 1, transaction 2, ....), a main chain binding height 4-13 and a main chain read data set 4-14; the main chain read data set 4-14 represents the global contract state that needs to be read from the main chain when executing the local consensus transaction in the transaction list 4-12, and the main chain read data set 4-14 includes one or more key-value pairs (for example, expressed as [key1: value1; key2: value2; ....]), "keyx: valuex” represents a key-value pair, "keyx” keyx represents the key-value data read, and "
- the global consensus block that is most recently synchronized when the local consensus transaction is packaged can be called the first global consensus block; that is, the main chain binding height is the block height of the first global consensus block synchronized from the main chain maintained by the core consensus node when the local consensus transaction is packaged. For example, if the current block height of the global consensus block on the main chain is 100, and the block height of the global consensus block that the local consensus node has most recently synchronized from the main chain when packaging the local consensus transaction is 80, then the main chain binding height is 80, and the most recently synchronized global consensus block is the first global consensus block.
- the global consensus block corresponding to the maximum global block height is obtained from the main chain through the core consensus node
- the global consensus block corresponding to the maximum global block height is used as the first global consensus block
- the maximum global block height is used as the main chain binding height.
- the local consensus node will synchronize the latest global consensus block on the main chain from the main chain, and use the latest global consensus block on the main chain as the first global consensus block, and use the block height of the latest global consensus block on the main chain as the main chain binding height.
- the main chain sub-ledger database is used to store the first global consensus block synchronized from the main chain and the first global contract state associated with the first global consensus block.
- the first global contract state is the set of read data read when the global consensus business contract on the main chain is called in the core consensus network to execute the global consensus transaction in the first global consensus block.
- the main chain read data set is the set of read data required to be read from the first global contract state data for executing local consensus transactions.
- the local consensus node can determine the data to be used on the main chain (that is, key-value data) for the local consensus transaction when packaging the local consensus transaction, and read the data to be used from the main chain sub-ledger database (that is, read the latest value data from the main chain sub-ledger database according to the key-value data), thereby obtaining the main chain read data set and completing the data reference to the main chain.
- the lottery rules can be declared in the global consensus business contract as a global contract state.
- the local consensus node When the local consensus node synchronizes data from the main chain, it will also synchronize this global contract state and put it into the main chain sub-ledger database.
- a local Consensus transaction When packaging the lottery business transaction initiated by the business party (called a local Consensus transaction), if it is determined that the global contract state corresponding to the lottery rules is read from the main chain, the lottery rules are obtained from the main chain sub-ledger database to construct the main chain read data set and package it into the local consensus block.
- the subsequent local consensus node can read the lottery rules from the main chain read data set when executing the lottery business transaction in the local consensus block, and execute the lottery business transaction based on the lottery rules read from the main chain and the relevant local consensus business contract.
- the lottery rules represent the data referenced from the main chain. It can be understood that according to different local consensus transactions, the global contract state referenced from the main chain in different scenarios is different, determined according to the specific blockchain scenario, which is only an example here and is not limited.
- the main chain binding height is used to bind the local consensus block currently undergoing block consensus to the main chain for state binding (also known as contract state data binding).
- state binding also known as contract state data binding
- the local consensus block will determine the block height of the synchronized global consensus block when packaging the local consensus transaction, and obtain the latest main chain read data set from the data synchronized to the main chain.
- the main chain binding height is 100
- the global consensus block synchronized to the main chain when packaging the local consensus transaction is the global consensus block with a block height of 100
- the global contract state data associated with the synchronized global consensus block with a block height of 100 and the previous global consensus block i.e., the global consensus block with a block height of 0-100
- the latest read data set required to execute the local consensus transaction is cleared as the main chain read data set.
- the local consensus network is created by the core consensus node in the core consensus network.
- the local consensus node When creating the local consensus network, the local consensus node will create the genesis block of the local consensus subchain to start the local consensus subchain; the process includes: synchronously writing the target consensus block with the registration transaction from the main chain, the registration transaction is a business transaction that points to the core consensus node to apply for registration of the local consensus subchain, the target consensus block includes the configuration transaction corresponding to the registration transaction, the configuration transaction carries the configuration information of the genesis block on the local consensus subchain, obtains the configuration information from the target consensus block, and after the configuration information is successfully verified, creates the genesis block in the local consensus network, and starts the local consensus subchain based on the genesis block. It can be understood that when the genesis block is created and the local consensus subchain is started through the core consensus network, it means that the local consensus network is created and activated.
- the registration transaction is initiated by the business party, and the registration transaction can carry information such as the hash data of the genesis block.
- the core consensus node executes the registration transaction to obtain the local consensus subchain identifier, and writes the registration transaction and the local consensus subchain identifier into the main chain. For example, after writing into the main chain, the block height where the registration transaction is located is X.
- the business party can initiate a configuration transaction, which carries the configuration information of the genesis block in the local consensus subchain.
- the core consensus node can write the configuration transaction into the main chain.
- the local consensus node first needs to synchronize at least the global consensus block with a block height of X from the main chain (i.e., the target consensus block), and search for the configuration information of the genesis block from the synchronized global consensus block. If the global consensus block with a block height of X is not found, it will continue to synchronize subsequent global consensus blocks until the global consensus block containing the configuration information is found.
- the local consensus node can specify the identifier of the local consensus subchain and configure the configuration information of the genesis block through the subchain startup service, and compare the configuration information obtained from the main chain and the configuration information configured in the local consensus node (that is, the configuration information is successfully verified). When the comparison result indicates consistency (that is, the information verification is successful), a genesis block is created to start the local consensus subchain. At this time, the local consensus network is started accordingly.
- the local verification node is the consensus node other than the local consensus node in the local consensus network.
- the local consensus block when a local consensus block is to be block-consensused, the local consensus block must first be broadcast to the local verification nodes in the local consensus network.
- the local verification node is a consensus node other than the local consensus node in the local consensus network.
- the local consensus network may include multiple local consensus nodes.
- any local consensus node packages a local consensus transaction to generate a local consensus block and performs block consensus on the local consensus block, the remaining local consensus nodes in the local consensus network can serve as local verification nodes of the current local consensus node.
- any local verification node receives a local consensus block, it is necessary to perform block consensus on the local consensus block.
- the remaining local consensus nodes corresponding to any local verification node are also local verification nodes of any local verification node.
- the block consensus process performed is the same.
- each local consensus block determines that the local consensus block has reached a block consensus
- each local consensus node links the local consensus block to the local consensus subchain.
- the block consensus process of the local verification node on the local consensus block can be: data audit of the main chain binding height and the main chain read data set in the local consensus block, and the block header and transaction list in the local consensus block are verified for legitimacy (for example, format verification and validity verification of the local consensus transaction in the transaction list). If the data audit is successful and the legitimacy verification is successful, the transaction execution result obtained by executing the local consensus transaction is voted on to obtain a voting consensus result, which will be sent to the remaining local consensus nodes; if the data audit is unsuccessful or the legitimacy transaction is unsuccessful, the block consensus process is terminated.
- the process and principle of data audit of the main chain binding height and the main chain read data set by each local verification node are the same, including: obtaining the block height of the global consensus block that is latest synchronized from the main chain when the block consensus is performed from the main chain sub-ledger database, and the block height of the latest synchronized global consensus block (called the block height of the second global consensus block), and auditing the main chain binding height and the main chain read data set according to the block height of the second global consensus block.
- local consensus nodes can synchronize global consensus blocks from the main chain, and accordingly, local verification nodes will also continuously synchronize global consensus blocks from the main chain.
- the process of synchronizing the global consensus block can be: calling the main chain clearing synchronization component to generate a main chain clearing synchronization request, the main chain clearing synchronization request carries the block height of the first global consensus block, sending the main chain clearing synchronization request to the core consensus node, receiving the global block to be synchronized returned by the core consensus node, and at this time, the global block to be synchronized can be used as the second global consensus block.
- the main chain clearing synchronization request is used to instruct the core consensus node to determine the global consensus block that has not been synchronized to the local consensus node from the main chain based on the global clearing synchronization rule and the block height of the first global consensus block, and select the global block to be synchronized from the global consensus block that has not been synchronized to the local consensus node.
- the local consensus node receives the global block to be synchronized, it can determine whether the global block to be synchronized is the same as the first global consensus block, that is, to determine the block height of the global block to be synchronized and the block height of the first global consensus block.
- the data audit of the main chain binding height and the main chain read data set according to the block height of the second global consensus block can be that the block height of the second global consensus block is used as the block height to be confirmed. If the main chain binding height is less than or equal to the block height to be confirmed, the read data set associated with the first global consensus block is searched from the main chain sub-ledger database, and the read data set is used as the read data set to be confirmed. If the read data set to be confirmed is consistent with the main chain, If the read data set is consistent, it means that the data audit is successful. That is to say, the local verification node will obtain the read data set associated with the first global consensus block from the local main chain sub-ledger database based on the main chain read data set.
- the read data set associated with the first global consensus block includes key-value data contained in multiple key-value pairs, which are the same as the key-value data contained in multiple key-value pairs included in the main chain read data set.
- the local verification node searches for the value data corresponding to the key-value data locally to construct the read data set associated with the first global consensus block. By comparing the main chain read data set with the locally stored read data set, the consistency of the referenced main chain data can be ensured.
- the main chain read data set includes a key-value pair representing a lottery rule.
- the local verification node can search for the lottery rule from the local main chain sub-ledger database.
- the searched lottery rule is the key-value pair in the read data set associated with the first global consensus block (that is, the key-value pair in the read data set to be confirmed).
- the lottery rules in the main chain read data set and the lottery rules in the read data set to be confirmed can be compared to determine whether the key-value pair in the main chain read data set in the local consensus block is consistent with the key-value pair synchronized locally.
- the main chain binding height is less than or equal to the block height to be confirmed, it means that the global consensus block synchronized by the local verification node during block consensus is equal to or more than the global consensus block synchronized by the local consensus node when packaging the local consensus transaction.
- the local verification node locally stores the global contract state synchronized by the local consensus node when packaging the local consensus transaction, so the local verification node can perform data audit through the main chain read data set.
- the main chain binding height is greater than the block height to be confirmed, it means that the global consensus block synchronized by the local verification node during block consensus is less than the global consensus block synchronized by the local consensus node when packaging the local consensus transaction.
- the local verification node does not locally store all the global contract states synchronized by the local consensus node when packaging the local consensus transaction, so the local verification node cannot perform consistency verification on the main chain read data set, and cannot participate in the voting consensus of the local consensus block.
- the main chain binding height is less than or equal to the block height to be confirmed, it means that the local verification node has been synchronized to the global consensus block corresponding to the main chain binding height (that is, the first global consensus block). Therefore, the global contract state associated with the global consensus block with the synchronized block height as the main chain binding height and the previous global consensus block (that is, the global consensus block from block height 0 to the main chain binding height) can be found to obtain the set of read data to be confirmed.
- the local verification node When the local verification node performs voting consensus, it includes: performing block consensus on the local consensus block to obtain the block consensus result, performing voting consensus based on the block consensus result, and obtaining the voting consensus result.
- performing block consensus on the local consensus block to obtain the block consensus result can be to call the local consensus business contract to execute the local consensus transaction in the local consensus block, and use the transaction execution result obtained by executing the local consensus transaction as the block consensus result when performing block consensus on the local consensus block.
- Voting consensus based on the block consensus result can be to compare the block consensus result between consensus nodes.
- a voting consensus result indicating voting approval can be generated, which indicates that the block consensus result is consistent, that is, the local verification node agrees to chain the local consensus block to the local consensus subchain.
- the voting consensus result of a local verification node will be sent to other local verification nodes and local consensus nodes, and it will also receive the voting consensus results sent by other local verification nodes and local consensus nodes.
- the local consensus node that packages and generates the local consensus block will also execute the above-mentioned voting consensus process and send the obtained voting consensus results to the local verification node.
- each local consensus node in the local consensus network when each local consensus node in the local consensus network performs block consensus on the local consensus block, it will execute the local consensus transaction in the local consensus block to obtain the block consensus result, and The local consensus nodes (partial consensus nodes and local verification nodes) mutually verify whether the block consensus results are consistent to generate the corresponding voting consensus results.
- Each local consensus node can receive the voting consensus results generated by the other local consensus nodes.
- each local consensus node when it performs block consensus, it will perform the steps of data auditing the main chain binding height and the main chain read data set, and during the data audit, it will determine whether the block height of the synchronized global consensus block is greater than or equal to the main chain binding height, and from the global consensus block corresponding to the main chain binding height and the global contract state associated with the previous global consensus block, find the read data set associated with the first global consensus block as the data set to be confirmed, and perform consistency verification on the main chain read data set based on the data set to be confirmed.
- Figure 5 is a schematic diagram of a data audit scenario provided by an embodiment of the present application; as shown in Figure 5, for example, at this time, the local consensus node 50a packages the local consensus transaction at time point A, obtains the block height of the global consensus block synchronized at time point A (that is, the block height of the first global consensus block), for example, the height value of the block height synchronized at this time is 100, then the block height 100 is used as the main chain binding height, and the main chain read data set is searched from the global contract state associated with the global consensus blocks 0 to 100 in the main chain sub-ledger database (for example, the key-value pairs in the main chain read data set here can be expressed as: [k1:v1; k2:v2]), thereby broadcasting the obtained local consensus block to local consensus nodes 50b, 50c and 50d.
- the key-value pairs in the main chain read data set here can be expressed as: [k1:v1; k2:v2]
- the main chain synchronization height maintained locally at time point B can be obtained.
- the main chain synchronization height maintained locally by the local consensus node 50b refers to the block height of the global consensus block synchronized from the main chain maintained by the local consensus node 50b at present (that is, at the audit timestamp of time point B) (that is, the block height of the second global consensus block); for example, at this time, the global consensus block synchronized from the main chain currently maintained by the local consensus node 50b is If the height value of the block height is 99, the block height with a height value of 99 can be used as the block height to be confirmed, and then when it is determined that the block height to be confirmed is less than the main chain binding height, it can be confirmed that the main chain synchronization height maintained locally lags behind the main chain synchronization height; at this time, the local consensus node 50b itself has no way to vote for the block (that is, the local consensus node 50b does not have the transaction read data set required to execute the local consensus transaction at this time), and then determines the audit failure information of the local consensus block (called the data audit result),
- the main chain synchronization height maintained locally at time point B can be obtained.
- the main chain synchronization height maintained locally by the local consensus node 50c refers to the block height of the global consensus block synchronized from the main chain maintained by the local consensus node 50c at present (that is, at the audit timestamp of time point B) (that is, the block height of the second global consensus block); for example, at this time, the block height synchronized from the main chain currently maintained by the local consensus node 50c is 100, then the block height with a height value of 100 can be used as the block height to be confirmed, and then it can be determined that the block height to be confirmed is equal to the main chain binding height; at this time, the local consensus node 50c can vote on the block (that is, The local consensus node 50c now has the transaction read data set required for executing the local consensus transaction in the local
- v1 and v1′ are different or v2 and v2′ are different, it indicates that the read data set to be confirmed and the main chain read data set are inconsistent, thereby generating audit failure information for the local consensus block (that is, the data audit result), and the audit failure information is used to indicate that the data audit is unsuccessful.
- the process of data audit of the local consensus block by the local consensus node 50d at time point B is similar to the process of data audit of the local consensus block by the local consensus node 50c at time point B, and the embodiments of the present application will not be repeated here.
- the key-value pairs in the to-be-confirmed read data set of the local consensus node 50d can be expressed as: [k1:v1′′; k2:v2′′]), v1′′ and v2′′ represent the value data found locally by the local consensus node 50d.
- v1 and v1′′ are the same, and v2 and v2′′ are the same, it indicates that the to-be-confirmed read data set is consistent with the main chain read data set, thereby generating audit success information, indicating that the data audit is successful; when v1 and v1′′ are different or v2 and v2′′ are different, it indicates that the to-be-confirmed read data set is inconsistent with the main chain read data set, thereby generating audit failure information, indicating that the data audit is unsuccessful.
- the time points B corresponding to the local consensus nodes 50b to 50d may be different.
- the local consensus node can receive the voting consensus result returned by the local verification node, and determine whether to reach a block consensus (also known as reaching a consensus) based on the received voting consensus result and the voting consensus result determined by itself (that is, determining whether the block consensus result obtained by itself is consistent with the block consensus result obtained by the local verification node). If it is determined that the number of voting consensus results indicating voting approval exceeds a certain number (such as 51% of the number of local consensus nodes in the local consensus network), it means that a block consensus has been reached. At this time, the local consensus node can write the local consensus block into the maintained local consensus subchain and into the local local consensus ledger database.
- a block consensus also known as reaching a consensus
- the local verification node will also receive these voting consensus results, and determine that a block consensus has been reached based on these voting consensus results, so as to put the local consensus nodes on the chain of the local consensus subchains maintained by each other and write them into their respective local consensus ledger databases.
- the local consensus subchain and the local consensus ledger database fully store the data references of the local consensus block to the main chain.
- the block consensus of the local consensus block can be realized in the local consensus network, and the local consensus block that reaches the block consensus can be chained to the local consensus sub-chain independent of the main chain, and the local consensus block has an association relationship with the main chain.
- the local consensus block can not only reference the data on the main chain based on the association relationship, but also verify the consistency of the referenced data based on the association relationship, ensuring that the business transaction can be executed safely and accurately.
- this block consensus method it is convenient to build and use the local consensus sub-chain, so that a multi-layer chain network can be constructed, which includes a core consensus network and a business network deployed with a local consensus network.
- the multi-layer chain network realizes the hierarchical division of the blockchain network.
- the local consensus nodes in the local consensus network can obtain the data on the main chain in the core consensus network, and can also be used for local consensus locally, so that each local consensus node of the local consensus network can process the relevant business transactions in the area where the local consensus network is located, forming a multi-level hierarchy of business transactions. For example, business transactions related to the whole country can be executed by the core consensus nodes in the core consensus network, and business transactions related to a certain region can be executed by the local consensus nodes in the local consensus network associated with the region. At the same time, the data isolation of business transaction data can be achieved through the local consensus network.
- the business transaction data related to region A is chained to the local consensus subchain in the local consensus network associated with region A
- the business transaction data related to region B is chained to the local consensus subchain in the local consensus network associated with region B to ensure the security of important transaction data.
- the local consensus network can also share the business processing pressure of the main chain and ensure the stability of business processing on the main chain.
- the multi-level stratification of business transactions can be: running the main chain in the core consensus network, the core consensus nodes in the core consensus network can be used to execute nationwide invoice business transactions, and each first-level regional invoice agency (such as national tax agencies) can create its own local consensus network and build its own local consensus sub-chain in its own local consensus network.
- each first-level regional invoice agency such as national tax agencies
- the business network may include multiple types of SPV nodes, such as the first type of SPV nodes and the second type of SPV nodes.
- the first type of SPV node is used to synchronize the consensus block from the blockchain maintained by the consensus node through the consensus node with a network connection relationship, and build its own blockchain.
- the local consensus node can synchronize the global consensus block from the main chain maintained by the core consensus node through the core consensus node with a network connection relationship; that is, the local consensus node in the local consensus network can be a first-class SPV node.
- the local consensus node in the local consensus network is referred to as a first-level SPV local consensus node.
- the second type of SPV node may refer to a local business node that has a network connection relationship with the first type of SPV node, for example, a local business node that has a network connection relationship with the local consensus network, and the local business node may be referred to as a business SPV node here.
- the data associated with each can be cleared from the main chain through the first-level SPV local consensus node, and the business nodes that have a network connection relationship with each local consensus network can synchronize data from the corresponding local consensus sub-chain.
- the business SPV node can also generate business transactions (called local consensus transactions) and send them to the first-level SPV local consensus node in the corresponding local consensus network, and the first-level SPV local consensus node will package and chain the local consensus transactions. It can be understood that business transactions that are consensused in the local consensus network will not be forwarded to the main chain, but will be processed in their respective local consensus networks.
- the business SPV node also clears the associated data on the local consensus sub-chain through the first-level SPV local consensus node in the corresponding local consensus network.
- a local consensus network of the next level can also be created in the business network through an SPV node.
- each secondary regional bill institution (such as a municipal tax agency) can create its own local consensus subnetwork, and the local consensus subnetwork has a network connection relationship with the corresponding local consensus network.
- the local consensus network associated with the secondary regional bill institution is regarded as the core consensus network for the secondary regional bill institution.
- the principle of data interaction between the local consensus network and the local consensus subnetwork is the same as the principle of data interaction between the core consensus network and the local consensus network.
- bill business transactions related to XX city can be executed in the local consensus subnetwork
- bill business transactions related to XX province can be executed in the local consensus network, thereby realizing the hierarchical division of the blockchain network.
- the local consensus subchain in the local consensus subnetwork is independent of the local consensus subchain in the local consensus network.
- the local consensus subchain in the local consensus subnetwork can synchronize data from the local consensus subchain in the local consensus network.
- the first type of SPV nodes included in the business network can also include local consensus nodes in the local consensus subnetwork; and the local consensus nodes in the local consensus subnetwork have a network connection relationship with the local consensus nodes in the local consensus network.
- the local consensus nodes in the local consensus subnetwork can synchronize local consensus blocks from the correspondingly maintained local consensus subchain through the local consensus nodes in the local consensus network, and build their own blockchain.
- the local consensus subnetwork can be referred to as The local consensus nodes in the local consensus subnetwork are called secondary SPV local consensus nodes.
- the second type of SPV nodes may include business nodes that have a network connection relationship with the local consensus nodes in the local consensus subnetwork.
- a main chain business transaction i.e., a global consensus transaction
- the transaction summary information corresponding to the execution result of the global consensus transaction is uploaded to the main chain, and an information chain transaction corresponding to the transaction summary information is generated, and the main chain business transaction is sent to the core consensus node in the core consensus network through the entrance of the core consensus network, and the core consensus node consensuses and executes the main chain business transaction.
- the business network may also include a third type of SPV node, which may act as a transit when the first type of SPV node and the consensus node with a network connection relationship perform data interaction.
- the first type of SPV node may generate a clearing synchronization request and send it to the third type of SPV node, and the third type of SPV node forwards the clearing synchronization request to the consensus node with a network connection relationship.
- the consensus node with a network connection relationship obtains the consensus block to be synchronized according to the clearing synchronization request
- the consensus block to be synchronized is sent to the third type of SPV node
- the third type of SPV node returns the consensus block to be synchronized to the first type of SPV node.
- one or more third-category SPV nodes can be deployed between the local consensus network and the core consensus network, and the third-category SPV nodes between the core consensus network and different local consensus nodes can be different.
- One or more third-category SPV nodes can be deployed between the local consensus network and the local consensus subnetwork, and the third-category SPV nodes between the local consensus network and different local consensus subnetworks can be different.
- the third-category SPV nodes between the local consensus network and the core consensus network can be referred to as primary SPV nodes
- the third-category SPV nodes between the local consensus network and the local consensus subnetwork can be referred to as secondary SPV nodes.
- the first-level SPV local consensus node when it generates a main chain business transaction, it can send the main chain business transaction to the first-level SPV node, and the first-level SPV node forwards the main chain business transaction to the entrance of the core consensus network, and finally sends it to the core consensus node.
- the first-level SPV node can continuously synchronize the latest global consensus block from the main chain through the core consensus node, and when receiving the main chain clearing synchronization request sent by the local consensus node, select the global block to be synchronized from the local synchronized data, and send the global block to be synchronized to the local consensus node.
- the first-level SPV nodes corresponding to different local consensus networks are different, and a local consensus network can correspond to one or more first-level SPV nodes.
- the next-level local consensus sub-network can be constructed based on the SPV nodes that have a network connection relationship with the local consensus network.
- there is an SPV node between the local consensus network and the local consensus sub-network which can be called a second-level SPV node, and the working principle of the second-level SPV node is the same as that of the first-level SPV node.
- Figures 6a and 6b are schematic diagrams of two blockchain frameworks based on multi-layer chain networks provided in the embodiments of the present application; as shown in Figure 6a, the core consensus network 600 includes core consensus nodes 60a, 60b, and 60c; the local consensus network 610 includes first-level SPV local consensus nodes 61a, 61b, and 61c; data can be directly exchanged between the local consensus network 610 and the core consensus network 600, for example, the first-level SPV local consensus node 61a can generate a main chain clearing synchronization request, and send the main chain clearing synchronization request to the core consensus node 60a through the entrance of the core consensus network, so as to synchronize the data on the main chain through the core consensus node 60a; the local consensus network 610 can communicate with the business SPV Nodes (62a, 62b, ..., 62n) interact with each other for data.
- the core consensus network 600 includes core consensus nodes 60a, 60b, and 60c
- the local consensus network 610 includes first
- the business SPV node 62a can submit a business transaction to the first-level SPV local consensus node 61a, and the first-level SPV local consensus node 61a broadcasts the business transaction to the remaining first-level SPV local consensus nodes. Subsequently, the business transaction can be packaged into a block in the local consensus network 610 and uploaded to the local consensus subchain. Alternatively, the local consensus network 610 and the core consensus network 600 can interact with each other through the first-level SPV nodes.
- the first-level SPV nodes here can include first-level SPV nodes 63a and 63b, indicating active-active service. The two first-level SPV nodes have the same functions and permissions.
- the first-level SPV local consensus node 61a can send the generated main chain clearing synchronization request to the first-level SPV node 63a, which is sent by the first-level SPV node 63a to the core consensus node 60a through the entrance of the core consensus network.
- the core consensus node 60a obtains the data to be synchronized from the main chain (such as the global consensus block and the global contract status) and sends it to the first-level SPV node 63a through the entrance of the core consensus network, which is returned by the first-level SPV node 63a to the first-level SPV local consensus node 61a.
- the main chain such as the global consensus block and the global contract status
- a local consensus subnetwork 620 can be created based on FIG. 6a .
- the local consensus subnetwork 620 includes secondary SPV local consensus nodes 64a, 64b, and 64c.
- the local consensus subnetwork 620 can directly interact with the local consensus network 610 for data.
- the secondary SPV local consensus node 64a can send the generated subchain clearing synchronization request to the primary SPV local consensus node 61a through the entrance of the local consensus network to synchronize the data on the local consensus subchain through the primary SPV local consensus node 61a.
- the local consensus subnetwork 620 can interact with the business SPV nodes 65a, 65b, ... 65n for data.
- the business SPV node 65a can submit a business transaction to the secondary SPV local consensus node 64a, and the secondary SPV local consensus node 64a broadcasts the business transaction to the remaining secondary SPV local consensus nodes. Subsequently, the business transaction can be packaged into a block in the local consensus network 620 and chained to the local consensus subchain in the local consensus subnetwork 620. In addition, data can be exchanged between the local consensus sub-network 620 and the local consensus network 610 through the secondary SPV node.
- the secondary SPV node here can include the secondary SPV nodes 66a and 66b, indicating that the service is active-active, and the two secondary SPV nodes have the same functions and permissions.
- the process of performing block consensus in the local consensus network 610 can be: the first-level SPV local consensus node 61a (referred to as the local consensus node) packages the local consensus transaction, and obtains the main chain binding height and the main chain read data set when packaging the local consensus transaction, thereby storing the main chain binding height, the main chain read data set and the local consensus transaction in the proposed block, and the proposed block is used as the local consensus block to be consensused.
- the local consensus block is broadcast to the first-level SPV local consensus nodes 61b and 61c (referred to as local verification nodes).
- the first-level SPV local consensus nodes 61a, 61b and 61c all perform the same block consensus steps, and the executed block consensus steps are similar to the block consensus steps of the local consensus nodes and the local verification nodes, and the embodiments of the present application will not be repeated here.
- the first-level SPV local consensus node 61a executes the local consensus transaction in the local consensus block to obtain a block consensus result; then It verifies whether the block consensus result obtained by the first-level SPV local consensus nodes 61b and 61c is consistent with the block consensus result obtained by the first-level SPV local consensus node 61a.
- voting consensus results corresponding to the first-level SPV local consensus nodes 61a, 61b, and 61c are all voting consensus results of a vote in favor, it is determined that a block consensus is reached, and the local consensus block is chained to the local consensus subchain maintained by the first-level SPV local consensus node 61a.
- the subchain clearing synchronization request carries the local block height synchronized to the local business node from the local consensus subchain (the local consensus subchain is maintained by the local consensus node, and the local block height is the block height of the local consensus block). Based on the local clearing synchronization rules and the local block height, determine the local consensus blocks that have not been synchronized to the local business node from the local consensus subchain, and select the local blocks to be synchronized from the local consensus blocks that have not been synchronized to the local business node, and obtain the local blocks to be synchronized.
- the local contract status is the set of read data read by executing the local consensus transaction in the local block to be synchronized.
- the local consensus transaction is executed by the local consensus business contract on the local chain of the local consensus network, thereby realizing data synchronization of the local consensus sub-chain.
- the local business node can sort out the business data related to itself from the synchronized data.
- the local business node here can refer to the business SPV node of the local consensus network (such as the business SPV node 62a in Figure 6a), and can also refer to the consensus node in the local consensus subnetwork of the next level of the local consensus network (such as the secondary SPV local consensus node 64a in Figure 6b).
- the local block height carried by the subchain clearing synchronization request is equivalent to the block height of the first global consensus block.
- the local contract state returned by the local consensus node to the local business node involves the data referenced from the main chain by the consensus block to be synchronized, that is, the main chain read data set in the consensus block to be synchronized.
- the local business node is a consensus node in the local consensus subnetwork
- the local business node can also build a blockchain in the local consensus subnetwork that is independent of the local consensus subchain in the local consensus network.
- the local consensus block that is not synchronized to the local business node refers to the unsynchronized consensus block determined from the local consensus subchain when the local consensus node receives the subchain clearing synchronization request; for example, it can be a local consensus block whose block height on the local consensus subchain is greater than the local block height. It can be understood that at this time, it may be determined that there is no local consensus block on the local consensus subchain that is not synchronized to the local business node.
- the local consensus node is determined from the local consensus subchain based on the local clearing synchronization rules and the local block height.
- the process and principle of the local block to be synchronized are similar to the process and principle of the core consensus node determining the global block to be synchronized from the main chain.
- the process of the local consensus node determining the local block to be synchronized can be: determine the synchronization result based on the local clearing synchronization rule and the local block height; when the synchronization result indicates that there is no local consensus block on the local consensus subchain that has not been synchronized to the local business node, obtain the local consensus block with the maximum local block height from the local consensus subchain, and use the local consensus block with the maximum local block height as the local block to be synchronized; when the synchronization result indicates that there is at least one local consensus block on the local consensus subchain that has not been synchronized to the local business node, use at least one local consensus block that has not been synchronized to the local business node as the local block to be synchronized.
- the maximum local block height on the local consensus subchain is the block height carried in the subchain clearing synchronization request, that is, the local consensus block corresponding to the maximum local block height on the local consensus subchain is the latest local consensus block synchronized to the local business node.
- the local consensus node can return the local consensus block corresponding to the maximum local block height on the local consensus subchain to the local business node.
- a notification message indicating that no new local consensus blocks have been added can also be generated and returned to the local business node.
- the local consensus node can use the new local consensus block as a local block to be synchronized to the local business node.
- the local business node can obtain the local consensus block corresponding to the maximum local block height from the local consensus subchain through the local consensus node.
- local business nodes can synchronize data on the local consensus sub-chain, but since the local consensus blocks on the local consensus sub-chain can reference data on the main chain, local business nodes can also synchronize this part of the referenced main chain data, that is, they can synchronize to the main chain data related to themselves through the local consensus nodes, thereby ensuring the security and privacy of transaction data on the main chain, and facilitating global management of the local consensus sub-chain through the main chain.
- the local consensus node can also generate business transactions that need to be executed on the main chain, including transaction aggregation processing of the transaction execution results corresponding to the local consensus transaction based on the transaction chain rules, obtaining the aggregated transaction information, and generating the information chain transaction carrying the aggregated transaction information, calling the main chain forwarding chain component to generate the main chain chain request carrying the information chain transaction; then send the main chain chain request to the core consensus node, and the main chain chain request is used to instruct the core consensus node to write the information chain transaction to the main chain, so as to write the aggregated transaction information to the main chain.
- the transaction aggregation processing can be a transaction aggregation processing of the transaction execution results in the local consensus block that has reached the current block consensus, and it can also be a transaction aggregation processing of the transaction execution results in the local consensus block that has reached the current block consensus and the previous local consensus block.
- the specific rules for transaction aggregation processing are not limited here.
- the transaction summary processing is used to instruct the transaction results (such as lottery results) obtained from the lottery business transactions executed at the specified time to be summarized to obtain transaction summary information (such as the age of the winner, the amount of the prize, and other statistical information); then an information chain transaction corresponding to the transaction summary information is generated, so that the core consensus node can write the transaction summary information into the main chain according to the information chain transaction.
- transaction results such as lottery results
- transaction summary information such as the age of the winner, the amount of the prize, and other statistical information
- the embodiment of the present application proposes a consensus mechanism for local consensus blocks, through which a local consensus block associated with the main chain can be generated, and the association is based on the main chain binding height packaged into the local consensus block and the main chain read data set.
- the data in the main chain sub-ledger database is synchronized from the main chain in the core consensus network; the main chain binding height is the block height of the first global consensus block synchronized from the main chain when packaging the local consensus transaction, and the main chain read data set is cleared from the main chain sub-ledger database.
- the read data set allocated for executing the local consensus transaction in the local consensus block is the data referenced from the main chain when executing the local consensus transaction.
- the local consensus node audits the main chain binding height and the main chain read data set, and performs the subsequent block consensus process after the data audit is successful.
- block consensus By conducting block consensus on the local consensus block in the local consensus network and writing the local consensus block that reaches the block consensus into the local consensus subchain, it is possible to build a local consensus subchain independent of the main chain, which facilitates the hierarchical management of the transaction data of the business transactions of each business party.
- each business party can build its own local consensus subchain to store the business data related to each business party in the local consensus block of each local consensus subchain (such as the transaction data involved in the execution of business transactions by business party A can be linked to the local consensus subchain A, and the transaction data involved in the execution of business transactions by business party B can be linked to the local consensus subchain B), so that the local consensus network
- the transaction data involved in executing a transaction can be stored in an associated local consensus subchain to ensure the security, privacy and data isolation of important transaction data.
- the data on the main chain can be directly and quickly referenced when executing a local consensus transaction in the local consensus block, avoiding the cumbersome cross-chain process between the main chain and the local consensus subchain.
- auditing the main chain binding height and the main chain read data set can also ensure the consistency of the data referenced from the main chain when executing local consensus transactions. This is to facilitate the block consensus of the local consensus block, thereby facilitating the construction and use of the local consensus subchain.
- FIG. 7 is a flow chart of a blockchain data processing method provided by an embodiment of the present application.
- the method can be executed by a local consensus node and a local verification node in a local consensus network; for example, the local consensus node can be any consensus node (such as local consensus node 10a) in the local consensus network 100a shown in FIG. 1 , and the local verification node can be any consensus node (such as 10b) in the local consensus network 100a shown in FIG. 1 except the local consensus node.
- the method includes steps S701 to S706, and each step is described below.
- the local consensus node when the local consensus node packages the local consensus transaction cached in the local consensus node into the proposal block, it packages the main chain binding height and the main chain read data set obtained from the main chain sub-ledger database into the proposal block, and uses the proposal block containing the main chain binding height, the main chain read data set and the local consensus transaction as the local consensus block to be agreed upon.
- step S701 may refer to the relevant description of the above embodiment.
- the local consensus block is broadcast to the local verification nodes in the local consensus network.
- a local verification node may refer to a consensus node other than a local consensus node in a local consensus network.
- the local consensus node performs data audit on the main chain binding height and the main chain read data set in the local consensus block, and performs block consensus on the local consensus block when the data audit is successful to obtain a block consensus result.
- the local consensus node when the local consensus node performs block consensus on the local consensus block, it will also perform the step of data auditing the main chain binding height and the main chain read data set. It can be understood that when the local consensus node performs block consensus on the local consensus block, it can call the local consensus business contract on the local consensus subchain corresponding to the local consensus network to perform data audit on the main chain binding height and the main chain read data set in the local consensus block to obtain the data audit result. When the data audit result indicates that the data audit is successful, the local consensus block is then subjected to block consensus. In addition, the local consensus business contract is called to execute the local consensus transaction in the local consensus block, and the transaction execution result obtained by executing the local consensus transaction is used as the block consensus result when the local consensus block is subjected to block consensus.
- the way in which the local consensus node performs data audit to obtain the data audit result can be: calling the local consensus business contract on the local consensus sub-chain to perform the following processing: obtaining the block height to be confirmed from the main chain sub-ledger database; the block height to be confirmed is the block height of the second global consensus block synchronized from the main chain through the core consensus node, and the second global consensus block is the global consensus block on the main chain synchronized when performing block consensus.
- the block height to be confirmed is compared with the main chain binding height in the local consensus block to obtain a first comparison result, and the data audit result is determined according to the first comparison result.
- the process of determining the data audit result according to the first comparison result can be: when the first comparison result indicates that the height of the block to be confirmed is less than the main chain binding height, a data audit result indicating that the data audit failed is generated; when the first comparison result indicates that the height of the block to be confirmed is equal to the main chain binding height, it is determined that the first global consensus block and the second global consensus block are the same global consensus block, that is, during the packaging of the local consensus transaction to the block consensus, the local consensus node is not synchronized from the main chain to the global consensus block, and the latest synchronized global consensus block (the second global consensus block) is still the first global consensus block; thus, the local consensus business contract is called to search the main chain sub-ledger database for a read data set related to the first global consensus block, and the read data set is used as the read data set to be confirmed, the key-value pair in the read data set to be confirmed is used as the first key-value pair, and the key-value pair of the main chain read data set in the local
- the read data set related to the first global consensus block is obtained by searching the data currently synchronized to the main chain sub-ledger database, and the key-value data of each key-value pair in the read data set related to the first global consensus block is consistent with the key-value data of each key-value pair in the main chain read data set, that is, the value data of the corresponding record can be searched from the main chain sub-ledger database according to the key-value data of each key-value pair in the main chain read data set, so as to use the key-value data of each key-value pair in the main chain read data set and the corresponding value data as the read data set related to the first global consensus block.
- the local consensus business contract is called to execute the local consensus transaction in the local consensus block, and the transaction execution result obtained by executing the local consensus transaction is used as the block consensus result when the local consensus block is performed on the block consensus; that is, when the data audit result indicates that the first key-value pair is consistent with the second key-value pair, it means that the data audit result indicates that the data audit is successful, and the local consensus business contract can be called to read the main chain read data set in the local consensus block, and the block consensus transaction in the local consensus block is executed through the read main chain read data set, so as to use the transaction execution result obtained by executing the local consensus transaction as the block consensus result when the local consensus block is performed on the block consensus. It can be understood that when the data audit result indicates that the first key-value pair and the second key-value pair remain inconsistent, it means that the data audit result indicates that the data audit has failed, and the subsequent consensus process will not be executed.
- the local consensus business contract can be called to search the main chain sub-ledger database for the read data set associated with the first global consensus block, and the read data set is used as the read data set to be confirmed.
- the read data set to be confirmed and the main chain read data set are compared according to the above process to obtain the data audit result.
- the search when searching for the read data set associated with the first global consensus block, the search is performed in the first global consensus block synchronized to the main chain sub-ledger database, and in the global contract state data associated with the first global consensus block.
- the search method can refer to the above-mentioned related description. That is to say, when the height of the block to be confirmed is greater than or equal to the main chain binding height, the read data set associated with the first global consensus block can be searched from the main chain sub-ledger database to obtain the data audit result. As a set of read data to be confirmed, the set of read data to be confirmed is used to verify the consistency of the main chain read data set.
- the block height of the second global consensus block can be compared with the block height of the first global consensus block.
- the first comparison result indicates that the block height to be confirmed is greater than the main chain binding height
- the first global consensus block and the second global consensus block are different global consensus blocks, that is, the second global consensus block is a newly synchronized consensus block
- the second global contract state data associated with the second global consensus block is added to the main chain sub-ledger database.
- the second global contract state data is a set of read data read when executing the global consensus transaction in the second global consensus block, and the execution is realized by calling the global consensus business contract on the main chain in the core consensus network. It should be understood that the set of data to be confirmed is obtained based on the first global contract state data associated with the first global consensus block in the main chain sub-ledger database.
- the block consensus result it is necessary to vote on the block consensus result, that is, to determine whether the block consensus result on the local verification node is consistent with the block consensus result on the local consensus node. For example, when a certain number of block consensus results are the same, it indicates consistency, and a voting consensus result indicating a vote in favor can be generated; when a certain number of block consensus results are not the same, it indicates inconsistency, and a voting consensus result indicating a vote against can be generated.
- the local consensus node can send the voting consensus node to the local verification node.
- the local verification node performs data audit on the main chain binding height and the main chain read data set in the local consensus block, and when the data audit is successful, performs voting consensus on the transaction execution result obtained by executing the local consensus transaction to obtain the voting consensus result.
- the process and principle of data auditing by local verification nodes on the main chain binding height and main chain read data set in the local consensus block are the same as the process and principle of data auditing by local consensus nodes. That is, it is determined whether the block height of the global consensus block synchronized at the time of block consensus is greater than or equal to the main chain binding height. If it is greater than or equal to the main chain binding height, the to-be-confirmed read data set is searched from the main chain sub-ledger database, and the to-be-confirmed read data set is checked to see if it is consistent with the main chain read data set. If they are consistent, it means that the data audit is successful. Among them, when the data audit is successful, it means that the voting consensus authority is obtained. If the data audit is successful, the voting consensus will not be carried out, and no voting consensus result will be generated.
- the process in which the local verification node executes the local consensus transaction to obtain the transaction execution result is the process in which the local verification node performs block consensus on the local consensus block to obtain the block consensus result. Therefore, the voting consensus on the transaction execution result can be to determine whether the transaction execution results on other local consensus nodes are consistent with the transaction execution results on the local verification node. If they are consistent, a voting consensus result indicating a vote in favor is generated. In addition, after the local verification node obtains the voting consensus result, it will send the voting consensus result to other local consensus nodes, and the local verification node will also receive the voting consensus node sent by other local consensus nodes.
- the local consensus network includes local consensus nodes 70a, 70b and 70c.
- the local consensus node 70a verifies whether the transaction execution results on the local consensus nodes 70b and 70c are consistent with its own transaction execution results and generates a corresponding voting consensus result, and sends the voting consensus result to the local consensus nodes 70b and 70c.
- the local consensus node 70b verifies whether the transaction execution results on the local consensus nodes 70a and 70c are consistent with its own transaction execution results and generates a corresponding voting consensus result, and sends the voting consensus result to the local consensus nodes 70a and 70c.
- the local consensus node 70c After obtaining the transaction execution result, the local consensus node 70c verifies whether the transaction execution results on the local consensus nodes 70a and 70b are consistent with its own transaction execution results and generates a corresponding voting consensus result, and sends the voting consensus result to the local consensus nodes 70a and 70c. Whether it is consistent with its own transaction execution result and generate a corresponding voting consensus result, and send the voting consensus result to the local consensus nodes 70a and 70b.
- the local verification node returns the voting consensus result to the local consensus node.
- the local consensus block is chained to the local consensus sub-chain corresponding to the local consensus network, and the local consensus block is written into the local consensus ledger database independent of the main chain sub-ledger database.
- the local consensus node can determine the corresponding voting consensus result based on the block consensus result, and determine whether the block consensus is reached based on the voting consensus result obtained by itself and the voting consensus result received. If it is determined that the block consensus is reached, the local consensus block will be chained to the local consensus sub-chain corresponding to the local consensus block, and the local consensus block will be written into the local consensus ledger database of the independent main chain sub-ledger database. Correspondingly, the local verification node will also determine that the block consensus is reached, and the local consensus block will be chained to the corresponding maintained local consensus sub-chain, and the local consensus block will be written into the local local consensus ledger database.
- the interaction process includes S1 to S23 , and each step is described below.
- Local consensus node 70a broadcasts the local consensus block to local consensus node 70b.
- Local consensus node 70a broadcasts the local consensus block to local consensus node 70c.
- the local consensus node 70a performs data audit on the main chain binding height and the main chain read data set in the local consensus node, and executes the local consensus transaction in the local consensus block after the data audit is successful, and obtains the transaction execution result a.
- the local consensus node 70b performs data audit on the main chain binding height and the main chain read data set in the local consensus node, and executes the local consensus transaction in the local consensus block after the data audit is successful, and obtains the transaction execution result b.
- the local consensus node 70c performs data audit on the main chain binding height and the main chain read data set in the local consensus node, and executes the local consensus transaction in the local consensus block after the data audit is successful, and obtains the transaction execution result c.
- Local consensus node 70a broadcasts the transaction execution result a to local consensus node 70b.
- Local consensus node 70a broadcasts the transaction execution result a to local consensus node 70c.
- Local consensus node 70b broadcasts the transaction execution result b to local consensus node 70a.
- Local consensus node 70b broadcasts the transaction execution result b to local consensus node 70c.
- Local consensus node 70c broadcasts the transaction execution result c to local consensus node 70a.
- Local consensus node 70c broadcasts the transaction execution result c to local consensus node 70b.
- the local consensus node 70a performs voting consensus on the transaction execution result a according to the transaction execution result b and the transaction execution result c, and generates a voting consensus result a.
- voting consensus result a indicates whether the transaction execution results b and c are consistent with the transaction execution result a.
- the local consensus node 70b performs voting consensus on the transaction execution result b according to the transaction execution result a and the transaction execution result c, and generates a voting consensus result b.
- voting consensus result b indicates whether the transaction execution result a and the transaction execution result c are consistent with the transaction execution result b.
- the local consensus node 70c determines the transaction execution result c based on the transaction execution result a and the transaction execution result b. Conduct voting consensus and generate voting consensus result c.
- voting consensus result c indicates whether the transaction execution result a and the transaction execution result b are consistent with the transaction execution result c.
- the local consensus node 70a sends the voting consensus result a to the local consensus node 70b.
- the local consensus node 70a sends the voting consensus result a to the local consensus node 70c.
- Local consensus node 70b sends the voting consensus result b to local consensus node 70a.
- Local consensus node 70b sends the voting consensus result b to local consensus node 70c.
- Local consensus node 70c sends the voting consensus result c to local consensus node 70a.
- Local consensus node 70c sends the voting consensus result c to local consensus node 70b.
- the local consensus node 70a determines that a block consensus has been reached based on the voting consensus results a-c, the local consensus block will be uploaded to the maintained local consensus sub-chain and written into the local main chain sub-ledger database.
- the local consensus node 70b determines that a block consensus has been reached based on the voting consensus results a-c, the local consensus block is uploaded to the maintained local consensus sub-chain and written into the local main chain sub-ledger database.
- the local consensus node 70c determines that a block consensus has been reached based on the voting consensus results a-c, the local consensus block is uploaded to the maintained local consensus sub-chain and written into the local main chain sub-ledger database.
- FIG. 9 is a flowchart of a blockchain data processing method provided by an embodiment of the present application.
- the method can be executed by a core consensus node in a core consensus network; for example, the core consensus node can be any consensus node in the core consensus network 200a shown in FIG. 1 .
- the method can include steps S901 to S904, and each step is described below.
- the main chain clearing synchronization request is used to request the core consensus node to obtain the data to be synchronized to the local consensus node from the main chain, and return the data to be synchronized to the local consensus node to the local consensus node.
- the main chain clearing synchronization request can carry the block height of the first global consensus block.
- the first global consensus block can be the global consensus block synchronized from the main chain by the local consensus node when packaging the local consensus transaction; for example, when packaging the local consensus transaction, the local consensus node can obtain the block height of the latest synchronized global consensus block from the main chain sub-ledger database, and use the latest synchronized global consensus block as the first global consensus block, and write the block height of the latest synchronized global consensus block into the main chain clearing synchronization request.
- S902 based on the global clearing synchronization rule and the block height of the first global consensus block, determine the global consensus blocks that have not been synchronized to the local consensus nodes from the main chain, and select the global block to be synchronized from the global consensus blocks that have not been synchronized to the local consensus nodes.
- the core consensus node determines the global consensus block that has not been synchronized to the local consensus node, it can use the global consensus block on the main chain with a block height greater than the block height of the first global consensus block as the global consensus block that has not been synchronized to the local consensus node.
- the process of the core consensus node determining the global block to be synchronized may be: if it is determined that there is no global consensus block on the main chain that has not been synchronized to the local consensus node, then the global consensus block corresponding to the maximum global block height is obtained from the main chain, and the global consensus block corresponding to the maximum global block height is used as the global block to be synchronized; if it is determined that there is at least one global consensus block on the main chain that has not been synchronized to the local consensus node, then at least one global consensus block that has not been synchronized to the local consensus node is used as the global block to be synchronized.
- the maximum global block height is the block height carried in the main chain clearing synchronization request, that is, the local consensus block corresponding to the maximum global block height on the main chain is the first global consensus block that has been synchronized to the local consensus node.
- the core consensus node can return the global consensus block corresponding to the maximum global block height on the main chain to the local consensus node, that is, return the first global consensus block on the main chain to the local consensus node; it can also generate a notification message indicating that no new global consensus block has been added, and return the notification message to the local consensus node.
- the local consensus node when it is determined that there is a global consensus block that has not been synchronized to the local consensus node, it means that there is a new global consensus block on the main chain at this time, and the core consensus node will synchronize the new global consensus block to the local consensus node as a global block to be synchronized.
- the local consensus node can obtain the global consensus block corresponding to the maximum global block height from the main chain through the core consensus node, that is, the local consensus node synchronizes the latest global consensus block from the main chain.
- the block height synchronized to the consensus node used for voting consensus is greater than or equal to the block height of the first global consensus block, there is a situation where the consensus node has not been synchronized to the latest global consensus block in time, so that there is a consensus node that cannot perform voting consensus. Therefore, when the core consensus node synchronizes the global consensus block on the main chain to the local consensus node, it can reduce the block height of the global consensus block synchronized from the main chain by each local consensus node through the buffer block height. For example, the block height of the global consensus block on the main chain is 100, and the buffer block height is 20. At this time, the block height of the global consensus block that the local consensus node can synchronize from the main chain is 80.
- the process of selecting the global block to be synchronized can be: obtaining the buffer block height, and taking the sum of the block height of the first global consensus block and the buffer block height as the target block height, determining the global synchronization height based on the block height of the global consensus block that has not been synchronized to the local consensus node and the target block height, obtaining the global consensus block corresponding to the global synchronization height from the global consensus block that has not been synchronized to the local consensus node, and taking the global consensus block corresponding to the global synchronization height as the global block to be synchronized.
- the process of determining the global synchronization height can be: if the block height of the global consensus block that has not been synchronized to the local consensus node is equal to the target block height, the block height of the first global consensus block is used as the global synchronization height; if the block height of the global consensus block that has not been synchronized to the local consensus node is greater than the target block height, the block height between the block height of the first global consensus block and the block height to be synchronized is obtained, and the block height between the block height of the first global consensus block and the block height to be synchronized is used as the global synchronization height; the block height to be synchronized refers to the sum of the height of the newly added block and the block height of the first global consensus block, and the newly added block height refers to the height difference between the maximum global block height of the global consensus block on the main chain and the target block height.
- the global block to be synchronized can be determined according to the number of new global consensus blocks added during the period from the last synchronization of data to this synchronization of data.
- L global consensus blocks were added during the period from the last synchronization of data to this synchronization of data, and L global consensus blocks can be synchronized to the local consensus nodes in sequence, where L is a positive integer.
- the target block height is 100. If the block height of the global consensus block on the main chain is 103 at this time, it means that 3 new global consensus blocks have been added to the main chain during this period, so the new block height is 3; at this time, starting from the next global consensus block of the first global consensus block, 3 global consensus blocks are synchronized to the local consensus nodes in sequence, that is, the global synchronization height is 103. They are 81, 82 and 83.
- the block height of the global consensus block that has not been synchronized to the local consensus node is equal to the target block height, it means that there is no new global consensus block on the main chain during the period from the last synchronization of data to this synchronization of data.
- the block height of the main chain has not increased, and the difference between the block height of the main chain and the block height of the first global consensus block is equal to the buffer block height; therefore, the first global consensus block can be obtained from the main chain and synchronized to the local consensus node, or a notification message indicating that no new global consensus block has been added is generated and returned to the local consensus node.
- the main chain data synchronization on the local consensus node can be completed through the above process. It can be understood that the main chain data synchronization process of each local consensus node in the local consensus network is the same.
- the global contract state is the set of read data read when executing the global consensus transaction in the global block to be synchronized.
- the global consensus transaction is executed by the global consensus business contract on the main chain in the core consensus network.
- the global block to be synchronized and the global contract state associated with the global block to be synchronized are returned to the local consensus node, if the local consensus node is in the process of packaging local consensus transactions and block consensus, the global block to be synchronized can be the second global consensus block synchronized to the local consensus node.
- the local consensus node can store the global block to be synchronized and the global contract state in the main chain sub-ledger database in the local consensus node.
- the embodiment of the present application also provides a blockchain data processing method, which is executed by a core consensus node in a core consensus network, the core consensus network is deployed in a multi-layer chain network, and a business network independent of the core consensus network in the multi-layer chain network is deployed with a local consensus network, the local consensus network includes a local consensus node, and the method includes: obtaining a main chain synchronization request sent by the local consensus node, the main chain synchronization request carries the block height of a third global consensus block; the third global consensus block is a global consensus block synchronized from the main chain by the local consensus node before synchronizing to the first global consensus block; from the main chain, a global consensus block with a block height greater than the block height of the third global consensus block is synchronized to the local consensus node; block, determined as the first global consensus block that has not been synchronized to the local consensus node; the first global contract state of the first global consensus block is obtained from the main chain; the first global contract state is a set of read data
- FIG 10 is a schematic diagram of a hierarchical structure of a blockchain network.
- the hierarchical structure shown in Figure 10 is applied to a blockchain electronic bill system, and the blockchain network corresponding to the blockchain electronic bill system includes a business network 1000a deployed in a public network and a consensus network 2000a deployed in a private cloud.
- business nodes 110a, 110b, 110c, 110d, 110e, 110f, 110g, ..., 110n are exemplarily shown.
- the number of business nodes deployed in the business network 1000a is not limited here. It should be understood that the business nodes in the business network 1000a do not need to participate in bookkeeping.
- each business node running in the business network 1000a can access one or more consensus networks through network communication, and each consensus network can also exchange data through network communication.
- consensus network 2000a shown in FIG. 10
- multiple consensus nodes are deployed, exemplarily shown as Except for consensus node 211a, consensus node 211b, consensus node 211c and consensus node 211d, the number of consensus nodes deployed in consensus network 2000a is not limited.
- blockchain 211e is jointly maintained for multiple consensus nodes running in the consensus network 2000a.
- the embodiment of the present application may collectively refer to the business nodes and consensus nodes in the blockchain electronic bill system corresponding to FIG. 10 as blockchain nodes (referred to as nodes), and may refer to the consensus network 2000a participating in the blockchain electronic bill system corresponding to FIG. 10 as a core consensus network, and may refer to each node in the core consensus network of FIG. 10 as a core consensus node. It is understandable that in the blockchain electronic bill system corresponding to FIG. 10, the business network and the consensus network may interact through a routing boundary.
- the core consensus node is used to reach a consensus in the core consensus network where the corresponding blockchain is located, that is, the core consensus node is a consensus node in the core consensus network.
- the process of writing the transaction data in the core consensus network in FIG10 into the corresponding blockchain account book can be: the client sends the transaction data to a certain business node, and then the transaction data is passed between the business nodes in the business network in the blockchain network in a relay manner until the consensus node in the core consensus network in the blockchain network (e.g., the consensus node 211b in the consensus network 2000a) receives the transaction data; at this time, the consensus node (e.g., the consensus node 211b in the consensus network 2000a) packs the transaction data into a block to reach a consensus among other consensus nodes; and when consensus is reached, the block is written into the distributed database of the core consensus network (e.g., the consensus network 2000a) where it is located.
- the consensus node e.g., the consensus network 2000a
- a smart contract can be deployed on the blockchain of the core consensus network.
- the smart contract is a code executed by each blockchain node (i.e., each consensus node) in the blockchain electronic invoice system. Any logic can be executed and a result can be obtained through the smart contract.
- the smart contract deployed on the blockchain e.g., blockchain 211e
- the corresponding core consensus network e.g., consensus network 2000a
- the business node in the business network can send the transaction business request to the consensus node in the corresponding core consensus network (for example, consensus node 211a) to authenticate the identity of the sent transaction business request through the chain entry of the corresponding core consensus network, and when the identity authentication is successful, authorize the transaction business request to be sent to other consensus nodes in the corresponding core consensus network (for example, consensus node 211b) to call the smart contracts running in these consensus nodes (for example, consensus node 211a and consensus node 211b shown in Figure 10) to execute the transaction business requested by the user.
- consensus node 211a consensus node 211a
- consensus node 211b the consensus node 211b
- an embodiment of the present application also provides a multi-layer blockchain, which includes a main chain and local consensus sub-chains under the main chain.
- the main chain can be maintained by the core consensus nodes in the consensus network in the hierarchical structure of the blockchain network in Figure 10
- the local consensus nodes used to maintain the local consensus sub-chains under the main chain can be located in the business network.
- the local consensus sub-chains can also be called local sub-chains, local chains, etc.
- the core consensus network corresponding to the main chain is used to process bill business nationwide; and, under the main chain, a local consensus subchain can be deployed for each provincial region, and the local consensus network corresponding to each local consensus subchain is used to interact with the business nodes in the provincial region for data processing in the provincial region; the local consensus network used for processing bill business in the provincial region can also be called a provincial local consensus network, and the local consensus subchain maintained by the provincial local consensus network can be called a provincial local consensus subchain.
- FIG 11 is a schematic diagram of the structure of a multi-layer blockchain network provided by an embodiment of the present application.
- a local consensus network 21 and a core consensus network 22 may be included in a multi-layer blockchain network.
- the local consensus network 21 (for example, a provincial local consensus network) can be used to maintain a local consensus subchain and process business transactions (for example, electronic bill business transactions) submitted by business nodes in a first-level (for example, provincial) area.
- the consensus nodes in the local consensus network 21 can be lightweight nodes (SPV nodes), also known as first-level SPV local consensus nodes (also known as local consensus nodes), such as the first-level SPV local consensus nodes 21a, 21b, 21c, 21d and 21e shown in Figure 11.
- SPV nodes lightweight nodes
- first-level SPV local consensus nodes also known as local consensus nodes
- local consensus nodes such as the first-level SPV local consensus nodes 21a, 21b, 21c, 21d and 21e shown in Figure 11.
- multiple local consensus networks can also be included in the multi-layer blockchain network for processing business transactions in different first-level regions.
- the local consensus network 21 is described as an example, and the local consensus networks corresponding to other first-level regions can refer to the relevant description of the local consensus network 21.
- the core consensus network 22 is used to maintain the main chain in the multi-layer blockchain and process the overall (for example, nationwide) electronic bill business.
- the blockchain nodes in the core consensus network can be called core consensus nodes, such as the core consensus nodes 22a, 22b and 22c shown in Figure 11.
- the local consensus network 21 can exchange data with the core consensus network 22, so that a safe and efficient business flow system can be constructed under the premise of mutual cooperation between the local consensus network and the core consensus network.
- the electronic bill system based on the multi-layer blockchain network is conducive to hierarchical business processing, which can ensure that each region runs the business at the regional level relatively independently and reduce the business traffic on the main chain.
- it can also reduce the business carried by the core consensus network, and realize global management while improving the execution efficiency of global tasks.
- a multi-layer blockchain network data can be exchanged between the local consensus network 21 and the core consensus network 22 through the primary main chain SPV node.
- multiple primary main chain SPV nodes (primary main chain SPV nodes 23a and 23b as shown in FIG11) can be included, and the roles, data and permissions of each primary main chain SPV node are exactly the same.
- the primary main chain SPV node can synchronize the account data on the main chain maintained by the core consensus network to the local consensus node in the local consensus network, so that the local consensus node can be based on the account of the main chain. This data is used for business processing.
- the first-level main chain SPV node can also receive the main chain business transactions submitted by each business object through the client; for example, when the business object archives the local consensus sub-chain, it can submit an archiving configuration transaction for indicating the archiving of the local consensus data on the local consensus sub-chain, and then the first-level main chain SPV node can forward the received archiving configuration transaction to the core consensus network entry 25, so that the core consensus network entry 25 forwards the received archiving configuration transaction to the core consensus node used to process the business transaction, such as the core consensus nodes 22a, 22b and 22c in Figure 11.
- the first-level main chain SPV node can also receive business transactions sent by the local consensus node, and forward the business transactions sent by the local consensus node to the core consensus network portal 25; for example, in the execution process of the archiving business, the first-level main chain SPV node can receive a summary sending transaction (referred to as a first summary sending transaction or a second summary sending transaction) determined by the local consensus node (such as the first-level SPV local consensus node 21a shown in 11) based on the summary information of the local consensus data to be archived, and forward the summary sending transaction to the core consensus network portal 25, so that the core consensus network portal 25 can forward the received summary sending transaction to the core consensus node.
- a summary sending transaction referred to as a first summary sending transaction or a second summary sending transaction
- the multi-layer blockchain network may also include business SPV nodes, such as business SPV nodes 24a, 24c and 24b in FIG11.
- the business SPV node may be a business node in the area corresponding to the local consensus network 21, and may interact with the local consensus network 21 for regional business processing.
- a first-level SPV local consensus node in the local consensus network may receive business transactions (also referred to as local business transactions) for the local consensus subchain sent by a business SPV node (a business SPV node 24a as shown in FIG11), and then the first-level SPV local consensus node (a first-level SPV local consensus node 21a as shown in FIG11) verifies the legitimacy of the received local business transactions, and packages the verified local business transactions for consensus, so as to link the local business transactions to the first-level local consensus subchain.
- business transactions also referred to as local business transactions
- the first-level SPV local consensus node verifies the legitimacy of the received local business transactions, and packages the verified local business transactions for consensus, so as to link the local business transactions to the first-level local consensus subchain.
- the business transactions submitted to the local consensus network 21 will not be forwarded to the core consensus network, but the business processing will be completed in the local consensus network.
- the summary information in the local consensus network can also be uploaded to the core consensus network.
- the local consensus network 21 can perform a lottery business based on invoices.
- the first-level SPV local consensus node in the local consensus network 21 (the first-level SPV local consensus node 21a shown in Figure 11) will not forward each lottery business transaction to the core consensus network, but after completing a cycle of lottery business, it can summarize the results of the lottery within this cycle, such as summarizing the number of times each prize is drawn within this cycle, and then upload the summary information to the core consensus network 22.
- the first-level local consensus network 21 can synchronize the ledger data on the main chain and store the ledger data associated with itself obtained by clearing, so that the local consensus network can refer to the data synchronized from the main chain when processing local business transactions, such as the read value set (Read Key-Value Set) of the contract status of the contract used when the main chain executes the transaction in the block.
- the business object is based on the electronic ticket issued on the main chain for lottery, and the lottery business transaction is carried out in the local consensus network.
- the local consensus node can determine the relevant data required for the lottery business transaction from the data synchronized from the main chain stored by itself, such as the list of companies that can participate in the lottery, and the proportion of participating in the lottery, and then process the lottery business transaction based on the data related to the lottery business transaction synchronized from the main chain.
- the local consensus node 300a may include components shown in areas 31 and 32, the components in area 31 are used to receive local business transactions, package local business transactions into blocks, and perform block consensus and chain on the packaged blocks to obtain local consensus blocks on the local consensus subchain; the components in area 32 are used to synchronize the data on the main chain, and clear the main chain data related to itself from the synchronized main chain data (for example, from the contract status on the referenced main chain when executing local business transactions), and can also generate business transactions to be executed by the core consensus network, and send the business transactions to be executed by the core consensus network to the core consensus network.
- the local consensus node 300a when it generates a business transaction to be uploaded to the main chain, it can trigger the main chain consensus RPC component 325 to call the main chain forwarding on-chain component 326 to forward the business transaction to be uploaded to the main chain to the core consensus network 33, and then the core consensus node in the core consensus network 33 can write the received business transaction to the main chain; for example, the main chain consensus RPC component 325 can perform transaction verification on the summary sending transaction to be uploaded to the main chain, and call the main chain forwarding on-chain component 326 through the main chain consensus RPC component 325 to forward the summary sending transaction with successful transaction verification to the core consensus network 33.
- the local consensus node 300a can also send the business transaction to be sent to the core consensus network to the first-level main chain SPV node through the main chain forwarding on-chain component 326, and then the first-level main chain SPV node forwards the business transaction to the core consensus network entrance, and then the core consensus network entrance forwards the business transaction to the core consensus node for processing the business transaction.
- the local consensus node 300a when it receives a local business transaction (for example, a local consensus transaction sent by a business object through a business node), it can call the local subchain consensus RPC component 311 to verify the local consensus transaction and put it into the transaction pool, and then call the local subchain consensus component 312 through the local subchain consensus RPC component 311 to obtain the cached local business transaction from the transaction pool, and the local subchain consensus component 312 will package the obtained local business transaction into blocks to obtain a block proposal (Proposal, called a proposed block).
- a local business transaction for example, a local consensus transaction sent by a business object through a business node
- the main chain binding height and the main chain reading data set can be obtained from the main chain sub-ledger database, and the local sub-chain consensus component 312 will obtain the main chain binding height and the main chain reading data set and package them into the block proposal, so that the block proposal can be bound to the main chain state through the main chain binding height, and the main chain data can be referenced through the main chain reading data set; since the block proposal at this time is a local consensus block to be agreed upon, the local sub-chain consensus component 312 is in the local consensus area to be agreed upon.
- the local consensus block to be consensus can be broadcasted to the local verification nodes in the local consensus network to vote on the local consensus block to be consensus. If the vote reaches a consensus, the local consensus block that reaches a consensus can be used as the local consensus block on the local consensus subchain. It can be understood that the local consensus data on the local consensus subchain (such as the ledger data of the local consensus block and the contract status of the contract on the local subchain) can be stored in the local consensus ledger database 314 in the local consensus node 300a.
- the data audit can also be performed on the main chain binding height and the main chain read data set in the local consensus block.
- the data audit process is similar to the data audit process described in Figure 2, and the embodiment of the present application will not be repeated here.
- the main chain binding height is lower than the latest main chain block height by a certain threshold, such as at least 20 block heights lower.
- the local consensus subchain 300a can call the corresponding business transaction contract to perform business processing through the local chain transaction contract execution component 313. For example, when the local consensus node detects an archiving task event, it can call the contract for archiving task processing through the local chain transaction contract execution component 313 to archive data.
- the local consensus node 300a may also include a task trigger 34, which may be triggered when it is detected that the main chain clearing synchronization component 327 has cleared a task event, and then the task trigger may determine the type of the task event, and schedule the task event based on the determined type to execute the corresponding task.
- the main chain clearing synchronization component 327 may clear a task event that matches the local consensus subchain maintained by the local consensus node, and then the task trigger may detect the type corresponding to the cleared task event, and when the task trigger detects that the task event is an archived task event, the local chain transaction contract execution component 313 is triggered to call the target archive business contract for processing the archived task event on the local consensus subchain to process the archived task event.
- the task trigger 34 may also forward and schedule information during task processing.
- the local consensus node 300a may send the local consensus data to be archived to the remote backup device 35 (e.g., server) through the task trigger 34; as another example, the local consensus node 300a may trigger the main chain forwarding component 326 to upload the transaction to be sent to the core consensus network 33 through the task trigger 34.
- an embodiment of the present application proposes a multi-layer blockchain data processing solution, which can be executed by a local consensus node (such as 300a in Figure 12) including a main chain clearing synchronization component; when the local consensus node clears the archiving task event from the first block synchronized from the main chain through the main chain clearing synchronization component, the summary corresponding to the local consensus data to be archived (such as the block data summary) is sent to the core consensus node corresponding to the main chain, and when the summary confirmation event is cleared from the second block synchronized from the main chain through the main chain clearing synchronization component, the local consensus data to be archived (such as the account book data to be backed up) is sent to the remote backup device for backup; then, when the local consensus node receives the remote backup signature (called the first backup signature) returned by the remote backup device, the remote backup signature is sent to the core consensus node, so that the core consensus node determines that the local consensus data to be archived has been backed up to the remote backup device when the
- the embodiment of the present application can control the local consensus node to archive its local local consensus data (for example, the ledger data of the archived block stored locally by the local consensus node itself) according to the currently acquired archiving task command through the mutual cooperation between multiple layers of blockchains, so as to realize the controllability of data archiving of the local consensus data on the local consensus subchain.
- the local consensus node since the local consensus node backs up its local ledger data to the remote backup device, the local consensus node can also archive its local consensus data to the remote backup device. Before the backup, the summary of the archived block stored locally is linked to the main chain through the core consensus node.
- the original text of the transaction executed locally by the local consensus node can be ensured to be non-synchronous, so that when archiving the local consensus data on the local consensus subchain, the privacy and security of the transaction executed on the local consensus node can be ensured.
- the core consensus node can also compare the summary with the first backup signature, and then ensure the data security of the ledger backup information backed up on the remote backup device during the archiving of the local consensus data on the local consensus subchain.
- FIG. 13 is a flow chart of a multi-layer blockchain data processing process provided by an embodiment of the present application.
- the process of archiving the ledger data on the local consensus subchain is introduced as an example.
- the core consensus node receives the archiving configuration transaction determined by the archiving task command triggered by the business object (step S1301); then, the core consensus node synchronizes the first block containing the archiving configuration transaction to the local consensus node (step S1302); the first block belongs to the main chain consensus block on the main chain; the local consensus node can clear the archiving task event that matches the chain identifier of the local consensus subchain from the first block through the main chain clearing synchronization component (the main chain clearing synchronization component 327 shown in Figure 12); when the archiving task command indicated by the archiving task event is a ledger archiving command, the local consensus node will be based on the ledger archiving command to be archived on the local consensus subchain.
- the local consensus block is used as an archive block (step S1303); then the local consensus node can determine the block data summary corresponding to the archive block.
- the local consensus node can trigger the local chain transaction contract execution component (the local chain transaction contract execution component 313 as shown in Figure 12) through a task trigger (the task trigger 34 as shown in Figure 12) to determine the block data summary; then, the local consensus node sends the block data summary of the archive block to the core consensus node (step S1304), and the local consensus node can trigger the main chain forwarding chain component (the main chain forwarding chain component 326 as shown in Figure 12) through the task trigger to send the block data summary to the core consensus node.
- the local consensus node can trigger the local chain transaction contract execution component (the local chain transaction contract execution component 313 as shown in Figure 12) through a task trigger (the task trigger 34 as shown in Figure 12) to determine the block data summary; then, the local consensus node sends the block data summary of the archive block to the core consensus node (step S1304), and the local
- the core consensus node After receiving the block data summary, the core consensus node writes the second block into the main chain when packaging the first summary confirmation event corresponding to the block data summary into the second block (step S1305); then the core consensus node synchronizes the second block including the first summary confirmation event to the local consensus node (step S1306).
- the local consensus node determines the account data to be backed up based on the transaction original text of all transactions in the archived block (step S1307); then the local consensus node sends the account data to be backed up to the remote backup device associated with the multi-layer blockchain (step S1308); the remote backup device performs backup processing on the account data to be backed up, and uses the account data to be backed up after the backup processing as the account backup information (step S1309); then based on the account backup information, the first backup signature is returned to the local consensus node (step S1310); and, after receiving the first backup signature, the local consensus node sends the first backup signature to the core consensus node (step S1311); after the core consensus node performs signature verification on the first backup signature, the account backup information is compared with the block data summary (step S1312), and when the comparison is successful
- the core consensus node when the core consensus node determines that the ledger data to be backed up has been successfully backed up to the remote backup device, it can also generate backup success information, and then return the backup success information to the local consensus node, so that when the local consensus node receives the backup success information, it can clear the successfully backed up ledger data to be backed up, thereby reducing the storage pressure on the local consensus node.
- the embodiment of the present application proposes a multi-layer blockchain data processing method.
- Figure 14 is a diagram of the embodiment of the present application.
- the embodiment provides a flow chart of a multi-layer blockchain data processing method. The method is executed by a local consensus node including a main chain clearing and synchronization component.
- the multi-layer blockchain data processing method may include steps S401 to S404, and each step is described below.
- the first block When synchronizing from the main chain to the first block, clear the archiving task events of the local consensus subchain from the first block; the first block includes an archiving configuration transaction associated with the archiving task event; the archiving configuration transaction is determined by the archiving task command triggered by the business object; the archiving task command is used to archive the local consensus data on the local consensus subchain.
- the core consensus node associated with the main chain can receive the archive configuration transaction submitted by the business object; after verifying the legitimacy of the archive configuration transaction, the core consensus node packages the archive configuration transaction into the first block, and then the core consensus node can synchronize the first block to the local consensus node.
- the business object is an object that includes the authority to trigger the archiving task command (for example, a personal or corporate account).
- the business object can be a management account of an electronic ticket system based on a double-layer chain network; furthermore, the business object can trigger the archiving task command based on the corresponding business device to archive the local consensus data on the local consensus sub-chain, and the business object can determine the archiving configuration transaction based on the archiving task command, and submit the archiving task configuration transaction to the core consensus node associated with the main chain.
- a business object when a business object triggers an archiving task command, it can specify the chain identifier of the local consensus subchain to be archived, that is, the archiving command parameter of the archiving task command can include the chain identifier of the local consensus subchain to be archived; and then the local consensus node can obtain the chain identifier of the local consensus subchain to be archived from the transaction parameters of the archiving configuration transaction determined by the archiving task command, so that the local consensus node can clear the archiving task event from the first block to the archiving configuration transaction based on the obtained chain identifier.
- business objects can archive local consensus data on the local consensus subchain whose generation time is a certain time threshold from the current time, which is also called archiving cold data.
- the account book data corresponding to the local consensus block generated 10 days ago can be archived.
- the local consensus node can clear the main chain consensus block (called the first block) synchronized from the main chain to the local consensus node through the main chain clearing synchronization component to obtain the ledger data and contract data (also called contract status) associated with the local consensus sub-chain maintained by the local consensus node.
- the ledger data and contract data also called contract status
- the local consensus node can determine the ledger data and contract data associated with the local consensus subchain from the first block based on the chain identifier of the local consensus subchain.
- the first block contains an archiving configuration transaction
- the archiving configuration transaction is determined to be a transaction associated with the local consensus subchain maintained by the local consensus node (also referred to as a transaction associated with the local consensus node)
- an archiving task event is generated based on the archiving configuration transaction, which is equivalent to clearing the archiving task event from the first block to the chain identifier of the local consensus subchain.
- the archiving task command indicated by the archiving task event is a ledger archiving command
- the block data summary of the archived block on the local consensus subchain is sent to the core consensus node, and the core consensus node is used to package the first summary confirmation event of the block data summary into the second block, and write the second block into the main chain.
- the local consensus node may include a task trigger, and when the main chain clearing synchronization component clears an archived task event that matches the local consensus subchain maintained by the local consensus node, the task trigger may detect the type of the cleared task event. If the task trigger detects that the type of the task event is an archived task event, and the archived task command indicated by the archived task event is the account book archive command corresponding to the local consensus data, The local consensus data on the local consensus subchain can be archived according to the instructions of the ledger archiving command.
- the ledger archiving command is used to instruct the archiving of the transaction original text in the local consensus block on the local subchain, which is equivalent to archiving the ledger data in the local consensus block.
- the business object can also specify the maximum block height of the local consensus block to be archived on the local consensus subchain, that is, the archiving command parameter of the ledger archiving command can include the chain identifier of the local consensus subchain to be archived, and the maximum block height of the local consensus block to be archived, and then the transaction parameters of the archiving configuration transaction determined based on the ledger archiving command can also include the chain identifier of the local consensus subchain to be archived, and the maximum block height of the local consensus block to be archived, so that the local consensus node can obtain the maximum block height of the local consensus block to be archived from the archiving command parameter of the ledger archiving command indicated by the archiving task event when clearing the first block to the archiving task event.
- the local consensus node also includes a local consensus ledger database; the local consensus ledger database is used to store the ledger data of the local consensus block on the local consensus subchain, and the main chain subledger database is also used to store the ledger data associated with the local consensus node, and the stored ledger data is cleared from the synchronized global consensus block; the local consensus node determines the archived block on the local consensus subchain, including: the local consensus node determines the height of the block to be archived of the local consensus subchain based on the archiving command parameters indicated by the ledger archiving command, and the height of the block to be archived is the maximum block height of the local consensus block to be archived on the local consensus subchain; from the ledger data stored in the main chain subledger database, the archived block height of the local consensus subchain is determined; the height of the block to be archived is greater than the height of the archived block; the intermediate block height between the archived block height and the height of the block to be archived is obtained, and the local consensus ledger database
- the archiving command parameters of the ledger archiving command include the maximum block height of the local consensus block to be archived, so that the local consensus node can use the maximum block height of the local consensus block to be archived in the archiving command parameters as the block height to be archived.
- the maximum block height of the local consensus block to be archived on the local consensus subchain is the height value of the maximum block height of the local consensus block to be archived indicated by the ledger archiving command, which is different from the height value of the maximum block height of the local consensus block that has not been archived on the local consensus subchain.
- the height value of the block height of the latest local consensus block on the local consensus subchain is 120, that is, the maximum block height of the local consensus block that has not been archived on the local consensus subchain is 120, and the ledger archiving command indicates that the local consensus blocks before the height value is 100 are archived, that is, the maximum block height of the local consensus blocks to be archived on the local consensus subchain is 100, so it can be determined that the height value of the block height to be archived in the local consensus subchain is 100.
- the block height of the archived local consensus block on the local consensus subchain can be used as the archived block height; for example, if the height value of the block height of the archived local consensus block on the local consensus subchain is n, it means that the local consensus blocks with block height values of 0-n (including n) on the local consensus subchain have been archived, that is, the archived block height is n. It is understandable that the block height between the archived block height and the to-be-archived block height is the intermediate block height, which may not include the archived block height, but includes the to-be-archived block height.
- the archiving command parameters indicated by the ledger archiving command include a block height of 100 to be archived, and the height of the archived block found in the main chain sub-ledger database is 80, then the local consensus block with a height value between 80 and 100 (excluding 80 and including 100) is used as the archived block.
- the local consensus node determines the height of the block to be archived of the local consensus subchain based on the archiving command parameters indicated by the ledger archiving command; here, the local consensus node searches for the archived block height from the ledger data stored in the main chain subledger database. If the archived block height is not found, the local consensus block from the first local consensus block on the local consensus subchain to the local consensus block corresponding to the height of the block to be archived is used as the archived block.
- the local consensus node can call the target archiving business contract on the local consensus subchain to determine the block data summary based on the block data of the archived block; then generate at least one first summary sending transaction based on the block data summary, and send the at least one first summary sending transaction to the core consensus node, so that the core consensus node generates a first summary confirmation event based on the at least one first summary sending transaction.
- the target archiving business contract is a smart contract deployed on the local consensus subchain and is used to perform archiving business processing. It is understandable that when calling the target archiving business contract to determine the block data summary, each archived block can determine the corresponding block data summary. It is understandable that the block data summary corresponding to any archived block can include the block header hash, block hash, transaction type, timestamp and other information of the archived block, and the determined block data summary is used for subsequent core consensus nodes to verify whether the archived block is successfully backed up.
- the first summary sending transaction is a summary sending transaction generated according to the block data summary, and the data volume of the generated first summary sending transaction is determined according to the data volume of the block data summary.
- a first summary sending transaction can be used to send the target data volume of the block data summary, and then the block data summary of all archived blocks can be divided into at least one portion according to the target data volume, so as to determine a first summary sending transaction according to each portion of data, and obtain at least one first summary sending transaction corresponding to at least one portion.
- the local consensus node can trigger the main chain forwarding on-chain component to send at least one first summary sending transaction to the core consensus node through a task trigger.
- the core consensus node when the core consensus node generates the first summary confirmation event, it can generate a first summary confirmation transaction associated with the first summary confirmation event, and package the first summary confirmation transaction into the second block, so that the first summary confirmation event can be packaged into the second block; finally, the core consensus node writes the second block into the main chain.
- the transaction parameters of the first summary confirmation transaction carry the chain identifier of the local consensus subchain of the first summary sending transaction, so that the local consensus node can perform data clearing based on the chain identifier.
- the second block on the main chain is a different global consensus block from the first block, and the block height of the first block is less than the block height of the second block.
- the block body of the local consensus block on the local consensus subchain can contain multiple transactions, each transaction has a corresponding transaction text, also known as the ledger number; the local consensus node can obtain the transaction text of all transactions in each local consensus block through the local consensus ledger database (as shown in the local consensus ledger database 314 in Figure 12), that is, the local consensus ledger database stores the transaction text of all transactions in the archived block, and then the transaction text of all transactions in the archived block can be determined from the local consensus ledger database; for example, the block height of the archived block is (80,100], then the transaction text of all transactions in multiple local consensus blocks corresponding to the height (80,100] is determined from the local consensus ledger database.
- the local consensus node determines the ledger data to be backed up based on the transaction texts of all transactions in the archived block, and the transaction texts of all transactions in the archived block can be determined as the ledger data to be backed up.
- the transaction texts of the transactions in the archived block and the block data summary of the archived block can also be determined as the ledger data to be backed up.
- the remote backup device can be used to back up the local consensus data on the local consensus subchain.
- the remote backup device can be some independent hardware storage devices, so as to reduce the waste of storage resources for archived data.
- the remote backup device can back up the ledger data to be backed up, thereby realizing the backup of the ledger data to be backed up of the archived block, so as to transfer the local consensus data stored on the local consensus node to the remote backup device, reducing the storage pressure of the local consensus node.
- the block data summary of the archived block is sent to the core consensus node again.
- the target time period is a preset time for timeout retransmission. If the first summary confirmation event returned by the core consensus node is not cleared within the target time period, the block data summary will be re-uploaded to the core consensus node. For example, the target time period is 10 minutes, and the timing starts after the block data summary is sent to the core consensus node. If the local consensus node still has not cleared the first summary confirmation event through the main chain clearing synchronization component after 10 minutes, the block data summary of the archived block will be sent to the core consensus node again.
- the local consensus node will back up the account data to be archived corresponding to the archived block to the remote backup device only after receiving the summary confirmation event returned by the core consensus node.
- the reliability of the block data summary upload is guaranteed through the timeout retransmission mechanism, and the fault tolerance of the archiving process is improved.
- S404 forwarding the first backup signature sent by the remote backup device to the core consensus node, where the core consensus node is used to determine that the ledger data to be backed up has been backed up to the remote backup device when it is determined that the first backup signature is generated by the remote backup device and the ledger backup data summary of the ledger backup information is consistent with the block data summary.
- the remote backup device when the remote backup device uses the account book data to be backed up after the backup processing as the account book backup information, it can generate a first backup signature based on the account book backup information.
- the first backup signature is used to indicate that the remote backup device has performed backup processing on the account book data to be backed up.
- the remote backup device when it generates the first backup signature based on the account book backup information, it can be based on
- the ledger backup information generates first remote backup confirmation information, and the first remote backup confirmation information is signed using a private key in the remote backup device to obtain first signature information, and a first backup signature is obtained based on the first remote backup confirmation information and the first signature information.
- the first remote backup confirmation information is a summary of the ledger backup data determined based on the ledger backup information, and the method for determining the summary of the ledger backup data can be consistent with the method for determining the summary of the block data, so that the core consensus node can determine consistency based on the first remote backup confirmation information and the summary of the block data.
- the core consensus node performs signature verification on the first backup signature, and can verify the first backup signature through the public key corresponding to the remote backup device, thereby ensuring that the first backup signature uploaded by the local consensus node is generated by the remote backup device and that the first backup signature has not been tampered with.
- the core consensus node compares the ledger backup information corresponding to the first backup signature with the block data summary, and can verify that the ledger backup information indicated by the first backup signature has been backed up to the remote backup device.
- the core consensus node can determine that the ledger backup data to be backed up has been backed up to the remote backup device.
- the core consensus node can store the received block data summary and the first backup signature, so as to determine the remote backup device backed up by the local consensus block corresponding to the block data summary through the public key corresponding to the first backup signature, and then the remote backup ledger information of the local consensus block indicated by the block data summary can be found from the determined remote backup device.
- the core consensus node determines that the account book data to be backed up has been successfully backed up to the remote backup device, it can also generate the first backup success information to notify the local consensus node that the account book data to be backed up has been successfully backed up to the remote backup device.
- the local consensus node receives the first backup success information returned by the core consensus node, it clears the account book data to be backed up that has been backed up to the remote backup device; the first backup success information is generated by the core consensus node when it determines that the account book data to be backed up has been successfully backed up.
- clearing the to-be-backed-up ledger data in the local consensus node that has been backed up to the remote backup device is equivalent to transferring some cold data in the local consensus node to the remote backup device for storage, thereby reducing the storage pressure on the local consensus node.
- the local consensus node can clear the blocks synchronized from the main chain to the first backup success information through the component clearing synchronization component, and the first backup success information can be stored in the main chain sub-ledger database.
- the first backup success information can include the maximum block height of the local consensus block that has been backed up to the remote backup device, and then when the next archiving task event for indicating the archiving of the ledger data is cleared, the block height of the archived local consensus block on the local consensus sub-chain can be found from the ledger data stored in the main chain sub-ledger database, and the next block archiving is performed based on the block height of the archived local consensus block found.
- the maximum block height of the local consensus block that has been backed up to the remote backup device in the first backup success information is 100
- the block height of the archived local consensus block on the current local consensus sub-chain is 100.
- FIG. 15 is a flow chart of a ledger data archiving process provided by an embodiment of the present application. Schematic diagram of the process.
- the local consensus node is synchronized from the main chain to the first block through the main chain clearing synchronization component (step S501a), and clears the account data and archiving task events related to the local consensus node from the first block.
- the task trigger detects that the clearing synchronization component clears the archiving task event, it detects the type of the archiving task event.
- the task trigger triggers the local chain transaction execution component (step S502a), so that the local chain transaction execution component can call the corresponding target business archiving contract to determine the block data summary of the local consensus block (also called the archiving block) to be archived.
- FIG 16 is a flow chart of a ledger data archiving process provided by an embodiment of the present application.
- the task trigger triggers the main chain forwarding chain component (step S501b), so that the main chain forwarding chain component sends the block data summary to the core consensus network.
- the block data summary can be placed in at least one first summary sending transaction, so that the block data summary is sent to the core consensus network in the form of a transaction.
- the local consensus node synchronizes the second block from the main chain through the main chain clearing synchronization component (step S501c), and clears the ledger data related to the local consensus node from the second block to clear the first summary confirmation event, and when the main chain clearing synchronization component clears the first summary confirmation event, the task trigger trigger triggers the local chain transaction execution component (step S502c), so that the local chain transaction execution component calls the corresponding target archiving business contract to determine the ledger data to be backed up corresponding to the archiving task event; and then the task trigger sends the ledger data to be backed up to the remote backup device (step S503c).
- the remote backup device After the remote backup device performs backup processing on the ledger data to be backed up, it can also return a first backup signature to the local consensus node.
- the local consensus node receives the first backup signature, it triggers the main chain forwarding chain component through the task trigger (step S504c), so that the main chain forwarding chain component uploads the first backup signature to the core consensus network.
- the core consensus nodes in the core consensus network perform a consistency comparison based on the first backup signature and the block data summary. When the comparison is successful, it is determined that the backup of the ledger data to be backed up is successful, and the first backup success information can be generated.
- the local consensus node can receive the first backup success information sent by the core consensus node in the core consensus network, and then clear the successfully backed up account data to be backed up.
- the first backup success information can be packaged into the fourth block by the core consensus node, and then the local consensus node can be synchronized from the main chain to the fourth block through the main chain clearing synchronization component, and clear the account data related to the local consensus node from the fourth block.
- the local consensus node detects that the main chain clearing synchronization component has cleared the first backup success information through the task trigger, it triggers the local chain transaction execution component to enable the local chain transaction execution component to call the corresponding target archiving business contract to clear the account data to be backed up to the remote backup device.
- the embodiment of the present application proposes a multi-layer blockchain data processing method.
- Figure 18, is a flow chart of a multi-layer blockchain data processing method provided by the embodiment of the present application.
- the method is executed by a local consensus node and includes steps S601 to S604.
- the first block When synchronizing from the main chain to the first block, clear the archiving task events of the local consensus subchain from the first block; the first block includes an archiving configuration transaction associated with the archiving task event; the archiving configuration transaction is determined by the archiving task command triggered by the business object; the archiving task command is used to archive the local consensus data on the local consensus subchain.
- step S601 may refer to the relevant description of step S401, which will not be elaborated here.
- S602 When the archiving task command indicated by the archiving task event is a contract archiving command, The command sends the contract data summary of the archived contract on the local consensus subchain to the core consensus node.
- the core consensus node is used to package the second summary confirmation event of the contract data summary pair into the third block and write the third block into the main chain.
- the task trigger in the local consensus node triggers the main chain clearing synchronization component to clear the task events that match the local consensus sub-chain maintained by the local consensus node.
- the task trigger can detect the type corresponding to the cleared task event. If the task trigger detects that the task event is an archived task event, and the archived task command indicated by the archived task event is the contract archive command corresponding to the local consensus data, the local consensus data (such as the contract data of the contract) on the local consensus sub-chain is archived according to the instructions of the contract archive command.
- the contract archiving command corresponding to the local consensus data is used to instruct the contract data on the local consensus subchain to be archived. Therefore, when the business object triggers the contract archiving command, it specifies the chain identifier of the local consensus subchain requested for archiving, the contract identifier of the contract to be archived on the local consensus subchain, and the maximum contract index value of the contract to be archived; therefore, the command parameters of the contract archiving command include the chain identifier of the local consensus subchain requested for archiving, the contract identifier of the contract to be archived on the local consensus subchain, and the maximum contract index value of the contract to be archived; and then the transaction parameters of the archiving configuration transaction determined based on the contract archiving command include the chain identifier requested for archiving, the contract identifier of the contract to be archived, and the maximum contract index value of the contract to be archived; thus, when the local consensus node clears from the first block including the archiving configuration transaction to the archiving task
- the contract identifier of the contract to be archived in the contract archiving command can be the contract call address, contract identification number or contract name, etc., which is not limited here.
- the contract index value is the data sequence index inside the contract, such as 0, 1, 2, 3 and other serial numbers.
- the local consensus node can determine the contract to be archived on the local consensus subchain based on the contract identifier indicated by the archiving command parameter in the contract archiving command, and use the contract to be archived on the local consensus subchain as the archived contract.
- the main chain sub-ledger database is also used to store contract data associated with the local consensus node, and the stored contract data is cleared from the synchronized global consensus block; thus, the local consensus node sends the contract data summary of the archived contract on the local consensus sub-chain to the core consensus node based on the contract archiving command, including: the local consensus node determines the contract index value to be archived in the archived contract based on the archiving command parameters indicated by the contract archiving command, and the contract index value to be archived is the maximum contract index value to be archived in the archived contract; from the ledger data stored in the main chain sub-ledger database, search for the archived contract index value in the archived contract; the contract index value to be archived is greater than the archived contract index value; based on the contract index value between the archived contract index value and the contract index value to be archived, determine the contract data to be backed up in the archived contract on the local consensus sub-chain; send the contract data summary information of the contract data to
- the contract state of the contract can be updated once, and the contract state can be the state value of the contract parameter represented by the key-value pair in the contract, and the contract index value of the contract state is determined; when the contract is called for business processing next time, the contract state is updated again, and the contract index value of the updated contract state is determined, and the contract index value determined this time is 1 greater than the contract index value determined last time.
- the contract index value of the contract state also called contract data
- the archive command parameters of the contract archive command include the parameters for indicating the contract to be archived on the local consensus subchain.
- the maximum contract index value of the archived contract can be used as the contract index value to be archived. It can be understood that the maximum contract index value of the contract to be archived on the local consensus subchain is the maximum contract index value to be archived indicated by the contract archiving command, which is different from the maximum contract index value that has not been archived in the archived contract on the local consensus subchain.
- the current maximum contract index value on the local consensus subchain is 50, that is, the maximum contract index value that has not been archived in the archived contract on the local consensus subchain is 50, and the contract archiving command indicates that the contract index value before the contract index value 30 is to be archived, that is, the maximum contract index value of the contract to be archived in the archived contract on the local consensus subchain is 30, so it can be determined that the contract index value to be archived is 30.
- the contract index value between the archived contract index value and the contract index value to be archived may not include the archived contract index value, but include the contract index value to be archived; here, the determined contract index value between the archived contract index value and the contract index value to be archived can also be called the archived contract index value in the archived contract.
- the contract data corresponding to the contract index values between 40-50 (excluding 40 and including 50) will be used as the contract data to be archived in the archived contract.
- the archived contract index value on the local consensus sub-chain is not found in the main chain sub-ledger database, it means that the contract data of the archived contract on the local consensus sub-chain is not currently archived, and then the contract data in the archived contract can be archived starting from the difference between the index value corresponding to the first contract in the archived contract on the local consensus sub-chain and 1 (such as the contract index value 0).
- the archived contract index value can be recorded as a specified value (for example, 0), so that the contract data corresponding to the contract index value to be archived in the archived contract on the local consensus sub-chain before the contract data to be archived are all used as contract data to be archived.
- the maximum contract index value included in the archiving command parameters indicated by the contract archiving command is 50, that is, the contract index value to be archived is 50, and the contract index value of the archived local consensus block is not found in the main chain sub-ledger database, it means that the block on the local consensus sub-chain has not been archived, and the contract data corresponding to the contract index value between 0-50 can be used as the contract data to be archived in the archived contract.
- the local consensus node can call the target archiving business contract on the local consensus subchain to determine the contract data summary based on the contract data to be archived in the archiving contract; generate at least one second summary sending transaction based on the contract data summary, and send at least one second summary sending transaction to the core consensus node, so that the core consensus node generates a second summary confirmation event based on the at least one second summary sending transaction.
- the second summary sending transaction can be a summary sending transaction generated according to the contract data summary, and the data volume of the generated second summary sending transaction can be determined according to the data volume of the contract data summary.
- a second summary sending transaction can be used for the target data volume of the contract data summary, and then the contract data summary can be divided into at least one portion according to the target data volume, so as to determine a second summary sending transaction according to each portion of data, and obtain at least one second summary sending transaction corresponding to at least one portion.
- the local consensus node can trigger the main chain forwarding on-chain component to send at least one second summary sending transaction to the core consensus node through a task trigger.
- the core consensus node After receiving all the second summary sending transactions, the core consensus node generates a second summary confirmation event.
- the second summary confirmation event is used to indicate that the core consensus node has received the block data summary on the local consensus subchain.
- the core consensus node when it generates the second summary confirmation event, it can generate a second summary confirmation transaction associated with the second summary confirmation event, and package the second summary confirmation transaction into the third block, so that the second summary confirmation event can be packaged into the third block; finally, the core consensus node writes the third block into the main chain.
- the transaction parameters of the second summary confirmation transaction carry the chain identifier of the local consensus subchain of the second summary sending transaction, so that the local consensus node can perform data clearing based on the chain identifier.
- the third block and the first block on the main chain can be different global consensus blocks, and the block height of the first block is less than the block height of the third block.
- the business object can trigger the contract archiving command for the registered contract on the main chain.
- the core consensus node registers the contract on the local consensus subchain on the main chain, it checks the description file of the contract to be registered to confirm whether the contract to be registered implements the archiving interface. If the contract to be registered does not implement the archiving interface, the core consensus node will not be able to archive the contract on the local consensus subchain that does not implement the archiving interface.
- each archiving task event indicated by the archiving configuration exchange can only be archived for one contract.
- the local consensus node can execute the contract archiving task for each contract in serial.
- the local consensus node can store the contract data on the local consensus subchain through the local consensus ledger database, and then determine the contract data to be archived from the local consensus ledger database; for example, the contract identifier of the archived contract is M1, and the contract data to be archived in the archived contract is the contract data corresponding to the contract index value (30,150], and then the contract data corresponding to the contract index value (30,150] can be determined from the contract data with the contract identifier M1 in the local consensus ledger database.
- the contract identifier of the archived contract is M1
- the contract data to be archived in the archived contract is the contract data corresponding to the contract index value (30,150]
- the contract data corresponding to the contract index value (30,150] can be determined from the contract data with the contract identifier M1 in the local consensus ledger database.
- the contract data to be backed up can be determined based on the contract data to be archived in the archived contract.
- the contract data to be archived in the archive contract is determined as the contract data to be backed up.
- the remote backup device can back up and store the contract data to be backed up, thereby realizing the backup of the contract data to be backed up corresponding to the archived block, so as to transfer the local consensus data stored on the local consensus node to the remote backup device, reducing the storage pressure of the local consensus node.
- the target time period is 10 minutes, starting from the time when the contract data summary is sent to the core consensus node. If the local consensus node has not obtained the second summary confirmation event through the main chain clearing synchronization component after 10 minutes, the block data summary of the archived block will be sent to the core consensus node again. It is understandable that during the archiving process, the local consensus node will back up the contract data to be backed up to the remote backup device only after receiving the summary confirmation event returned by the core consensus node.
- the timeout retransmission mechanism ensures the reliability of the contract data summary upload and improves the fault tolerance of the archiving process.
- the core consensus node is used to determine that the contract data to be backed up has been backed up to the remote backup device when it is determined that the second backup signature is generated by the remote backup device and the account backup data summary of the contract backup information is consistent with the contract data summary.
- the remote backup device when the remote backup device uses the backup-processed contract data to be backed up as the contract backup information, it can generate second remote backup signature information based on the contract backup information.
- the second remote backup signature information can be used to indicate that the remote backup device has backed up the contract data to be backed up.
- the remote backup device when it generates the second backup signature based on the contract backup information, it can generate the second remote backup confirmation information based on the contract backup information, use the private key in the remote backup device to sign the second remote backup confirmation information to obtain the second signature information, and obtain the second backup signature based on the second remote backup confirmation information and the second signature information.
- the second remote backup confirmation information is a contract backup data summary determined based on the contract backup information, and the method for determining the contract backup data summary can be consistent with the method for determining the above-mentioned contract data summary, so that the core consensus node can determine the consistency based on the second remote backup confirmation information and the contract data summary.
- the core consensus node can verify the signature of the second backup signature by using the public key corresponding to the remote backup device, thereby ensuring that the second backup signature uploaded by the local consensus node is generated by a trusted remote backup device and that the second backup signature has not been tampered with.
- the core consensus node compares the contract backup information corresponding to the second backup signature with the contract data summary, and can verify that the contract backup information indicated by the second backup signature has been backed up to the remote backup device.
- the core consensus node can determine that the contract data to be backed up has been backed up to the remote backup device.
- the core consensus node can store the received contract data summary and the second backup signature, so as to determine the remote backup device to which the contract data corresponding to the contract data summary is backed up through the public key corresponding to the second backup signature, and then find the contract data corresponding to the contract data summary from the determined remote backup device. Remote backup of contract information.
- the core consensus node can also generate a second backup success message when determining that the contract data to be backed up has been successfully backed up to the remote backup device, to notify the local consensus node that the contract data to be backed up has been successfully backed up to the remote backup device.
- the local consensus node receives the second backup success message returned by the core consensus node, it clears the contract data to be backed up that has been backed up to the remote backup device; wherein, the second backup success message is generated by the core consensus node when determining that the contract data to be backed up has been successfully backed up to the remote backup device.
- the local consensus node can be synchronized from the main chain to the first block through the main chain clearing synchronization component, and clear the account book data related to the local consensus node.
- the task trigger detects that the clearing synchronization component clears the archiving task event, it can judge the type of the detected archiving task event. If it is judged that the archiving task command indicated by the archiving task event is a contract archiving command, the task trigger triggers the local chain transaction execution component to call the corresponding target business archiving contract to determine the block data summary of the contract to be archived. Then, the task trigger can trigger the main chain forwarding chain component, so that the main chain forwarding chain component can send the contract data summary to the core consensus network.
- the contract data summary can be placed in at least one second summary sending transaction, so that the contract data summary is sent to the core consensus network in the form of a transaction.
- the local consensus node can be synchronized from the main chain to the third block through the main chain clearing synchronization component.
- the task trigger can trigger the local chain transaction execution component, so that the local chain transaction execution component can call the corresponding target archiving business contract to determine the contract data to be backed up corresponding to the archiving task event, and then the task trigger can send the contract data to be backed up to the remote backup device.
- the remote backup device After the remote backup device performs backup processing on the contract data to be backed up, it can also return a second backup signature to the local consensus node.
- the local consensus node When the local consensus node receives the second backup signature, it can trigger the main chain forwarding chain component through the task trigger, and the main chain forwarding chain component can upload the second backup signature to the core consensus network.
- the core consensus node in the core consensus network can perform consistency comparison based on the second backup signature and the contract data summary. When the comparison is successful, it can be determined that the backup of the contract data to be backed up is successful, and then the second backup success information can be generated.
- the local consensus node can receive the second backup success information sent by the core consensus node, and then clear the backup contract data based on the second backup success information.
- the second backup success information can be packaged into the fifth block by the core consensus node, and then the local consensus node can be synchronized from the main chain to the fifth block through the main chain clearing synchronization component, and clear the account data related to the local consensus node from the fifth block.
- the task trigger can trigger the local chain transaction execution component, so that the local chain transaction execution component calls the corresponding target archiving business contract to clear the backup contract data.
- the local consensus node can clear the blocks synchronized from the main chain through the component clearing synchronization component to obtain the second backup success information
- the second backup success information can be stored in the main chain sub-ledger database.
- the second backup success information can include the contract identifier corresponding to the to-be-backed-up contract data that has been backed up to the remote backup device and the maximum contract index value that has been backed up in the contract corresponding to the contract identifier.
- the maximum contract index value indicated by the success message is equivalent to the contract index value that has been archived in the contract (such as the contract with the contract identifier M1) indicated by the second backup success message on the current local consensus subchain.
- the archived contract index value in the contract to be archived on the local consensus subchain can be found from the account data stored in the main chain sub-account database, and the archived contract index value in the contract to be archived on the local consensus subchain found is used as the archived contract index value. For example, if the maximum contract index value of the contract M1 corresponding to the contract data to be backed up that has been backed up to the remote backup device contained in the second backup success message is 100, then the archived contract index value in the contract M1 on the current local consensus subchain is 100.
- the summary corresponding to the local consensus data to be archived (such as the contract data summary) is sent to the core consensus node corresponding to the main chain; and when the summary confirmation event is cleared from the second block through the main chain clearing synchronization component, the local consensus data to be archived (such as the contract data to be backed up) is sent to the remote backup device for backup; then when the local consensus node receives the second backup signature returned by the remote backup device, the second backup signature is sent to the core consensus node, so that the core consensus node determines that the local consensus data to be archived has been backed up to the remote backup device when the summary is successfully compared with the second remote backup signature.
- the archiving configuration transaction can be received by the core consensus node corresponding to the main chain, and then the archiving of the local consensus data on the local consensus subchain used for regional business processing can be controlled, so that the transactions related to the business nodes in different regions can be archived separately, thereby improving the controllability of the data archiving process of the blockchain and the security of data archiving through collaborative archiving between multi-layer blockchains.
- the core consensus node can audit the archiving process of local consensus data to improve the controllability and data security of the archiving process of local consensus data.
- the archiving configuration transaction submitted by the business object for the archiving task command when the archiving configuration transaction submitted by the business object for the archiving task command is packaged into the first block through the core consensus node and chained to the main chain, it can ensure that the local consensus node deployed in the local consensus network of the multi-layer blockchain is synchronized from the main chain maintained by the core consensus node to the first block packaged with the archiving configuration transaction, and then the archiving task event associated with the archiving task command is cleared from the first block, and then the archiving task command indicated by the archiving task event can be obtained.
- the embodiment of the present application can control the local consensus node to archive its local local consensus data (for example, the contract status data stored locally by the local consensus node itself) according to the currently acquired archiving task command through the mutual cooperation between the multi-layer blockchains, so as to achieve the controllability of data archiving of the local consensus data on the local consensus subchain.
- its local local consensus data for example, the contract status data stored locally by the local consensus node itself
- the local consensus node uploads the summary of its locally stored contract data to the main chain through the core consensus node before backing up its local contract data to the remote backup device, rather than directly uploading its locally stored contract data to the main chain through the core consensus node, it can ensure that the contract data executed locally by the local consensus node itself will not be synchronized by other business nodes, so that when archiving the local consensus data on the local consensus subchain, the privacy and security of the transactions executed on the local consensus node can be ensured.
- the core consensus node can also compare the summary submitted by the local consensus node with the second backup signature, so that during the archiving process of the local consensus data on the local consensus subchain, the data security of the ledger backup information backed up on the remote backup device can be ensured.
- the embodiment of the present application proposes a multi-layer blockchain data processing method.
- Figure 19 is a flow chart of a multi-layer blockchain data processing method provided by the embodiment of the present application. The method is executed by the core consensus node, and the multi-layer blockchain data processing method includes steps S801 to S804, and each step is described below.
- the local consensus node is used to clear the archiving task events of the local consensus subchain from the first block; the first block includes an archiving configuration transaction associated with the archiving task event; the archiving configuration transaction is determined by the archiving task command triggered by the business object; the archiving task command is used to archive the local consensus data on the local consensus subchain.
- the archived block is a local consensus block to be archived on the local consensus subchain determined by the local consensus node based on the ledger archiving command when the archiving task command indicated by the archiving task event is a ledger archiving command.
- the local consensus node is also used to determine the ledger data to be backed up when the first summary confirmation event is cleared from the second block, and send the ledger data to be backed up to the remote backup device of the multi-layer chain network.
- the first backup signature is information returned by the remote backup device based on the ledger backup information, and the first backup signature is forwarded through the local consensus node.
- the ledger backup information is information obtained by the remote backup device when backing up the ledger data to be backed up.
- step S801 to step S804 is opposite to the description corresponding to step S601 to step S604, the embodiment of the present application will not be repeated here.
- the consensus module 20-12 is configured to broadcast the local consensus block to the local verification node, and the local verification node is used to obtain the voting consensus result corresponding to the transaction execution result of the local consensus transaction when the synchronized block height is greater than or equal to the main chain binding height and the synchronized read data set is consistent with the main chain read data set.
- the local verification node is a consensus node other than the local consensus node in the local consensus network;
- the consensus module 20-12 also includes: a data review unit 20-121 and a block consensus unit 20-122.
- the data review unit 20-121 includes:
- the contract calling subunit 20-1211 is configured to call the local consensus business contract on the local consensus subchain to perform data review
- the data comparison subunit 20-1214 is configured to use the key-value pair in the to-be-confirmed read data set as the first key-value pair, and the key-value pair of the main chain read data set as the second key-value pair, and when the first key-value pair and the second key-value pair are consistent, execute the local consensus transaction in the local consensus block to obtain a transaction execution result.
- the block consensus unit 20-122 is configured to cancel the review of the main chain read data set when the height of the block to be confirmed is lower than the main chain binding height;
- the block consensus unit 20-122 is also configured to cancel the execution of the local consensus transaction when the first key-value pair is inconsistent with the second key-value pair.
- the packaging module 20-11 also includes:
- the synchronization request sending unit 20-112 is configured to send the main chain clearing synchronization request to the core consensus node; the main chain clearing synchronization request is used to instruct the core consensus node to determine the global consensus block with a block height higher than the first global consensus block as a global consensus block on the main chain that has not been synchronized to the local consensus node, and select a global block to be synchronized from the global consensus blocks that have not been synchronized to the local consensus node;
- the data receiving unit 20-113 is configured to receive the global block to be synchronized returned by the core consensus node, and use the global block to be synchronized as the second global consensus block.
- the packaging module 20-11 also includes:
- the binding height determination unit 20-114 is configured to obtain the maximum global block height and the global consensus block corresponding to the maximum global block height from the main chain through the core consensus node when packaging the local consensus transaction; use the global consensus block corresponding to the maximum global block height as the first global consensus block, and use the maximum global block height as the main chain binding height.
- processing module 20-13 also includes:
- a synchronization request acquisition unit 20-131 is configured to acquire a subchain clearing synchronization request sent by a local business node;
- the local business node includes a local chain subledger database, the subchain clearing synchronization request carries the local block height synchronized by the local business node from the local consensus subchain, the local consensus subchain is the blockchain of the local consensus node, and the local block height is the block height of the local consensus block;
- the local block selection unit 20-132 is configured to determine the local consensus block whose block height on the local consensus subchain is greater than the local block height as a local consensus block that has not been synchronized to the local business node, and select the local consensus block from the local consensus subchain. Selecting a local block to be synchronized from the local consensus blocks that have not been synchronized to the local business node;
- the local block sending unit 20-133 is configured to obtain the local contract status of the local block to be synchronized, and return the local block to be synchronized and the local contract status to the local business node, and the local business node is used to write the local block to be synchronized and the local contract status into the local chain sub-ledger database; the local contract status is a set of read data read by executing the local consensus transaction in the local block to be synchronized, and the local consensus transaction is executed by the local consensus business contract on the local consensus sub-chain of the local consensus network.
- the local block selection unit 20-132 is also configured to obtain the local consensus block corresponding to the maximum local block height from the local consensus subchain when the maximum local block height on the local consensus subchain is equal to or less than the local block height; and use the local consensus block corresponding to the maximum local block height as the local block to be synchronized.
- the data receiving unit 20-113 is further configured to synchronize a target consensus block including a registration transaction from the main chain, wherein the registration transaction is a business transaction that applies to the core consensus node to register the local consensus subchain, and a configuration transaction corresponding to the registration transaction is written in the target consensus block, and the configuration transaction carries configuration information;
- the packaging module 20-11 also includes:
- the block creation subunit 20-115 is configured to obtain the configuration information from the target consensus block, and when the configuration information is consistent with the information configured by the local consensus node, create a genesis block in the local consensus network; and start the local consensus subchain based on the genesis block.
- the processing module 20-13 is also configured to perform transaction aggregation processing on the execution results corresponding to the local consensus transactions to obtain aggregated transaction information; generate an information on-chain transaction carrying the aggregated transaction information; call the main chain forwarding on-chain component to generate a main chain on-chain request carrying the information on-chain transaction; and send the main chain on-chain request to the core consensus node, where the main chain on-chain request is used to instruct the core consensus node to write the information on-chain transaction into the main chain.
- the first blockchain data processing device 20 - 1 further includes: a main chain synchronization module 20 - 81 , an archive data processing module 20 - 82 , a data backup module 20 - 83 , and an information receiving module 20 - 84 ;
- the main chain synchronization module 20-81 is configured to clear the archiving task event of the local consensus subchain from the first block when synchronizing from the main chain to the first block;
- the first block includes an archiving configuration transaction associated with the archiving task event;
- the archiving configuration transaction is determined by an archiving task command triggered by a business object;
- the archiving task command is used to archive the local consensus data on the local consensus subchain;
- the archiving data processing module 20-82 is configured to send the block data summary of the archived block on the local consensus subchain to the core consensus node based on the account archiving command when the archiving task command indicated by the archiving task event is a ledger archiving command, and the core consensus node is used to package the first summary confirmation event of the block data summary into a second block, and write the second block into the main chain;
- the data backup module 20-83 is configured to synchronize the second block from the main chain, determine the ledger data to be backed up based on the transaction original text in the archived block when the first summary confirmation event is cleared from the second block, and send the ledger data to be backed up to a remote backup device connected to the multi-layer chain network, wherein the remote backup device is used to back up the ledger data to be backed up to obtain ledger backup information;
- the information receiving module 20-84 is configured to forward the first backup signature sent by the remote backup device to the core consensus node, and the core consensus node is used to determine that the first backup signature has been generated by the remote backup device and the account backup data summary of the account backup information is consistent with the block data summary.
- the account book data to be backed up is backed up to the remote backup device.
- the local consensus node includes a local consensus ledger database and a main chain sub-ledger database; the local consensus ledger database is used to store the ledger data of the local consensus block on the local consensus sub-chain, and the main chain sub-ledger database is used to store the ledger data associated with the local consensus node, and the stored ledger data is cleared from the synchronized global consensus block;
- the archive data processing module 20-82 includes: a command parsing unit 20-821, a data search unit 20-822, and a backup data determination unit 20-823;
- the command parsing unit 20-821 is configured to read the to-be-archived block height of the local consensus subchain from the archiving command parameter indicated by the ledger archiving command, wherein the to-be-archived block height is the maximum block height of the to-be-archived local consensus block on the local consensus subchain;
- the data search unit 20-822 is configured to determine the archived block height of the local consensus sub-chain from the ledger data stored in the main chain sub-ledger database; the height of the block to be archived is greater than the archived block height;
- the backup data determination unit 20-823 is configured to obtain an intermediate block height between the archived block height and the to-be-archived block height, and use the local consensus block corresponding to the intermediate block height as the archived block.
- the archive data processing module 20-82 includes: a contract calling unit 20-824 and an information sending unit 20-825;
- the information sending unit 20-825 is configured to generate at least one first summary sending transaction based on the block data summary; send at least one first summary sending transaction to the core consensus node, and the core consensus node is used to generate the first summary confirmation event based on at least one first summary sending transaction.
- the archive data processing module 20-82 is further configured to, when the archive task command indicated by the archive task event is a contract archive command, send the contract data summary of the archive contract on the local consensus subchain to the core consensus node based on the contract archive command, and the core consensus node is used to package the second summary confirmation event of the contract data summary pair into a third block, and write the third block into the main chain;
- the information receiving module 20-84 is also configured to forward the second backup signature sent by the remote backup device to the core consensus node, and the core consensus node is used to determine that the contract data to be backed up has been backed up to the remote backup device when it is determined that the second backup signature is generated by the remote backup device and the account backup data summary of the contract backup information is consistent with the contract data summary.
- the archive data processing module 20-82 is also configured to determine the archive contract from the local consensus sub-chain based on the contract identifier indicated by the archive command parameter in the contract archive command.
- the main chain sub-ledger database is also used to store contract data associated with the local consensus node.
- the contract data is cleared from the synchronized global consensus block;
- the command parsing unit 20-821 is further configured to read the contract index value to be archived in the archived contract from the archive command parameter, wherein the contract index value to be archived is the maximum contract index value to be archived in the archived contract;
- the data search unit 20-822 is further configured to search for an archived contract index value in the archived contract from the account data stored in the main chain sub-account database; the index value of the contract to be archived is greater than the index value of the archived contract;
- the backup data determination unit 20-823 is also configured to determine the contract data to be backed up in the archived contract on the local consensus subchain based on the contract index value between the archived contract index value and the contract index value to be archived.
- the contract calling unit 20-824 is further configured to call the target archiving business contract on the local consensus subchain to process the contract data to be backed up of the archiving contract to obtain the contract data summary;
- the information sending unit 20-825 is also configured to generate at least one second summary sending transaction based on the contract data summary; send the at least one second summary sending transaction to the core consensus node, and the core consensus node is used to generate the second summary confirmation event based on the at least one second summary sending transaction.
- the information sending unit 20-825 is also configured to clear the contract data to be backed up that has been backed up to the remote backup device when receiving the second backup success information returned by the core consensus node; the second backup success information is generated by the core consensus node when it determines that the contract data to be backed up has been successfully backed up.
- the packaging module 20-11, the consensus module 20-12, the processing module 20-13, the main chain synchronization module 20-81, the archive data processing module 20-82, the data backup module 20-83 and the information receiving module 20-84 can be referred to the above description, and will not be further described here.
- the description of the same beneficial effects obtained by using the same method will not be repeated.
- FIG 21 is a structural diagram of a blockchain data processing device provided in an embodiment of the present application.
- the second blockchain data processing device 21-1 can be applied to the core consensus node.
- the second blockchain data processing device 21-1 can be a computer program (including program code) running in the blockchain node.
- the second blockchain data processing device 21-1 can be an application software; it can be understood that the second blockchain data processing device 21-1 can be used to execute the corresponding steps in the method provided in the embodiment of the present application.
- the second blockchain data processing device 21-1 may include: an acquisition module 21-21, a determination module 21-22, and a data return module 21-23;
- the determination module 21-22 is configured to determine, from the main chain, a global consensus block whose block height is greater than the block height of the third global consensus block as the first global consensus block that has not been synchronized to the local consensus node;
- the acquisition module 21-21 is further configured to acquire the first global contract state of the first global consensus block from the main chain;
- the first global contract state is a set of read data read when executing the global consensus transaction in the first global consensus block;
- the second blockchain data processing device 21 - 1 further includes: a data synchronization module 21 - 91 , an information confirmation module 21 - 92 , and an information verification module 21 - 93 ;
- the data synchronization module 21-91 is configured to synchronize the first block to the local consensus node of the local consensus subchain, wherein the local consensus node is used to clear the archiving task event of the local consensus subchain from the first block; the first block includes an archiving configuration transaction associated with the archiving task event; the archiving configuration transaction is determined by the archiving task command triggered by the business object; the archiving task command is used to archive the local consensus data on the local consensus subchain;
- the information confirmation module 21-92 is configured to receive the block data summary of the archived block sent by the local consensus node, package the first summary confirmation event of the block data summary into the second block, and write the second block into the main chain;
- the archived block is the local consensus block to be archived on the local consensus subchain determined by the local consensus node based on the ledger archiving command when the archiving task command indicated by the archiving task event is a ledger archiving command;
- the data synchronization module 21-91 is configured to synchronize the second block to the local consensus node, and the local consensus node is further used to determine the ledger data to be backed up when the first summary confirmation event is cleared from the second block, and send the ledger data to be backed up to a remote backup device of the multi-layer chain network;
- the information verification module 21-93 is configured to receive a first backup signature returned by the local consensus node, and when it is determined that the first backup signature is generated by the remote backup device and the ledger backup data summary of the ledger backup information is consistent with the block data summary, it is determined that the ledger data to be backed up has been successfully backed up to the remote backup device; the first backup signature is information returned by the remote backup device based on the ledger backup information, and the first backup signature is forwarded through the local consensus node, and the ledger backup information is information obtained by the remote backup device when backing up the ledger data to be backed up.
- the electronic device 1200 can be a terminal or a server, which will not be limited here. It can be understood that the electronic device can be a local consensus node and a core consensus node.
- the embodiment of the present application takes the electronic device as a server as an example for explanation, and the electronic device 1200 may include: a processor 1201, a network interface 1204 and a memory 1205.
- the electronic device 1200 may also include: a user interface 1203, and at least one communication bus 1202. Among them, the communication bus 1202 is used to realize the connection and communication between these components.
- the user interface 1203 may also include a standard wired interface and a wireless interface.
- the network interface 1204 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
- the memory 1205 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory.
- the memory 1205 may also be at least one storage device located away from the aforementioned processor 1201. As shown in FIG. 22 , the memory 1205 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
- the network interface 1204 in the electronic device 1200 can also provide a network communication function.
- the network interface 1204 can provide a network communication function;
- the user interface 1203 is mainly used to provide an input interface for the user;
- the processor 1201 can be used to call the device control application stored in the memory 1205 to execute the blockchain data processing method applied to the local consensus node or the blockchain data processing method applied to the core consensus node provided in the embodiment of the present application.
- the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the first blockchain data processing device or the second blockchain data processing device, and the computer program includes computer instructions.
- the processor executes the computer instructions, it can execute the blockchain data processing method applied to the local consensus node or the blockchain data processing method applied to the core consensus node provided in the embodiment of the present application.
- the computer instructions can be deployed on an electronic device for execution, or on multiple electronic devices located in one location, or on multiple electronic devices distributed in multiple locations and interconnected by a communication network. Multiple electronic devices distributed in multiple locations and interconnected by a communication network can constitute a blockchain system.
- the embodiment of the present application also provides a computer program product or a computer program, which may include computer instructions, which may be stored in a computer-readable storage medium.
- the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor may execute the computer instructions, so that the electronic device executes the blockchain data processing method applied to the local consensus node or the blockchain data processing method applied to the core consensus node provided in the embodiment of the present application.
- the blockchain data processing system 23-3 may include a local consensus node 3a and a core consensus node 3b; wherein the local consensus node 3a may be a local consensus node in a local consensus network as described in an embodiment of the present application. wherein the core consensus node 3b may be a core consensus node in a core consensus network as described in an embodiment of the present application.
- the modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
- the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a RAM, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
Claims (26)
- 一种区块链数据处理方法,所述方法由局部共识网络中的局部共识节点执行,所述局部共识网络部署在多层链网络的业务网络中,所述多层链网络中还部署有独立于所述业务网络的核心共识网络,所述核心共识网络包括核心共识节点;所述方法包括:将局部共识交易、主链绑定高度和主链读数据集合打包为局部共识区块,所述局部共识交易是指在所述局部共识网络中执行的业务交易,所述主链绑定高度为第一全局共识区块的区块高度,所述第一全局共识区块是在打包所述局部共识交易时从所述核心共识节点的主链上同步到的,所述主链读数据集合是从第一全局合约状态中所清分到的、且用于执行所述局部共识交易,所述第一全局合约状态为在执行所述第一全局共识区块中的全局共识交易时所读取到的读数据集合;将所述局部共识区块广播给局部验证节点,所述局部验证节点用于在所同步到的区块高度大于或等于所述主链绑定高度、以及所同步到的读数据集合与所述主链读数据集合一致时,获取所述局部共识交易的交易执行结果所对应的投票共识结果,所述局部验证节点为所述局部共识网络中除所述局部共识节点之外的共识节点;在基于所述局部验证节点返回的投票共识结果确定达成共识时,将所述局部共识区块上链至所述局部共识网络对应的局部共识子链,并将所述局部共识区块写入局部共识账本数据库。
- 根据权利要求1所述的方法,其中,所述方法还包括:调用所述局部共识子链上的局部共识业务合约执行以下处理:从主链子账本数据库中获取待确认区块高度;所述待确认区块高度为通过所述核心共识节点从所述主链上同步到的第二全局共识区块的区块高度,所述第二全局共识区块为对所述局部共识区块共识时同步到的所述主链上的全局共识区块;在所述待确认区块高度大于或等于所述主链绑定高度时,在所述主链子账本数据库中查找与所述第一全局共识区块相关联的读数据集合,得到待确认读数据集合;将所述待确认读数据集合中的键值对作为第一键值对,并将所述主链读数据集合的键值对作为第二键值对,在所述第一键值对和所述第二键值对一致时,执行所述局部共识区块中的所述局部共识交易,得到交易执行结果。
- 根据权利要求2所述的方法,其中,所述从主链子账本数据库中获取待确认区块高度之后,所述方法还包括:在所述待确认区块高度低于所述主链绑定高度时,取消对所述主链读数据集合的审核。
- 根据权利要求2所述的方法,其中,所述将所述待确认读数据集合中的键值对作为第一键值对,并将所述主链读数据集合的键值对作为第二键值对之后,所述方法还包括:在所述第一键值对与所述第二键值对不一致时,取消执行所述局部共识交易。
- 根据权利要求2所述的方法,其中,所述方法还包括:调用主链清分同步组件生成主链清分同步请求;所述主链清分同步请求携带所述第一全局共识区块的区块高度;将所述主链清分同步请求发送给所述核心共识节点;所述主链清分同步请求用于指示所述核心共识节点将高于所述第一全局共识区块的区块高度的全局共识区块,确定为所述主链上未同步给所述局部共识节点的全局共识区块,并从未同步给所述局部共识节点的全局共识区块中,选取待同步全局区块;接收所述核心共识节点返回的所述待同步全局区块,并将所述待同步全局区块作为所述第二全局共识区块。
- 根据权利要求1所述的方法,其中,所述方法还包括:在打包所述局部共识交易时,通过所述核心共识节点从所述主链上获取最大全局区块高度、以及所述最大全局区块高度对应的全局共识区块;将所述最大全局区块高度对应的全局共识区块作为所述第一全局共识区块,并将所述最大全局区块高度作为所述主链绑定高度。
- 根据权利要求1至6任一项所述的方法,其中,所述方法还包括:获取局部业务节点发送的子链清分同步请求;所述局部业务节点包括局部链子账本数据库,所述子链清分同步请求携带所述局部业务节点从局部共识子链上同步到的局部区块高度,所述局部共识子链为所述局部共识节点的区块链,所述局部区块高度为局部共识区块的区块高度;将所述局部共识子链上区块高度大于所述局部区块高度的局部共识区块,确定为未同步给所述局部业务节点的局部共识区块,并从所述未同步给所述局部业务节点的局部共识区块中,选取待同步局部区块;获取所述待同步局部区块的局部合约状态,并将所述待同步局部区块和所述局部合约状态返回给所述局部业务节点,所述局部业务节点用于将所述待同步局部区块、以及所述局部合约状态写入所述局部链子账本数据库中;所述局部合约状态为执行所述待同步局部区块中的局部共识交易所读取到的读数据集合,所述局部共识交易由所述局部共识网络的局部共识子链上的局部共识业务合约执行。
- 根据权利要求7所述的方法,其中,所述获取局部业务节点发送的子链清分同步请求之后,所述方法还包括:当所述局部共识子链上的最大局部区块高度等于或小于所述局部区块高度时,从所述局部共识子链上获取最大局部区块高度对应的局部共识区块;将所述最大局部区块高度对应的局部共识区块作为所述待同步局部区块。
- 根据权利要求1至6任一项所述的方法,其中,所述方法还包括:从所述主链上同步包括注册交易的目标共识区块,所述注册交易是指向所述核心共识节点申请注册所述局部共识子链的业务交易,所述目标共识区块中写有所述注册交易对应的配置交易,所述配置交易携带有配置信息;从所述目标共识区块中获取所述配置信息,在所述配置信息与所述局部共识节点所配置的信息一致时,在所述局部共识网络中创建创世区块;基于所述创世区块启动所述局部共识子链。
- 根据权利要求2至6任一项所述的方法,其中,所述方法还包括:对所述局部共识交易对应的执行结果进行交易汇总处理,得到汇总交易信息;生成携带所述汇总交易信息的信息上链交易;调用主链转发上链组件生成携带所述信息上链交易的主链上链请求;将所述主链上链请求发送给所述核心共识节点,所述主链上链请求用于指示所述核心共识节点将携带所述信息上链交易写入所述主链。
- 根据权利要求1至6任一项所述的方法,其中,所述方法还包括:在从所述主链上同步到第一区块时,从所述第一区块中清分所述局部共识子链的归档任务事件;所述第一区块中包括与所述归档任务事件关联的归档配置交易;所述归档配置交易是由业务对象触发的归档任务命令所确定的;所述归档任务命令用于对所述局部共识子链上的局部共识数据进行归档;在所述归档任务事件所指示的所述归档任务命令为账本归档命令时,基于所述账本归档命令,将所述局部共识子链上的归档区块的区块数据摘要发送给所述核心共识节点,所述核心共识节点用于将所述区块数据摘要的第一摘要确认事件打包至第二区块,并将所述第二区块写入所述主链;从所述主链上同步所述第二区块,在从所述第二区块中清分到所述第一摘要确认事件时,基于所述归档区块中的交易原文确定待备份账本数据,将所述待备份账本数据发送给与所述多层链网络的远程备份设备,所述远程备份设备用于对所述待备份账本数据进行备份,得到账本备份信息;将所述远程备份设备所发送的第一备份签名转发给所述核心共识节点,所述核心共识节点用于在确定所述第一备份签名由所述远程备份设备生成、且所述账本备份信息的账本备份数据摘要与所述区块数据摘要一致时,确定已将所述待备份账本数据备份至所述远程备份设备。
- 根据权利要求11所述方法,其中,所述局部共识节点包括局部共识账本数据库和主链子账本数据库;所述局部共识账本数据库用于存储所述局部共识子链上的局部共识区块的账本数据,所述主链子账本数据库用于存储与所述局部共识节点相关联的账本数据,存储的所述账本数据是从同步到的全局共识区块中清分到的;所述基于所述账本归档命令,将所述局部共识子链上的归档区块的区块数据摘要发送给所述核心共识节点,包括:从所述账本归档命令所指示的归档命令参数中,读取所述局部共识子链的待归档区块高度,所述待归档区块高度为所述局部共识子链上待归档局部共识区块的最大区块高度;从所述主链子账本数据库所存储的账本数据中,确定所述局部共识子链的已归档区块高度;所述待归档区块高度大于所述已归档区块高度;获取所述已归档区块高度与所述待归档区块高度之间的中间区块高度,将所述中间区块高度对应的局部共识区块,作为所述归档区块;将所述归档区块的所述区块数据摘要发送给所述核心共识节点。
- 根据权利要求11所述方法,其中,所述将所述局部共识子链上的归档区块的区块数据摘要发送给所述核心共识节点,包括:调用所述局部共识子链上的目标归档业务合约对所述归档区块的区块数据进行处理,得到所述区块数据摘要;根据所述区块数据摘要生成至少一个第一摘要发送交易;将至少一个所述第一摘要发送交易发送至所述核心共识节点,所述核心共识节点用于基于至少一个所述第一摘要发送交易生成所述第一摘要确认事件。
- 根据权利要求11所述方法,其中,所述将所述远程备份设备所发送的第一备份签名转发给所述核心共识节点之后,所述方法还包括:在接收到所述核心共识节点返回的第一备份成功信息时,将已备份至所述远程备份设备的所述待备份账本数据进行清除;所述第一备份成功信息是所述核心共识节点在确定已将所述待备份账本数据成功备份时生成的。
- 根据权利要求11所述方法,其中,所述从所述第一区块中清分所述局部共识子链的归档任务事件之后,所述方法还包括:在所述归档任务事件所指示的所述归档任务命令为合约归档命令时,基于所述合约归档命令,将所述局部共识子链上的归档合约的合约数据摘要发送给所述核心共识节点,所述核心共识节点用于将所述合约数据摘要对的第二摘要确认事件打包至第三区块,并将所述第三区块写入所述主链;从所述主链上同步所述第三区块,在从所述第三区块中清分到所述第二摘要确认事件时,将所述归档合约中的待备份合约数据发送给所述远程备份设备,所述远程备份设备还用于对所述待备份合约数据进行备份,得到合约备份信息;将所述远程备份设备所发送的第二备份签名转发给所述核心共识节点,所述核心共识节点用于在确定所述第二备份签名由所述远程备份设备生成、且所述合约备份信息的账本备份数据摘要与所述合约数据摘要一致时,确定已将所述待备份合约数据备份至所述远程备份设备。
- 根据权利要求15所述方法,其中,所述基于所述合约归档命令,将所述局部共识子链上的归档合约的合约数据摘要发送给所述核心共识节点,包括:基于所述合约归档命令中的归档命令参数所指示的合约标识,从所述局部共识子链上确定所述归档合约;将所述归档合约的所述合约数据摘要发送给所述核心共识节点。
- 根据权利要求16所述方法,其中,主链子账本数据库还用于存储与所述局部共识节点相关联的合约数据,存储的所述合约数据是从同步到的全局共识区块中所清分到的;所述将所述归档合约的所述合约数据摘要发送给所述核心共识节点,包括:从所述归档命令参数中,读取所述归档合约中的待归档合约索引值,所述待归档合约索引值为所述归档合约中待进行归档的最大合约索引值;从所述主链子账本数据库所存储的账本数据中,查找所述归档合约中的已归档合约索引值;所述待归档合约索引值大于所述已归档合约索引值;基于所述已归档合约索引值与所述待归档合约索引值之间的合约索引值,确定所述局部共识子链上的所述归档合约中的待备份合约数据;将所述待备份合约数据的所述合约数据摘要发送给所述核心共识节点。
- 根据权利要求15所述方法,其中,所述将所述局部共识子链上的归档合约的合约数据摘要发送给所述核心共识节点,包括:调用所述局部共识子链上的目标归档业务合约对所述归档合约的所述待备份合约数据进行处理,得到所述合约数据摘要;根据所述合约数据摘要生成至少一个第二摘要发送交易;将至少一个所述第二摘要发送交易发送至所述核心共识节点,所述核心共识节点用于基于至少一个所述第二摘要发送交易生成所述第二摘要确认事件。
- 根据权利要求15所述方法,其中,所述将所述远程备份设备所发送的第二备份签名转发给所述核心共识节点之后,所述方法还包括:在接收到所述核心共识节点返回的第二备份成功信息时,将已备份至所述远程备份设备的所述待备份合约数据进行清除;所述第二备份成功信息是所述核心共识节点在确定已将所述待备份合约数据成功备份时生成的。
- 一种区块链数据处理方法,所述方法由核心共识网络中的核心共识节点执行,所述核心共识网络部署在多层链网络中,所述多层链网络中与所述核心共识网络独立的业务网络部署有局部共识网络,所述局部共识网络包括局部共识节点,所述方法包括:获取所述局部共识节点发送的主链同步请求,所述主链同步请求携带第三全局共识区块的区块高度;所述第三全局共识区块为所述局部共识节点在同步到第一全局共识区块之前从主链上同步到的全局共识区块;从所述主链上,将区块高度大于所述第三全局共识区块的区块高度的全局共识区块,确定为未同步给所述局部共识节点的第一全局共识区块;从所述主链上获取所述第一全局共识区块的第一全局合约状态;所述第一全局合约状态为执行所述第一全局共识区块中的全局共识交易时所读取到的读数据集合;将所述第一全局共识区块、以及所述第一全局合约状态返回给所述局部共识节点,所述局部共识节点用于基于第一全局共识区块的区块高度和第一全局合约状态,将局部共识交易、主链绑定高度和主链读数据集合打包为局部共识区块,并在基于所述局部共识网络对所述局部共识区块达成共识时,将所述局部共识区块上链至所述局部共识网络中。
- 根据权利要求20所述的方法,其中,所述方法还包括:将第一区块同步至与局部共识子链的局部共识节点,所述局部共识节点用于从所述第一区块中清分所述局部共识子链的归档任务事件;所述第一区块中包括与所述归档任务事件关联的归档配置交易;所述归档配置交易是由业务对象触发的归档任务命令所确定的;所述归档任务命令用于对所述局部共识子链上的局部共识数据进行归档;接收所述局部共识节点发送的归档区块的区块数据摘要,将所述区块数据摘要的第一摘要确认事件打包至第二区块,将所述第二区块写入所述主链;所述归档区块为在所述归档任务事件所指示的所述归档任务命令为账本归档命令时,由所述局部共识节点基于所述账本归档命令确定的所述局部共识子链上待归档的局部共识区块;将所述第二区块同步至所述局部共识节点,所述局部共识节点还用于从所述第二区块中清分到所述第一摘要确认事件时确定待备份账本数据,并将所述待备份账本数据发送给与所述多层链网络的远程备份设备;接收所述局部共识节点返回的第一备份签名,在确定所述第一备份签名由所述远程备份设备生成、且账本备份信息的账本备份数据摘要与所述区块数据摘要一致时,确定已将所述待备份账本数据成功备份至所述远程备份设备;所述第一备份签名为所述远程备份设备基于所述账本备份信息返回的信息,且所述第一备份签名是通过所述局部共识 节点转发的,所述账本备份信息为所述远程备份设备对所述待备份账本数据进行备份所得到的信息。
- 一种第一区块链数据处理装置,所述第一区块链数据处理装置运行在局部共识网络中的局部共识节点上,所述局部共识网络部署在多层链网络的业务网络中,所述多层链网络中还部署有独立于所述业务网络的核心共识网络,所述核心共识网络包括核心共识节点,所述第一区块链数据处理装置包括:打包模块,配置为将局部共识交易、主链绑定高度和主链读数据集合打包为局部共识区块,所述局部共识交易是指在所述局部共识网络中执行的业务交易,所述主链绑定高度为第一全局共识区块的区块高度,所述第一全局共识区块是在打包所述局部共识交易时从所述核心共识节点的主链上同步到的,所述主链读数据集合是从第一全局合约状态中所清分到的、且用于执行所述局部共识交易,所述第一全局合约状态为在执行所述第一全局共识区块中的全局共识交易时所读取到的读数据集合;共识模块,配置为将所述局部共识区块广播给局部验证节点,所述局部验证节点用于在所同步到的区块高度大于或等于所述主链绑定高度、以及所同步到的读数据集合与所述主链读数据集合一致时,获取所述局部共识交易的交易执行结果所对应的投票共识结果,所述局部验证节点为所述局部共识网络中除所述局部共识节点之外的共识节点;处理模块,配置为在基于所述局部验证节点返回的投票共识结果确定达成共识时,将所述局部共识区块上链至所述局部共识网络对应的局部共识子链,并将所述局部共识区块写入局部共识账本数据库。
- 一种第二区块链数据处理装置,所述第二区块链数据处理装置运行在核心共识网络中的核心共识节点上,所述核心共识网络部署在多层链网络中;所述多层链网络中的业务网络部署有局部共识网络,所述局部共识网络是通过独立与所述业务网络的核心共识网络中的核心共识节点所构建的;所述第二区块链数据处理装置包括:获取模块,配置为获取局部共识节点发送的主链同步请求,所述主链同步请求携带第三全局共识区块的区块高度;所述第三全局共识区块为所述局部共识节点在同步到第一全局共识区块之前从主链上同步到的全局共识区块;确定模块,配置为从所述主链上,将区块高度大于所述第三全局共识区块的区块高度的全局共识区块,确定为未同步给所述局部共识节点的第一全局共识区块;所述获取模块,还配置为从所述主链上获取所述第一全局共识区块的第一全局合约状态;所述第一全局合约状态为执行所述第一全局共识区块中的全局共识交易时所读取到的读数据集合;数据返回模块,配置为将所述第一全局共识区块、以及所述第一全局合约状态返回给所述局部共识节点,所述局部共识节点用于基于第一全局共识区块的区块高度和第一全局合约状态,将局部共识交易、主链绑定高度和主链读数据集合打包为局部共识区块,并在基于所述局部共识网络对所述局部共识区块达成共识时,将所述局部共识区块上链至所述局部共识网络中。
- 一种用于区块链数据处理的电子设备,所述电子设备包括存储器和处理器;所述存储器与所述处理器相连,所述存储器用于存储计算机程序,所述处理器用于调用所述计算机程序,以使得电子设备执行权利要求1至21任一项所述的方法。
- 一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序适于由处理器加载并执行,以使得电子设备执行权利要求1至21任一项所述的方法。
- 一种计算机程序产品,所述计算机程序产品包括计算机程序或计算机可执行指令,所述计算机程序或计算机可执行指令被处理器执行时,实现权利要求1至21任一项所述的方法。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP23902161.1A EP4568174A4 (en) | 2022-12-15 | 2023-08-22 | BLOCKCHAIN DATA PROCESSING METHOD, APPARATUS, DEVICE, COMPUTER-READABLE STORAGE MEDIA AND COMPUTER PROGRAM PRODUCT |
| US18/510,310 US12445316B2 (en) | 2022-12-15 | 2023-11-15 | Blockchain data processing method, apparatus, and device, computer-readable storage medium, and computer program product |
Applications Claiming Priority (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211637944.0A CN118210853A (zh) | 2022-12-15 | 2022-12-15 | 多层区块链数据处理方法、相关设备、介质及程序产品 |
| CN202211637945.5 | 2022-12-15 | ||
| CN202211637944.0 | 2022-12-15 | ||
| CN202211637945.5A CN118214569A (zh) | 2022-12-15 | 2022-12-15 | 区块链数据处理方法、装置、设备、介质及产品 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US18/510,310 Continuation US12445316B2 (en) | 2022-12-15 | 2023-11-15 | Blockchain data processing method, apparatus, and device, computer-readable storage medium, and computer program product |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2024124952A1 true WO2024124952A1 (zh) | 2024-06-20 |
Family
ID=91484339
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2023/114284 Ceased WO2024124952A1 (zh) | 2022-12-15 | 2023-08-22 | 一种区块链数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 |
Country Status (1)
| Country | Link |
|---|---|
| WO (1) | WO2024124952A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121125742A (zh) * | 2025-11-14 | 2025-12-12 | 北京致医健康信息技术有限公司 | 一种基于数据分析的数据多向同步方法及系统 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190332702A1 (en) * | 2018-04-30 | 2019-10-31 | Hewlett Packard Enterprise Development Lp | System and method of decentralized management of multi-owner nodes using blockchain |
| CN110601857A (zh) * | 2019-09-25 | 2019-12-20 | 东北大学 | 一种基于局部-全局区块链协同的数据交互方法 |
| US20200366495A1 (en) * | 2018-01-29 | 2020-11-19 | Ubiquicorp Limited | Proof of majority block consensus method for generating and uploading a block to a blockchain |
| CN112541758A (zh) * | 2020-12-01 | 2021-03-23 | 鲁静 | 基于区块链的多轮投票式容错排序共识机制与方法 |
| CN113067707A (zh) * | 2021-06-02 | 2021-07-02 | 腾讯科技(深圳)有限公司 | 基于区块链的数据处理方法、装置、设备及可读存储介质 |
| CN114511319A (zh) * | 2021-12-29 | 2022-05-17 | 壹链盟生态科技有限公司 | 一种区块链共识方法 |
-
2023
- 2023-08-22 WO PCT/CN2023/114284 patent/WO2024124952A1/zh not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20200366495A1 (en) * | 2018-01-29 | 2020-11-19 | Ubiquicorp Limited | Proof of majority block consensus method for generating and uploading a block to a blockchain |
| US20190332702A1 (en) * | 2018-04-30 | 2019-10-31 | Hewlett Packard Enterprise Development Lp | System and method of decentralized management of multi-owner nodes using blockchain |
| CN110601857A (zh) * | 2019-09-25 | 2019-12-20 | 东北大学 | 一种基于局部-全局区块链协同的数据交互方法 |
| CN112541758A (zh) * | 2020-12-01 | 2021-03-23 | 鲁静 | 基于区块链的多轮投票式容错排序共识机制与方法 |
| CN113067707A (zh) * | 2021-06-02 | 2021-07-02 | 腾讯科技(深圳)有限公司 | 基于区块链的数据处理方法、装置、设备及可读存储介质 |
| CN114511319A (zh) * | 2021-12-29 | 2022-05-17 | 壹链盟生态科技有限公司 | 一种区块链共识方法 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121125742A (zh) * | 2025-11-14 | 2025-12-12 | 北京致医健康信息技术有限公司 | 一种基于数据分析的数据多向同步方法及系统 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20230316273A1 (en) | Data processing method and apparatus, computer device, and storage medium | |
| CN108777625B (zh) | 签名的验证方法、装置和系统、存储介质、电子装置 | |
| EP4332870A1 (en) | Transaction data processing method and apparatus, computer device and storage medium | |
| EP4568174A1 (en) | Blockchain data processing method, apparatus, device, computer-readable storage medium, and computer program product | |
| CN120494970B (zh) | 基于区块链的数字资产安全交易系统及方法 | |
| CN117917681B (zh) | 基于多区块链的资产转移方法、装置、设备、介质及产品 | |
| CN119691819A (zh) | 用于管理区块链网络上的大区块的计算机实现的系统和方法 | |
| CN112615847B (zh) | 基于区块链的数据共享和隐私保护方法 | |
| CN109766673A (zh) | 一种联盟式音视频版权区块链系统及音视频版权上链方法 | |
| US20230289782A1 (en) | Smart contract-based data processing | |
| WO2024082818A1 (zh) | 基于多区块链的跨链处理方法、装置、设备、系统及介质 | |
| CN116708463B (zh) | 基于多区块链的信息处理方法、装置、设备以及介质 | |
| WO2024093593A1 (zh) | 基于多区块链的数据处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品 | |
| WO2024099023A1 (zh) | 多区块链数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 | |
| CN116827957B (zh) | 基于多区块链的信息处理方法、装置、设备以及介质 | |
| WO2024124952A1 (zh) | 一种区块链数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 | |
| CN113300853A (zh) | 金融征信信息管理方法、装置、电子设备及存储介质 | |
| CN115695449A (zh) | 一种区块链数字藏品源文件跨平台同步与转移方法 | |
| CN117938867A (zh) | 一种多区块链数据处理方法、装置、设备、介质及产品 | |
| CN117951217B (zh) | 基于多区块链的跨链配置方法、装置、设备、系统及介质 | |
| WO2024153001A1 (zh) | 一种基于分层链网络的数据处理方法、装置、设备及介质 | |
| CN118214569A (zh) | 区块链数据处理方法、装置、设备、介质及产品 | |
| CN118210853A (zh) | 多层区块链数据处理方法、相关设备、介质及程序产品 | |
| CN117992534B (zh) | 基于多区块链的数据跨链方法、相关设备、介质及产品 | |
| WO2024216966A1 (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: 23902161 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 11202500398T Country of ref document: SG |
|
| WWP | Wipo information: published in national office |
Ref document number: 11202500398T Country of ref document: SG |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2023902161 Country of ref document: EP |
|
| ENP | Entry into the national phase |
Ref document number: 2023902161 Country of ref document: EP Effective date: 20250304 |
|
| WWP | Wipo information: published in national office |
Ref document number: 2023902161 Country of ref document: EP |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |