WO2021259125A1 - 区块链网络的数据清理方法及装置 - Google Patents

区块链网络的数据清理方法及装置 Download PDF

Info

Publication number
WO2021259125A1
WO2021259125A1 PCT/CN2021/100559 CN2021100559W WO2021259125A1 WO 2021259125 A1 WO2021259125 A1 WO 2021259125A1 CN 2021100559 W CN2021100559 W CN 2021100559W WO 2021259125 A1 WO2021259125 A1 WO 2021259125A1
Authority
WO
WIPO (PCT)
Prior art keywords
blockchain
block
transaction
business
transactions
Prior art date
Application number
PCT/CN2021/100559
Other languages
English (en)
French (fr)
Inventor
姚忠孝
杨达一
张紫荣
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021259125A1 publication Critical patent/WO2021259125A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • One or more embodiments of this specification relate to the field of blockchain technology, and more particularly to a method and device for data cleaning of a blockchain network.
  • Blockchain technology also known as distributed ledger technology
  • distributed ledger technology is a de-neutralized distributed database technology. It has the characteristics of decentralization, openness and transparency, non-tampering, trustworthiness, etc., and is suitable for many In application scenarios that have high requirements for data reliability.
  • various performance indicators such as the load capacity of the blockchain network and the upper limit of data throughput can be obtained, so as to maintain the normal operation of the blockchain network, or carry out the performance of the blockchain network. optimization.
  • one or more embodiments of this specification provide a data cleaning method and device for a blockchain network.
  • a data cleaning method for a blockchain network including: a blockchain node receives a data cleaning transaction, and the blockchain node maintains a business blockchain And a stress test blockchain corresponding to the business blockchain, the blocks of the stress test blockchain are used to store stress test transactions, and the blocks of the business blockchain are used to store business transactions;
  • the blockchain node modifies the state data corresponding to the latest block on the pressure test block chain to the state data corresponding to the designated block, and deletes other areas on the pressure test block chain that are different from the designated block Status data corresponding to the block.
  • a data cleaning device for a blockchain network including: a receiving unit for enabling blockchain nodes to receive data cleaning transactions, and the blockchain nodes maintain A business block chain and a pressure test block chain corresponding to the business block chain, the block of the pressure test block chain is used to store the pressure test transaction, and the block of the business block chain is used to store the business Transaction; a cleaning unit that enables the blockchain node to modify the state data corresponding to the latest block on the pressure test block chain to the state data corresponding to the specified block, and delete the state data on the pressure test block chain that is different from State data corresponding to other blocks of the designated block.
  • an electronic device including: a processor; and a memory for storing executable instructions of the processor.
  • the processor executes the executable instruction to implement the method described in any of the foregoing embodiments.
  • a computer-readable storage medium which stores computer instructions, which when executed by a processor, implements the method described in any of the above-mentioned embodiments. step.
  • Fig. 1 is a schematic diagram of a blockchain network provided by an exemplary embodiment.
  • Fig. 2 is a flowchart of a method for stress testing of a blockchain network provided by an exemplary embodiment.
  • Fig. 3 is a schematic diagram of a network architecture provided by an exemplary embodiment.
  • Fig. 4 is a schematic diagram of a pressure test system for a blockchain network provided by an exemplary embodiment.
  • Fig. 5 is a flowchart of a data cleaning method for a blockchain network provided by an exemplary embodiment.
  • Fig. 6 is a flow chart of executing blockchain transactions according to an exemplary embodiment.
  • Fig. 7 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Fig. 8 is a block diagram of a data cleaning device for a blockchain network provided by an exemplary embodiment.
  • the steps of the corresponding method are not necessarily executed in the order shown and described in this specification.
  • the method may include more or fewer steps than described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
  • FIG. 1 is a schematic diagram of a network architecture provided by an exemplary embodiment.
  • the business system 11 After the business system 11 generates a processing request, it sends the processing request to the blockchain client 12, and the blockchain client 12 creates a blockchain transaction for the processing request, and performs the blockchain transaction Submit to the blockchain network 13 so that the blockchain nodes on the blockchain network 13 execute the blockchain transaction.
  • the business system 11 can generate a processing request of the stress test request type (including data used for the stress test), and the blockchain client 12 can Create corresponding blockchain transactions (ie stress testing transactions) for these stress testing requests, and execute these blockchain transactions by the blockchain network 13 to perform stress testing on the blockchain network 13; and, the blockchain client 12 Feedback the transaction receipt (first transaction receipt) generated by the blockchain network 13 to execute the blockchain transaction to the business system 11, so that the business system 11 analyzes the transaction receipt to determine the pressure test of the blockchain network 13 result.
  • stress test for short
  • the interaction process between the business system 11, the blockchain client 12, and the blockchain network 13 is similar to the aforementioned stress testing process: the business system 11 generates a processing request of the business request type, and the blockchain The client 12 creates corresponding blockchain transactions (ie, business transactions) for these business requests, and the blockchain network 13 executes these blockchain transactions; and the blockchain client 12 executes the blockchain network 13
  • the transaction receipt (second transaction receipt) generated by the blockchain transaction is fed back to the business system 11.
  • the service system 11 can add a stress test label to the service request to distinguish it from the service request; of course, it can also add a service label to the service request to distinguish it from the stress test. ask.
  • the blockchain client 12 creates a blockchain transaction, due to the need to comply with the existing transaction format and other relevant regulations, it cannot distinguish between the blockchain transactions corresponding to different processing requests, that is, the above-mentioned stress test cannot be distinguished.
  • Feature tags such as tags or business tags are brought into the blockchain network 13, causing the transaction receipt generated by the blockchain network 13 to also fail to carry the aforementioned feature tags, so that the business system 11 cannot effectively distinguish the source of the transaction receipt, and cannot be based on this. Accurately know the pressure test results of the blockchain network 13.
  • FIG. 2 is a flowchart of a method for stress testing of a blockchain network according to an exemplary embodiment.
  • the method is applied to a blockchain node and may include the following steps: Step 202: Identify the transaction type of the received blockchain transaction, and the transaction type includes a stress test transaction and a business transaction.
  • corresponding blockchains are maintained; that is, the blocks of each blockchain store the corresponding types of blockchain transactions.
  • the corresponding blockchain network is deployed and configured separately for each blockchain, it will lead to increased costs.
  • the same blockchain network can respond to various blockchain transactions.
  • the same node device (as a blockchain node) in the blockchain network maintains these areas.
  • Blockchain, and all node devices constitute the blockchain network in this manual.
  • the blockchain node can include the blockchain transaction after identifying the transaction type of the received blockchain transaction
  • the block obtained by executing the block chain transaction of the transaction type, so that the block chain transaction of the transaction type is stored in the block body of the block
  • the block is added to the block chain corresponding to the transaction type .
  • a business blockchain B and a stress test block corresponding to the business blockchain B are maintained Chain A.
  • the blocks of the stress test blockchain A are used to store stress test transactions
  • the blocks of the business blockchain B are used to store business transactions.
  • the stress test blockchain A includes blocks a-1, a-2, a-3, a-4, a-5, etc., and these blocks are all executed by the blockchain node 30 after responding to the stress test transaction generate.
  • the business blockchain B contains blocks b-1, b-2, b-3, b-4, b-5, etc., and these blocks are all generated by the blockchain node 30 in response to business transactions .
  • the stress test transaction may be generated by the transaction initiator in response to the stress test request from the business system
  • the business transaction may be generated by the transaction initiator in response to the business request from the business system.
  • the transaction initiator may be a blockchain client, which is used to cooperate with the business system and the blockchain network to realize data interaction between the business system and the blockchain network.
  • the blockchain client can include any electronic device that can realize data interaction, such as a blockchain gateway; of course, this specification does not limit this.
  • the blockchain client receives the processing request initiated by the business system, creates a blockchain transaction corresponding to the processing request, and then submits the blockchain transaction to the district
  • the block chain network enables all the block chain nodes in the block chain network to perform operations such as consensus, execution, and chaining on the block chain transaction; and, in the process of transmitting data from the block chain network to the business system, the block chain
  • the chain client obtains the transaction receipt (receipt) generated by the blockchain network by executing the above-mentioned blockchain transaction, and feeds the transaction receipt to the business system.
  • the blocks of the stress test blockchain are used to store stress test transactions
  • the blocks of the business blockchain are used to store business transactions.
  • the same blockchain network can respond to various blockchain transactions.
  • the same node device (as a blockchain node) in the blockchain network maintains these areas.
  • Blockchain, and all node devices constitute the blockchain network in this manual.
  • the same blockchain network can respond to stress test transactions and business transactions. Then the same blockchain network needs to receive To the blockchain transaction to be identified.
  • the blockchain client when it creates a blockchain transaction, it can add a type identifier (corresponding to the request type of the processing request) to indicate the transaction type in the blockchain transaction.
  • a stress test transaction includes a first type of identification
  • a business transaction includes a second type of identification.
  • the blockchain node can read the type identification contained in the received blockchain transaction; in the case that the read type identification is the first type identification, the blockchain transaction is determined as a stress test transaction.
  • the type identification is the second type identification
  • the blockchain transaction is determined as a business transaction.
  • the blockchain network when the blockchain network generates a transaction receipt, it also adds a corresponding type identifier to the transaction receipt to indicate which processing request the transaction receipt corresponds to.
  • the blockchain client can respond to a processing request from a business system to generate a stress test transaction containing a first type of identifier when the processing request is a stress test request, and generate a second type of identifier when the processing request is a business request Business transactions. Further, after the blockchain client generates the stress test transaction and business transaction, it submits the stress test transaction and business transaction to the blockchain network. After receiving the blockchain transaction, the blockchain network can generate a transaction receipt corresponding to the blockchain transaction; the transaction receipt includes the type identification of the blockchain transaction. For example, after receiving the stress testing transaction and business transaction submitted by the blockchain client, the blockchain node in the blockchain network can execute the stress testing transaction and generate a transaction receipt containing the first type of identification (i.e., the first transaction).
  • Receipt execute the business transaction and generate a transaction receipt containing the second type of identification (ie, the second transaction receipt).
  • the blockchain client can obtain the transaction receipt generated by the blockchain network and return it to the business system.
  • the business system can receive the transaction receipt returned by the blockchain client, store the transaction receipt including the first type identifier in the stress test database, and store the transaction receipt including the second type identifier in the business database.
  • the blockchain nodes in the blockchain network 43 maintain both the stress test block chain A and the business block chain B; among them, the block of the stress test block chain A is used to record the stress test transaction ,
  • the block of business blockchain B is used to record business transactions.
  • the stress test transaction is stored in the block included in the stress test blockchain; after the blockchain network 43 executes the business transaction, the business transaction is stored in the business area In the blocks contained in the block chain.
  • the block headers of the blocks included in the pressure test blockchain include the first type identifier
  • the block headers of the blocks included in the business blockchain include the second type identifier.
  • the pressure test block chain can be effectively distinguished from the business block chain. For example, after generating the blocks of the pressure test block chain and the business block chain, the block header can be used to identify which block chain these blocks belong to, and then the recognized block is added to the block chain to which it belongs The end.
  • the business system 41 does not need to perceive the test environment (that is, does not need to perceive the existence of the stress test blockchain), and is responsible for marking the processing request (marking the stress test request or the business request). Yes, it makes the stress test less intrusive to the business.
  • the blockchain client 42 After receiving the processing request initiated by the business system 41, the blockchain client 42 needs to identify the type of the processing request to determine whether the processing request is a business request or a stress test request.
  • the blockchain client 42 may create a stress test transaction (including the first type identification, such as a stress test tag) corresponding to the stress test request when the received processing request is a stress test request; and, upon receiving If the processing request of is a business request, create a business transaction corresponding to the business request (including a second type identifier, such as a stress test label). Then, the blockchain client 42 may respectively submit the stress test transaction and the business transaction to the blockchain network 43 in the production state to receive the first transaction receipt and the second transaction receipt respectively returned by the blockchain network 43.
  • the first type identification such as a stress test tag
  • the blockchain client 42 can submit stress testing transactions and business transactions to a certain blockchain node 43n in the blockchain network 43, and the blockchain node 43n can further submit stress testing transactions and business transactions. Passed to other blockchain nodes in the blockchain network 43, so that all blockchain nodes can perform consensus, execution, and chain operations for stress test transactions and business transactions, and generate transaction receipts corresponding to stress test transactions. (Including the first type identification, that is, the above-mentioned stress test label) and the transaction receipt corresponding to the business transaction (including the second type of identification, that is, the above-mentioned business label).
  • the blockchain node in the blockchain network 43 can identify the type identification contained in the received blockchain transaction, and determine accordingly Whether the blockchain transaction is a stress test transaction or a business transaction. Specifically, in the case where the blockchain transaction contains the first type of identification (indicating that the blockchain transaction is a stress test transaction), the blockchain transaction can be stored in a block included in the stress test blockchain; In the case where the block chain transaction contains the second type of identification (indicating that the block chain transaction is a business transaction), the block chain transaction can be stored in a block included in the business block chain.
  • the block header of the block included in the pressure test blockchain includes the first type identifier
  • the block header of the block included in the business blockchain includes the second type identifier.
  • the stress test block chain A in Figure 3 corresponds to the stress test request
  • the business block chain B corresponds to the business request; then, a-1, a-2, a-3, a-4, a-5, etc.
  • the block header of the block contains the first type identifier
  • the block headers of b-1, b-2, b-3, b-4, b-5 and other blocks contain the second type identifier.
  • the blockchain client can establish a connection with a certain blockchain node in the blockchain network to submit a blockchain transaction to the blockchain node.
  • the blockchain node may be a blockchain node 43n as shown in FIG. 4.
  • the connection established between the block chain client 42 and the block chain node 43n may be a long connection, so that the block chain node 43n executes the block chain transaction (stress test transaction or business transaction ), after the corresponding transaction receipt is generated, the corresponding transaction receipt generation event can be generated, and the blockchain client 42 can learn that the transaction receipt has been generated by monitoring the transaction receipt generation event (that is, the event monitoring mechanism), and based on the aforementioned long term Connect to get the transaction receipt.
  • the blockchain node 43n can also monitor the transaction receipt generation event through the aforementioned event monitoring mechanism, and feed the transaction receipt back to the blockchain client 42 through the aforementioned long connection, so that the blockchain client 42 can obtain Transaction receipt. Or, if the connection established between the blockchain client 42 and the blockchain node 43n is not a persistent connection or the established persistent connection is disconnected, the blockchain client 42 needs to initiate an additional query transaction to query the corresponding Transaction receipt.
  • the query transaction can be a regular blockchain transaction, so that all blockchain nodes in the blockchain network 43 need to perform operations such as obtaining, consensus, execution, and chaining for the query transaction, while the blockchain customer
  • the terminal 42 can establish a long connection with a certain blockchain node through the above-mentioned method, and obtain a transaction receipt from the blockchain node based on the above-mentioned event monitoring mechanism; or, the query transaction can be a special transaction, such as a blockchain client
  • the terminal 42 can only establish a long connection with the blockchain node 43n and send the query transaction, then the query transaction will only be acquired and executed by the blockchain node 43n.
  • the query transaction does not need to participate in consensus and does not need to be chained, or even be
  • the other blockchain nodes obtain it, and then the blockchain client 42 can obtain the transaction receipt based on the event monitoring mechanism as described above.
  • the blockchain client 42 may obtain multiple transaction receipts in batches, and the obtained transaction receipts may include the first transaction receipt and/or the second transaction receipt.
  • the type field (or any other field) can be added to the blockchain transaction to mark the blockchain transaction as a business transaction (corresponding to a business request) or a test transaction ( Corresponding to the pressure test request).
  • the value of the type field of any blockchain transaction is the first value
  • the value of the type field of any blockchain transaction is the second value (the difference is In the first value)
  • a type field is also added to the transaction receipt to mark whether the transaction receipt corresponds to a business transaction or a test transaction.
  • the existing fields in the blockchain transaction and transaction receipt can also be reused, and the type identification can be added to the existing fields.
  • the "reserved field" in the blockchain transaction is reused to indicate the transaction type of the blockchain transaction; for example, a business tag can be added to the "reserved field” so that the blockchain node on the blockchain network can A blockchain transaction that contains a business tag is identified as a business transaction, and a blockchain transaction that does not contain a business tag is identified as a test transaction.
  • a stress test label can be added to the "reserved field” so that the blockchain node can recognize the blockchain transaction that contains the stress test label as a test transaction, and the blockchain transaction that does not contain the stress test label as a business trade.
  • the blockchain nodes in the blockchain network After the blockchain nodes in the blockchain network obtain the blockchain transaction containing the first type of identification (i.e. stress test transaction) and the blockchain transaction containing the second type of identification (i.e. business transaction), the same Under the conditions of mixed execution of the above-mentioned blockchain transactions, that is, stress test transactions and business transactions are executed by blockchain nodes under the same conditions.
  • the blockchain nodes in the blockchain network can reuse their own software and hardware resources (such as machine resources, network resources, computing resources, etc.) to perform stress testing transactions and business transactions, that is, the above-mentioned "same "Conditions" can include the software resources and hardware resources of the blockchain node.
  • the stress test implemented on the stress test block chain can reflect the true status of the business block chain, and on the other hand, the stress test block chain and The business blockchain shares software and hardware resources, which can effectively reduce costs. It should be noted that it is possible to avoid stress testing through stress testing transactions during peak traffic periods of business transactions (for example, when a large number of business transactions are submitted to achieve business). On the one hand, the accuracy of stress testing can be improved as much as possible. , On the other hand, it can reduce the impact on the normal execution of the business.
  • the block data of the pressure test block chain and the block data of the business block chain are in the block chain network Isolate storage on the blockchain nodes in the block chain, that is, the block data of the pressure test block chain and the business block chain are isolated from each other, and each uses independent storage resources, thereby avoiding the impact of the stress test on the business production environment and affecting the business Perform normally.
  • the first state data of the pressure test block chain corresponds to the second state data of the business block chain.
  • the first state data is the world state of the pressure test block chain (the account state of all the block chain accounts on the pressure test block chain)
  • the second state data is the world state of the business block chain (on the business block chain) Account status of all blockchain accounts).
  • the account status on the pressure test blockchain will change, which in turn will cause the world state of the pressure test blockchain to change.
  • the stress test transaction is used to drive the update of the first state data.
  • the blockchain nodes in the blockchain network execute business transactions, it will cause the account status on the business blockchain to change, which in turn will cause the world status of the business blockchain to change;
  • the business transaction is used to drive the update of the second state data. Therefore, in the case that the received blockchain transaction belongs to a stress test transaction, the blockchain node in the blockchain network executes the stress test transaction, and drives the update of the first state data according to the execution result; In the case that the blockchain transaction is a business transaction, the business transaction is executed, and the update of the second state data is driven according to the execution result.
  • the first state data and the second state data are on the block chain node in the block chain network Isolation storage, that is, the state data of the pressure test blockchain and the business blockchain are isolated from each other, and each uses independent storage resources, thereby avoiding the impact of the stress test on the business production environment and affecting the normal execution of the business.
  • Step 204 In the case that the blockchain transaction belongs to the stress test transaction, add the stress test block containing the stress test transaction to the stress test blockchain maintained by the blockchain node.
  • Step 206 In the case where the blockchain transaction belongs to the business transaction, add the business block containing the business transaction to the business blockchain maintained by the blockchain node.
  • the blockchain nodes in the blockchain network need to reach a consensus on the received blockchain transactions in order to execute the consensus-based blockchain transactions.
  • the blockchain node in the blockchain network may receive multiple blockchain transactions.
  • the blockchain node in the blockchain network can agree on the received multiple blockchain transactions.
  • the transaction type of the multiple blockchain transactions can be identified, and then differentiated processing can be performed.
  • the blockchain nodes in the blockchain network can identify the transaction types of multiple blockchain transactions received, and then respectively agree on various types of blockchain transactions in the multiple blockchain transactions. .
  • the business system can receive the transaction receipt returned by the blockchain client.
  • the transaction receipt containing the first type identifier is stored in the stress testing database
  • the transaction receipt containing the second type identifier is stored in the business database.
  • the follow-up business system can obtain the transaction receipt corresponding to the stress test request from the stress test database, and then analyze the stress test result.
  • the blockchain nodes in the blockchain network maintain both a business blockchain and a pressure test blockchain corresponding to the business blockchain. Since the data on the pressure test block chain is all test data, it can be deleted after the test ends, thereby reducing the storage space of the block chain node occupied by the pressure test block chain data.
  • this manual also provides a data cleaning solution for the pressure test blockchain.
  • FIG. 5 is a flowchart of a method for cleaning data in a blockchain network according to an exemplary embodiment.
  • the method is applied to a blockchain node and may include the following steps: Step 502, the blockchain node receives a data cleaning transaction, and the blockchain node maintains a business blockchain and corresponds to the business
  • the pressure test block chain of the block chain, the block of the pressure test block chain is used to store the pressure test transaction, and the block of the business block chain is used to store the business transaction.
  • Step 504 The blockchain node modifies the state data corresponding to the latest block on the pressure test blockchain to the state data corresponding to the designated block, and deletes the state data on the pressure test blockchain that is different from the designated block. State data corresponding to other blocks of the block.
  • the blockchain nodes in the blockchain network can keep the pressure test block chain and the business block chain highly consistent (that is, ensure that the pressure test block chain and the business block chain are synchronized in blocks. ), so that the business system does not need to perceive the pressure test block chain (the pressure test block chain is the test environment) and the business block chain (the business block chain is the production environment) on the blockchain network, that is, there is no need to perceive the test environment and production surroundings. Then, there is no need to develop corresponding environmental control codes for the business system to adapt to the test environment and the production environment respectively, but a unified blockchain data management method can be adopted for the test environment and the production environment.
  • the data of the pressure test block chain can be managed to reduce the occupation of the storage resources of the block chain node.
  • the administrator of the blockchain network can submit a data cleaning transaction to the blockchain network through the client (similarly, a third type of cleaning type identification can be added to the data cleaning transaction, and the third type identification is used to indicate belonging
  • the transaction is a data cleaning transaction
  • the data cleaning transaction is used to instruct the blockchain node of the blockchain network to modify the state data corresponding to the latest block on the pressure test blockchain to when receiving the data cleaning transaction Specify the state data corresponding to the block, and delete the state data corresponding to other blocks on the pressure test block chain that are different from the specified block.
  • the designated block may be a pre-appointed block, and each time a data cleaning transaction is received, the state data is cleaned according to the agreed block.
  • the designated block is the genesis block of the pressure test blockchain.
  • the designated block can be a block designated by the administrator of the blockchain network, and the data cleaning transaction contains the information of the block, so that the blockchain nodes in the blockchain network follow the block indicated by the data cleaning transaction Perform state data cleaning.
  • the block data of all blocks located before the latest block on the pressure test block chain can also be archived.
  • the block data (mainly the transactions contained in the block) of all blocks located before the latest block on the pressure test block chain can be archived to other storage devices different from the block chain node, and then the block The block data stored in the chain node is deleted.
  • the pressure test block chain and the business block chain can be cycled into blocks.
  • the block chain node in the block chain network can determine multiple block chain transactions in the current cycle; the block chain transaction belongs to In the case of stress testing transactions (that is, all containing the first type of identification), the first normal block containing the multiple blockchain transactions and the second blank block not containing the blockchain transaction are generated respectively, and the first The normal block is added to the end of the pressure test block chain, and the second blank block is added to the end of the business block chain.
  • the first blank block that does not contain the blockchain transaction and the multiple blockchain transactions are generated respectively The second normal block of the transaction, and the first blank block is added to the end of the pressure test block chain, and the second normal block is added to the end of the second normal block chain.
  • the stress test block chain and the business block chain are cycled into Blocks, then it can also ensure that after the multiple blockchain transactions are executed and formed into blocks, the blocks of the pressure test blockchain and the business blockchain are kept highly consistent.
  • the business blockchain as the production chain (for example, the implementation of a smart contract to achieve a certain business), and the pressure test blockchain as the shadow chain corresponding to the production chain as an example, combined with Figure 6
  • the process by which the blockchain nodes in the blockchain network 43 execute blockchain transactions will be described in detail.
  • FIG. 6 is a flowchart of executing blockchain transactions according to an exemplary embodiment.
  • the execution process may include the following steps: Step 602, read a batch of blockchain transactions.
  • the blockchain nodes in the blockchain network can make a consensus on multiple blockchain transactions sent by the blockchain client 42, and after the consensus is passed, they can respectively agree on the first type identification and the second type identification.
  • Blockchain transactions identified by the type are processed. That is, the blockchain node may first make a consensus on the blockchain transaction sent by the blockchain client 42, and then identify the transaction type of the blockchain transaction passed by the consensus, and then perform differentiated processing.
  • the processing method of adopting consensus first and then identifying the transaction type for blockchain transactions it is possible to perform a consensus operation only once and call the consensus service only once, thereby effectively improving the efficiency of consensus.
  • the blockchain nodes in the blockchain network can distinguish between the type identifications contained in multiple blockchain transactions sent by the blockchain client, and then separately identify the first type identification and The second type identifies blockchain transactions for consensus.
  • the blockchain transactions received by the blockchain nodes in the blockchain network 43 include stress testing transactions and business transactions, and for the execution process of these different types of blockchain transactions, part of the execution process may be To reuse. For example, pre-checking, consensus, post-checking for blockchain transactions, computing services used to execute transactions, block verification, etc. In other words, in the process of performing the above operations, there is no need to differentiate between blockchain transactions for transaction types.
  • the subsequent consensus scheduling can be carried out according to certain rules (for example, According to the chronological order of submitting the blockchain transaction) read a batch of blockchain transactions from the verified queue, and then make a consensus on the read blockchain transactions.
  • Step 604 Consensus is made on the read blockchain transaction.
  • the real data generated in the physical world can be constructed into a standard transaction format supported by the blockchain network, and then published to the blockchain network, and the node devices in the blockchain network will respond to the received transactions. Perform consensus processing, and after reaching a consensus, the node device (ie, blockchain node) as the accounting node in the blockchain network will package the transaction into the block and store it persistently in the blockchain network. certificate.
  • the node device ie, blockchain node
  • the accounting node in the blockchain network will package the transaction into the block and store it persistently in the blockchain network. certificate.
  • the consensus algorithms supported in the blockchain network can include: the first type of consensus algorithm, that is, the consensus algorithm that node devices need to compete for the accounting right of each round of accounting cycle; for example, Proof of Work (Proof of Work, POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS) and other consensus algorithms; the second type of consensus algorithm, that is, pre-election of accounting nodes for each round of accounting cycle (no need Consensus algorithms that compete for the right to bookkeeping; for example, practical Byzantine Fault Tolerance (PBFT) and other consensus algorithms.
  • the first type of consensus algorithm that is, the consensus algorithm that node devices need to compete for the accounting right of each round of accounting cycle
  • POW Proof of Work
  • POS Proof of Stake
  • DPOS Delegated Proof of Stake
  • PBFT Byzantine Fault Tolerance
  • all node devices that compete for the right to bookkeeping can execute the transaction after receiving the transaction.
  • the node devices competing for the right to bookkeeping one of the node devices may win this round of contention for the right to bookkeeping and become the bookkeeping node.
  • the accounting node can package the received transaction with other transactions to generate the latest block, and send the generated latest block or the block header of the latest block to other node devices for consensus.
  • the node device In the blockchain network using the second type of consensus algorithm, the node device with the right to book accounts has been agreed before this round of bookkeeping. Therefore, after receiving the transaction, the node device can send the transaction to the accounting node if it is not the accounting node of the current round. For this round of accounting nodes, the transaction can be executed during or before the process of packaging the transaction with other transactions to generate the latest block. After the accounting node generates the latest block, it can send the latest block or the block header of the latest block to other node devices for consensus.
  • the accounting node in this round can package the received transaction to generate the latest block, and the generated latest block or the latest area
  • the block header of the block is sent to other node devices for consensus verification. If other node devices receive the latest block or the block header of the latest block, and there is no problem after verification, the latest block can be appended to the end of the original blockchain network to complete the accounting of the blockchain network process. In the process of verifying the new block or block header sent by the accounting node, other nodes can also execute the transactions contained in the block.
  • the blockchain transactions passed by the consensus are placed in the pending execution list, and then the blockchain transactions in the pending execution list are post-checked.
  • Step 606 Identify the transaction type of the blockchain transaction in the to-be-executed list.
  • the blockchain transaction is a stress test transaction, proceed to step 608A; when the blockchain transaction is a business transaction, proceed to step 608B.
  • the anti-replay check can also be performed on the blockchain transactions in the list to be executed to prevent the same transaction from being executed multiple times.
  • the anti-replay check can be performed separately for each transaction type.
  • Anti-replay check, and the means of anti-replay check can be the same.
  • blockchain accounts can include external accounts and contract accounts.
  • External accounts are usually owned by users (individuals or institutions), while contract accounts correspond to smart contracts deployed in the blockchain.
  • the structure of all types of accounts is similar and can include fields such as Balance, Nonce, Code, and Storage.
  • the Balance field is used to maintain the current account balance of the account
  • the Nonce field is used to maintain the number of transactions in the account; it is a counter used to ensure that each transaction can be processed and can only be processed once, effectively avoiding replay attacks
  • the Code field is used to maintain the contract code of the account (therefore the Code field of the external account is usually empty); in actual applications, the Code field usually only maintains the hash value of the contract code; therefore, the Code field is usually also called Codehash Field.
  • the Storage field is used to maintain the storage content of the account (the default field value is empty); for contract accounts, an independent storage space is usually allocated to store the storage content of the contract account; the independent storage space is usually Call it the account storage of the contract account.
  • the storage content of the contract account is usually constructed as an MPT (Merkle Patricia Trie) tree and the data structure is stored in the above independent storage space; among them, the MPT tree constructed based on the storage content of the contract account is usually also called the Storage tree .
  • the Storage field usually only maintains the root node of the Storage tree; therefore, the Storage field is usually also called the StorageRoot field.
  • Step 608A perform stress test transaction.
  • Step 608B execute the business transaction.
  • the transaction type can be identified based on the tags included in the blockchain transaction.
  • a block chain transaction includes a stress test tag, it is determined that the block chain transaction is a stress test transaction; when a block chain transaction includes a business tag, it is determined that the block chain transaction is a business transaction.
  • the to-be-executed list can be further divided into a stress test transaction list and a business transaction list, and then call the computing service interface (for example, execute by calling a smart contract), respectively Perform block chain transactions in the stress test transaction list and the business transaction list.
  • Step 610A generate a pressure test block.
  • step 610B a business block is generated.
  • Ethereum uses MPT tree (a variant of Merkle tree) as a form of data organization to organize and manage important data such as account status and transaction information.
  • MPT tree a variant of Merkle tree
  • Ethereum has designed three MPT trees for the data that needs to be stored and maintained in the blockchain, namely the MPT state tree, the MPT transaction tree and the MPT receipt tree.
  • the MPT state tree is an MPT tree organized by the account state data of all accounts in the blockchain;
  • the MPT transaction tree is an MPT tree organized by the transaction data in the blockchain;
  • MPT receipt tree Is the MPT tree organized by the transaction receipt (receipt) corresponding to each transaction generated after the transaction in the block is executed.
  • the hash values of the root nodes of the MPT state tree, MPT transaction tree, and MPT receipt tree shown above will all be added to the block header of the corresponding block eventually.
  • the MPT transaction tree and MPT receipt tree correspond to blocks, that is, each block has its own MPT transaction tree and MPT receipt tree.
  • the MPT state tree is a global MPT tree, which does not correspond to a specific block, but covers the account state data (ie world state) of all accounts in the blockchain.
  • the organized MPT transaction tree, MPT receipt tree, and MPT state tree will eventually be stored in a Key-Value database (for example, LevelDB) that uses a multi-level data storage structure.
  • LevelDB Key-Value database
  • the relevant account of the executed transaction in the blockchain can be an external account or a contract account
  • the status of your account usually changes accordingly, and the state of the world also changes accordingly.
  • the balances of the transferor account and transferee account related to the "transfer transaction” that is, the field value of the Balance field of these accounts
  • the node device After the transaction of the node device in the latest block generated by the blockchain is completed, because the account status in the current blockchain has changed, the node device needs to use the current account status data of all accounts in the blockchain to Construct the MPT state tree to maintain the latest state of all accounts in the blockchain. That is, whenever a newest block is generated in the blockchain, and the transaction in the latest block is executed, the account status in the blockchain changes, and the node device needs to be based on all accounts in the blockchain With the latest account status data, rebuild an MPT status tree. In other words, each block in the blockchain has a corresponding MPT state tree; the MPT state tree maintains the latest account of all accounts in the blockchain after the transactions in the block are executed. state.
  • corresponding tags are also added to the transaction receipts obtained, that is, the first transaction receipts obtained by performing stress testing transactions contain the stress testing tags, and the business transactions are executed.
  • the production label is included in the second transaction receipt.
  • the blockchain nodes in the blockchain network can construct the stress test area of the shadow chain based on the transactions in the stress test transaction list, the world state obtained after the stress test transaction is executed, and the transaction receipt. Block; Among them, a pressure test label can be added to the block header of the pressure test block.
  • the transaction in the business transaction list, the world status obtained after the execution of the business transaction, and the transaction receipt construct the business block of the production chain; among them, Add a production tag to the block header of the business block.
  • Step 612 Put the generated block into the block queue to be written.
  • Step 614 Read the block from the block queue to be written.
  • Step 616 Identify the block type. When the block is a pressure test block, go to step 618A; when the block is a business block, go to step 618B.
  • the block-based block header contains a label indicating the block type. For a block read from the queue to be written, the block can be identified according to the label contained in the block header of the block. Whether the block is a pressure test block or a business block.
  • Step 618A generate block height information of the test chain.
  • Step 618B generate block height information of the production chain.
  • Step 620A write the pressure test block.
  • Step 620B write the business block.
  • the block type can be written in the corresponding block database (ie Block formation process), and generate block height information (ie, block number) of the blockchain to which any block belongs. For example, write the pressure test block into the pressure test database used to store the shadow chain block data (logically add the pressure test block to the end of the shadow chain, that is, the process of building blocks on the shadow chain); , To generate the current block height information of the shadow chain.
  • write the business block into the production database used to store the block data of the production chain (logically add the business block to the end of the production chain, that is, the process of building blocks on the production chain); at the same time, generate Current block height information of the production chain.
  • the generated block height information can be stored locally in the blockchain node, or stored in other devices different from the blockchain node.
  • the block chain node can be based on the stored block height Information and corresponding block data quickly reconstruct the shadow chain and the production chain, that is, realize the rapid recovery of the shadow chain and the production chain.
  • the blockchain nodes in the blockchain network when the blockchain nodes in the blockchain network maintain the shadow chain and the production chain, the shadow chain and the production chain form blocks in cycles. Then, the blockchain nodes in the blockchain network can keep the shadow chain and the block of the production chain highly consistent (that is, ensure that the shadow chain and the production chain are synchronized in blocks), so that the business system does not need to perceive the shadow on the blockchain network
  • the logic control for the blockchain is "pull block".
  • the block information of the shadow chain and the production chain needs to be obtained by pulling the block, the In the case that the blocks of the chain are highly consistent, the logic of the business system pulling the business block and the pressure testing block is the same, then a code for pulling the block can be configured for the business system, and the code can be used to obtain at the same time Blocks of shadow chain and production chain.
  • the shadow chain and the production chain block are highly inconsistent, the business system pulls the business block and the pressure test block logic is not the same, then the business system needs to be configured to obtain the pressure test block on the shadow chain. Code, and also need to configure the business system to obtain the code of the business block on the production chain.
  • the above "pulling block” is only an illustrative example, and it can actually be other logic control for blocks.
  • the blockchain node in the blockchain network can determine multiple blockchain transactions sent by the blockchain client for the current cycle.
  • the multiple blockchain transactions all contain stress test tags (that is, the blockchain transactions in the current cycle are used for stress testing)
  • the first normal block and the first normal block containing the multiple blockchain transactions are generated respectively.
  • the second blank block that does not contain the blockchain transaction, and the first normal block is added to the end of the shadow chain, and the second blank block is added to the end of the production chain.
  • the multiple blockchain transactions all contain business tags (that is, the blockchain transactions in the current cycle are all used to perform actual business in the production environment), respectively generate the first blank area that does not contain the blockchain transaction Block and the second normal block containing the multiple blockchain transactions, and the first blank block is added to the end of the shadow chain, and the second normal block is added to the end of the production chain.
  • the multiple blockchain transactions contain both stress test tags and business tags (that is, both stress test transactions and business transactions are included)
  • since the shadow chain and the production chain are cycled into blocks it can also be guaranteed to be executed After completing the multiple blockchain transactions and forming blocks, keep the blocks of the shadow chain and the production chain highly consistent.
  • Step 622 Put the block into the queue to be verified.
  • Step 624 verify the correctness of the block.
  • the blockchain node in the blockchain network can read the block from the queue to be verified, verify the correctness of the block, and then, if the block is verified to be correct, forward the block to the
  • the block chain client issues a block notification so that the block chain client can obtain the transaction receipt.
  • the data of the shadow chain can be managed to reduce the occupation of the storage resources of the blockchain nodes.
  • the administrator of the blockchain network can submit a data cleaning transaction to the blockchain network through the client.
  • the data cleaning transaction is used to instruct the blockchain node of the blockchain network to receive the data cleaning transaction. Modify the state data corresponding to the latest block on the shadow chain to the state data corresponding to the specified block, and delete the state data corresponding to other blocks on the shadow chain that are different from the specified block.
  • the designated block may be a pre-appointed block, and each time a data cleaning transaction is received, the state data is cleaned according to the agreed block.
  • the designated block is the genesis block of the shadow chain.
  • the designated block can be a block designated by the administrator of the blockchain network, and the data cleaning transaction contains the information of the block, so that the blockchain nodes in the blockchain network follow the block indicated by the data cleaning transaction Perform state data cleaning.
  • the block data of all blocks located before the latest block on the shadow chain can also be archived.
  • the block data (mainly the transactions contained in the block) of all blocks located before the latest block on the shadow chain can be archived to other storage devices that are different from the blockchain node, and then the blockchain node
  • the stored block data is deleted, for example, the block header and block body are deleted, and the block is empty after deletion.
  • the blockchain node of the blockchain network can add the shadow chain to block 10
  • the account status of is modified to the account status corresponding to block 1, that is, account X100 yuan, account Y0 yuan, and then the account status corresponding to blocks 1-9 is deleted, thereby saving the storage space of the blockchain node.
  • the stress test can still be performed again based on the account status corresponding to block 10, and the shadow chain account status is cleared after the completion At the same time, it is ensured that the blocks of the shadow chain and the production chain are highly consistent.
  • the block data of blocks 1-9 can also be archived.
  • this specification also provides an embodiment of a data cleaning device for a blockchain network.
  • Fig. 7 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to FIG. 7.
  • the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710.
  • the processor 702 reads the corresponding computer program from the non-volatile memory 710 to the memory 708 and then runs it to form a data cleaning device of the blockchain network on a logical level.
  • one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each
  • the logic unit can also be a hardware or a logic device.
  • the data cleaning device of the blockchain network may include: a receiving unit 802 to enable a blockchain node to receive data cleaning transactions, and the blockchain node maintains a business blockchain And a stress test blockchain corresponding to the business blockchain, the blocks of the stress test blockchain are used to store stress test transactions, and the blocks of the business blockchain are used to store business transactions; a cleaning unit 804. Make the blockchain node modify the state data corresponding to the latest block on the pressure test block chain to the state data corresponding to the specified block, and delete the state data on the pressure test block chain that is different from the specified block. State data corresponding to other blocks of the block.
  • the designated block includes the genesis block of the pressure test blockchain.
  • the pressure test blockchain and the business blockchain are formed into blocks in cycles; the device further includes: a block generation unit 808, which enables the blockchain node to determine multiple blocks in the current cycle Blockchain transaction; when the multiple blockchain transactions belong to the stress test transaction, the blockchain node generates the first normal block containing the multiple blockchain transactions and the first normal block that does not contain the multiple blockchain transactions. The second blank block of the blockchain transaction, and the first normal block is added to the end of the pressure test block chain, and the second blank block is added to the end of the business block chain; the area When the multiple blockchain transactions are all business transactions, the blockchain node generates a first blank block that does not contain a blockchain transaction and a second normal block that contains the multiple blockchain transactions. , And add the first blank block to the end of the pressure test block chain, and add the second normal block to the end of the business block chain.
  • a block generation unit 808 which enables the blockchain node to determine multiple blocks in the current cycle Blockchain transaction
  • the blockchain node when the multiple blockchain transactions belong to the stress test transaction, the blockchain node
  • the stress test transaction is generated by a transaction initiator in response to a stress test request from a business system
  • the business transaction is generated by the transaction initiator in response to a business request from the business system.
  • the stress test transaction includes a first type identifier
  • the business transaction includes a second type identifier
  • the transaction receipt corresponding to the stress test transaction includes a first type identifier
  • the transaction receipt corresponding to the business transaction includes a second type identifier
  • the block header of the block included in the pressure test blockchain includes a first type identifier
  • the block header of the block included in the business blockchain includes a second type identifier
  • block data of the pressure test block chain and the block data of the business block chain are stored separately in the block chain node.
  • the blockchain node maintains first state data corresponding to the stress test blockchain and second state data corresponding to the business blockchain; the stress test transaction is used to drive The update of the first state data and the business transaction are used to drive the update of the second state data.
  • the first state data and the second state data are stored separately in the blockchain node.
  • the stress test transaction and the business transaction are mixedly executed by the blockchain node under the same conditions.
  • a consensus unit 810 which enables the blockchain node to make a consensus on the received multiple blockchain transactions, so as to identify the transaction type of the multiple blockchain transactions after the consensus is passed; or After identifying the transaction types of the received multiple blockchain transactions, the blockchain node respectively agrees on various types of transactions in the multiple blockchain transactions.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the computer includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
  • processors CPU
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM).
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media, can be used to store information that can be accessed by computing devices.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as second information, and similarly, the second information may also be referred to as first information.
  • word “if” as used herein can be interpreted as "when” or “when” or “in response to a certainty”.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

一种区块链网络的数据清理方法及装置,区块链网络的数据清理方法包括:区块链节点接收数据清理交易,区块链节点维护有业务区块链和对应于业务区块链的压测区块链,压测区块链的区块用于存储压测交易,业务区块链的区块用于存储业务交易(502);区块链节点将压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除压测区块链上区别于指定区块的其他区块对应的状态数据(504)。

Description

区块链网络的数据清理方法及装置 技术领域
本说明书一个或多个实施例涉及区块链技术领域,尤其涉及一种区块链网络的数据清理方法及装置。
背景技术
区块链技术(也被称之为,分布式账本技术)是一种去中性化的分布式数据库技术,具有去中心化、公开透明、不可篡改、可信任等多种特点,适用于诸多对数据可靠性具有高需求的应用场景中。
通过向区块链网络导入压力测试流量,可以获知区块链网络的负载能力、数据吞吐量上限等各项性能指标,从而据此维护区块链网络的正常运行,或者针对区块链网络进行优化。
发明内容
有鉴于此,本说明书一个或多个实施例提供一种区块链网络的数据清理方法及装置。
根据本说明书一个或多个实施例的第一方面,提出了一种区块链网络的数据清理方法,包括:区块链节点接收数据清理交易,所述区块链节点维护有业务区块链和对应于所述业务区块链的压测区块链,所述压测区块链的区块用于存储压测交易,所述业务区块链的区块用于存储业务交易;所述区块链节点将所述压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除所述压测区块链上区别于所述指定区块的其他区块对应的状态数据。
根据本说明书一个或多个实施例的第二方面,提出了一种区块链网络的数据清理装置,包括:接收单元,使区块链节点接收数据清理交易,所述区块链节点维护有业务区块链和对应于所述业务区块链的压测区块链,所述压测区块链的区块用于存储压测交易,所述业务区块链的区块用于存储业务交易;清理单元,使所述区块链节点将所述压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除所述压测区块链上区别于所述指定区块的其他区块对应的状态数据。
根据本说明书一个或多个实施例的第三方面,提出了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器。其中,所述处理器通过运行所述可执行指令以实现如上述实施例中任一所述的方法。
根据本说明书一个或多个实施例的第四方面,提出了一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如上述实施例中任一所述方法的步骤。
附图说明
图1是一示例性实施例提供的一种区块链网络的示意图。
图2是一示例性实施例提供的一种区块链网络的压力测试方法的流程图。
图3是一示例性实施例提供的一种网络架构的示意图。
图4是一示例性实施例提供的一种区块链网络的压力测试系统的示意图。
图5是一示例性实施例提供的一种区块链网络的数据清理方法的流程图。
图6是一示例性实施例提供的一种执行区块链交易的流程图。
图7是一示例性实施例提供的一种设备的结构示意图。
图8是一示例性实施例提供的一种区块链网络的数据清理装置的框图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。
请参见图1,图1是一示例性实施例提供的一种网络架构的示意图。如图1所示,业务系统11产生处理请求后,将该处理请求发送至区块链客户端12,由区块链客户端12针对该处理请求创建区块链交易,并将区块链交易提交至区块链网络13,使得区块链网络13上的区块链节点执行该区块链交易。当针对区块链网络13存在压力测试(简称“压测”)需求时,业务系统11可以生成压测请求类型的处理请求(包含用于压力测试的数据),而区块链客户端12可以针对这些压测请求创建相应的区块链交易(即压测交易),并由区块链网络13执行这些区块链交易以对区块链网络13进行压力测试;以及,区块链客户端12将区块链网络13执行区块链交易而产生的交易回执(第一交易回执)反馈至业务系统11,以由业务系统11对交易回执进行分析后,确定区块链网络13的压测结果。而在生产环境下,业务系统11、区块链客户端12和区块链网络13之间的交互过程,与上述的压测过程类似:业务系统11生成业务请求类型的处理请求,区块链客户端12针对这些业务请求创建相应的区块链交易(即业务交易),并由区块链网络13执行这些区块链交易;以及,区块链客户端12将区块链网络13执行区块链交易而产生的交易回执(第二交易回执)反馈至业务系统11。
在全链路压测场景下,涉及到生产环境中的压力测试。为了避免上述的压测请求与业务请求之间产生相互干扰,业务系统11可以在业务请求中添加压测标签以区分于业务请求;当然,也可以在业务请求中添加业务标签以区分于压测请求。但是,区块链客户端12在创建区块链交易时,由于需要遵守现有的交易格式等相关规定,因而无法针 对不同处理请求对应的区块链交易予以区分,即无法将上述的压测标签或业务标签等特征标签带入到区块链网络13中,造成区块链网络13产生的交易回执同样无法携带上述的特征标签,使得业务系统11无法有效区分交易回执的来源,无法据此准确获知区块链网络13的压测结果。
请参见图2,图2是一示例性实施例提供的一种区块链网络的压力测试方法的流程图。如图2所示,该方法应用于区块链节点,可以包括以下步骤:步骤202,识别接收到的区块链交易的交易类型,所述交易类型包括压测交易和业务交易。
在本实施例中,针对各种交易类型的区块链交易,维护有相应的区块链;即各条区块链的区块分别存储对应类型的区块链交易。在该情况下,若针对每条区块链分别部署和配置相应的区块链网络,则会导致提高了成本。为了避免重复部署和配置多条区块链网络,可由同一区块链网络来响应各类区块链交易,该区块链网络中的同一节点设备(作为区块链节点)均维护有这些区块链,而所有的节点设备构成本说明书中的区块链网络。基于区块链节点维护有多条区块链,且区块链与交易类型相对应,区块链节点可在识别出接收到的区块链交易的交易类型后,将包含该区块链交易的区块(通过执行该交易类型的区块链交易得到该区块,从而在该区块的区块体中存储该交易类型的区块链交易)添加至与该交易类型对应的区块链。
以上述压力测试场景为例,如图3所示,在区块链网络中的任一区块链节点30中,维护有业务区块链B和对应于业务区块链B的压测区块链A。其中,压测区块链A的区块用于存储压测交易,业务区块链B的区块用于存储业务交易。具体而言,区块链节点30在执行压测交易后,可在所生成区块的区块体中存储压测交易,并将包含压测交易的区块添加至压测区块链A的末端。例如,压测区块链A包含区块a-1、a-2、a-3、a-4、a-5等等,并且这些区块均由区块链节点30响应于压测交易后生成。类似的,业务区块链B包含区块b-1、b-2、b-3、b-4、b-5等等,并且这些区块均由区块链节点30响应于业务交易后生成。
在本实施例中,压测交易可由交易发起方响应于来自业务系统的压测请求而生成,业务交易可由交易发起方响应于来自业务系统的业务请求而生成。比如,交易发起方可以是区块链客户端,该区块链客户端用于配合业务系统与区块链网络,以实现业务系统与区块链网络之间的数据交互。区块链客户端可以包括任意能够实现数据交互的电子设备,比如为区块链网关;当然,本说明书并不对此进行限制。在业务系统向区块链网络传递数据的过程中,区块链客户端接收业务系统发起的处理请求,并创建对应于该处理请求的区块链交易,然后将该区块链交易提交至区块链网络,使得区块链网络中的所有区块链节点对该区块链交易进行共识、执行、上链等操作;以及,在区块链网络向业务系统传递数据的过程中,区块链客户端获取区块链网络通过执行上述区块链交易所产生的交易回执(receipt),并将该交易回执反馈至业务系统。
在本实施例中,压测区块链的区块用于存储压测交易,业务区块链的区块用于存储业务交易。在该情况下,若针对每条区块链分别部署和配置相应的区块链网络,则会导致提高了成本。为了避免重复部署和配置多条区块链网络,可由同一区块链网络来响应各类区块链交易,该区块链网络中的同一节点设备(作为区块链节点)均维护有这些区 块链,而所有的节点设备构成本说明书中的区块链网络。换言之,在压力测试场景下,不需要基于额外资源来部署专用于压力测试的区块链网络,可由同一区块链网络来响应压测交易和业务交易,那么该同一区块链网络需要对接收到的区块链交易进行识别。因此,区块链客户端在创建区块链交易时,可在区块链交易中添加用于表明交易类型的类型标识(与处理请求的请求类型相对应)。比如,压测交易包含第一类型标识,业务交易包含第二类型标识。那么,区块链节点可读取接收到的区块链交易包含的类型标识;在读取到的类型标识为第一类型标识的情况下,将该区块链交易判定为压测交易,在该类型标识为第二类型标识的情况下,将该区块链交易判定为业务交易。相应的,区块链网络在生成交易回执时,同样在交易回执中添加相应的类型标识来表明该交易回执与哪种处理请求相对应。比如,区块链客户端可响应于来自业务系统的处理请求,在处理请求为压测请求时生成包含第一类型标识的压测交易,在处理请求为业务请求时生成包含第二类型标识的业务交易。进一步的,区块链客户端在生成压测交易和业务交易后,向该区块链网络提交压测交易和业务交易。而区块链网络在接收到区块链交易后,可生成对应于该区块链交易的交易回执;其中,交易回执中包含该区块链交易的类型标识。比如,区块链网络中的区块链节点在接收到区块链客户端提交的压测交易和业务交易后,可执行压测交易并生成包含第一类型标识的交易回执(即第一交易回执),执行业务交易并生成包含第二类型标识的交易回执(即第二交易回执)。然后,区块链客户端可获取区块链网络生成的交易回执,并返回至业务系统。相应的,业务系统可接收区块链客户端返回的交易回执,将包含第一类型标识的交易回执存储至压测数据库,以及将包含第二类型标识的交易回执存储至业务数据库。
以处于生产状态的区块链网络分别响应压测交易和业务交易为例进行举例说明。如图4所示,区块链网络43中的区块链节点同时维护有压测区块链A和业务区块链B;其中,压测区块链A的区块用于记录压测交易,业务区块链B的区块用于记录业务交易。换言之,区块链网络43在执行压测交易后,压测交易被存储至压测区块链所含的区块中;区块链网络43在执行业务交易后,业务交易被存储至业务区块链所含的区块中。相应的,压测区块链所含区块的区块头中包含第一类型标识,业务区块链所含区块的区块头中包含第二类型标识。基于区块头中包含类型标识,那么可有效将压测区块链和业务区块链区分。比如,在生成压测区块链的区块和业务区块链的区块后,可通过区块头识别出这些区块属于哪个区块链,进而将识别出的区块添加至所属区块链的末端。
可见,通过上述部署区块链网络的方式,业务系统41可无需感知测试环境(即无需感知压测区块链的存在),负责对处理请求进行打标(标记压测请求或业务请求)即可,使得压力测试对业务的侵入较低。
区块链客户端42在收到业务系统41发起的处理请求后,需要对该处理请求的类型予以识别,以确定该处理请求为业务请求还是压测请求。区块链客户端42可以在接收到的处理请求为压测请求的情况下,创建对应于压测请求的压测交易(包含第一类型标识,比如为压测标签);以及,在接收到的处理请求为业务请求的情况下,创建对应于业务请求的业务交易(包含第二类型标识,比如为压测标签)。然后,区块链客户端42可将压测交易和业务交易分别提交至处于生产状态的区块链网络43,以接收区块链网络43分别返回的第一交易回执和第二交易回执。比如,区块链客户端42可以将压测交易 和业务交易分别提交至区块链网络43中的某一区块链节点43n,而该区块链节点43n可以进一步将压测交易和业务交易传递至区块链网络43中的其他区块链节点,使得所有区块链节点可以针对压测交易和业务交易进行共识、执行、上链等操作,并分别生成对应于压测交易的交易回执(包含第一类型标识,即上述压测标签)和对应于业务交易的交易回执(包含第二类型标识,即上述业务标签)。其中,区块链网络43中的区块链节点在接收到区块链客户端42提交的区块链交易后,可识别接收到的区块链交易所含的类型标识,从而据此确定出该区块链交易为压测交易还是业务交易。具体而言,在区块链交易包含第一类型标识的情况下(表明该区块链交易属于压测交易),可将该区块链交易存储至压测区块链所含的区块;在区块链交易包含第二类型标识的情况下(表明该区块链交易属于业务交易),可将区块链交易存储至业务区块链所含的区块。换言之,压测区块链所含区块的区块头中包含第一类型标识,业务区块链所含区块的区块头中包含第二类型标识。例如,图3中的压测区块链A与压测请求对应,业务区块链B与业务请求对应;那么,a-1、a-2、a-3、a-4、a-5等区块的区块头中包含第一类型标识,b-1、b-2、b-3、b-4、b-5等区块的区块头中包含第二类型标识。
区块链客户端可以通过与区块链网络中的某一区块链节点之间建立连接,从而向该区块链节点提交区块链交易。比如,该区块链节点可以为如图4所示的区块链节点43n。以区块链节点43n为例,区块链客户端42与该区块链节点43n之间建立的连接可以为长连接,使得区块链节点43n执行区块链交易(压测交易或者业务交易),生成相应的交易回执之后,可以产生相应的交易回执生成事件,而区块链客户端42可以通过监听该交易回执生成事件获知交易回执已生成(即事件监听机制),并基于上述的长连接获取该交易回执。当然,也可以由区块链节点43n自身通过上述的事件监听机制来监听交易回执生成事件,并通过上述的长连接将交易回执反馈至区块链客户端42,使得区块链客户端42获得交易回执。或者,如果区块链客户端42与区块链节点43n之间建立的连接并非长连接或者所建立的长连接断开,区块链客户端42需要额外通过发起一笔查询交易,以查询相应的交易回执。其中,该查询交易可以为常规的区块链交易,使得区块链网络43中的所有区块链节点均需针对该查询交易进行获取、共识、执行、上链等操作,而区块链客户端42可以通过上述方式与某一区块链节点建立长连接,并基于上述的事件监听机制从该区块链节点处获取交易回执;或者,该查询交易可以为特殊交易,譬如区块链客户端42可以仅与区块链节点43n建立长连接并发送该查询交易,那么该查询交易仅会被区块链节点43n获取并执行,该查询交易无需参与共识且不需要上链,甚至无需被其他区块链节点获取,然后区块链客户端42可以基于如前所述的事件监听机制获取交易回执。当然,区块链客户端42可批量获取多个交易回执,那么获取到的交易回执中可包括第一交易回执和/或第二交易回执。
对于添加类型标识的方式,在一种情况下,可在区块链交易中添加type字段(或者其他任意字段),用于标记区块链交易为业务交易(与业务请求对应)或测试交易(与压测请求对应)。比如,当任一区块链交易type字段的取值为第一取值时,表明该区块链交易属于业务交易,当任一区块链交易type字段的取值为第二取值(区别于第一取值)时,表明该区块链交易属于测试交易。相应地,在交易回执中也添加type字段,用于标记该交易回执对应于业务交易还是对应于测试交易。在另一种情况下,还可复用区块链 交易和交易回执中的已有字段,在已有字段中添加类型标识。比如,复用区块链交易中的“reserved字段”来表明区块链交易的交易类型;例如,可在“reserved字段”中添加业务标签,使得区块链网络上的区块链节点可以将包含业务标签的区块链交易识别为业务交易,而将未包含业务标签的区块链交易识别为测试交易。或者,可在“reserved字段”中添加压测标签,使得区块链节点可将包含压测标签的区块链交易识别为测试交易,而将未包含压测标签的区块链交易识别为业务交易。或者,还可同时在“reserved字段”中添加业务标签和压测标签,使得区块链节点可将包含业务标签的区块链交易识别为业务交易,将包含压测标签的区块链交易识别为测试交易。需要说明的是,针对在交易回执中添加类型标识的方式与上述类似,在此不再赘述。
区块链网络中的区块链节点在获取到包含第一类型标识的区块链交易(即压测交易)和包含第二类型标识的区块链交易(即业务交易)后,可在相同的条件下混合执行上述区块链交易,即压测交易和业务交易由区块链节点在相同的条件下混合执行。作为一示例性实施例,区块链网络中的区块链节点可复用自身的软硬件资源(比如机器资源、网络资源、计算资源等)来执行压测交易和业务交易,即上述“相同的条件”可包括区块链节点的软件资源和硬件资源。通过在相同的条件下混合执行压测交易和业务交易,一方面可使得针对压测区块链所实施的压力测试能够体现出业务区块链的真实状况,另一方面压测区块链和业务区块链共享软硬件资源,可有效降低成本。需要说明的是,可避开在业务交易的流量高峰期(比如,大量通过提交业务交易来实现业务的时间段)通过压测交易来进行压力测试,一方面可尽可能提高压力测试的准确度,另一方面可减少对业务正常执行的影响。
针对上述区块链网络中的区块链节点同时维护压测区块链和业务区块链的方式,压测区块链的区块数据和业务区块链的区块数据在区块链网络中的区块链节点上隔离存储,即压测区块链和业务区块链的区块数据互相隔离,各自使用独立的存储资源,从而避免压力测试给业务的生产环境造成影响,影响业务的正常执行。
以区块链网络采用账户模型为例,由于区块链网络中的区块链节点同时维护压测区块链和业务区块链,则区块链网络中的区块链节点维护有对应于压测区块链的第一状态数据、对应于业务区块链的第二状态数据。其中,第一状态数据为压测区块链的世界状态(压测区块链上所有区块链账户的账户状态),第二状态数据为业务区块链的世界状态(业务区块链上所有区块链账户的账户状态)。针对压测区块链,区块链网络中的区块链节点在执行压测交易后,将导致压测区块链上的账户状态发生变化,进而导致压测区块链的世界状态发生变化;换言之,压测交易被用于驱动第一状态数据的更新。同理,针对业务区块链,区块链网络中的区块链节点在执行业务交易后,将导致业务区块链上的账户状态发生变化,进而导致业务区块链的世界状态发生变化;换言之,业务交易被用于驱动第二状态数据的更新。因此,区块链网络中的区块链节点在接收到的区块链交易属于压测交易的情况下,执行该压测交易,并根据执行结果驱动第一状态数据的更新;在接收到的区块链交易属于业务交易的情况下,执行该业务交易,并根据执行结果驱动第二状态数据的更新。
类似的,针对上述区块链网络中的区块链节点同时维护第一状态数据和第二状态数据的方式,第一状态数据和第二状态数据在区块链网络中的区块链节点上隔离存储,即 压测区块链和业务区块链的状态数据互相隔离,各自使用独立的存储资源,从而避免压力测试给业务的生产环境造成影响,影响业务的正常执行。
步骤204,在所述区块链交易属于所述压测交易的情况下,将包含所述压测交易的压测区块添加至所述区块链节点维护的压测区块链。
步骤206,在所述区块链交易属于所述业务交易的情况下,将包含所述业务交易的业务区块添加至所述区块链节点维护的业务区块链。
在本实施例中,区块链网络中的区块链节点需对接收到的区块链交易进行共识,以执行通过共识的区块链交易。而区块链网络中的区块链节点可能接收到多笔区块链交易,在该情况下,区块链网络中的区块链节点可对接收到的多笔区块链交易进行共识,以在共识通过后识别该多笔区块链交易的交易类型,进而进行差异化处理。通过上述针对区块链交易采用先共识再识别交易类型的处理方式,可以仅执行一次共识操作,仅调用一次共识服务,从而有效提高了共识的效率。或者,区块链网络中的区块链节点可在识别接收到的多笔区块链交易的交易类型后,再分别对该多笔区块链交易中各种类型的区块链交易进行共识。
在本实施例中,业务系统可接收区块链客户端返回的交易回执。其中,将包含第一类型标识的交易回执存储至压测数据库,将包含第二类型标识的交易回执存储至业务数据库。那么,后续业务系统可以从压测数据库获取对应于压测请求的交易回执,进而分析压测结果。
在上述压力测试的场景中,区块链网络中的区块链节点同时维护有业务区块链和对应于该业务区块链的压测区块链。由于压测区块链上的数据均为测试数据,在测试结束后可删除,从而减少压测区块链的数据对区块链节点存储空间的占用。对此,本说明书还提供针对该压测区块链的数据清理方案。
请参见图5,图5是一示例性实施例提供的一种区块链网络的数据清理方法的流程图。如图5所示,该方法应用于区块链节点,可以包括以下步骤:步骤502,区块链节点接收数据清理交易,所述区块链节点维护有业务区块链和对应于所述业务区块链的压测区块链,所述压测区块链的区块用于存储压测交易,所述业务区块链的区块用于存储业务交易。
步骤504,所述区块链节点将所述压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除所述压测区块链上区别于所述指定区块的其他区块对应的状态数据。
在本实施例中,区块链网络中的区块链节点可保持压测区块链和业务区块链的区块高度一致(即保证压测区块链和业务区块链成块同步进行),使得业务系统无需感知区块链网络上的压测区块链(压测区块链为测试环境)和业务区块链(业务区块链为生产环境),即无需感知测试环境和生产环境。那么,便无需针对业务系统开发相应的环境控制代码以分别适配于测试环境和生产环境,而是针对测试环境和生产环境能够采用统一的区块链数据管理方式。
在上述为了保持压测区块链和业务区块链的区块高度一致的前提下,可对压测区块 链的数据进行管理以减少对区块链节点存储资源的占用。比如,区块链网络的管理员可通过客户端向区块链网络提交数据清理交易(类似的,可在数据清理交易中添加清理类型的第三类型标识,该第三类型标识用于表明所属交易为数据清理交易),该数据清理交易用于指示区块链网络的区块链节点在接收到该数据清理交易的情况下,将压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除压测区块链上区别于指定区块的其他区块对应的状态数据。那么,在执行完数据清理交易后,即使后续又存在与该指定区块的状态数据对应的压力测试需求,由于最新区块的状态数据被修改为该指定区块的状态数据,也依然可以重新基于最新区块的状态数据进行压力测试,并且在完成清理压测区块链状态数据的同时保证压测区块链和业务区块链的区块高度一致。
进一步的,指定区块可以是预先约定好的区块,每次接收到数据清理交易均按照该约定好的区块进行状态数据清理。比如,指定区块为压测区块链的创世块。或者,指定区块可以是区块链网络的管理员指定的区块,数据清理交易中包含该区块的信息,进而使得区块链网络中的区块链节点按照数据清理交易指示的区块进行状态数据清理。
为了进一步减少压测区块链的数据对区块链节点存储资源的占用,还可将压测区块链上位于最新区块之前的所有区块的区块数据归档。比如,可将压测区块链上位于最新区块之前的所有区块的区块数据(主要为区块中包含的交易)归档至区别于区块链节点的其他存储设备,进而将区块链节点中存储的区块数据删除。
在本实施例中,压测区块链和业务区块链可按周期成块。为了保证压测区块链和业务区块链的区块高度一致,区块链网络中的区块链节点可确定当前周期内的多笔区块链交易;在该笔区块链交易均属于压测交易(即均包含第一类型标识)的情况下,分别生成包含该多笔区块链交易的第一正常区块和未包含区块链交易的第二空白区块,并将第一正常区块添加至压测区块链的末端、将第二空白区块添加至业务区块链的末端。同理,在该多笔区块链交易均属于业务交易(即均包含第二类型标识)的情况下,分别生成未包含区块链交易的第一空白区块和包含该多笔区块链交易的第二正常区块,并将第一空白区块添加至压测区块链的末端、将第二正常区块添加至第二正常区块链的末端。而针对该多笔区块链交易中既包含第一类型标识又包含第二类型标识的情况(即同时包含压测交易和业务交易),由于压测区块链和业务区块链按周期成块,那么也能保证在执行完该多笔区块链交易并成块之后,保持压测区块链和业务区块链的区块高度一致。
为了便于理解和描述,以下以业务区块链为生产链(比如,通过执行智能合约来实现某项业务)、压测区块链为对应于生产链的影子链为例,结合图6对区块链网络43中的区块链节点执行区块链交易的过程进行详细说明。
请参见图6,图6是一示例性实施例提供的一种执行区块链交易的流程图。如图6所示,该执行过程可以包括以下步骤:步骤602,读取一批区块链交易。
在一种情况下,区块链网络中的区块链节点可对区块链客户端42发送的多笔区块链交易进行共识,并在共识通过后分别对包含第一类型标识和第二类型标识的区块链交易进行处理。也即,区块链节点可先对区块链客户端42发送的区块链交易进行共识,再识别共识通过的区块链交易的交易类型,进而进行差异化处理。通过上述针对区块链交 易采用先共识再识别交易类型的处理方式,可以仅执行一次共识操作,仅调用一次共识服务,从而有效提高了共识的效率。
在另一种情况下,区块链网络中的区块链节点可对区块链客户端发送的多笔区块链交易所含的类型标识进行区分后,再分别对包含第一类型标识和第二类型标识的区块链交易进行共识。
在本实施例中,区块链网络43中的区块链节点接收到的区块链交易包括压测交易和业务交易,而针对这些不同类型的区块链交易的执行过程,部分执行流程可进行复用。比如,针对区块链交易的前置校验、共识、后置校验、执行交易采用的计算服务、区块验证等。换言之,在执行上述操作的过程中,可不必针对交易类型对区块链交易进行差异化处理。
举例而言,在对接收到的区块链交易进行前置校验后,将校验通过的区块链交易放入已验证队列,那么后续在进行共识调度时,可按照一定规则(比如,按照提交区块链交易的时间先后顺序)从已验证队列中读取一批区块链交易,进而对读取到的区块链交易进行共识。
步骤604,对读取到的区块链交易进行共识。
对于物理世界产生的真实数据,可以将其构建成区块链网络所支持的标准的交易(transaction)格式,然后发布至区块链网络,由区块链网络中的节点设备对收到的交易进行共识处理,并在达成共识后,由区块链网络中作为记账节点的节点设备(即区块链节点),将这笔交易打包进区块,在区块链网络中进行持久化存证。
其中,区块链网络中支持的共识算法可以包括:第一类共识算法,即节点设备需要争夺每一轮的记账周期的记账权的共识算法;例如,工作量证明(Proof of Work,POW)、股权证明(Proof of Stake,POS)、委任权益证明(Delegated Proof of Stake,DPOS)等共识算法;第二类共识算法,即预先为每一轮记账周期选举记账节点(不需要争夺记账权)的共识算法;例如,实用拜占庭容错(Practical Byzantine Fault Tolerance,PBFT)等共识算法。
在采用第一类共识算法的区块链网络中,争夺记账权的节点设备,都可以在接收到交易后执行该笔交易。争夺记账权的节点设备中可能有一个节点设备在本轮争夺记账权的过程中胜出,成为记账节点。记账节点可以将收到的交易与其它交易一起打包以生成最新区块,并将生成的最新区块或者该最新区块的区块头发送至其它节点设备进行共识。
在采用第二类共识算法的区块链网络中,具有记账权的节点设备在本轮记账前已经商定好。因此,节点设备在接收到交易后,如果自身不是本轮的记账节点,则可以将该交易发送至记账节点。对于本轮的记账节点,在将该交易与其它交易一起打包以生成最新区块的过程中或者之前,可以执行该交易。记账节点在生成最新区块后,可以将该最新区块或者该最新区块的区块头发送至其它节点设备进行共识。
如上所述,无论区块链网络采用以上示出的哪种共识算法,本轮的记账节点都可以将接收到的交易打包以生成最新区块,并将生成的最新区块或者该最新区块的区块头发送至其它节点设备进行共识验证。如果其它节点设备接收到最新区块或者该最新区块的 区块头后,经验证没有问题,可以将该最新区块追加到原有的区块链网络末尾,从而完成区块链网络的记账过程。其它节点验证记账节点发来的新的区块或区块头的过程中,也可以执行该区块中的包含的交易。
在完成共识后,将共识通过的区块链交易放入待执行列表中,进而对待执行列表中的区块链交易进行后置校验。
步骤606,识别待执行列表中区块链交易的交易类型,当区块链交易为压测交易时转入步骤608A;当区块链交易为业务交易时转入步骤608B。
在本实施例中,还可对待执行列表中的区块链交易进行防重放检查,防止同一笔交易执行多次。其中,由于在生成区块阶段会根据不同的交易类型生成不同的区块,并且不同的区块中的交易访问不同的数据存储,在进行防重放检查时,可分别针对每种交易类型进行防重放检查,而进行防重放检查的手段可以相同。
以账户模型(以太坊)为例,区块链账户可以包括外部账户和合约账户等。外部账户通常为用户(个人或机构)所有,而合约账户则对应于部署在区块链中的智能合约。各类账户的结构都类似,可以包括Balance,Nonce,Code和Storage等字段。其中:Balance字段,用于维护账户目前的账户余额;Nonce字段,用于维护该账户的交易次数;它是用于保障每笔交易能且只能被处理一次的计数器,有效避免重放攻击;Code字段,用于维护该账户的合约代码(因而外部账户的Code字段通常为空);在实际应用中,Code字段中通常仅维护合约代码的hash值;因而,Code字段通常也称之为Codehash字段。
Storage字段,用于维护该账户的存储内容(默认字段值为空);对于合约账户而言,通常会分配一个独立的存储空间,用以存储该合约账户的存储内容;该独立的存储空间通常称之为该合约账户的账户存储。合约账户的存储内容通常会构建成MPT(Merkle Patricia Trie)树的数据结构存储在上述独立的存储空间之中;其中,基于合约账户的存储内容构建成的MPT树,通常也称之为Storage树。而Storage字段通常仅维护该Storage树的根节点;因此,Storage字段通常也称之为StorageRoot字段。
步骤608A,执行压测交易。
步骤608B,执行业务交易。
在本实施例中,可根据区块链交易中包含的标签来识别交易类型。当区块链交易中包含压测标签时,确定该区块链交易为压测交易;当区块链交易中包含业务标签时,确定该区块链交易为业务交易。在识别出待执行列表中区块链交易的交易类型后,可将待执行列表进一步划分为压测交易列表和业务交易列表,进而调用计算服务接口(比如,通过调用智能合约来执行),分别执行压测交易列表和业务交易列表中的区块链交易。
步骤610A,生成压测区块。
步骤610B,生成业务区块。
同样以以太坊为例,以太坊使用了MPT树(一种Merkle树变种),作为数据组织形式,用来组织和管理账户状态、交易信息等重要数据。以太坊针对区块链中需要存储和维护的数据,设计了三棵MPT树,分别是MPT状态树、MPT交易树和MPT收据树。
MPT状态树,是由区块链中所有账户的账户状态(state)数据组织成的MPT树;MPT交易树,是由区块链中的交易(transaction)数据组织成的MPT树;MPT收据树,是区块中的交易在执行完毕后生成的与每笔交易对应的交易收据(receipt)组织成的MPT树。以上示出的MPT状态树、MPT交易树和MPT收据树的根节点的hash值,最终都会被添加至对应区块的区块头中。其中,MPT交易树和MPT收据树均与区块相对应,即每一个区块都有自己的MPT交易树和MPT收据树。而MPT状态树是一个全局的MPT树,并不与某一个特定的区块相对应,而是涵盖了区块链中所有账户的账户状态数据(即世界状态)。对于组织成的MPT交易树、MPT收据树和MPT状态树,最终都会在采用多级数据存储结构的Key-Value型数据库(比如,LevelDB)中进行存储。
需要说明的是,区块链每产生一个最新区块,则在该最新区块中的交易被执行之后,区块链中这些被执行交易的相关账户(可以是外部账户也可以是合约账户)的账户状态,通常也会随之发生变化,那么世界状态也随之发生变化。例如,当区块中的一笔“转账交易”执行完毕后,与该“转账交易”相关的转出方账户和转入方账户的余额(即这些账户的Balance字段的字段值),通常也会随之发生变化。而节点设备在区块链产生的最新区块中的交易执行完毕后,由于当前区块链中的账户状态发生了变化,因此节点设备需要根据区块链中所有账户当前的账户状态数据,来构建MPT状态树,用于维护区块链中所有账户的最新状态。也即,每当区块链中产生一个最新区块,并且该最新区块中的交易执行完毕后,导致区块链中的账户状态发生了变化,节点设备都需要基于区块链中所有账户最新的账户状态数据,重新构建一棵MPT状态树。换言之,区块链中每一个区块,都有一个与之对应的MPT状态树;该MPT状态树,维护了在该区块中的交易在执行完毕后,区块链中所有账户最新的账户状态。
在本实施例中,在执行压测交易和业务交易时,同样也在得到的交易回执中添加相应的标签,即执行压测交易得到的第一交易回执中包含压测标签,执行业务交易得到的第二交易回执中包含生产标签。
相应的,区块链网络中的区块链节点在压测交易执行完毕后,可基于压测交易列表中的交易、执行压测交易后得到的世界状态和交易回执构建影子链的压测区块;其中,可在压测区块的区块头中添加压测标签。类似的,区块链网络中的区块链节点在业务交易执行完毕后,业务交易列表中的交易、执行业务交易后得到的世界状态和交易回执构建生产链的业务区块;其中,可在业务区块的区块头中添加生产标签。
步骤612,将生成的区块放入待写块队列。
步骤614,从待写块队列读取区块。
步骤616,识别区块类型,当区块为压测区块时转入步骤618A;当区块为业务区块时转入步骤618B。
在本实施例中,基于区块的区块头中包含表明区块类型的标签,针对从待写块队列中读取到的区块,可根据该区块的区块头中包含的标签来识别该区块属于压测区块还是业务区块。
步骤618A,生成测试链的区块高度信息。
步骤618B,生成生产链的区块高度信息。
步骤620A,写入压测区块。
步骤620B,写入业务区块。
在本实施例中,在读取待写块队列中的任一区块并识别出该任一区块的区块类型后,可在相应的区块数据库中写入该任一区块(即成块的过程),并生成该任一区块所属区块链的区块高度信息(即区块号)。比如,将压测区块写入用于存储影子链区块数据的压测数据库中(逻辑上将该压测区块添加至影子链的末端,即在影子链上成块的过程);同时,生成影子链当前的区块高度信息。又如,将业务区块写入用于存储生产链区块数据的生产数据库中(逻辑上将该业务区块添加至生产链的末端,即在生产链上成块的过程);同时,生成生产链当前的区块高度信息。其中,生成的区块高度信息,可存储在区块链节点本地,或者存储至区别于该区块链节点的其他设备中。通过生成影子链和生产链的区块高度信息,在区块链节点因各种原因(比如断电、宕机、关闭等)导致设备重启时,该区块链节点可依据存储的区块高度信息和相应的区块数据快速重新构建出影子链和生产链,即实现影子链和生产链的快速恢复。
在本实施例中,区块链网络中的区块链节点在维护影子链和生产链时,影子链和生产链按周期成块。那么,区块链网络中的区块链节点可保持影子链和生产链的区块高度一致(即保证影子链和生产链成块同步进行),使得业务系统无需感知区块链网络上的影子链(影子链为测试环境)和生产链(生产链为生产环境),即无需感知测试环境和生产环境。那么,便无需针对业务系统开发相应的环境控制代码以分别适配于测试环境和生产环境,而是针对测试环境和生产环境能够采用统一的区块链数据管理方式。以针对区块链的逻辑控制代码为例,假定针对区块链的逻辑控制为“拉块”,当需要通过拉块来获取影子链和生产链的区块信息时,在保持影子链和生产链的区块高度一致的情况下,业务系统拉取业务区块和压测区块的逻辑相同,那么可为业务系统配置一种拉取区块的代码即可,该代码可同时用于获取影子链和生产链的区块。而在影子链和生产链的区块高度不一致的情况下,业务系统拉取业务区块和压测区块的逻辑不相同,那么需要为业务系统配置用于获取影子链上压测区块的代码,以及还需要为业务系统配置用于获取生产链上业务区块的代码。当然,上述“拉块”仅为一示例性举例,实际还可为其他针对区块的逻辑控制。
具体而言,区块链网络中的区块链节点可确定区块链客户端发送的用于当前周期的多笔区块链交易。在该多笔区块链交易均包含压测标签的情况(即当前周期内的区块链交易均用于压力测试)下,分别生成包含该多笔区块链交易的第一正常区块和未包含区块链交易的第二空白区块,并将第一正常区块添加至影子链的末端、将第二空白区块添加至生产链的末端。在该多笔区块链交易均包含业务标签的情况(即当前周期内的区块链交易均用于执行生产环境下的实际业务)下,分别生成未包含区块链交易的第一空白区块和包含该多笔区块链交易的第二正常区块,并将第一空白区块添加至影子链的末端、将第二正常区块添加至生产链的末端。而针对该多笔区块链交易中既包含压测标签又包含业务标签的情况(即同时包含压测交易和业务交易),由于影子链和生产链按周期成块,那么也能保证在执行完该多笔区块链交易并成块之后,保持影子链和生产链的区块 高度一致。
步骤622,将区块放入待验证队列。
步骤624,验证区块正确性。
在本实施例中,区块链网络中的区块链节点可从待验证队列中读取区块,验证该区块的正确性,进而在验证得出该区块正确的情况下,向区块链客户端下发成块通知,以使区块链客户端获取交易回执。
在本实施例中,在上述为了保持影子链和生产链的区块高度一致的前提下,可对影子链的数据进行管理以减少对区块链节点存储资源的占用。比如,区块链网络的管理员可通过客户端向区块链网络提交数据清理交易,该数据清理交易用于指示区块链网络的区块链节点在接收到该数据清理交易的情况下,将影子链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除影子链上区别于指定区块的其他区块对应的状态数据。那么,在执行完数据清理交易后,即使后续又存在与该指定区块的状态数据对应的压力测试需求,由于最新区块的状态数据被修改为该指定区块的状态数据,也依然可以重新基于最新区块的状态数据进行压力测试,并且在完成清理影子链状态数据的同时保证影子链和生产链的区块高度一致。
进一步的,指定区块可以是预先约定好的区块,每次接收到数据清理交易均按照该约定好的区块进行状态数据清理。比如,指定区块为影子链的创世块。或者,指定区块可以是区块链网络的管理员指定的区块,数据清理交易中包含该区块的信息,进而使得区块链网络中的区块链节点按照数据清理交易指示的区块进行状态数据清理。
为了进一步减少影子链的数据对区块链节点存储资源的占用,还可将影子链上位于最新区块之前的所有区块的区块数据归档。比如,可将影子链上位于最新区块之前的所有区块的区块数据(主要为区块中包含的交易)归档至区别于区块链节点的其他存储设备,进而将区块链节点中存储的区块数据删除,比如将区块的区块头和区块体均删除,删除后该区块为空块。
以测试转账过程中账户X向账户Y转账导致的账户状态变化为例。假设在完成测试后,影子链上当前存在区块1-10,区块1(即创世块)对应的账户状态为账户X100元,账户Y0元,区块10(最新区块)对应的账户状态为账户X0元,账户Y100元。此时,若区块链网络的管理员通过客户端向区块链网络提交数据清理交易以清理影子链上的压测数据,区块链网络的区块链节点可将影子链上区块10的账户状态修改为区块1对应的账户状态,即账户X100元,账户Y0元,然后将区块1-9对应的账户状态删除,从而节省了区块链节点的存储空间。而即使后续需要重新进行转账的压力测试(比如,换个时间段,但是测试的账户状态不变),也依然可以重新基于区块10对应的账户状态进行压力测试,并且在完成清理影子链账户状态的同时保证影子链和生产链的区块高度一致。当然,为了进一步减少影子链的数据对区块链节点存储资源的占用,还可将区块1-9的区块数据归档。
与上述方法实施例相对应,本说明书还提供了一种区块链网络的数据清理装置的实施例。
图7是一示例性实施例提供的一种设备的示意结构图。请参考图7,在硬件层面,该设备包括处理器702、内部总线704、网络接口706、内存708以及非易失性存储器710,当然还可能包括其他业务所需要的硬件。处理器702从非易失性存储器710中读取对应的计算机程序到内存708中然后运行,在逻辑层面上形成区块链网络的数据清理装置。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
请参考图8,在一软件实施方式中,该区块链网络的数据清理装置可以包括:接收单元802,使区块链节点接收数据清理交易,所述区块链节点维护有业务区块链和对应于所述业务区块链的压测区块链,所述压测区块链的区块用于存储压测交易,所述业务区块链的区块用于存储业务交易;清理单元804,使所述区块链节点将所述压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除所述压测区块链上区别于所述指定区块的其他区块对应的状态数据。
可选的,所述指定区块包括所述压测区块链的创世块。
可选的,还包括:归档单元806,使所述区块链节点将所述压测区块链中位于所述最新区块之前的所有区块的区块数据归档。
可选的,所述压测区块链和所述业务区块链按周期成块;所述装置还包括:区块生成单元808,使所述区块链节点确定当前周期内的多笔区块链交易;所述区块链节点在所述多笔区块链交易均属于所述压测交易的情况下,分别生成包含所述多笔区块链交易的第一正常区块和未包含区块链交易的第二空白区块,并将第一正常区块添加至所述压测区块链的末端、将第二空白区块添加至所述业务区块链的末端;所述区块链节点在所述多笔区块链交易均属于业务交易的情况下,分别生成未包含区块链交易的第一空白区块和包含所述多笔区块链交易的第二正常区块,并将第一空白区块添加至所述压测区块链的末端、将第二正常区块添加至所述业务区块链的末端。
可选的,所述压测交易由交易发起方响应于来自业务系统的压测请求而生成,所述业务交易由所述交易发起方响应于来自所述业务系统的业务请求而生成。
可选的,所述压测交易包含第一类型标识,所述业务交易包含第二类型标识。
可选的,对应于所述压测交易的交易回执包含第一类型标识,对应于所述业务交易的交易回执包含第二类型标识。
可选的,所述压测区块链所含区块的区块头中包含第一类型标识,所述业务区块链所含区块的区块头中包含第二类型标识。
可选的,所述压测区块链的区块数据和所述业务区块链的区块数据在所述区块链节点中隔离存储。
可选的,所述区块链节点维护有对应于所述压测区块链的第一状态数据、对应于所述业务区块链的第二状态数据;所述压测交易被用于驱动第一状态数据的更新、所述业务交易被用于驱动第二状态数据的更新。
可选的,第一状态数据和第二状态数据在所述区块链节点中隔离存储。
可选的,所述压测交易和所述业务交易由所述区块链节点在相同的条件下混合执行。
可选的,还包括:共识单元810,使所述区块链节点对接收到的多笔区块链交易进行共识,以在共识通过后识别所述多笔区块链交易的交易类型;或者,所述区块链节点在识别接收到的多笔区块链交易的交易类型后,分别对所述多笔区块链交易中各种类型的交易进行共识。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的, 而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。

Claims (26)

  1. 一种区块链网络的数据清理方法,包括:
    区块链节点接收数据清理交易,所述区块链节点维护有业务区块链和对应于所述业务区块链的压测区块链,所述压测区块链的区块用于存储压测交易,所述业务区块链的区块用于存储业务交易;
    所述区块链节点将所述压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除所述压测区块链上区别于所述指定区块的其他区块对应的状态数据。
  2. 根据权利要求1所述的方法,所述指定区块包括所述压测区块链的创世块。
  3. 根据权利要求1所述的方法,还包括:
    所述区块链节点将所述压测区块链中位于所述最新区块之前的所有区块的区块数据归档。
  4. 根据权利要求1所述的方法,所述压测区块链和所述业务区块链按周期成块;所述方法还包括:
    所述区块链节点确定当前周期内的多笔区块链交易;
    所述区块链节点在所述多笔区块链交易均属于所述压测交易的情况下,分别生成包含所述多笔区块链交易的第一正常区块和未包含区块链交易的第二空白区块,并将第一正常区块添加至所述压测区块链的末端、将第二空白区块添加至所述业务区块链的末端;
    所述区块链节点在所述多笔区块链交易均属于业务交易的情况下,分别生成未包含区块链交易的第一空白区块和包含所述多笔区块链交易的第二正常区块,并将第一空白区块添加至所述压测区块链的末端、将第二正常区块添加至所述业务区块链的末端。
  5. 根据权利要求1所述的方法,所述压测交易由交易发起方响应于来自业务系统的压测请求而生成,所述业务交易由所述交易发起方响应于来自所述业务系统的业务请求而生成。
  6. 根据权利要求1所述的方法,所述压测交易包含第一类型标识,所述业务交易包含第二类型标识。
  7. 根据权利要求6所述的方法,对应于所述压测交易的交易回执包含第一类型标识,对应于所述业务交易的交易回执包含第二类型标识。
  8. 根据权利要求6所述的方法,所述压测区块链所含区块的区块头中包含第一类型标识,所述业务区块链所含区块的区块头中包含第二类型标识。
  9. 根据权利要求1所述的方法,所述压测区块链的区块数据和所述业务区块链的区块数据在所述区块链节点中隔离存储。
  10. 根据权利要求1所述的方法,所述区块链节点维护有对应于所述压测区块链的第一状态数据、对应于所述业务区块链的第二状态数据;所述压测交易被用于驱动第一状态数据的更新、所述业务交易被用于驱动第二状态数据的更新。
  11. 根据权利要求10所述的方法,第一状态数据和第二状态数据在所述区块链节点中隔离存储。
  12. 根据权利要求1所述的方法,所述压测交易和所述业务交易由所述区块链节点在相同的条件下混合执行。
  13. 一种区块链网络的数据清理装置,包括:
    接收单元,使区块链节点接收数据清理交易,所述区块链节点维护有业务区块链和对应于所述业务区块链的压测区块链,所述压测区块链的区块用于存储压测交易,所述业务区块链的区块用于存储业务交易;
    清理单元,使所述区块链节点将所述压测区块链上最新区块对应的状态数据修改为指定区块对应的状态数据,并删除所述压测区块链上区别于所述指定区块的其他区块对应的状态数据。
  14. 根据权利要求13所述的装置,所述指定区块包括所述压测区块链的创世块。
  15. 根据权利要求13所述的装置,还包括:
    归档单元,使所述区块链节点将所述压测区块链中位于所述最新区块之前的所有区块的区块数据归档。
  16. 根据权利要求13所述的装置,所述压测区块链和所述业务区块链按周期成块;所述装置还包括:
    区块生成单元,使所述区块链节点确定当前周期内的多笔区块链交易;
    所述区块链节点在所述多笔区块链交易均属于所述压测交易的情况下,分别生成包含所述多笔区块链交易的第一正常区块和未包含区块链交易的第二空白区块,并将第一正常区块添加至所述压测区块链的末端、将第二空白区块添加至所述业务区块链的末端;
    所述区块链节点在所述多笔区块链交易均属于业务交易的情况下,分别生成未包含区块链交易的第一空白区块和包含所述多笔区块链交易的第二正常区块,并将第一空白区块添加至所述压测区块链的末端、将第二正常区块添加至所述业务区块链的末端。
  17. 根据权利要求13所述的装置,所述压测交易由交易发起方响应于来自业务系统的压测请求而生成,所述业务交易由所述交易发起方响应于来自所述业务系统的业务请求而生成。
  18. 根据权利要求13所述的装置,所述压测交易包含第一类型标识,所述业务交易包含第二类型标识。
  19. 根据权利要求18所述的装置,对应于所述压测交易的交易回执包含第一类型标识,对应于所述业务交易的交易回执包含第二类型标识。
  20. 根据权利要求18所述的装置,所述压测区块链所含区块的区块头中包含第一类型标识,所述业务区块链所含区块的区块头中包含第二类型标识。
  21. 根据权利要求13所述的装置,所述压测区块链的区块数据和所述业务区块链的区块数据在所述区块链节点中隔离存储。
  22. 根据权利要求13所述的装置,所述区块链节点维护有对应于所述压测区块链的第一状态数据、对应于所述业务区块链的第二状态数据;所述压测交易被用于驱动第一状态数据的更新、所述业务交易被用于驱动第二状态数据的更新。
  23. 根据权利要求22所述的装置,第一状态数据和第二状态数据在所述区块链节点中隔离存储。
  24. 根据权利要求13所述的装置,所述压测交易和所述业务交易由所述区块链节点在相同的条件下混合执行。
  25. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-12中任一项所述的方法。
  26. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-12中任一项所述方法的步骤。
PCT/CN2021/100559 2020-06-24 2021-06-17 区块链网络的数据清理方法及装置 WO2021259125A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010586357.8 2020-06-24
CN202010586357.8A CN111475501B (zh) 2020-06-24 2020-06-24 区块链网络的数据清理方法及装置

Publications (1)

Publication Number Publication Date
WO2021259125A1 true WO2021259125A1 (zh) 2021-12-30

Family

ID=71765366

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/100559 WO2021259125A1 (zh) 2020-06-24 2021-06-17 区块链网络的数据清理方法及装置

Country Status (2)

Country Link
CN (1) CN111475501B (zh)
WO (1) WO2021259125A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111475501B (zh) * 2020-06-24 2020-10-30 支付宝(杭州)信息技术有限公司 区块链网络的数据清理方法及装置
CN111478827B (zh) * 2020-06-24 2020-12-04 支付宝(杭州)信息技术有限公司 区块链网络的压力测试方法及装置、系统
CN111478828B (zh) * 2020-06-24 2020-10-20 支付宝(杭州)信息技术有限公司 区块链网络的压力测试方法及装置、系统
CN113204432A (zh) * 2021-02-03 2021-08-03 支付宝(杭州)信息技术有限公司 区块链中的交易处理方法、装置及电子设备
CN113360456B (zh) * 2021-08-11 2021-10-29 腾讯科技(深圳)有限公司 数据归档方法、装置、设备以及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107332876A (zh) * 2017-05-31 2017-11-07 深圳前海微众银行股份有限公司 区块链状态的同步方法及装置
CN110291506A (zh) * 2018-11-30 2019-09-27 阿里巴巴集团控股有限公司 区块链网络测试平台
CN110442579A (zh) * 2019-08-02 2019-11-12 杭州复杂美科技有限公司 一种状态树数据存储方法、同步方法及设备和存储介质
CN110543788A (zh) * 2019-09-11 2019-12-06 腾讯科技(深圳)有限公司 数据存储方法、装置、计算机可读存储介质和计算机设备
US20190379543A1 (en) * 2018-06-07 2019-12-12 International Business Machines Corporation Efficient validation for blockchain
CN111475501A (zh) * 2020-06-24 2020-07-31 支付宝(杭州)信息技术有限公司 区块链网络的数据清理方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109034809B (zh) * 2018-08-16 2021-08-17 北京京东尚科信息技术有限公司 区块链的生成方法、装置、区块链节点及存储介质
US11462120B2 (en) * 2018-10-19 2022-10-04 Mastercard International Incorporated Method and system for conducting examinations over blockchain
CN110162470B (zh) * 2019-04-28 2023-08-18 创新先进技术有限公司 一种区块链的测试方法和装置
CN110399373B (zh) * 2019-06-26 2024-02-02 杭州慧牧科技有限公司 一种区块链账本存储系统、存储查询方法及删除方法
SG11202010682UA (en) * 2019-11-29 2020-11-27 Alipay Hangzhou Inf Tech Co Ltd Taking snapshots of blockchain data
CN111143396A (zh) * 2019-12-04 2020-05-12 深圳市智微智能软件开发有限公司 高压测试数据管理方法及系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107332876A (zh) * 2017-05-31 2017-11-07 深圳前海微众银行股份有限公司 区块链状态的同步方法及装置
US20190379543A1 (en) * 2018-06-07 2019-12-12 International Business Machines Corporation Efficient validation for blockchain
CN110291506A (zh) * 2018-11-30 2019-09-27 阿里巴巴集团控股有限公司 区块链网络测试平台
CN110442579A (zh) * 2019-08-02 2019-11-12 杭州复杂美科技有限公司 一种状态树数据存储方法、同步方法及设备和存储介质
CN110543788A (zh) * 2019-09-11 2019-12-06 腾讯科技(深圳)有限公司 数据存储方法、装置、计算机可读存储介质和计算机设备
CN111475501A (zh) * 2020-06-24 2020-07-31 支付宝(杭州)信息技术有限公司 区块链网络的数据清理方法及装置

Also Published As

Publication number Publication date
CN111475501B (zh) 2020-10-30
CN111475501A (zh) 2020-07-31

Similar Documents

Publication Publication Date Title
WO2021259125A1 (zh) 区块链网络的数据清理方法及装置
WO2021259126A1 (zh) 区块链网络的压力测试方法及装置、系统
WO2021259127A1 (zh) 区块链网络的压力测试方法及装置、系统
US11868944B2 (en) Container image management system for distributed clusters
US11195231B2 (en) Transaction processing in a service blockchain
US10785168B2 (en) Allocating virtual resource based on block chain
US5327559A (en) Remote and batch processing in an object oriented programming system
WO2021259149A1 (zh) 区块链网络的压力测试方法及装置、系统
WO2021259131A1 (zh) 区块链网络的压力测试方法及装置、系统
CN106155775B (zh) 消息处理方法、设备及系统
US8862613B2 (en) Extensibility of business process and application logic
EP2416246A1 (en) Extensibility of business process and application logic
CN111049904A (zh) 多公有云资源监控的方法与设备
WO2023160077A1 (zh) 区块链数据恢复方法及装置、电子设备
WO2023231335A1 (zh) 在区块链中执行交易的方法及区块链的主节点
WO2023231337A1 (zh) 在区块链中执行交易的方法、区块链的主节点和从节点
CN104951306A (zh) 基于实时计算框架的数据处理方法和系统
CN110955724A (zh) 基于区块链的数据处理方法、装置、节点设备及存储介质
CN110704438A (zh) 一种区块链中布隆过滤器的生成方法及装置
WO2021073096A1 (zh) 资源数据的转移方法、装置和区块链系统
CN114491662B (zh) 一种基于区块链的数据资产审计方法、系统及设备
CN113095824B (zh) 基于区块链的资产管理方法、装置及电子设备
EP2601627B1 (en) Transaction processing system and method
CN111930475B (zh) 启动ett运行的方法及装置
CN112699002A (zh) 多云资源报警管控的方法与设备

Legal Events

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

Ref document number: 21829780

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21829780

Country of ref document: EP

Kind code of ref document: A1