WO2021213065A1 - 一种区块链数据归档方法、装置和计算机可读存储介质 - Google Patents
一种区块链数据归档方法、装置和计算机可读存储介质 Download PDFInfo
- Publication number
- WO2021213065A1 WO2021213065A1 PCT/CN2021/080371 CN2021080371W WO2021213065A1 WO 2021213065 A1 WO2021213065 A1 WO 2021213065A1 CN 2021080371 W CN2021080371 W CN 2021080371W WO 2021213065 A1 WO2021213065 A1 WO 2021213065A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- accounting node
- state data
- data
- node
- information
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 79
- 230000001360 synchronised effect Effects 0.000 claims abstract description 92
- 238000012795 verification Methods 0.000 claims description 25
- 238000012217 deletion Methods 0.000 claims description 11
- 230000037430 deletion Effects 0.000 claims description 11
- 239000000284 extract Substances 0.000 claims description 5
- 230000004044 response Effects 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 20
- 230000006870 function Effects 0.000 description 17
- 230000008569 process Effects 0.000 description 14
- 238000007726 management method Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000013475 authorization Methods 0.000 description 4
- 238000004590 computer program Methods 0.000 description 4
- 238000012544 monitoring process Methods 0.000 description 4
- 239000000047 product Substances 0.000 description 4
- 230000006978 adaptation Effects 0.000 description 3
- 238000001914 filtration Methods 0.000 description 3
- 238000012216 screening Methods 0.000 description 3
- 238000012550 audit Methods 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000013480 data collection Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012954 risk control Methods 0.000 description 2
- 238000013515 script Methods 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012384 transportation and delivery Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
- G06F11/1464—Management of the backup or restore process for networked environments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/113—Details of archiving
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/178—Techniques for file synchronisation in file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/84—Using snapshots, i.e. a logical point-in-time copy of the data
Definitions
- This application relates to the field of communication technology, and in particular to a blockchain data archiving method, device, electronic equipment, and computer-readable storage medium.
- Blockchain system refers to the collection of a series of nodes that incorporate new blocks into the blockchain through consensus.
- the application of blockchain systems in the transaction field has become more and more. Extensive, for example, it can be used in transaction scenarios such as banks and governments.
- the storage space occupied by the blockchain data of each node in the blockchain system will also increase, resulting in slow response or even downtime of the nodes in the blockchain system. Circumstances have a negative impact on the operation of the blockchain.
- the embodiment of the application provides a blockchain data archiving method, which is used in a blockchain system.
- the blockchain system includes a consensus node, a first accounting node, and a second accounting node, and the method includes:
- the first accounting node synchronizes blockchain data with the consensus node, and determines the synchronization block height of the synchronized blockchain data, and the synchronized blockchain data includes state data;
- the first accounting node determines the target state data required by the current transaction in the state data, and backs up the target state data
- the first accounting node generates a state data snapshot of the synchronization block height according to the backed up target state data, and snapshots the state data, the synchronization block height, and the signature information of the first accounting node Together as archive point information, and sent to the second accounting node;
- the first accounting node archives the synchronized blockchain data according to the endorsement information and the archive point information.
- an embodiment of the present application provides a blockchain data archiving device for use in a blockchain system.
- the blockchain system includes a consensus node, a first accounting node, and a second accounting node.
- the device includes :
- a synchronization unit configured to synchronize the blockchain data between the first accounting node and the consensus node, and determine the synchronization block height of the synchronized blockchain data, and the synchronized blockchain data includes state data;
- a determining unit configured to determine the target state data required by the current transaction in the state data by the first accounting node, and back up the target state data
- the generating unit is configured so that the first accounting node generates a state data snapshot of the synchronization block height according to the target state data after the backup, and combines the state data snapshot, the synchronization block height, and the first record
- the signature information of the accounting nodes is collectively used as archive point information and sent to the second accounting node;
- a receiving unit configured to receive the endorsement information of the second accounting node for the archive point information by the first accounting node
- the archiving unit is configured so that the first accounting node archives the synchronized blockchain data according to the endorsement information and the archiving point information.
- an embodiment of the present application also provides an electronic device, including a processor and a memory, the memory stores executable instructions, and the processor is configured to execute the executable instructions stored in the memory to implement the embodiments of the present application.
- an electronic device including a processor and a memory, the memory stores executable instructions, and the processor is configured to execute the executable instructions stored in the memory to implement the embodiments of the present application.
- an embodiment of the present application also provides a computer-readable storage medium that stores executable instructions, which are used to implement the blockchain data archiving provided by the embodiments of the present application when executed by a processor. method.
- Fig. 1A is a schematic structural diagram of a blockchain data archiving system provided by an embodiment of the present application
- FIG. 1B is a schematic structural diagram of a blockchain system provided by an embodiment of the present application.
- FIG. 2A is a schematic flowchart of a blockchain data archiving method provided by an embodiment of the present application
- 2B is a schematic flowchart of a blockchain data archiving method provided by an embodiment of the present application.
- 2C is a schematic flowchart of a blockchain data archiving method provided by an embodiment of the present application.
- FIG. 3 is a schematic diagram of sub-state data backup provided by an embodiment of the present application.
- FIG. 4 is a schematic diagram of a snapshot of the Merkel tree corresponding to the state data provided by an embodiment of the present application
- FIG. 5 is a schematic diagram of blockchain data archiving of the first accounting node provided by an embodiment of the present application.
- Fig. 6 is a schematic diagram of a process of archiving blockchain data in a blockchain system provided by an embodiment of the present application
- FIG. 7 is a schematic structural diagram of a Merkel tree corresponding to state data provided by an embodiment of the present application.
- FIG. 8 is a schematic diagram of a process of constructing a local world state by a first accounting node according to an embodiment of the present application
- FIG. 9 is a schematic flowchart of a blockchain data archiving method provided by an embodiment of the present application.
- FIG. 10 is a schematic diagram of the flow of obtaining the latest blockchain data by the first accounting node according to an embodiment of the present application.
- FIG. 11 is a schematic structural diagram of a blockchain data archiving device provided by an embodiment of the present application.
- FIG. 12 is a schematic structural diagram of a blockchain data archiving device provided by an embodiment of the present application.
- FIG. 13 is a schematic structural diagram of a blockchain data archiving device provided by an embodiment of the present application.
- FIG. 14 is a schematic structural diagram of a blockchain data archiving device provided by an embodiment of the present application.
- FIG. 15 is a schematic structural diagram of a blockchain data archiving device provided by an embodiment of the present application.
- FIG. 16 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
- first ⁇ second ⁇ third involved only distinguishes similar objects, and does not represent a specific order for the objects. Understandably, “first ⁇ second ⁇ third” Where permitted, the specific order or sequence can be interchanged, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein.
- the term “plurality” refers to at least two.
- Blockchain It is an encrypted, chain-type transaction storage structure formed by blocks.
- the header of each block can not only include the hash value of all transactions in the block, but also the hash value of all transactions in the previous block, so as to achieve tamper-proof transactions in the block based on the hash value And anti-counterfeiting; newly generated transactions are filled in the block and after the consensus of the nodes in the block chain system, they will be appended to the end of the block chain to form chain growth.
- Blockchain Network Also known as the blockchain system, it refers to a series of nodes that incorporate new blocks into the blockchain through consensus.
- Transaction equivalent to the computer term "transaction”, a transaction includes operations that need to be submitted to the blockchain system for execution, and does not simply refer to transactions in a business context.
- transaction the embodiments of this application follow this habit.
- the deployment (Deploy) transaction is used to install the specified smart contract on the node in the blockchain system and is ready to be called;
- the Invoke transaction is used to add the transaction record in the blockchain by calling the smart contract, and
- Operations on the state database of the blockchain include update operations (including adding, deleting, and modifying key-value pairs in the state database) and query operations (ie, querying the key-value pairs in the state database).
- Ledger a collective term for blockchain (also known as ledger data) and a state database synchronized with the blockchain.
- the blockchain records transactions in the form of files in the file system
- the state database records transactions in the blockchain in the form of key (Key) value (Value) pairs, and is used to support transactions in the blockchain.
- the state database is also called the ledger database.
- Smart contracts also known as chain code (Chaincode) or application code, the program deployed in the node of the blockchain network, the node executes the smart contract called in the received transaction, to check the state database The key value updates or queries the data.
- Consensus It is a process in the blockchain system used to reach agreement on transactions in the block between multiple nodes involved, and the agreed block will be appended to the end of the blockchain .
- the mechanisms for achieving consensus include proof of work (PoW, Proof of Work), proof of equity (PoS, Proof of Stake), and share authorization proof (DPoS, Delegated Proof-of-Stake), etc.
- the applicant of this application found that the blockchain system is still providing transaction services normally when generating a snapshot of the ledger. If the state data of the accounting node is read and written in the snapshot, it still exists Transaction, snapshot reading and writing will conflict with the transaction, resulting in snapshot reading failure or inaccurate data read by the snapshot, and the generated state data snapshot also lacks credibility. Therefore, in the solutions provided by related technologies, the archiving accuracy and archiving efficiency of blockchain data are low.
- the embodiments of the present application provide a blockchain data archiving method, device, electronic equipment, and computer-readable storage medium, which can effectively improve the archiving accuracy and archiving efficiency of blockchain data.
- the blockchain data archiving device can be integrated in an electronic device, and the electronic device can be a server or a terminal or other equipment.
- the blockchain data archiving method provided in the embodiments of the present application is mainly applied to the blockchain system, which is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
- the blockchain is essentially a decentralized database, which is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify the validity of the information. (Anti-counterfeiting) and generate the next block.
- the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
- the underlying platform of the blockchain can include processing modules such as user management, basic services, smart contracts, and operation monitoring.
- the user management module is responsible for the identity information management of all blockchain participants, including the maintenance of public and private key generation (account management), key management, and maintenance of the correspondence between the user’s real identity and the blockchain address (authority management), etc.
- authorization supervise and audit certain real-identity transactions, and provide risk control rule configuration (risk control audit); basic service modules are deployed on all blockchain node devices to verify the validity of business requests, After completing the consensus on the valid request, it is recorded on the storage.
- the basic service For a new business request, the basic service first performs interface adaptation analysis and authentication processing (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management), After encryption, it is completely and consistently transmitted to the shared ledger (network communication), and recorded and stored; the smart contract module is responsible for contract registration and issuance, contract triggering and contract execution.
- interface adaptation interface adaptation
- consensus algorithm consensus algorithm
- the smart contract module is responsible for contract registration and issuance, contract triggering and contract execution.
- the operation monitoring module is mainly responsible for the deployment of the product release process , Configuration modification, contract settings, cloud adaptation, and visual output of real-time status during product operation, such as: alarms, monitoring network conditions, monitoring node equipment health status, etc.
- the platform product service layer provides basic capabilities and implementation frameworks for typical applications. Based on these basic capabilities, developers can superimpose business characteristics to complete the blockchain implementation of business logic.
- the application service layer provides application services based on the blockchain solution for business participants to use.
- FIG. 1A is a schematic structural diagram of the blockchain data archiving system 100 provided by the embodiment of the present application, including a blockchain system 200 (block The chain system 200 includes a plurality of nodes, the node 210 is exemplarily shown in FIG. 1A) and the service system 400 (the terminal 410 belonging to the service system 400 and the graphical interface 420 thereof are exemplarily shown), which will be described separately below.
- the type of the blockchain system 200 is flexible and diverse, for example, it can be any one of a public chain, a private chain, or a consortium chain.
- the electronic equipment of any business system (or business subject), such as terminals and servers can access the blockchain system 200 without authorization; taking the alliance chain as an example, the business system is getting After authorization, electronic devices (such as terminals/servers) under its jurisdiction can access the blockchain system 200. At this time, they become a special type of node in the blockchain system 200, namely, the client node.
- the blockchain system 200 receives the transaction submitted by the client node of the business system (for ease of description, the terminal 410 is taken as an example below), executes the transaction to update the ledger or query the ledger, and displays the execution in the graphical interface 420 of the terminal 410 Various intermediate or final results of the transaction. Understandably, for the blockchain system 200 that receives and executes transactions above, it specifically refers to the native node 210 in the blockchain system 200.
- the client node of the business system has a blockchain system When the functions of the native node 210 in 200 (for example, consensus function, accounting function), the corresponding client node may also be included.
- the following takes the business system access to the blockchain system as an example to illustrate an exemplary application of the blockchain system.
- the terminal 410 when the terminal 410 needs to upload data to the blockchain, it can generate a transaction corresponding to the update operation, and the transaction includes the data that needs to be uploaded.
- the transaction can also specify the smart contract that needs to be called to implement the update operation and the parameters passed to the smart contract.
- the transaction can also carry the digital signature signed by the business system 400 (for example, the digital certificate issued by the certification center 300 for the business system 400)
- the private key in the transaction is obtained by encrypting the digest of the transaction), and the transaction is broadcast to the blockchain system 200.
- the node 210 in the blockchain system 200 receives the transaction, it verifies the digital signature carried by the transaction.
- the node 210 successfully verifies the digital signature in the transaction, it confirms whether the business system 400 has the transaction authority according to the identity of the business system 400 carried in the transaction. Any verification judgment of the digital signature and authority verification will cause the transaction to fail.
- the digital signature of the node 210 is signed (for example, the digest of the transaction is encrypted using the private key of the node 210), and it continues to be broadcast in the blockchain system 200.
- the digital signature is the signature information.
- the node 210 with the sorting function in the blockchain system 200 After the node 210 with the sorting function in the blockchain system 200 receives the successfully verified transaction, it fills the transaction into a new block and broadcasts it to the node (ie, consensus node) that provides the consensus service in the blockchain system 200.
- the node ie, consensus node
- the node 210 that provides consensus services in the blockchain system 200 performs a consensus process on the new block to reach a consensus.
- the node 210 that provides the accounting function (ie, the accounting node) appends the new block to the end of the blockchain and executes the new block.
- Transactions in blocks For transactions that submit data, add key-value pairs corresponding to the data in the state database to update the state database. It is worth noting that a node in the blockchain system can provide multiple functions at the same time, for example, it provides sorting function and consensus function at the same time.
- the terminal 410 when the terminal 410 needs to query data from the blockchain system 200, it can generate a transaction corresponding to the query operation (for example, the transaction may include the key to be queried), specify the smart contract that needs to be called to implement the query operation, and For the parameters passed to the smart contract, the transaction can also carry the digital signature signed by the business system 400 and broadcast the transaction to the blockchain system 200.
- the transaction may include the key to be queried
- the smart contract For the parameters passed to the smart contract, the transaction can also carry the digital signature signed by the business system 400 and broadcast the transaction to the blockchain system 200.
- the block is filled and the consensus is consistent, the new block is appended to the end of the blockchain, and the transaction in the new block is executed: for the transaction querying data, query from the state database Corresponding key-value pairs, and return the query result (for example, the query result can be the value corresponding to the key in the submitted transaction).
- the blockchain system may include a consensus node and multiple accounting nodes.
- the accounting node can be responsible for implementing the read and write operations on the ledger by executing the chain code, that is, it is mainly responsible for maintaining the state data and a copy of the ledger.
- the accounting node can also be called a peer node.
- Consensus nodes can also be called consensus ordering nodes (Orderer).
- they are mainly used to receive transactions containing signature information, sort unpackaged transactions to generate blocks, and broadcast to peer nodes and blockchain systems.
- the number of consensus nodes included may be only one, and of course the blockchain system may also include a node cluster of consensus nodes.
- the accounting node that needs to perform the archiving operation is called the first accounting node, and the other accounting nodes are called the second accounting node.
- the number of second accounting nodes Is at least one.
- the blockchain system 500 includes a first accounting node 510, a second accounting node 520, and a consensus node 530.
- the first accounting node 510 may synchronize the blockchain data with the consensus node 530, and determine the synchronization block height of the synchronized blockchain data, and the synchronized blockchain data includes state data. Then, the first accounting node 510 determines the target state data required for the current transaction in the state data, and backs up the target state data, where the current transaction is a transaction performed after the blockchain data is synchronized.
- the first accounting node 510 generates a state data snapshot of the synchronization block height according to the target state data after the backup, and uses the state data snapshot, the synchronization block height, and the signature information of the first accounting node 510 as archive point information together, and The archive point information is sent to the second accounting node 520.
- the first accounting node 510 receives the endorsement information of the second accounting node 520 for the archive point information, and the endorsement information is used to instruct the second accounting node 520 to approve the archive point information.
- the first accounting node 510 archives the synchronized blockchain data according to the endorsement information and archiving point information.
- the block chain data can include block data in the block chain and state data describing the world state (World State).
- the block data is the record of each transaction that actually occurs on the block chain.
- the data can include normal block data and configuration block data.
- the state data may include recording the current state of each account and smart contract, and the state data of the node may be stored in the state database (ie, the local database) of the node.
- archiving can be understood as data archiving, which mainly refers to copying some data in the blockchain data to obtain a snapshot, and can also refer to deleting and/or transferring block data within a certain range to other distributed In the cold storage of the storage system (referring to the distributed storage system different from the blockchain system, dedicated to archiving), to save the local storage space of the accounting node.
- the nodes in the blockchain system may be servers or terminals, and client nodes are the same.
- the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, and cloud communications. , Middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms.
- the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but it is not limited to this.
- the terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited in the embodiment of the present application.
- the embodiments of the present application will be described from the perspective of a blockchain data archiving device.
- the blockchain data archiving device may be integrated in an electronic device, and the electronic device may be a server or a terminal and other equipment.
- FIG. 2A is a schematic flowchart of a blockchain data archiving method provided by an embodiment of the present application, which will be described in conjunction with the steps shown in FIG. 2A.
- step 101 the first accounting node synchronizes the blockchain data with the consensus node, and determines the synchronization block height of the synchronized blockchain data, and the synchronized blockchain data includes state data.
- the blockchain system includes a consensus node and multiple accounting nodes.
- the accounting node can also be called a Peer node, which is responsible for implementing the read and write operations on the ledger by executing the chain code, that is, it is mainly responsible for maintaining the state data and the copy of the ledger.
- the consensus node is used to receive transactions containing signature information, sort unpackaged transactions to generate blocks, and broadcast to Peer nodes.
- the accounting node that needs to archive data is referred to as the first accounting node, and other accounting nodes are referred to as the second accounting node, and the number of the second accounting nodes is at least one.
- the first accounting node When the first accounting node needs to archive data, it first synchronizes the blockchain data with the consensus node, and determines the synchronization block height of the blockchain data after synchronization.
- the synchronized blockchain data includes block data and status data.
- the block data is used to describe the blocks in the blockchain.
- the status data can include recording the current status of each account and smart contract in the blockchain system. .
- the synchronization block height may refer to the block height (or the number of blocks) of the synchronized block chain data obtained after the first accounting node and the consensus node synchronize the block chain data. For example, if there are 5 blocks in the blockchain data after the synchronization of the first accounting node, the synchronization block height can be 5.
- the above-mentioned first accounting node and consensus node can synchronize blockchain data in this way: the first accounting node sends a synchronization request to the consensus node, and the synchronization request includes the first accounting node
- the first billing node receives the block sent by the consensus node for the synchronization request; where the block is sent when the consensus node verifies the identity of the first billing node in the synchronization request; the first note
- the account node updates the local blockchain data according to the block sent by the consensus node, and obtains the synchronized blockchain data.
- the first accounting node may send a synchronization request to the consensus node, and the synchronization request may carry the identity of the first accounting node.
- the consensus node receives the synchronization request, it verifies the identity of the first accounting node in the synchronization request.
- the consensus node passes the verification of the identity of the first accounting node, that is, when it is determined that there is no problem with the identity of the first accounting node, the block locally stored by the consensus node is sent to the first accounting node.
- the consensus node can send all the blocks stored locally to the first accounting node, or send the latest block to the first accounting node to save computing resources, where the latest block can refer to the latest Blocks that are appended to the end of the blockchain and whose number is equal to the synchronization number threshold (such as 1 or 2) can also refer to the last synchronization (that is, the consensus node sends the block to the first accounting node once) Based on the new block.
- the consensus node sending the latest block to the first accounting node as an example.
- the first accounting node After the first accounting node receives the latest block from the consensus node, it updates the local blockchain data according to the latest block received, and uses the updated blockchain data as the synchronized blockchain data , Complete the blockchain data synchronization.
- the first accounting node recognizes the number of blocks existing in the synchronized blockchain data, and uses the number of blocks as the synchronized block height of the synchronized blockchain data. For example, if the synchronized blockchain data contains 5 blocks, the synchronized block height of the synchronized blockchain data is 5.
- the first accounting node may trigger a synchronization request (send a synchronization request to the consensus node) when receiving an archiving request or an archiving instruction (for example, an artificially triggered archiving request or an archiving instruction).
- the first billing node can also automatically trigger the sending of synchronization requests every fixed time period. For example, the first billing node can be set to trigger a synchronization request every 5 minutes or every 20 minutes and other time periods, and then Determine the synchronization block height of the blockchain data after synchronization.
- step 102 the first accounting node determines the target state data required by the current transaction in the state data, and backs up the target state data.
- the nodes in the blockchain system may still be performing transactions. If these transactions are ignored, the accuracy of data archiving will be reduced. Therefore, in the embodiment of the present application, the first accounting node determines the target state data required by the current transaction among the state data included in the synchronized blockchain data, and backs up the target state data, where the current transaction is Transactions performed after the blockchain data is synchronized.
- the first accounting node can directly archive the synchronized blockchain data, which can ensure data archiving Accuracy.
- the above-mentioned first accounting node can determine the target state data required for the current transaction in the state data in this way: the first accounting node compares the synchronization block height with the archive block height Matching; when the synchronization block height matches the archive block height successfully, the first accounting node determines the target state data required for the current transaction in the state data.
- conditions can be preset for data archiving.
- the archive block height can be preset, and after obtaining the synchronization block height, the first accounting node matches the synchronization block height with the archive block height.
- the first accounting node performs the operation of determining the target state data required for the current transaction in the state data; when the synchronization block height matches the archive block height failed, The first accounting node no longer performs subsequent operations.
- the height of the archive block can be set according to actual application scenarios, and the number can be one or more.
- the height of multiple archive blocks with the same interval can be set, such as an integer multiple of 10, specifically including 10, 20, ... 10 ⁇ n, where n is an integer greater than 1.
- "synchronization block height and archive block height match successfully” can mean that the synchronization block height is the same as the archive block height, and "the synchronization block height is the same as the archive block height.
- “Height matching failure” can mean that the synchronization block height is different from the archive block height; in the case where the number of archive block heights includes multiple, "the synchronization block height matches the archive block height successfully” can refer to the synchronization area The block height is the same as the height of a certain archive block. "The synchronization block height and the archive block height failed to match” can mean that the synchronization block height is different from the height of all archive blocks.
- the first accounting node In step 103, the first accounting node generates a state data snapshot of the synchronization block height according to the target state data after the backup, and uses the state data snapshot, the synchronization block height and the signature information of the first accounting node as the archive point information. , And sent to the second accounting node.
- the state data snapshot may be a snapshot obtained by performing a snapshot copy of the state data (here, the target state data after the backup).
- the first accounting node may package the state data snapshot, the synchronization block height, and the signature information of the first accounting node into archive point information, and send the archive point information to the second accounting node. Among them, the first accounting node can sign the state data snapshot to obtain signature information.
- step 104 the first billing node receives the endorsement information of the second billing node for the archive point information.
- the endorsement information is used to indicate the approval of the archive point information by the second accounting node.
- the second accounting node may verify the received archive point information, and sign the archive point information when the verification passes to obtain the endorsement information.
- the second accounting node may verify the root hash value of the state data snapshot in the archive point information sent by the first accounting node.
- the second accounting node will archive the point The information is approved, and the archive point information is signed to obtain the endorsement information for the archive point information.
- the second accounting node can also broadcast the archive point information to other second accounting nodes.
- it further includes: when the first accounting node receives the archive point information sent by the second accounting node, the first accounting node extracts the second accounting point from the archive point information.
- the root hash value of the state data of the accounting node the first accounting node compares the root hash value of the state data of the second accounting node with the root hash value of the state data of the first accounting node; when the second accounting node When the root hash value of the state data of the accounting node is the same as the root hash value of the state data of the first accounting node, the first accounting node signs the archive point information to obtain the endorsement information of the archive point information; The accounting node sends the endorsement information to the second accounting node, and broadcasts the archive point information in the blockchain system.
- the first accounting node may also receive the archiving point information sent by the second accounting node that requires data archiving.
- the first accounting node extracts the root hash value of the state data of the second accounting node from the archive point information sent by the second accounting node, and compares the extracted root hash value with the first The root hash value of the state data of the accounting node is compared, and the method of generating the root hash value will be explained later.
- the first accounting node signs the archive point information sent by the second accounting node, Obtain the endorsement information of the archive point information, and send the endorsement information to the second accounting node.
- the archive point information sent by the second accounting node can also be broadcast in the blockchain system. Through the above method, the accuracy and effectiveness of the endorsement are improved.
- the first accounting node archives the synchronized blockchain data according to the endorsement information and archiving point information.
- the first accounting node can determine the target block data that needs to be deleted in the blockchain data after synchronization according to the endorsement information and archive point information, and delete the target block data, and at the same time, store the target block data
- the distributed storage system here is different from the blockchain system.
- the embodiment of the present application backs up the target state data required by the current transaction, and generates a state data snapshot based on the target state data after the backup, which solves the conflict between the snapshot and the original transaction, and realizes the status data
- the embodiment of the present application backs up the target state data required by the current transaction, and generates a state data snapshot based on the target state data after the backup, which solves the conflict between the snapshot and the original transaction, and realizes the status data
- let other accounting nodes in the blockchain system sign and endorse information such as state data snapshots, making this information credible, and therefore, can greatly improve the archiving efficiency and accuracy of blockchain data archiving .
- Figure 2B is a schematic flow chart of the blockchain data archiving method provided by an embodiment of the present application.
- Step 102 shown in Figure 2A can be implemented through steps 201 to 204, and each step will be combined. Be explained.
- step 201 the first accounting node obtains the block height corresponding to the sub-state data and the storage tag in the local database.
- the state data may include a plurality of sub-state data, and these sub-state data are stored in a local database (that is, the state database) of the first accounting node.
- the storage tag may refer to a key-value pair K-V (key-value) in the local database, and each K (key) corresponds to a V (value).
- K-V key-value
- V value
- the storage tag of a certain sub-state data in the local database can be K1-V1
- K1 is the number of the sub-state data in the local database
- V1 is the value corresponding to this number in the local database.
- Different sub-state data may correspond to different block heights, and the first accounting node can determine the block height corresponding to the sub-state data according to the block number corresponding to the sub-state data. For example, if the first sub-state data corresponds to the first block (refers to the first block in the blockchain, the same applies to the following), it can be explained that the block height corresponding to the first sub-state data is 1; The third block corresponding to the two sub-state data can indicate that the block height corresponding to the second sub-state data is 3. The first accounting node can read the key-value pair corresponding to each sub-state data in the local database, and use the key-value pair as the storage tag of the sub-state data.
- step 202 the first billing node adds the block height corresponding to the sub-state data to the storage tag corresponding to the sub-state data for marking, and the storage tag is obtained after the mark is obtained.
- the first accounting node adds the block height corresponding to the sub-state data to the storage tag corresponding to the sub-state data to mark the storage tag.
- the first accounting node may add a version number (Version) to the storage tag of the sub-state data, and the version number is the block height corresponding to the sub-state data. For example, if the block height corresponding to a certain sub-state data is 5 and the storage label is (K1-V1), after adding the version number (block height) to the storage label, the storage label after marking can be (K1 -V1, version (5)).
- the first accounting node selects the target sub-state data required by the current transaction from the multiple sub-state data according to the stored tag after the mark.
- the above-mentioned first billing node can be implemented in this way to filter out the target sub-state data required by the current transaction from the multiple sub-state data according to the stored tag after the mark: the first billing node obtains Transaction information corresponding to the current transaction; the first accounting node determines the current block height of the current blockchain data of the first accounting node according to the transaction information; when the current block height exceeds the synchronization block height, the first accounting node The node determines that there is a new block in the current blockchain data; the first accounting node filters out the call information required by the transaction in the new block from the current blockchain data, and the call information is used to indicate the sub-state data of the call; first The accounting node stores the label according to the calling information and the label, and filters out the target sub-state data from multiple sub-state data.
- the first accounting node will receive the consensus node For the new block sent, at this time, the first accounting node can determine the current block height according to the current block chain data.
- the current blockchain data is not necessarily the synchronized blockchain data.
- the current blockchain data continues to generate transactions after the blockchain data is synchronized, thereby updating the synchronized blockchain data The obtained blockchain data. Therefore, the block height of the current blockchain data and the synchronized blockchain data may be different. If there is no transaction information in the current transaction (equivalent to the absence of the current transaction), it means that the current blockchain data at this time is equal to the synchronized blockchain data.
- the first accounting node determines that there is a new block in the current block chain data, and filters out the calling information needed for the transaction in the new block from the current block chain data, and calls
- the information is used to indicate the sub-status data of the call.
- the calling information can be used to indicate which sub-state data of which block height in the state data needs to be called for the current transaction. For example, the sub-state data with a block height of 3 and a sub-state data value of V1 needs to be called.
- the first billing node determines the label of the sub-state data that needs to be called and stores the label according to the calling information, and filters out the target sub-state data in the state data according to the determined labeling storage label, for example, or uses the calling information to indicate the need to call
- the first accounting node can determine the label of the target sub-state data that needs to be called and store the label as (K1-V1, version (3))
- the first billing node stores the label according to this mark, and can filter out the target sub-state data in the state data.
- the target status data includes all target sub-status data filtered out here.
- the first accounting node can stop performing subsequent operations, that is, stop data archiving.
- step 204 the first accounting node backs up the target sub-state data.
- the first accounting node can back up the target sub-state data after filtering and obtaining the target sub-state data.
- the above-mentioned first accounting node can back up the target sub-state data in such a way: the first accounting node filters out the transaction operation information required by the transaction in the new block from the transaction information; An accounting node determines the transaction operation type corresponding to the target sub-state data according to the transaction operation information; when the transaction operation type is an update operation, the first accounting node backs up the target sub-state data corresponding to the update operation; when the transaction operation type For the deletion operation, the first accounting node backs up the target sub-state data corresponding to the deletion operation, and adds a delete label to the target sub-state data after the backup; the delete label is used to indicate that the target sub-state data after the backup is in It cannot be read during transaction execution.
- the first accounting node can filter out the transaction operation information required by the transaction in the new block from the transaction information of the current blockchain data.
- the transaction operation information contains the operation type of the target sub-state data called during the transaction.
- the usual operation types can include update and delete.
- the first accounting node determines the transaction operation type corresponding to the target sub-state data according to the transaction operation information. For example, the transaction operation type of each target sub-state data in the transaction operation information is one-to-one correspondence, and finally, each target sub-state data is obtained. The type of transaction operation corresponding to the status data.
- the first accounting node backs up the target sub-state data according to the transaction operation type of the target sub-state data.
- the transaction operation type of the target sub-state data is an update operation
- the target sub-state data corresponding to the update operation will be updated.
- Perform backup directly For example, if the storage tag of the target sub-state data corresponding to the update operation is (K1-V1, version (5)), then this sub-state data can be backed up directly.
- the block height of the new block in FIG. 3 refers to the current block height.
- the first accounting node When the transaction operation type of the target sub-state data is a delete operation, the first accounting node backs up the target sub-state data corresponding to the delete operation, and adds a delete label to the target sub-state data after the backup, for example, as shown in Figure 3
- the storage label is (K3-V3, version (4)) as an example.
- the first accounting node directly backs up the target sub-state data and is the target after the backup.
- the deletion tag can be any identifier, for example, it can be deleted, D, it can be the Chinese character "deleted", or it can be other deletion identifiers.
- Adding a deletion label to the target sub-state data after the backup may refer to adding the deletion label to the marked storage label corresponding to the target sub-state data after the backup, so as to update the marked storage label.
- the post-marked storage label corresponding to the target sub-state data after the backup can be updated to (K3-V3, version (4), delete).
- the first accounting node adds a deletion tag to the backed up target sub-state data
- the backed-up target sub-state data cannot be read during subsequent transactions.
- step 103 shown in FIG. 2A can be implemented through step 205 to step 209, which will be described in combination with each step.
- step 205 the first accounting node filters out the synchronization sub-state data whose block height does not exceed the height of the synchronization block from the state data, and obtains the synchronization sub-state data set.
- the first accounting node stores tags according to the sub-state data in the state data, and filters out the sub-state data whose block height does not exceed the height of the synchronization block.
- the sub-state data filtered out here is named To synchronize the sub-state data. Taking the synchronization block height as an example of 5, the first accounting node can filter out the sub-state data whose block height does not exceed 5 in the local database after the tag is stored, and use these filtered sub-state data as synchronization The sub-state data is added to the synchronized sub-state data collection.
- step 206 the first accounting node uses the backed up target sub-state data as the new synchronization sub-state data and adds it to the synchronization sub-state data set to update the synchronization sub-state data set.
- the target sub-state data corresponding to the update operation in the state data of the first accounting node may have been updated, that is, the synchronized sub-state data set obtained in step 205 includes Is the target sub-state data that has been updated; the target sub-state data corresponding to the deletion operation in the state data of the first accounting node may have been deleted, that is, the synchronization sub-state data set obtained in step 205 does not include deletion The target sub-state data corresponding to the operation.
- the first accounting node uses the backed up target sub-state data as the new synchronization sub-state data and adds it to the synchronization sub-state data.
- the state data set in order to realize the update of the synchronized sub-state data set.
- the target state data after the backup may include the target sub-state data corresponding to the update operation of the backup, and the target sub-state data after the backup with the added or deleted tag, the two cases will be described separately.
- the first accounting node uses the target sub-state data corresponding to the backup update operation to replace the corresponding synchronization sub-state data in the synchronization sub-state data set. For example, take the target sub-state data corresponding to the update operation as (K1-V1, version (5)), which is updated to (K1-V1', version (5+1)) in the transaction of the new block, in step 205
- the obtained synchronization sub-state data set also includes (K1-V1', version (5+1)).
- the first accounting node uses the previously backed up (K1-V1, version (5)) to replace (K1-V1', version (5+1)) in the synchronized sub-state data set, so that it can Ensure the accuracy of subsequent state data snapshots.
- step 205 For the target sub-state data corresponding to the delete operation, take (K3-V3, version (4)) as an example. Since (K3-V3, version (4)) has been deleted during the current transaction, step 205 is obtained The post-synchronization sub-state data set does not include (K3-V3, version (4)). Therefore, the target sub-state data after the backup with the added and deleted tags, namely (K3-V3, version (4)), is added to the synchronized sub-state data set to supplement the deleted (K3-V3, version (4) ))s position.
- the corresponding sub-state data is represented by storing tags after marking.
- the above method can obtain the updated synchronized sub-state data set through the operation of replacement and addition.
- the first accounting node can ensure that the state data within the height of the synchronized block Integrity, and further, can ensure the accuracy of the state data snapshot of the synchronized block obtained when the state data is snapshotted.
- step 207 the first accounting node performs a hash operation on the synchronized sub-state data in the updated synchronized sub-state data set to generate state data of the target structure.
- the target structure may be a Merkle Tree, which of course does not constitute a limitation to the embodiments of the present application.
- the above-mentioned first accounting node can perform a hash operation on the synchronized sub-state data in the updated synchronized sub-state data set to generate the state data of the target structure in this way:
- the accounting node classifies the multiple synchronization sub-state data in the updated synchronization sub-state data set to obtain multiple types of synchronization sub-state data; the first accounting node performs data processing on multiple types of synchronization sub-state data respectively.
- the leaf hash values corresponding to multiple types of synchronized sub-state data are obtained; the first accounting node performs hash operations according to the leaf hash values corresponding to multiple types of synchronized sub-state data to obtain the root hash Value; the first accounting node generates the state data of the target structure according to the root hash value and the leaf hash values corresponding to multiple types of synchronized sub-state data, respectively.
- the embodiment of the present application provides a schematic diagram of the state data of the target structure as shown in FIG. V10) is explained as an example.
- the first accounting node can classify all the synchronization sub-state data in the synchronization sub-state data set. For example, it can classify according to the setting order of the keys in the storage tag (or the storage tag after marking), and limit each The number of synchronized sub-state data included in a type does not exceed the type number threshold, where the key setting order can be from small to large or from large to small, and the type number threshold can be set according to actual application scenarios. If set to 3.
- (K1-V1), (K2-V2) and (K3-V3) can be divided into the first category, and (K4-V4), (K5-V5) and (K6-V6) Divided into the second category, (K7-V7), (K8-V8) and (K9-V9) are divided into the third category, and (K10-V10) alone as the fourth category.
- the intermediate hash values h5 and h6 are hashed to obtain the root hash value h7.
- the state data of the target structure is generated.
- a Merkel tree can be constructed based on these hash values, and the hash values h1, h2, h3, and h4 corresponding to the four types can be used as
- h5 and h6 are used as the intermediate hash value of the Merkel tree
- h7 is used as the root hash value (Root Hash) of the Merkel tree.
- step 208 the first accounting node copies the state data of the target structure to generate a state data snapshot of the synchronization block height.
- the first accounting node copies the generated state data of the target structure to obtain a state data snapshot of the synchronization block height.
- the state of the generated Merkel tree can be copied to obtain a snapshot of the Merkel tree, as shown in Figure 4.
- the first accounting node uses the state data snapshot, the synchronization block height, and the signature information of the first accounting node as archive point information, and sends it to the second accounting node.
- the first accounting node signs the state data snapshot to obtain signature information. Then, the first accounting node packs the signature information, the state data snapshot and the synchronization block height into archive point information, and sends the archive point information to the second accounting node of the blockchain system.
- the embodiment of the present application filters the target sub-state data according to the stored tags after marking, which can improve the efficiency and accuracy of the screening; according to the backup target sub-state data, the synchronized sub-state data set is updated to ensure the update The data integrity and data accuracy of the subsequent synchronized sub-state data collection.
- Figure 2C is a schematic flow chart of a blockchain data archiving method provided by an embodiment of the present application. Step 105 shown in Figure 2A can be implemented through steps 301 to 304, and each step will be combined. Be explained.
- the first billing node determines the number of endorsements of the second billing node that sends endorsement information.
- the first billing node determines the number of second billing nodes that send endorsement information according to the received endorsement information, as the endorsement number. For example, if the first billing node receives 5 pieces of endorsement information, it can be determined that the number of second billing nodes that send endorsement information is 5, that is, the number of endorsements is 5.
- step 302 when the number of endorsements exceeds the number threshold, the first accounting node adds the endorsement information to the archive point information to obtain updated archive point information.
- the number threshold can be set according to actual application scenarios, for example, it can be 1/2, 1/3, or other proportions of the total number of second accounting nodes included in the blockchain system, or it can be set directly It is 3, 5, or 7 values.
- the first accounting node adds the endorsement information to the archive point information to update the archive point information to obtain updated archive point information.
- the endorsement information in the updated archive point information and the signature information of the first accounting node can jointly constitute the signature evidence information for the state data of the synchronization block height.
- step 303 the first accounting node sends the updated archive point information to the consensus node.
- the first accounting node sends the updated archive point information to the consensus node, and the consensus node determines whether to generate configuration block data according to the updated archive point information.
- the configuration block data is obtained by generating the configuration block by the consensus node and storing the updated archive point information in the configuration block.
- step 303 it further includes: the consensus node screens out the endorsement information and signature information from the updated archive point information; the consensus node verifies the endorsement information and signature information; when the consensus node verifies the endorsement information and signature information When the information verification is passed, the consensus node generates a configuration block, and stores the updated archive point information in the configuration block to obtain the configuration block data; the consensus node sends the configuration block data to the first accounting node and the second accounting node Account node.
- the first accounting node sends the updated archive point information to the consensus node, and the consensus node filters out the endorsement information and signature information from the updated archive point information, and verifies the endorsement information and signature information, that is, the endorsement information
- the signature evidence information composed of the signature information of the first accounting node is verified.
- the consensus node can verify the amount of endorsement information. For example, when the amount of endorsement information exceeds the quantity threshold (which can be the same as the quantity threshold in step 302), it is determined that the endorsement information has passed the verification; When the quantity does not exceed the quantity threshold, it is determined that the verification of the endorsement information has failed.
- the consensus node can also verify the identity of the second billing node corresponding to the endorsement information. For example, when there is a second billing node corresponding to each endorsement information in the blockchain system, it is determined that the endorsement information has passed the verification. ; When there is no second accounting node corresponding to one or more background information in the blockchain system, it is determined that the endorsement information verification fails.
- the consensus node may verify the signature information of the first accounting node according to at least one of the set signature format and signature rules.
- the signature format As an example, when the signature information of the first accounting node conforms to the signature format, it is determined that the signature information is verified; when the signature information of the first accounting node does not conform to the signature format, it is determined to verify the signature information. The test failed.
- the verification process according to the signature rules is the same. It is worth noting that, in the case of verifying the signature information of the first accounting node according to the signature format and signature rules, only when the signature information of the first accounting node meets both the signature format and the signature rules, the verification The signature information is verified.
- the verification rules for the endorsement information and signature information of the consensus node are not limited to the above examples, and can be set according to actual application scenarios.
- the endorsement information can be verified according to specific endorsement rules or endorsement requirements.
- the consensus node passes the verification of the endorsement information and the signature information, the consensus node generates a configuration block, and stores the updated archive point information in the configuration block to obtain the configuration block data. Then, the consensus node sends the configuration block data to the first accounting node and the second accounting node.
- step 304 when the first accounting node receives the configuration block data sent by the consensus node for the updated archive point information, the first accounting node archives the synchronized blockchain data.
- the first accounting node when the first accounting node receives the configuration block data sent by the consensus node for the updated archive point information, it proves that the consensus node has approved the updated archive point information, so the first accounting node pairs the synchronized blockchain data File it.
- the above-mentioned first accounting node can archive the synchronized blockchain data in this way: the first accounting node copies the updated archive point information to generate the first accounting A snapshot of the archived data of the node at the height of the synchronization block; the first accounting node adds the configuration block data to the first block data to obtain the updated first block data; the first accounting node is in the first area after the update From the block data, the target block data whose block height does not exceed the synchronization block height is filtered out; the first accounting node deletes the target block data.
- the first accounting node copies the synchronization block height, signature information, and endorsement information in the updated archive information to obtain data snapshots corresponding to these data, and then copies the data snapshots corresponding to these data and the updated archive information.
- the state data snapshots together constitute a synchronized block-high archive data snapshot, and the archive data snapshot is stored locally.
- the first accounting node adds the configuration block data to the first block data to update the first block data to obtain the updated first block data, where the first block data refers to the synchronization Blocks included in post-blockchain data.
- the first accounting node filters out the block data whose block height does not exceed the synchronization block height from the updated first block data.
- the block data selected here is named the target block data.
- the embodiment of the present application provides a schematic diagram of data archiving as shown in FIG. From the ordinary block data, ordinary blocks whose block height does not exceed H are further screened out as target block data. As shown in FIG. 5, the target block data includes ordinary block 0 to ordinary block H.
- the ordinary block data refers to the block data that is different from the configuration block data in the updated first block data.
- H in FIG. 5 is an integer greater than or equal to 0, and N is an integer greater than H.
- the method further includes: when the second accounting node receives the configuration block data sent by the consensus node, the second accounting node checks the signature information, endorsement information, and status in the configuration block data.
- the data snapshot and the synchronization block height are copied to obtain the archived data snapshot of the synchronization block height; the second accounting node adds the configuration block data to the blockchain data of the second accounting node, and the updated first From the blockchain data of the second accounting node, the target block data whose block height does not exceed the height of the synchronization block is filtered out; the second accounting node deletes the target block data.
- the consensus node After generating the configuration block data, the consensus node sends the configuration block data to the first accounting node and the second accounting node.
- the second accounting node receives the configuration block data
- the second accounting node extracts the signature information, endorsement information, state data snapshot and synchronization block height in the configuration block data, and copies the extracted data Obtain a snapshot of archived data at the height of the synchronization block, and store the archived data snapshot locally.
- the second accounting node may also add the configuration block data to the local blockchain data of the second accounting node to obtain the updated blockchain data of the second accounting node. Then, the second billing node filters out the target block data whose block height does not exceed the height of the synchronization block from the updated block chain data of the second billing node (for easy distinction, named as the second billing node Target block data), and delete the target block data of the second accounting node to complete data archiving.
- the data archiving of the second accounting node can also be realized, thereby saving storage resources of all accounting nodes in the blockchain system.
- the process of archiving target block data that does not exceed the synchronization block height by the first accounting node and the second accounting node may be performed at the same time or at different times.
- the entire archiving process can be shown in Figure 6.
- the archiving consensus in Figure 6 refers to the operations performed by the consensus node during the data archiving process.
- the target block data can also be stored in a distributed storage system.
- the distributed storage system is different from the blockchain system, and the distributed storage system can be used for cold storage ( Cold Storage, that is, the stored data is not often accessed; the blockchain system can be used for hot storage, that is, the stored data is often accessed.
- it further includes: when the first accounting node is a newly added accounting node in the blockchain system, the first accounting node sends a synchronization request to the consensus node and receives the consensus The endorsement information and archiving point information sent by the node in response to the synchronization request; the first accounting node obtains state data from the second accounting node according to the endorsement information and archiving point information; the first accounting node obtains the status data from the consensus node or the second accounting node Obtain the second block data whose block height exceeds the synchronization block height; the first accounting node updates the state data according to the transaction information in the second block data to obtain the current blockchain data of the first accounting node .
- the first accounting node When the first accounting node is a newly added accounting node in the blockchain system, the first accounting node needs to obtain the locally stored blockchain data from the blockchain system, that is, in the embodiment of this application, except In addition to the demand for data archiving, there is also a demand for data acquisition.
- the first accounting node can send a synchronization request to the consensus node, and when the consensus node receives the synchronization request, it sends endorsement information and archive point information for the synchronization request to the first accounting node.
- the first accounting node obtains status data from the second accounting node according to the received endorsement information and filing point information.
- the first accounting node can also obtain block data whose block height exceeds the synchronization block height from the consensus node or the second accounting node.
- the block data obtained here is named the second block data.
- the synchronization block height here may refer to the synchronization block height obtained after the second accounting node performs the blockchain data synchronization.
- the first accounting node when the synchronization block height is 5, the first accounting node obtains block data with a block height exceeding 5 from the consensus node or the second accounting node as the second block data. Then, the first billing node updates the state data according to the transaction information in the second block data. For example, the world state of the first billing node can be reviewed by replaying the transactions in the block included in the second block data. Update to synchronize to the latest world state in the consensus node and the second accounting node, and obtain the current blockchain data of the first accounting node.
- the newly added accounting node in the blockchain system can obtain accurate and effective current blockchain data, and the accuracy of data acquisition can be improved.
- the above-mentioned first billing node can obtain status data from the second billing node according to the endorsement information and archiving point information in this way: the first billing node compares the endorsement information and the second billing The signature information of the accounting node is verified; when the first accounting node verifies the endorsement information and the signature information of the second accounting node, the first accounting node determines the multiple leaf hash values corresponding to the root hash value ; The first accounting node obtains the sub-state data corresponding to different leaf hash values in parallel from the second accounting node as the obtained state data.
- the first accounting node when it receives the endorsement information and archiving point information, it can check the signature information of the second accounting node (here, the accounting node for data archiving) in the endorsement information and archiving point information.
- the verification rules There are no restrictions on the verification rules here, and the verification rules of the consensus nodes mentioned above can be used.
- the first accounting node determines the corresponding multiple leaf hash values according to the root hash value in the archive point information.
- the archive point information received by the first accounting node includes the root hash value of the state data of the consensus node and the signature information of the second accounting node.
- the root hash value is h7
- the first accounting node can determine the root hash according to the Merkel tree
- the leaf hash values corresponding to the values include h1, h2, h3, and h4.
- the first accounting node can obtain the sub-state data corresponding to different leaf hash values in parallel from the second accounting node, and use all the obtained sub-state data together as the obtained state data.
- the first accounting node may obtain sub-state data corresponding to all leaf hash values from a single second accounting node, or may obtain different sub-state data from different second accounting nodes.
- the above-mentioned first accounting node can obtain the sub-state data corresponding to different leaf hash values from the second accounting node in parallel in this way: the first accounting node performs accounting according to the second accounting The number of nodes classifies multiple leaf hash values; the first accounting node determines the target leaf hash values corresponding to different second accounting nodes according to the classification results of multiple leaf hash values; first accounting The node obtains the sub-state data corresponding to the hash value of the target leaf from a different second accounting node.
- the first accounting node can divide h1 and h2 into one category, and h3 and h4 into one category. Then, the first accounting node determines the target leaf hash value corresponding to the second accounting node according to the classification result. For example, the first accounting node can classify h1 and h2 as the second accounting node. For the target leaf hash value corresponding to A, the other types of h3 and h4 are both used as the target leaf hash value corresponding to the second accounting node B.
- the first accounting node obtains the sub-state data corresponding to the target leaf hash value from the second accounting node according to the target leaf hash value corresponding to the second accounting node.
- the first accounting node can obtain the sub-state data (K1-V1) to (K3-V3) corresponding to h1 and the sub-state data (K4-V4) corresponding to h2 from the second accounting node A.
- K6-V6 obtains sub-state data (K7-V7) to (K9-V9) corresponding to h3 and the sub-state data (K10-V10) corresponding to h4 from the second accounting node B.
- the first accounting node can construct the local world state of the first accounting node.
- obtaining different sub-state data from different second accounting nodes can reduce the processing pressure of each second accounting node, and at the same time can improve the accuracy of the obtained state data.
- the embodiment of the application sends the updated archive information to the consensus node, and when the configuration block data sent by the consensus node for the updated archive information is received, the synchronized blockchain data is archived, Can effectively improve the effectiveness and accuracy of archiving.
- FIG. 9 is a schematic flowchart of a blockchain data archiving method provided by an embodiment of the present application, which will be described in conjunction with the steps shown in FIG. 9.
- step 401 the first accounting node synchronizes blockchain data with the consensus node, and determines the synchronization block height of the synchronized blockchain data.
- step 402 when the synchronization block height matches the archive block height successfully, the first accounting node obtains the block height corresponding to the sub-state data and the storage tag in the local database.
- step 403 the first billing node adds the block height corresponding to the sub-state data to the storage tag corresponding to the sub-state data for marking, and the storage tag is obtained after the mark is obtained.
- step 404 the first accounting node selects the target sub-state data required for the current transaction from the multiple sub-state data according to the stored tag after the mark.
- step 405 the first accounting node backs up the target sub-state data.
- the first accounting node In step 406, the first accounting node generates a state data snapshot of the synchronization block height according to the target sub-state data after the backup, and uses the state data snapshot, the synchronization block height and the signature information of the first accounting node as the archive point. Information and sent to the second accounting node.
- step 407 the second accounting node generates endorsement information for the archive point information, and sends the endorsement information to the first accounting node.
- the first billing node receives the endorsement information of the second billing node for the archive point information.
- the first billing node determines the number of endorsements of the second billing node that sent the endorsement information.
- step 410 when the number of endorsements exceeds the number threshold, the first accounting node adds the endorsement information to the archive point information, obtains the updated archive point information, and sends the updated archive point information to the consensus node.
- step 411 the consensus node generates configuration block data according to the updated archive point information, and sends the configuration block data to the first accounting node and the second accounting node.
- step 412 when the first accounting node receives the configuration block data sent by the consensus node, the first accounting node archives the synchronized blockchain data.
- step 413 when the second accounting node receives the configuration block data, the second accounting node archives the blockchain data of the second accounting node.
- the first accounting node when the first accounting node is a newly added accounting node in the blockchain system, the first accounting node can obtain the latest blockchain data from the blockchain system, which will be combined with Figure 10 The steps shown are explained.
- step 414 the first accounting node sends a synchronization request to the consensus node.
- step 415 the consensus node sends the endorsement information and archive point information to the first accounting node according to the synchronization request.
- the first accounting node obtains status data from the second accounting node according to the endorsement information and the filing point information.
- step 417 the first accounting node obtains the second block data whose block height exceeds the synchronization block height from the consensus node or the second accounting node.
- the first billing node updates the state data according to the transaction information in the second block data to obtain the current blockchain data of the first billing node.
- the embodiment of the present application can back up the target state data required by the current transaction, and generate a state data snapshot based on the target state data after the backup, which solves the conflict between the snapshot and the original transaction, and realizes Real-time snapshots of state data; and let other accounting nodes in the blockchain system sign and endorse information such as state data snapshots, making this information credible, and therefore, can greatly improve the archiving efficiency and efficiency of blockchain data archiving Filing accuracy; in addition, in addition to data archiving, the embodiments of this application aim at newly-added accounting nodes. By sending endorsement information, archive point information, and second block data, the newly-added accounting nodes can obtain Accurate current blockchain data can get a concise and accurate ledger.
- an embodiment of the present application also provides a blockchain data archiving device.
- the blockchain data archiving device can be integrated in an electronic device, such as a server or a terminal.
- the terminal can include a tablet computer. , Laptops and/or personal computers, etc.
- the device for generating blockchain data archives may include a synchronization unit 301, a determining unit 302, a generating unit 303, a receiving unit 304, and an archiving unit 305.
- the synchronization unit 301 is configured to synchronize the blockchain data between the first accounting node and the consensus node and determine the synchronization block height of the synchronized blockchain data.
- the synchronized blockchain data includes state data; the determining unit 302 is configured Determine the target state data required by the current transaction for the first accounting node in the state data, and back up the target state data; the generating unit 303 is configured to generate the synchronization block according to the backup target state data by the first accounting node High-level state data snapshot, the state data snapshot, synchronization block height, and signature information of the first accounting node are used as archive point information, and sent to the second accounting node; the receiving unit 304 is configured as the first accounting node Receive the endorsement information of the second accounting node for the archive point information; the archiving unit 305 is configured to archive the synchronized blockchain data according to the endorsement information and archive point information by the first accounting node.
- the state data includes multiple sub-state data
- the determining unit 302 may include an obtaining sub-unit 3021, an adding sub-unit 3022, a filtering sub-unit 3023, and a backup sub-unit 3024, as shown in FIG. 12.
- Obtaining sub-unit 3021 configured as the first accounting node to obtain the block height corresponding to the sub-state data and the storage tag in the local database; adding sub-unit 3022, configured as the block corresponding to the sub-state data by the first accounting node The height is added to the storage tag corresponding to the sub-state data for marking, and the tag is stored after the tag is obtained; the filtering subunit 3023 is configured as the first accounting node to filter the current exchange from the multiple sub-state data according to the marked storage tag The required target sub-state data; the backup sub-unit 3024 is configured as the first accounting node to back up the target sub-state data.
- the screening subunit 3023 is configured to: the first accounting node obtains transaction information corresponding to the current transaction; the first accounting node determines the current blockchain data of the first accounting node according to the transaction information Block height; when the current block height exceeds the synchronization block height, the first accounting node determines that there is a new block in the current blockchain data; the first accounting node filters out the new block in the current blockchain data
- the call information required by the transaction the call information is used to indicate the sub-state data to be called; the first accounting node stores the tag according to the call information and the tag, and filters out the target sub-state data from the multiple sub-state data.
- the backup subunit 3024 is configured to: the first accounting node screens out the transaction operation information required by the transaction in the new block from the transaction information; the first accounting node determines the target sub-state according to the transaction operation information The transaction operation type corresponding to the data; when the transaction operation type is an update operation, the first accounting node will back up the target sub-state data corresponding to the update operation; when the transaction operation type is a delete operation, the first accounting node will delete the operation The corresponding target sub-state data is backed up, and a delete tag is added to the backed-up target sub-state data; where the delete tag is used to indicate that the backed-up target sub-state data cannot be read during transaction execution.
- the generating unit 303 is configured to: the first billing node filters out the synchronization sub-state data whose block height does not exceed the height of the synchronization block from the state data to obtain the synchronization sub-state data set; The node takes the backed-up target sub-state data as the new synchronization sub-state data and adds it to the synchronization sub-state data set to update the synchronization sub-state data set; the first accounting node compares the data in the updated synchronization sub-state data set The synchronization sub-state data is hashed to generate the state data of the target structure; the first accounting node copies the state data of the target structure to generate a state data snapshot of the synchronization block height.
- the generating unit 303 is configured to: the first accounting node classifies multiple synchronization sub-state data in the updated synchronization sub-state data set to obtain multiple types of synchronization sub-state data; The accounting node performs hash operations on multiple types of synchronized sub-state data to obtain leaf hash values corresponding to multiple types of synchronized sub-state data; the first accounting node respectively performs a hash operation on multiple types of synchronized sub-state data.
- the corresponding leaf hash value is hashed to obtain the root hash value; the first accounting node generates the state data of the target structure according to the root hash value and the leaf hash values corresponding to multiple types of synchronized sub-state data. .
- the archiving unit 305 may include a determining subunit 3051, an updating subunit 3052, a sending subunit 3053, and an archiving subunit 3054, as shown in FIG. 13.
- the determining subunit 3051 is configured as the first accounting node to determine the number of endorsements of the second accounting node that sends the endorsement information
- the update subunit 3052 is configured to add the endorsement information to the first accounting node when the number of endorsements exceeds the number threshold In the archive point information, the updated archive point information is obtained
- the sending subunit 3053 is configured as the first accounting node to send the updated archive point information to the consensus node
- the archive subunit 3054 is configured to be received when the first accounting node receives When the consensus node sends the configuration block data for the updated archive point information, the first accounting node archives the synchronized blockchain data.
- the synchronized blockchain data includes the first block data; the archive subunit 3054 is configured to: the first accounting node copies the updated archive point information to generate the first accounting node in the synchronization A snapshot of the archived data of the block height; the first accounting node adds the configuration block data to the first block data to obtain the updated first block data; the first accounting node is in the updated first block data The target block data whose block height does not exceed the synchronization block height is filtered out; the first accounting node deletes the target block data.
- the archiving subunit 3054 is configured to: when the first accounting node deletes the target block data, the first accounting node stores the target block data in the distributed storage system; wherein, the distribution The storage system is different from the blockchain system.
- the sending subunit 3053 is configured to: the consensus node screens out the endorsement information and signature information from the updated archive point information; the consensus node verifies the endorsement information and the signature information; when the consensus node checks the endorsement information and When the signature information is verified, the consensus node generates a configuration block, and stores the updated archive point information in the configuration block to obtain the configuration block data; the consensus node sends the configuration block data to the first accounting node and the second accounting node. Accounting node.
- the sending subunit 3053 is configured to: the consensus node verifies at least one of the number of endorsement information and the identity of the second accounting node corresponding to the endorsement information; the consensus node verifies according to the signature format and At least one of the signature rules verifies the signature information.
- the blockchain data archiving device may further include an endorsement unit 306, as shown in FIG. 14.
- the endorsement unit 306 is configured to, when the first accounting node receives the archive point information sent by the second accounting node, the first accounting node extracts the root hash of the state data of the second accounting node from the archive point information Value; the first accounting node compares the root hash value of the state data of the second accounting node with the root hash value of the state data of the first accounting node; when the root hash value of the state data of the second accounting node When the value is the same as the root hash value of the state data of the first accounting node, the first accounting node signs the archive point information to obtain the endorsement information of the archive point information; the first accounting node sends the endorsement information to the first accounting node. Second, the accounting node, and broadcast the archive point information in the blockchain system.
- the blockchain data archiving device may further include an update unit 307, as shown in FIG. 15.
- the update unit 307 is configured to send a synchronization request to the consensus node by the first accounting node, and receive endorsement information and archiving point information sent by the consensus node in response to the synchronization request; the first accounting node obtains data from the second accounting node according to the endorsement information and archiving point information.
- the accounting node obtains the state data; the first accounting node obtains the second block data whose block height exceeds the synchronization block height from the consensus node or the second accounting node; the first accounting node according to the second block data Transaction information, the status data is updated, and the current blockchain data of the first accounting node is obtained.
- the archive point information includes the root hash value of the state data of the consensus node and the signature information of the second accounting node;
- the update unit 307 is configured to: the first accounting node endorses the information and the second accounting The signature information of the node is verified; when the first billing node passes the verification of the endorsement information and the signature information of the second billing node, the first billing node determines multiple leaf hash values corresponding to the root hash value; The first accounting node obtains the sub-state data corresponding to different leaf hash values in parallel from the second accounting node as the obtained state data.
- the update unit 307 is configured to: the first accounting node classifies the multiple leaf hash values according to the number of the second accounting nodes; the first accounting node classifies the multiple leaf hash values according to the According to the classification result of, determine the target leaf hash value corresponding to different second accounting nodes; the first accounting node obtains the sub-state data corresponding to the target leaf hash value from the different second accounting nodes.
- the synchronization unit 301 is configured to: the first accounting node sends a synchronization request to the consensus node, the synchronization request includes the identity of the first accounting node; the first accounting node receives the synchronization request sent by the consensus node Block; among them, the block is sent when the consensus node verifies the identity of the first accounting node in the synchronization request; the first accounting node responds to the local blockchain data according to the block sent by the consensus node Update to get the synchronized blockchain data.
- the determining unit 302 is configured to: the first accounting node matches the synchronization block height with the archive block height; when the synchronization block height matches the archive block height successfully, the first accounting node Determine the target state data required by the current transaction in the state data.
- each of the above units can be implemented as an independent entity, or can be combined arbitrarily, and implemented as the same or several entities.
- each of the above units please refer to the previous method embodiments.
- the embodiment of the present application also provides an electronic device, as shown in FIG. 16, which shows a schematic structural diagram of the electronic device involved in the embodiment of the present application.
- the electronic device may include one or more processing core processors 401, One or more components such as the memory 402, the power supply 403, and the input unit 404 of one or more computer-readable storage media.
- processing core processors 401 One or more components such as the memory 402, the power supply 403, and the input unit 404 of one or more computer-readable storage media.
- FIG. 16 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different component arrangements.
- the processor 401 is the control center of the electronic device. It uses various interfaces and lines to connect the various parts of the entire electronic device, runs or executes the software programs and/or modules stored in the memory 402, and calls Data, perform various functions of electronic equipment and process data, so as to monitor the electronic equipment as a whole.
- the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, etc. , The modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 401.
- the memory 402 may be used to store software programs and modules.
- the processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402.
- the memory 402 may mainly include a program storage area and a data storage area.
- the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of electronic equipment, etc.
- the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
- the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
- the electronic device also includes a power supply 403 for supplying power to various components.
- the power supply 403 may be logically connected to the processor 401 through a power management system, so that functions such as charging, discharging, and power consumption management can be managed through the power management system.
- the power supply 403 may also include any components such as one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
- the electronic device may further include an input unit 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
- an input unit 404 which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
- the electronic device may also include a display unit and the like.
- the processor 401 in the electronic device will load the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run and store the executable file in the memory.
- the application program (executable instruction) in 402 realizes various functions, as follows:
- the first accounting node synchronizes the blockchain data with the consensus node, and determines the synchronization block height of the synchronized blockchain data.
- the blockchain data includes state data; the first accounting node determines the current state in the state data
- the target state data required by the transaction and the target state data are backed up; the first accounting node generates a state data snapshot of the synchronization block height according to the target state data after the backup, and the state data snapshot, the synchronization block height and the first
- the signature information of the accounting node is collectively used as the archiving point information and sent to the second accounting node; the first accounting node receives the endorsement information of the second accounting node for the archiving point information; the first accounting node uses the endorsement information and filing Click the information to archive the blockchain data after synchronization.
- the implementation of the above operations can refer to the previous embodiments.
- the embodiment of the present application can back up the target state data required by the current transaction, and generate a state data snapshot based on the backed up target state data, solve the conflict problem between the snapshot and the original transaction, and realize the real-time status data Snapshots, and allow other accounting nodes in the blockchain to sign and endorse information such as state data snapshots, making this information credible, and therefore, can greatly improve the archiving efficiency and accuracy of blockchain data archiving.
- an embodiment of the present application provides a computer program product or computer program.
- the computer program product or computer program includes executable instructions, and the executable instructions are stored in a computer-readable storage medium.
- the processor of the computer device reads the executable instruction from the computer-readable storage medium, and the processor executes the executable instruction, so that the computer device executes the blockchain data archiving method described in the embodiment of the present application.
- the embodiments of the present application also provide a computer-readable storage medium, in which executable instructions are stored, and the executable instructions can be loaded by a processor to implement any of the blockchain data archiving methods provided in the embodiments of the present application .
- the computer-readable storage medium may include: read only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks, etc.
- any of the methods provided in the embodiments of this application can be implemented.
- the beneficial effects that can be achieved by the blockchain data archiving method are detailed in the previous embodiment.
- the executable instructions may be in the form of programs, software, software modules, scripts or codes, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and their It can be deployed in any form, including being deployed as an independent program or as a module, component, subroutine or other unit suitable for use in a computing environment.
- executable instructions may but do not necessarily correspond to files in the file system, and may be stored as part of files that store other programs or data, for example, in a HyperText Markup Language (HTML, HyperText Markup Language) document
- HTML HyperText Markup Language
- One or more scripts in are stored in a single file dedicated to the program in question, or in multiple coordinated files (for example, a file storing one or more modules, subroutines, or code parts).
- executable instructions can be deployed to be executed on one computing device, or on multiple computing devices located in one location, or on multiple computing devices that are distributed in multiple locations and interconnected by a communication network Executed on.
Abstract
Description
Claims (20)
- 一种区块链数据归档方法,用于区块链系统,所述区块链系统包括共识节点、第一记账节点和第二记账节点,所述方法包括:所述第一记账节点与所述共识节点进行区块链数据同步,并确定同步后区块链数据的同步区块高度,所述同步后区块链数据包括状态数据;所述第一记账节点在所述状态数据中确定当前交易所需的目标状态数据,并对所述目标状态数据进行备份;所述第一记账节点根据备份后的目标状态数据生成所述同步区块高度的状态数据快照,将所述状态数据快照、所述同步区块高度和所述第一记账节点的签名信息共同作为归档点信息,并发送至所述第二记账节点;所述第一记账节点接收所述第二记账节点针对所述归档点信息的背书信息;所述第一记账节点根据所述背书信息和所述归档点信息,对所述同步后区块链数据进行归档。
- 根据权利要求1所述的区块链数据归档方法,其中,所述状态数据包括多个子状态数据;所述第一记账节点在所述状态数据中确定当前交易所需的目标状态数据,并对所述目标状态数据进行备份,包括:所述第一记账节点获取所述子状态数据对应的区块高度和在本地数据库中的存储标签;所述第一记账节点将所述子状态数据对应的区块高度,添加至所述子状态数据对应的存储标签以进行标记,得到标记后存储标签;所述第一记账节点根据所述标记后存储标签,在所述多个子状态数据中筛选出当前交易所需的目标子状态数据;所述第一记账节点对所述目标子状态数据进行备份。
- 根据权利要求2所述的区块链数据归档方法,其中,所述第一记账节点根据所述标记后存储标签,在所述多个子状态数据中筛选出当前交易所需的目标子状态数据,包括:所述第一记账节点获取所述当前交易对应的交易信息;所述第一记账节点根据所述交易信息,确定所述第一记账节点的当前区块链数据的当前区块高度;当所述当前区块高度超过所述同步区块高度时,所述第一记账节点确定在所述当前区块链数据中存在新区块;所述第一记账节点在所述当前区块链数据中筛选出所述新区块中的交易需要的调用信息,所述调用信息用于指示调用的所述子状态数据;所述第一记账节点根据所述调用信息和所述标记后存储标签,在所述多个子状态数据中筛选出所述目标子状态数据。
- 根据权利要求3所述的区块链数据归档方法,其中,所述第一记账节点对所述目标子状态数据进行备份,包括:所述第一记账节点在所述交易信息中筛选出所述新区块中的交易需要的交易操作信息;所述第一记账节点根据所述交易操作信息,确定所述目标子状态数据对应的交易操作类型;当所述交易操作类型为更新操作时,所述第一记账节点将所述更新操作对应的目标子状态数据进行备份;当所述交易操作类型为删除操作时,所述第一记账节点将所述删除操作对应的目标子状态数据进行备份,并对备份后的目标子状态数据添加删除标签;其中,所述删除标签用于指示所述备份后的目标子状态数据在交易执行时不能被读取。
- 根据权利要求2所述的区块链数据归档方法,其中,所述第一记账节点根据备份后的目标状态数据生成所述同步区块高度的状态数据快照,包括:所述第一记账节点在所述状态数据中筛选出区块高度不超过所述同步区块高度的同步子状态数据,得到同步子状态数据集合;所述第一记账节点将备份后的目标子状态数据作为新的同步子状态数据,并添加至所述同步子状态数据集合,以更新所述同步子状态数据集合;所述第一记账节点对更新后的同步子状态数据集合中的同步子状态数据进行哈希运算,以生成目标结构的状态数据;所述第一记账节点对所述目标结构的状态数据进行拷贝,以生成所述同步区块高度的状态数据快照。
- 根据权利要求5所述的区块链数据归档方法,其中,所述第一记账节点对更新后的同步子状态数据集合中的同步子状态数据进行哈希运算,以生成目标结构的状态数据,包括:所述第一记账节点对更新后的同步子状态数据集合中的多个同步子状态数据进行分类,得到多个类型的同步子状态数据;所述第一记账节点对所述多个类型的同步子状态数据分别进行哈希运算,得到所述多个类型的同步子状态数据分别对应的叶哈希值;所述第一记账节点根据所述多个类型的同步子状态数据分别对应的叶哈希值进行哈希运算,得到根哈希值;所述第一记账节点根据所述根哈希值以及所述多个类型的同步子状态数据分别对应的叶哈希值,生成目标结构的状态数据。
- 根据权利要求1所述的区块链数据归档方法,其中,所述第一记账节点根据所述背书信息和所述归档点信息,对所述同步后区块链数据进行归档,包括:所述第一记账节点确定发送所述背书信息的第二记账节点的背书数量;当所述背书数量超过数量阈值时,所述第一记账节点将所述背书信息添加至所述归档点信息中,得到更新后归档点信息;所述第一记账节点将所述更新后归档点信息发送至所述共识节点;当所述第一记账节点接收到所述共识节点针对所述更新后归档点信息发送的配置区块数据时,所述第一记账节点对所述同步后区块链数据进行归档。
- 根据权利要求7所述的区块链数据归档方法,其中,所述同步后区块链数据包括第一区块数据;所述第一记账节点对所述同步后区块链数据进行归档,包括:所述第一记账节点对所述更新后归档点信息进行拷贝,以生成所述第一记账节点在所述同步区块高度的归档数据快照;所述第一记账节点将所述配置区块数据添加至所述第一区块数据中,得到更新后第一区块数据;所述第一记账节点在所述更新后第一区块数据中筛选出区块高度未超过所述同步区块高度的目标区块数据;所述第一记账节点将所述目标区块数据进行删除。
- 根据权利要求8所述的区块链数据归档方法,其中,当所述第一记账节点将所述目标区块数据进行删除时,还包括:所述第一记账节点将所述目标区块数据存储至分布式存储系统中;其中,所述分布式存储系统区别于所述区块链系统。
- 根据权利要求7所述的区块链数据归档方法,其中,所述第一记账节点将所述更新后归档点信息发送至所述共识节点之后,还包括:所述共识节点在所述更新后归档点信息中筛选出所述背书信息和所述签名信息;所述共识节点对所述背书信息和所述签名信息进行校验;当所述共识节点对所述背书信息和所述签名信息校验通过时,所述共识节点生成配置区块,并将所述更新后归档点信息存储至所述配置区块,得到配置区块数据;所述共识节点将所述配置区块数据发送至所述第一记账节点和所述第二记账节点。
- 根据权利要求10所述的区块链数据归档方法,其中,所述共识节点对所述背书信息和所述签名信息进行校验,包括:所述共识节点对所述背书信息的数量、以及所述背书信息对应的第二记账节点的身份标识中的至少之一进行校验;所述共识节点根据签名格式以及签名规则中的至少之一,对所述签名信息进行校验。
- 根据权利要求1至11任一项所述的区块链数据归档方法,其中,还包括:当所述第一记账节点接收到所述第二记账节点发送的所述归档点信息时,所述第一记账节点从所述归档点信息中提取出所述第二记账节点的状态数据的根哈希值;所述第一记账节点将所述第二记账节点的状态数据的根哈希值与所述第一记账节点自身状态数据的根哈希值进行对比;当所述第二记账节点的状态数据的根哈希值与所述第一记账节点自身状态数据的根哈希值相同时,所述第一记账节点对所述归档点信息进行签名,得到所述归档点信息的背书信息;所述第一记账节点将所述背书信息发送至所述第二记账节点,并将所述归档点信息在所述区块链系统中进行广播。
- 根据权利要求1至11任一项所述的区块链数据归档方法,其中,还包括:当所述第一记账节点为所述区块链系统中新增的记账节点时,所述第一记账节点向所述共识节点发送同步请求,并接收所述共识节点针对所述同步请求发送的背书信息和归档点信息;所述第一记账节点根据所述背书信息和所述归档点信息,从所述第二记账节点获取状态数据;所述第一记账节点从所述共识节点或所述第二记账节点获取区块高度超过所述同步区块高度的第二区块数据;所述第一记账节点根据所述第二区块数据中的交易信息,对所述状态数据进行更新,得到所述第一记账节点的当前区块链数据。
- 根据权利要求13所述的区块链数据归档方法,其中,所述归档点信息包括所述共识节点的状态数据的根哈希值和所述第二记账节点的签名信息;所述第一记账节点根据所述背书信息和所述归档点信息,从所述第二记账节点获取状态数据,包括:所述第一记账节点对所述背书信息和所述第二记账节点的签名信息进行校验;当所述第一记账节点对所述背书信息和所述第二记账节点的签名信息校验通过时,所述第一记账节点确定所述根哈希值对应的多个叶哈希值;所述第一记账节点从所述第二记账节点中并行获取不同所述叶哈希值对应的子状态数据,以作为得到的状态数据。
- 根据权利要求14所述的区块链数据归档方法,其中,所述第一记账节点从所述第二记账节点中并行获取不同所述叶哈希值对应的子状态数据,包括:所述第一记账节点根据所述第二记账节点的数量,对所述多个叶哈希值进行分类;所述第一记账节点根据对所述多个叶哈希值的分类结果,确定不同所述第二记账节点对应的目标叶哈希值;所述第一记账节点从不同所述第二记账节点获取所述目标叶哈希值对应的子状态数据。
- 根据权利要求1至11任一项所述的区块链数据归档方法,其中,所述第一记账节点与所述共识节点进行区块链数据同步,包括:所述第一记账节点向所述共识节点发送同步请求,所述同步请求包括所述第一记账节点的身份标识;所述第一记账节点接收所述共识节点针对所述同步请求发送的区块;其中,所述区块是所述共识节点对所述同步请求中的所述第一记账节点的身份标识校验通过时发送的;所述第一记账节点根据所述共识节点发送的区块,对本地的区块链数据进行更新,得到同步后区块链数据。
- 根据权利要求1至11任一项所述的区块链数据归档方法,其中,所述第一记账节点在所述状态数据中确定当前交易所需的目标状态数据,包括:所述第一记账节点将所述同步区块高度与归档区块高度进行匹配;当所述同步区块高度与所述归档区块高度匹配成功时,所述第一记账节点在所述状态数据中确定当前交易所需的目标状态数据。
- 一种区块链数据归档装置,用于区块链系统,所述区块链系统包括共识节点、第一记账节点和第二记账节点,所述装置包括:同步单元,配置为所述第一记账节点与所述共识节点进行区块链数据同步,并确定同步后区块链数据的同步区块高度,所述同步后区块链数据包括状态数据;确定单元,配置为所述第一记账节点在所述状态数据中确定当前交易所需的目标状态数据,并对所述目标状态数据进行备份;生成单元,配置为所述第一记账节点根据备份后的目标状态数据生成所述同步区块高度的状态数据快照,将所述状态数据快照、所述同步区块高度和所述第一记账节点的签名信息共同作为归档点信息,并发送至所述第二记账节点;接收单元,配置为所述第一记账节点接收所述第二记账节点针对所述归档点信息的背书信息;归档单元,配置为所述第一记账节点根据所述背书信息和所述归档点信息,对所述同步后区块链数据进行归档。
- 一种电子设备,包括:存储器,用于存储可执行指令;处理器,用于执行所述存储器中存储的可执行指令时,实现权利要求1至17任一项所述的区块链数据归档方法。
- 一种计算机可读存储介质,所述计算机可读存储介质存储有可执行指令,用于被处理器执行时,实现权利要求1至17任一项所述的区块链数据归档方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2022539416A JP7330596B2 (ja) | 2020-04-24 | 2021-03-12 | ブロックチェーンデータのアーカイブ方法、ブロックチェーンデータのアーカイブ装置、電子機器、及びコンピュータプログラム |
US17/703,085 US20220214995A1 (en) | 2020-04-24 | 2022-03-24 | Blockchain data archiving method, apparatus, and computer-readable storage medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010329695.3A CN111209346B (zh) | 2020-04-24 | 2020-04-24 | 一种区块链数据归档方法、装置和计算机可读存储介质 |
CN202010329695.3 | 2020-04-24 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/703,085 Continuation US20220214995A1 (en) | 2020-04-24 | 2022-03-24 | Blockchain data archiving method, apparatus, and computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021213065A1 true WO2021213065A1 (zh) | 2021-10-28 |
Family
ID=70784399
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/080371 WO2021213065A1 (zh) | 2020-04-24 | 2021-03-12 | 一种区块链数据归档方法、装置和计算机可读存储介质 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20220214995A1 (zh) |
JP (1) | JP7330596B2 (zh) |
CN (1) | CN111209346B (zh) |
WO (1) | WO2021213065A1 (zh) |
Families Citing this family (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111209346B (zh) | 2020-04-24 | 2020-07-28 | 腾讯科技(深圳)有限公司 | 一种区块链数据归档方法、装置和计算机可读存储介质 |
CN112073484B (zh) * | 2020-08-28 | 2022-01-04 | 武汉大学 | 一种基于联盟链的gdpr合规监管方法及系统 |
CN112073483B (zh) * | 2020-08-28 | 2022-01-04 | 武汉大学 | 基于信誉与委员会背书机制的权威证明共识方法及系统 |
CN112184206A (zh) * | 2020-09-30 | 2021-01-05 | 杭州复杂美科技有限公司 | 数据获取方法、设备和存储介质 |
KR102473672B1 (ko) * | 2020-10-20 | 2022-12-02 | 주식회사 커먼컴퓨터 | 트리 구조의 상태 데이터베이스를 포함하는 블록체인에 대한 상태 관리 방법 및 시스템 |
CN112383610B (zh) * | 2020-11-11 | 2022-12-09 | 上海保险交易所股份有限公司 | 区块链状态数据的同步处理方法及系统 |
CN112650733A (zh) * | 2020-12-28 | 2021-04-13 | 杭州趣链科技有限公司 | 一种智能合约状态数据的处理方法、系统与装置 |
CN112291376B (zh) * | 2020-12-31 | 2021-04-09 | 腾讯科技(深圳)有限公司 | 区块链系统中的数据处理方法及相关设备 |
CN112925479A (zh) * | 2021-02-20 | 2021-06-08 | 京东数字科技控股股份有限公司 | 区块链数据管理方法及装置、电子设备及介质 |
CN113297214B (zh) * | 2021-05-06 | 2022-06-10 | 湖南兆物信链科技集团有限公司 | 基于dag区块链的快照处理方法、设备及存储介质 |
CN113364847B (zh) * | 2021-05-31 | 2022-07-19 | 新疆大学 | 区块链节点的数据同步方法、装置及存储介质 |
CN113610527A (zh) * | 2021-08-24 | 2021-11-05 | 上海点融信息科技有限责任公司 | 联盟链的交易方法、装置、系统、终端设备及存储介质 |
US20230147295A1 (en) * | 2021-11-05 | 2023-05-11 | Salesforce.Com, Inc. | Mechanisms for grouping nodes |
CN114745131A (zh) * | 2022-04-06 | 2022-07-12 | 广东钜联信息科技有限公司 | 一种区块链的pbft改进共识算法 |
CN114938380B (zh) * | 2022-06-23 | 2023-08-22 | 成都质数斯达克科技有限公司 | 一种适用于区块链的数据共享系统及方法 |
CN117633099A (zh) * | 2022-08-15 | 2024-03-01 | 财付通支付科技有限公司 | 一种基于区块链的数据处理方法、设备以及可读存储介质 |
CN115934849B (zh) * | 2023-03-13 | 2023-05-30 | 安徽中科晶格技术有限公司 | 区块的工作量证明共识方法、装置、节点及存储介质 |
CN116663068B (zh) * | 2023-07-31 | 2023-12-29 | 腾讯科技(深圳)有限公司 | 联盟链归档方法、相关装置和介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107526775A (zh) * | 2017-07-18 | 2017-12-29 | 杭州趣链科技有限公司 | 一种区块链数据归档的方法 |
CN109656873A (zh) * | 2018-11-02 | 2019-04-19 | 平安科技(深圳)有限公司 | 基于区块链的数据归档方法、装置及终端设备 |
CN110717764A (zh) * | 2019-10-21 | 2020-01-21 | 深圳前海环融联易信息科技服务有限公司 | 多账本管理方法、装置、计算机设备及存储介质 |
US20200026712A1 (en) * | 2017-04-12 | 2020-01-23 | Vijay Madisetti | Method and System for Tuning Blockchain Scalability, Decentralization, and Security for Fast and Low-Cost Payment and Transaction Processing |
CN111209346A (zh) * | 2020-04-24 | 2020-05-29 | 腾讯科技(深圳)有限公司 | 一种区块链数据归档方法、装置和计算机可读存储介质 |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103150232B (zh) * | 2013-02-01 | 2016-06-01 | 浪潮(北京)电子信息产业有限公司 | 存储快照创建方法和装置 |
CN107423426B (zh) | 2017-08-02 | 2020-06-02 | 众安信息技术服务有限公司 | 一种区块链块数据的数据归档方法及电子设备 |
US11494344B2 (en) | 2018-03-06 | 2022-11-08 | International Business Machines Corporation | Customized endorsement logic for blockchain |
AU2019232978A1 (en) | 2018-03-14 | 2020-08-13 | Jieqian ZHENG | Block chain data processing method, management terminal, user terminal, conversion device, and medium |
CN109189853B (zh) * | 2018-08-08 | 2021-05-28 | 众安信息技术服务有限公司 | 一种区块链之间数据同步方法与装置 |
CN109347941A (zh) * | 2018-10-10 | 2019-02-15 | 南京简诺特智能科技有限公司 | 一种基于区块链的数据共享平台及其实现方法 |
CN110011788B (zh) * | 2019-04-10 | 2020-12-25 | 深圳市网心科技有限公司 | 一种基于区块链的数据处理方法、系统及相关设备 |
-
2020
- 2020-04-24 CN CN202010329695.3A patent/CN111209346B/zh active Active
-
2021
- 2021-03-12 JP JP2022539416A patent/JP7330596B2/ja active Active
- 2021-03-12 WO PCT/CN2021/080371 patent/WO2021213065A1/zh active Application Filing
-
2022
- 2022-03-24 US US17/703,085 patent/US20220214995A1/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20200026712A1 (en) * | 2017-04-12 | 2020-01-23 | Vijay Madisetti | Method and System for Tuning Blockchain Scalability, Decentralization, and Security for Fast and Low-Cost Payment and Transaction Processing |
CN107526775A (zh) * | 2017-07-18 | 2017-12-29 | 杭州趣链科技有限公司 | 一种区块链数据归档的方法 |
CN109656873A (zh) * | 2018-11-02 | 2019-04-19 | 平安科技(深圳)有限公司 | 基于区块链的数据归档方法、装置及终端设备 |
CN110717764A (zh) * | 2019-10-21 | 2020-01-21 | 深圳前海环融联易信息科技服务有限公司 | 多账本管理方法、装置、计算机设备及存储介质 |
CN111209346A (zh) * | 2020-04-24 | 2020-05-29 | 腾讯科技(深圳)有限公司 | 一种区块链数据归档方法、装置和计算机可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN111209346B (zh) | 2020-07-28 |
JP7330596B2 (ja) | 2023-08-22 |
CN111209346A (zh) | 2020-05-29 |
JP2023509006A (ja) | 2023-03-06 |
US20220214995A1 (en) | 2022-07-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021213065A1 (zh) | 一种区块链数据归档方法、装置和计算机可读存储介质 | |
US10904009B2 (en) | Blockchain implementing delta storage | |
US11895223B2 (en) | Cross-chain validation | |
US11257081B2 (en) | Integrating a blockchain ledger with an application external to the blockchain ledger | |
US11212076B2 (en) | Distributed platform for computation and trusted validation | |
US11200260B2 (en) | Database asset fulfillment chaincode deployment | |
CN106991035A (zh) | 一种基于微服务架构的主机监控系统 | |
US11784789B2 (en) | Distributed platform for computation and trusted validation | |
US11599431B2 (en) | Database optimized disaster recovery orchestrator | |
JP2021525931A (ja) | ブロックチェーンのための効率的な検証 | |
US11593316B2 (en) | Database snapshot for managing state synchronization | |
US11354198B2 (en) | Snapshot for world state recovery | |
US11003523B2 (en) | Database optimized disaster recovery testing | |
US11177938B2 (en) | Database composite endorsement | |
US11940978B2 (en) | Distributed platform for computation and trusted validation | |
CN108810112B (zh) | 一种市场监管区块链系统的节点同步方法及装置 | |
US11645268B2 (en) | Database world state performance improvement | |
US20200021602A1 (en) | Trace-based transaction validation and commitment | |
US11816069B2 (en) | Data deduplication in blockchain platforms | |
US11050822B2 (en) | Secure data dissemination | |
CN108092936A (zh) | 一种基于插件架构的主机监控系统 | |
US11144645B2 (en) | Blockchain technique for immutable source control | |
US20200159928A1 (en) | Blockchain technique for immutable source control | |
CN112035291A (zh) | 快照恢复 | |
US11321298B1 (en) | Automated merge of DLT networks |
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: 21793440 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2022539416 Country of ref document: JP Kind code of ref document: A |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED DD/MM/YYYY16/03/2023 |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21793440 Country of ref document: EP Kind code of ref document: A1 |