WO2023160094A1 - Blockchain-based transaction verification method and apparatus, and electronic device - Google Patents

Blockchain-based transaction verification method and apparatus, and electronic device Download PDF

Info

Publication number
WO2023160094A1
WO2023160094A1 PCT/CN2022/135627 CN2022135627W WO2023160094A1 WO 2023160094 A1 WO2023160094 A1 WO 2023160094A1 CN 2022135627 W CN2022135627 W CN 2022135627W WO 2023160094 A1 WO2023160094 A1 WO 2023160094A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
cryptographic
blockchain
consensus
commitment
Prior art date
Application number
PCT/CN2022/135627
Other languages
French (fr)
Chinese (zh)
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 WO2023160094A1 publication Critical patent/WO2023160094A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Definitions

  • One or more embodiments of this specification relate to the field of blockchain technology, and in particular to a blockchain-based transaction verification method and device, and electronic equipment.
  • the bookkeeping node needs to verify the legality of the transaction before packing the transaction into the block. Only when the transaction is legal can it be packed into the block.
  • the verification of legitimacy is mainly based on the state data in the blockchain ledger. Therefore, each node device participating in the transaction consensus needs to maintain the full amount of state data in the blockchain ledger locally.
  • state data will continue to increase in the blockchain ledger, and the increase in state data will not only continue to occupy storage space, but also reduce the verification efficiency of node devices participating in the consensus.
  • the embodiments of this specification provide a method, device, and electronic equipment for improving information security.
  • a blockchain-based transaction verification method is provided, the method is applied to node devices participating in consensus in the blockchain, and the blockchain ledger of the blockchain is stored in the The node device in the above block chain that does not participate in the consensus; the method includes:
  • the transaction includes that the client obtains from a node device that does not participate in the consensus in the block chain, and is used to prove the target account and the target account related to the transaction Cryptographic proof that the state data of the said blockchain is contained in the blockchain ledger of said blockchain;
  • the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm
  • the transaction and the execution result of the transaction will be It is sent to a node device in the blockchain that does not participate in the consensus, and stored in the blockchain ledger.
  • a blockchain-based transaction verification device is provided, the device is applied to a node device participating in the consensus in the blockchain, and the blockchain ledger of the blockchain is stored in the The node device in the blockchain that does not participate in the consensus; the device includes:
  • the receiving unit receives the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device in the block chain that does not participate in the consensus, and is used to prove the target account and the transaction related to the transaction.
  • Cryptographic proof that the state data of the target account is included in the blockchain ledger of the blockchain;
  • a verification unit is configured to verify the legality of the transaction; wherein the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
  • the processing unit if the validity check is passed, executes the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, transfers the transaction and the transaction
  • the execution results are sent to the node devices in the blockchain that do not participate in the consensus, and stored in the blockchain ledger.
  • an electronic device including:
  • memory for storing processor-executable instructions
  • the processor is configured as any one of the above blockchain-based transaction verification methods.
  • the embodiment of this specification provides a blockchain-based transaction verification scheme, which verifies the legitimacy of transactions through cryptographic commitments and cryptographic proofs corresponding to blockchain ledgers. Since the cryptographic proof is not based on the account status of the account, the node devices participating in the consensus in the blockchain do not need to store the account status of the full account in the blockchain ledger, thus solving the verification of the node devices participating in the consensus due to too much account status data The problem of low efficiency.
  • Fig. 1 is a schematic diagram of the architecture of the block chain system provided by an exemplary embodiment
  • Fig. 2 is a schematic diagram of multi-party interaction provided by an exemplary embodiment
  • Fig. 3 is a flowchart of a blockchain-based transaction verification method provided by an exemplary embodiment
  • Fig. 4 is a schematic structural diagram of an electronic device provided by an exemplary embodiment
  • Fig. 5 is a block diagram of a blockchain-based transaction verification device provided by an exemplary embodiment.
  • the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification.
  • the method may include more or less steps than those described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
  • Blockchain technology also known as distributed ledger technology, is an emerging technology in which several computing devices jointly participate in "bookkeeping" and jointly maintain a complete distributed database. Due to the characteristics of decentralization, openness and transparency, each computing device can participate in database records, and fast data synchronization between computing devices, blockchain technology has been widely used in many fields. to apply.
  • blockchains can generally be divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
  • Public Blockchain Private Blockchain
  • Consortium Blockchain Third Generation Partnership
  • private chain + alliance chain alliance chain + public chain, etc.
  • the public chain has the highest degree of decentralization. Participants joining the public chain (also known as nodes in the blockchain) can read data records on the chain, participate in transactions, and compete for the accounting rights of new blocks. Moreover, each node can freely join or exit the network and perform related operations.
  • the private chain the write permission of the network is controlled by an organization or institution, and the data read permission is regulated by the organization.
  • a private chain can be a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for internal use by specific institutions.
  • the alliance chain is a blockchain between the public chain and the private chain, which can realize "partial decentralization".
  • Each node in the consortium chain usually has a corresponding entity or organization; nodes join the network through authorization and form an alliance of stakeholders to jointly maintain the operation of the blockchain.
  • the blockchain is usually composed of several blocks. Time stamps corresponding to the creation time of the block are respectively recorded in these blocks, and all blocks form a time-ordered data chain in strict accordance with the time stamps recorded in the block.
  • a Merkle tree composed of the state (state) data of all accounts in the blockchain (hereinafter referred to as account states) for consensus on transactions.
  • the consensus node Each node device participating in the consensus (hereinafter referred to as the consensus node) will carry out the simulated execution of the transaction during the consensus.
  • the simulated execution means that the consensus node executes the transaction but does not record the account status after execution to the state tree. That is, simulation execution does not affect the world state.
  • a read-write set will be generated; the read set contains the latest account status required for transaction execution read by the consensus node locally, and the write set contains the updated account status during the simulation execution process.
  • Consensus nodes can verify whether the account status required for the transaction is consistent through the read set, and the write set is used to verify whether the account status after execution is consistent.
  • the accounting node can package the transaction into the block and update the state of the world based on the write set.
  • each consensus node needs to maintain the full amount of state data in the blockchain ledger locally, which requires a large amount of storage space.
  • the storage space will continue to increase (a large amount of historical status data causes status data to expand).
  • the ever-increasing state data will not only continue to occupy storage space, but also reduce the verification efficiency of consensus nodes.
  • this specification aims to provide a stateless transaction verification scheme.
  • the legitimacy of the transaction is no longer verified based on state data, but the legitimacy of the transaction is verified based on cryptographic commitments and cryptographic proofs. Since there is no need for state data to participate in the verification, the node devices participating in the consensus do not need to store the full amount of state data in the blockchain ledger locally; thus, the node devices participating in the consensus can be lightweighted to free up storage space and improve the verification of the node devices participating in the consensus efficiency.
  • FIG. 1 is a schematic diagram of the architecture of a blockchain system provided by an exemplary embodiment.
  • the blockchain system can include at least one node device that does not participate in the consensus (the non-consensus node shown in Figure 1), and a number of node devices that participate in the consensus (the 4 consensus nodes shown in Figure 1). chain, and the client corresponding to the blockchain.
  • the non-consensus node stores the full amount of state data in the blockchain ledger of the block chain (hereinafter, the full amount of state data is referred to as the state database for short).
  • the state database is used to record all accounts in the blockchain and the latest state data of the accounts.
  • the non-consensus node can provide the client with the latest state data and cryptographic proof required for the transaction.
  • the client Before publishing the transaction, the client needs to obtain the latest state data and cryptographic proof required for the transaction from the non-consensus node; and then send the transaction, the latest state data and cryptographic proof involved in the transaction to the consensus node of the blockchain .
  • the optimal non-consensus node can be routed for the client according to the preset strategy (such as load balancing strategy, minimum delay strategy), so that the client can obtain from the optimal non-consensus node data.
  • the preset strategy such as load balancing strategy, minimum delay strategy
  • the consensus node that receives and responds to the transaction sent by the client can verify the cryptographic proof provided by the client based on the local cryptographic commitment to determine whether the latest state data is true.
  • the other consensus nodes are used for consensus on the transaction and transaction results synchronized by the consensus node that responds to the transaction.
  • the blockchain account books of the blockchain are no longer stored in the consensus nodes, that is, the consensus nodes no longer store the state database of the blockchain locally, but the blocks of the blockchain are maintained by special non-consensus nodes.
  • a full state database in the chain ledger improve verification efficiency by lightweight consensus nodes.
  • the cryptographic algorithm in this specification may include a vector commitment (Vector commitment) algorithm, a polynomial algorithm, and the like.
  • the cryptography commitment includes enciphering all blockchain accounts recorded in the full amount of blockchain ledgers and the account states corresponding to all blockchain accounts based on the Vector commitment algorithm
  • the cryptographic proof includes the proof obtained by performing cryptographic calculation based on the Vector commitment algorithm for the target account recorded in the full amount of blockchain ledger and the state data corresponding to the target account value.
  • stateless (Stateless) transaction verification scheme provided by this specification is further introduced below in conjunction with FIG. 2-FIG. 4 , which is applicable to the blockchain system in FIG. 1 .
  • the multi-party corresponds to the client, non-consensus node, and consensus node in FIG. 1 .
  • the steps in the schematic diagram include at least:
  • Step 310 the client sends the transaction to be published to the non-consensus nodes of the blockchain.
  • Step 320 The non-consensus node receives the transaction sent by the client.
  • Step 322 The non-consensus node queries the account status of the target account related to the transaction from the locally stored blockchain ledger.
  • the blockchain ledger records all accounts in the blockchain and the latest account status of the account.
  • the account status may refer to the value of the Balance field of the user account.
  • Step 324 The non-consensus node obtains the locally stored cryptographic commitment.
  • the cryptographic commitment is the latest cryptographic commitment synchronized by the consensus node of the block chain (detailed in the subsequent steps); the cryptographic commitment is all blocks recorded in the block chain ledger of the block chain Commitment to the authenticity of the chain account and the account state corresponding to the blockchain account.
  • Step 326 The non-consensus node calculates the queried account status and cryptographic commitment based on a cryptographic algorithm, and obtains a cryptographic proof.
  • Step 328 The non-consensus node returns the account status and cryptographic proof of the target account related to the transaction to the client.
  • Step 330 The client receives the account status and cryptographic proof of the target account returned by the non-consensus node.
  • Step 332 The client sends the transaction, the account status of the target account related to the transaction, and cryptographic proof to the blockchain in the form of a blockchain transaction.
  • the client before sending the transaction to the blockchain, the client needs to obtain the account status and cryptographic proof of the target account related to the transaction from the non-consensus node of the blockchain.
  • Step 340 The consensus node receives the transaction sent by the client; wherein, the transaction includes that the client obtains from a non-consensus node (ie, a node device that does not participate in the consensus) in the blockchain, and is used to prove The target account associated with the transaction and the account status of the target account are included in the cryptographic proof of the blockchain ledger of the blockchain.
  • a non-consensus node ie, a node device that does not participate in the consensus
  • the target account associated with the transaction and the account status of the target account are included in the cryptographic proof of the blockchain ledger of the blockchain.
  • Step 342 The consensus node checks the validity of the transaction.
  • the legality check may include checking the cryptographic proof based on a cryptographic algorithm; it may also include checking the validity of the data format of the transaction, and it may also check the account status related to the transaction. Perform legality checks, etc.
  • the consensus node maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is recorded in the blockchain ledger A commitment to the authenticity of all blockchain accounts and the account states corresponding to said all blockchain accounts.
  • the verification of the cryptographic proof based on the cryptographic algorithm includes:
  • the cryptographic proof sent by the client is calculated based on the cryptographic algorithm, and it is determined whether the calculated cryptographic commitment is consistent with the cryptographic commitment maintained by the consensus node.
  • consensus nodes and non-consensus nodes use the same cryptographic algorithm.
  • the cryptographic proof is calculated based on the cryptographic algorithm for the cryptographic commitment and the account status of the target account; that is, the cryptographic algorithm (cryptographic commitment + account status) ⁇ cryptographic proof.
  • the consensus node When the consensus node obtains the account status and cryptographic proof of the target account sent by the client, using the same cryptographic algorithm, it can reverse the cryptographic commitment when the non-consensus node generates the cryptographic proof; that is, the password Cryptographic commitment algorithm (cryptographic proof + account status) ⁇ cryptographic commitment.
  • the cryptographic commitment stored locally by the consensus node is exactly the same as the cryptographic commitment stored locally by the non-consensus node, if the cryptographic commitment is consistent with the calculation result, it means that the cryptographic proof and account status are credible. If they are inconsistent, it means that the cryptographic proof sent by the client and the account status of the target account have been tampered with.
  • the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
  • the legality check also includes:
  • the consensus node can interact with the non-consensus node to determine whether the latest account status corresponding to the target account sent by the client is the same as the latest account status corresponding to the target account maintained by the non-consensus node.
  • the latest account status sent by the client is obtained from a non-consensus node, under normal circumstances, the latest account status of the target account should be consistent; if not, it means that the latest account status sent by the client has been tampered of.
  • the legality check also includes:
  • the latest account status of the target account sent by the client is calculated based on a cryptographic algorithm, and it is determined whether the calculated cryptographic proof is consistent with the cryptographic proof sent by the client.
  • the cryptographic proof is calculated based on the cryptographic algorithm for the cryptographic commitment and the latest account status of the target account; that is, the cryptographic algorithm (cryptographic commitment + account status) ⁇ cryptographic proof.
  • the non-consensus node makes the cryptographic commitment locally maintained by the non-consensus node and the target account sent by the client based on the cryptographic algorithm.
  • the calculation result of the latest account status is the cryptographic proof.
  • the cryptographic proof sent by the client is consistent with the calculation result, it means that the cryptographic proof and the latest account status are credible. If not, it means that the cryptographic proof and the latest account status sent by the client have been tampered with.
  • Step 344 The consensus node executes the transaction if the validity check is passed.
  • the transaction can be executed, and the transaction of this round of bookkeeping is packaged into the latest block; and the latest block is appended to the end of the original blockchain, thus completing the blockchain Bookkeeping process.
  • the execution of the transaction may include:
  • the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
  • the account status of the target account involved in the transaction has changed, and due to the change of the account status, the blockchain ledger has also changed; All blockchain accounts recorded in the blockchain ledger and the cryptographic commitments of the authenticity commitments of the account states corresponding to all the blockchain accounts also need to be updated.
  • Step 346 After the consensus node reaches a consensus on the execution result of the transaction with other consensus nodes in the blockchain, send the transaction and the execution result of the transaction to the non-consensus node in the blockchain node to store in the blockchain ledger.
  • consensus nodes do not store account status, but are stored by non-consensus nodes, consensus nodes need to synchronize the latest account status to non-consensus nodes. That is, the consensus node synchronizes the updated cryptographic commitment and the updated account status to the non-consensus node.
  • Step 352 The non-consensus node receives the execution result of the transaction synchronized by the consensus node.
  • the execution result includes the updated account status and the updated cryptographic commitment.
  • Step 354 After the non-consensus node reaches a consensus on the execution result of the transaction with other consensus nodes, update the maintained cryptographic commitment based on the updated cryptographic commitment.
  • the non-consensus node modifies the locally stored cryptographic commitment to the updated vector commitment; modifies the account state of the target account in the local blockchain ledger to the updated account state.
  • non-consensus nodes can update the latest account status of the target account in the locally maintained blockchain ledger, as well as update the latest cryptographic commitments.
  • the transaction can be executed after it is determined that the transaction is legal, and the cryptographic commitment and account status stored by the non-consensus node are updated after the transaction is executed to prepare for the next round of verification.
  • the legitimacy of the transaction is no longer verified based on the account status data, but the legitimacy of the transaction is verified through the cryptographic commitment and cryptographic proof corresponding to the blockchain ledger. Since the cryptographic proof is not based on the account status of the account, the node devices participating in the consensus in the blockchain do not need to store the account status of the full account in the blockchain ledger, thus solving the verification of the node devices participating in the consensus due to too much account status data The problem of low efficiency.
  • the following describes an embodiment of the method in which the node device participating in the consensus is the main body of this specification in conjunction with FIG. 3.
  • the blockchain ledger of the blockchain is stored at the node device that does not participate in the consensus in the blockchain.
  • the method includes:
  • Step 410 Receive the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device that does not participate in the consensus in the block chain, and is used to prove the target account and the transaction related to the transaction.
  • the state data of the target account is contained in the cryptographic proof in the blockchain ledger of the blockchain.
  • Step 420 Perform a legality check on the transaction; wherein, the legality check includes checking the cryptographic proof based on a cryptographic algorithm.
  • Step 430 If the legality check passes, execute the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, post the transaction and the transaction The execution results are sent to the node devices in the blockchain that do not participate in the consensus, and stored in the blockchain ledger.
  • This embodiment may correspond to the foregoing FIG. 2 , and details of specific steps may also refer to the foregoing embodiment in FIG. 2 .
  • the node device participating in the consensus maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is a blockchain ledger for the blockchain Commitment to the authenticity of all blockchain accounts recorded in and the account status corresponding to all blockchain accounts;
  • the verification of the cryptographic proof based on a cryptographic algorithm includes:
  • the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
  • the legality check also includes:
  • the legality check also includes:
  • the aforementioned execution of the transaction includes:
  • the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
  • the account status of the target account involved in the transaction has changed, and due to the change of the account status, the blockchain ledger has also changed; All blockchain accounts recorded in the blockchain ledger and the cryptographic commitments of the authenticity commitments of the account states corresponding to all the blockchain accounts also need to be updated.
  • the method also includes:
  • the maintained cryptographic commitment is updated based on the updated cryptographic commitment.
  • non-consensus nodes can update the maintained cryptographic commitment based on the updated cryptographic commitment after other nodes participating in the consensus reach a consensus on the execution result of the transaction.
  • the cryptographic algorithm includes a Vector commitment algorithm
  • the cryptographic commitment includes the commitment value obtained by cryptographic calculation based on the Vector commitment algorithm for all blockchain accounts recorded in the full blockchain ledger and the account states corresponding to all blockchain accounts; correspondingly,
  • the cryptographic proof includes a proof value obtained by cryptographically calculating the target account and the state data corresponding to the target account recorded in the full blockchain ledger based on the Vector commitment algorithm.
  • the block chain includes a consortium chain.
  • the embodiment of this specification provides a blockchain-based transaction verification scheme to realize a stateless alliance chain architecture design.
  • the legitimacy of the transaction is verified through the cryptographic commitment and cryptographic proof corresponding to the blockchain ledger. Since the cryptographic proof is not based on the account status of the account, the node devices participating in the consensus in the blockchain do not need to store the account status of the full account in the blockchain ledger, thus solving the verification of the node devices participating in the consensus due to too much account status data The problem of low efficiency.
  • this specification also provides an embodiment of a blockchain-based transaction verification device.
  • the embodiment of the blockchain-based transaction verification device in this specification can be applied to electronic equipment.
  • the device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for operation by the processor of the electronic device where it is located.
  • FIG 4 it is a hardware structure diagram of the electronic device where the blockchain-based transaction verification device in this specification is located, except for the processor, memory, network interface, and non- In addition to the volatile memory, the electronic device where the device in the embodiment is located usually may also include other hardware according to the actual function of the electronic device, which will not be repeated here.
  • Fig. 5 is a block diagram of a blockchain-based transaction verification device shown in an exemplary embodiment of this specification.
  • the block chain-based transaction verification device can be applied to the electronic device shown in Figure 4 above, and corresponds to the method embodiment shown in Figure 3 above, and the device includes:
  • the device is applied to node devices participating in the consensus in the block chain, and the block chain ledger of the block chain is stored at the node device not participating in the consensus in the block chain; the device includes:
  • the receiving unit 510 is configured to receive a transaction sent by the client; wherein, the transaction includes that the client obtains from a node device in the block chain that does not participate in the consensus, and is used to prove the target account and transaction related to the transaction.
  • the state data of the target account is included in the cryptographic proof in the blockchain ledger of the blockchain;
  • the verification unit 520 is configured to perform a legality verification on the transaction; wherein, the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
  • the processing unit 530 if the validity check is passed, executes the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, transfers the transaction and the The execution result of the transaction is sent to the node device in the blockchain that does not participate in the consensus, and stored in the blockchain ledger.
  • the consensus node maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is recorded in the blockchain ledger A commitment to the authenticity of all blockchain accounts and the account status corresponding to said all blockchain accounts;
  • the verification of the cryptographic proof based on a cryptographic algorithm includes:
  • the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
  • the legality check also includes:
  • the legality check also includes:
  • the latest account status of the target account is calculated to obtain cryptographic proof;
  • the execution of the transaction in the processing unit 530 includes:
  • the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
  • the device also includes:
  • the updating unit is configured to update the maintained cryptographic commitment based on the updated cryptographic commitment after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain.
  • the cryptographic algorithm includes a Vector commitment algorithm
  • the cryptographic commitment includes the commitment value obtained by cryptographic calculation based on the Vector commitment algorithm for all blockchain accounts recorded in the full blockchain ledger and the account states corresponding to all blockchain accounts; correspondingly,
  • the cryptographic proof includes a proof value obtained by cryptographically calculating the target account and the state data corresponding to the target account recorded in the full blockchain ledger based on the Vector commitment algorithm.
  • the block chain includes a consortium chain.
  • a typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
  • a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, 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, Compact Disc Read-Only Memory (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 that can be used to store information that can be accessed by computing devices.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of the present specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word “if” as used herein may be interpreted as “at” or "when” or "in response to a determination.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Finance (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Accounting & Taxation (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Development Economics (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

Provided in the embodiments of the present description are a blockchain-based transaction verification method and apparatus, and an electronic device. The method comprises: receiving a transaction sent by a client, wherein the transaction comprises a cryptographic proof, which is acquired by the client from a node device in a blockchain, which node device does not participate in consensus, the cryptographic proof being used for proving that a target account related to the transaction, and state data of the target account, are included in a blockchain ledger of the blockchain; performing legitimacy validation on the transaction, wherein the legitimacy validation comprises validating the cryptographic proof on the basis of a cryptographic algorithm; and if the legitimacy validation is passed, executing the transaction, and after other nodes in the blockchain, which participate in consensus, reach a consensus regarding an execution result of the transaction, sending the transaction and the execution result of the transaction to the node device in the blockchain, which node device does not participate in consensus, and storing the transaction and the execution result of the transaction in the blockchain ledger.

Description

基于区块链的交易验证方法及装置、电子设备Blockchain-based transaction verification method, device, and electronic equipment
本申请要求于2022年02月25日提交中国专利局、申请号为202210179227.1、发明名称为“基于区块链的交易验证方法及装置、电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the China Patent Office on February 25, 2022, with the application number 202210179227.1, and the title of the invention is "Blockchain-based transaction verification method and device, electronic equipment", the entire content of which is passed References are incorporated in this application.
技术领域technical field
本说明书一个或多个实施例涉及区块链技术领域,尤其涉及一种基于区块链的交易验证方法及装置、电子设备。One or more embodiments of this specification relate to the field of blockchain technology, and in particular to a blockchain-based transaction verification method and device, and electronic equipment.
背景技术Background technique
现有的区块链中,记账节点在将交易打包进区块之前,需要对交易进行合法性的验证,只有在交易合法的情况下才可以将其打包进区块。In the existing blockchain, the bookkeeping node needs to verify the legality of the transaction before packing the transaction into the block. Only when the transaction is legal can it be packed into the block.
合法性的验证主要是基于区块链账本中的状态数据来进行的。因此,参与交易共识的每个节点设备在本地都需要维护区块链账本中全量的状态数据。The verification of legitimacy is mainly based on the state data in the blockchain ledger. Therefore, each node device participating in the transaction consensus needs to maintain the full amount of state data in the blockchain ledger locally.
然而,随着业务的增加,区块链账本中会不断增加状态数据,而状态数据的增加不仅会持续占用存储空间,而且会降低参与共识的节点设备的验证效率。However, as the business increases, state data will continue to increase in the blockchain ledger, and the increase in state data will not only continue to occupy storage space, but also reduce the verification efficiency of node devices participating in the consensus.
发明内容Contents of the invention
本说明书实施例提供的一种提高信息安全的方法及装置、电子设备。The embodiments of this specification provide a method, device, and electronic equipment for improving information security.
根据本说明书实施例的第一方面,提供一种基于区块链的交易验证方法,所述方法应用于区块链中参与共识的节点设备,所述区块链的区块链账本存储在所述区块链中不参与共识的节点设备处;所述方法包括:According to the first aspect of the embodiments of this specification, a blockchain-based transaction verification method is provided, the method is applied to node devices participating in consensus in the blockchain, and the blockchain ledger of the blockchain is stored in the The node device in the above block chain that does not participate in the consensus; the method includes:
接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中不参与共识的节点设备处获取的,用于证明与所述交易相关的目标账户和所述目标账户的状态数据包含在所述区块链的区块链账本中的密码学证明;Receiving the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device that does not participate in the consensus in the block chain, and is used to prove the target account and the target account related to the transaction Cryptographic proof that the state data of the said blockchain is contained in the blockchain ledger of said blockchain;
针对所述交易进行合法性校验;其中,所述合法性校验包括基于密码学算法对所述密码学证明进行校验;Carry out legality verification for the transaction; wherein, the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
如果所述合法性校验通过,执行所述交易,并在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中不参与共识的节点设备处,在所述区块链账本中进行存储。If the legality check is passed, execute the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, the transaction and the execution result of the transaction will be It is sent to a node device in the blockchain that does not participate in the consensus, and stored in the blockchain ledger.
根据本说明书实施例的第二方面,提供一种基于区块链的交易验证装置,所述装置应用于区块链中参与共识的节点设备,所述区块链的区块链账本存储在所述区块链中不参与共识的节点设备处;所述装置包括:According to the second aspect of the embodiment of this specification, a blockchain-based transaction verification device is provided, the device is applied to a node device participating in the consensus in the blockchain, and the blockchain ledger of the blockchain is stored in the The node device in the blockchain that does not participate in the consensus; the device includes:
接收单元,接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中不参与共识的节点设备处获取的,用于证明与所述交易相关的目标账户和所述目标账户的状态数据包含在所述区块链的区块链账本中的密码学证明;The receiving unit receives the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device in the block chain that does not participate in the consensus, and is used to prove the target account and the transaction related to the transaction. Cryptographic proof that the state data of the target account is included in the blockchain ledger of the blockchain;
校验单元,针对所述交易进行合法性校验;其中,所述合法性校验包括基于密码学算法对所述密码学证明进行校验;A verification unit is configured to verify the legality of the transaction; wherein the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
处理单元,如果所述合法性校验通过,执行所述交易,并在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中不参与共识的节点设备处,在所述区块链账本中进行存储。The processing unit, if the validity check is passed, executes the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, transfers the transaction and the transaction The execution results are sent to the node devices in the blockchain that do not participate in the consensus, and stored in the blockchain ledger.
根据本说明书实施例的第三方面,提供一种电子设备,包括:According to a third aspect of the embodiments of this specification, there is provided an electronic device, including:
处理器;processor;
用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
其中,所述处理器被配置为上述任一项基于区块链的交易验证方法。Wherein, the processor is configured as any one of the above blockchain-based transaction verification methods.
本说明书实施例,提供了一种基于区块链的交易验证方案,通过与区块链账本对应的密码学承诺和密码学证明来验证交易的合法性。由于密码学证明不是基于账户的账户状态,因此区块链中参与共识的节点设备无需存储区块链账本中全量账户的账户状态,从而解决由于账户状态数据过多导致参与共识的节点设备的验证效率低的问题。The embodiment of this specification provides a blockchain-based transaction verification scheme, which verifies the legitimacy of transactions through cryptographic commitments and cryptographic proofs corresponding to blockchain ledgers. Since the cryptographic proof is not based on the account status of the account, the node devices participating in the consensus in the blockchain do not need to store the account status of the full account in the blockchain ledger, thus solving the verification of the node devices participating in the consensus due to too much account status data The problem of low efficiency.
附图说明Description of drawings
图1是一示例性实施例提供的区块链系统的架构示意图;Fig. 1 is a schematic diagram of the architecture of the block chain system provided by an exemplary embodiment;
图2是一示例性实施例提供的多方交互的示意图;Fig. 2 is a schematic diagram of multi-party interaction provided by an exemplary embodiment;
图3是一示例性实施例提供的基于区块链的交易验证方法流程图;Fig. 3 is a flowchart of a blockchain-based transaction verification method provided by an exemplary embodiment;
图4是一示例性实施例提供的一种电子设备的结构示意图;Fig. 4 is a schematic structural diagram of an electronic device provided by an exemplary embodiment;
图5是一示例性实施例提供的一种基于区块链的交易验证装置的框图。Fig. 5 is a block diagram of a blockchain-based transaction verification device provided by an exemplary embodiment.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实现方式并不代表与本说明书一个或多个实施例相一致的所有实现方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with aspects of one or more embodiments of the present specification as recited in the appended claims.
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。It should be noted that in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or less steps than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
区块链技术,也被称之为分布式账本技术,是一种由若干台计算设备共同参与“记账”,共同维护一份完整的分布式数据库的新兴技术。由于区块链技术具有去中心化、公开透明、每台计算设备可以参与数据库记录、并且各计算设备之间可以快速的进行数据同步的特性,使得区块链技术已在众多的领域中广泛的进行应用。Blockchain technology, also known as distributed ledger technology, is an emerging technology in which several computing devices jointly participate in "bookkeeping" and jointly maintain a complete distributed database. Due to the characteristics of decentralization, openness and transparency, each computing device can participate in database records, and fast data synchronization between computing devices, blockchain technology has been widely used in many fields. to apply.
一般的,区块链一般可以被划分为三种类型:公有链(Public Blockchain),私有链(Private Blockchain)和联盟链(Consortium Blockchain)。此外,还可以有上述多种类型的结合,比如私有链+联盟链、联盟链+公有链等。In general, blockchains can generally be divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain. In addition, there can be a combination of the above types, such as private chain + alliance chain, alliance chain + public chain, etc.
其中,去中心化程度最高的是公有链。加入公有链的参与者(也可称为区块链中的节点)可以读取链上的数据记录、参与交易、以及竞争新区块的记账权等。而且,各节点可自由加入或者退出网络,并进行相关操作。Among them, the public chain has the highest degree of decentralization. Participants joining the public chain (also known as nodes in the blockchain) can read data records on the chain, participate in transactions, and compete for the accounting rights of new blocks. Moreover, each node can freely join or exit the network and perform related operations.
私有链则相反,该网络的写入权限由某个组织或者机构控制,数据读取权限受组织规定。简单来说,私有链可以为一个弱中心化系统,其对节点具有严格限制且节点数量较少。这种类型的区块链更适合于特定机构内部使用。On the contrary, the private chain, the write permission of the network is controlled by an organization or institution, and the data read permission is regulated by the organization. In simple terms, a private chain can be a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for internal use by specific institutions.
联盟链则是介于公有链以及私有链之间的区块链,可实现“部分去中心化”。联盟链中各个节点通常有与之相对应的实体机构或者组织;节点通过授权加入网络并组成利益相关联盟,共同维护区块链运行。The alliance chain is a blockchain between the public chain and the private chain, which can realize "partial decentralization". Each node in the consortium chain usually has a corresponding entity or organization; nodes join the network through authorization and form an alliance of stakeholders to jointly maintain the operation of the blockchain.
基于区块链的基本特性,区块链通常是由若干个区块构成。在这些区块中分别记录有与该区块的创建时刻对应的时间戳,所有的区块严格按照区块中记录的时间戳,构成一条在时间上有序的数据链条。Based on the basic characteristics of the blockchain, the blockchain is usually composed of several blocks. Time stamps corresponding to the creation time of the block are respectively recorded in these blocks, and all blocks form a time-ordered data chain in strict accordance with the time stamps recorded in the block.
现有的区块链在对交易进行共识时需要依赖由区块链中所有账户的状态(state)数据(以下称为账户状态)构成的Merkle树(称为状态树或者状态数据库)。Existing blockchains need to rely on a Merkle tree (called a state tree or a state database) composed of the state (state) data of all accounts in the blockchain (hereinafter referred to as account states) for consensus on transactions.
每个参与共识的节点设备(以下称为共识节点)在共识时都会进行交易的模拟执行,这里的模拟执行是指共识节点执行交易但不将执行后的账户状态记录到状态树。也就是说,模拟执行不影响世界状态。Each node device participating in the consensus (hereinafter referred to as the consensus node) will carry out the simulated execution of the transaction during the consensus. The simulated execution here means that the consensus node executes the transaction but does not record the account status after execution to the state tree. That is, simulation execution does not affect the world state.
交易模拟执行过程中会产生读写集;其中读集中包含共识节点从本地读取到的交易执行所需的最新的账户状态,写集包含模拟执行过程中更新的账户状态。During the transaction simulation execution process, a read-write set will be generated; the read set contains the latest account status required for transaction execution read by the consensus node locally, and the write set contains the updated account status during the simulation execution process.
共识节点之间通过读集可以验证交易所需的账户状态是否一致,写集用于校验执行后的账户状态是否一致。当读写集都一致时,记账节点才可以将交易打包进区块,并基于写集更新世界状态。Consensus nodes can verify whether the account status required for the transaction is consistent through the read set, and the write set is used to verify whether the account status after execution is consistent. When the read and write sets are consistent, the accounting node can package the transaction into the block and update the state of the world based on the write set.
基于上述验证过程可知,现有基于状态数据的交易验证方式中,每个共识节点本地都需要维护区块链账本中全量的状态数据,而这需要占用大量的存储空间。尤其是针对多版本状态(历史状态数据+最新状态数据),即使存量的区块链账户没有变化,存储空间也将持续上升(大量历史状态数据造成状态数据膨胀)。而不断增加的状态数据不仅会持续占用存储空间,而且会降低共识节点的验证效率。Based on the above verification process, in the existing transaction verification method based on state data, each consensus node needs to maintain the full amount of state data in the blockchain ledger locally, which requires a large amount of storage space. Especially for multi-version status (historical status data + latest status data), even if the existing blockchain account has not changed, the storage space will continue to increase (a large amount of historical status data causes status data to expand). The ever-increasing state data will not only continue to occupy storage space, but also reduce the verification efficiency of consensus nodes.
基于上述问题,本说明书旨在提供一种无状态(Stateless)的交易验证方案。不再基于状态数据来验证交易的合法性,而是基于密码学承诺和密码学证明来验证交易的合法性。由于无需状态数据参与验证,因此参与共识的节点设备本地就不需要存储区块链账本中全量的状态数据;从而可以轻量化参与共识的节点设备以释放存储空间,提高参与共识的节点设备的验证效率。Based on the above problems, this specification aims to provide a stateless transaction verification scheme. The legitimacy of the transaction is no longer verified based on state data, but the legitimacy of the transaction is verified based on cryptographic commitments and cryptographic proofs. Since there is no need for state data to participate in the verification, the node devices participating in the consensus do not need to store the full amount of state data in the blockchain ledger locally; thus, the node devices participating in the consensus can be lightweighted to free up storage space and improve the verification of the node devices participating in the consensus efficiency.
请参见图1,图1是一示例性实施例提供的区块链系统的架构示意图。该区块链系统可以包括由至少一个不参与共识的节点设备(图1中示出的非共识节点),若干参与共识的节点设备(图1中示出的4个共识节点)构成的区块链,以及与区块链对应的客户端。Please refer to FIG. 1, which is a schematic diagram of the architecture of a blockchain system provided by an exemplary embodiment. The blockchain system can include at least one node device that does not participate in the consensus (the non-consensus node shown in Figure 1), and a number of node devices that participate in the consensus (the 4 consensus nodes shown in Figure 1). chain, and the client corresponding to the blockchain.
其中,所述非共识节点中存储有区块链的区块链账本中全量的状态数据(以下将全量的状态数据简称为状态数据库)。所述状态数据库用于记录区块链中所有账户以及账户最新的状态数据。所述非共识节点可以为客户端提供交易所需的最新的状态数据和密码学证明。Wherein, the non-consensus node stores the full amount of state data in the blockchain ledger of the block chain (hereinafter, the full amount of state data is referred to as the state database for short). The state database is used to record all accounts in the blockchain and the latest state data of the accounts. The non-consensus node can provide the client with the latest state data and cryptographic proof required for the transaction.
客户端在发布交易之前需要先从非共识节点处获取交易所需的最新的状态数据和密码学证明;进而将交易、交易涉及的最新的状态数据和密码学证明发送给区块链的共识节点。Before publishing the transaction, the client needs to obtain the latest state data and cryptographic proof required for the transaction from the non-consensus node; and then send the transaction, the latest state data and cryptographic proof involved in the transaction to the consensus node of the blockchain .
如果非共识节点存在多个,那么可以根据预设的策略(例如负载均衡策略、时延最低策略),为客户端路由最优的非共识节点,以使客户端从最优的非共识节点获取数据。If there are multiple non-consensus nodes, the optimal non-consensus node can be routed for the client according to the preset strategy (such as load balancing strategy, minimum delay strategy), so that the client can obtain from the optimal non-consensus node data.
其中,接收并响应客户端发送的交易的共识节点可以基于本地的密码学承诺对客户端提供的密码学证明进行验证,以确定最新的状态数据是否为真。Among them, the consensus node that receives and responds to the transaction sent by the client can verify the cryptographic proof provided by the client based on the local cryptographic commitment to determine whether the latest state data is true.
而其它的共识节点用于对该响应交易的共识节点同步的交易以及交易结果进行共识。The other consensus nodes are used for consensus on the transaction and transaction results synchronized by the consensus node that responds to the transaction.
本说明书中,所述共识节点中不再存储区块链的区块链账本,即共识节点本地不再存储区块链的状态数据库,而是由专门的非共识节点维护区块链的区块链账本中全量的状态数据库。通过轻量化共识节点以提高验证效率。In this specification, the blockchain account books of the blockchain are no longer stored in the consensus nodes, that is, the consensus nodes no longer store the state database of the blockchain locally, but the blocks of the blockchain are maintained by special non-consensus nodes. A full state database in the chain ledger. Improve verification efficiency by lightweight consensus nodes.
本说明书中的密码学算法可以包括向量承诺(Vector commitment)算法、多项式算法等。The cryptographic algorithm in this specification may include a vector commitment (Vector commitment) algorithm, a polynomial algorithm, and the like.
在密码学算法为Vector commitment算法时,所述密码学承诺包括基于Vector commitment算法针对全量的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态进行密码学计算得到的承诺值;相应的,所述密码学证明包括基于Vector commitment算法针对全量的区块链账本中记录的所述目标账户以及所述目标账户对应的状态数据进行密码学计算得到的证明值。When the cryptography algorithm is the Vector commitment algorithm, the cryptography commitment includes enciphering all blockchain accounts recorded in the full amount of blockchain ledgers and the account states corresponding to all blockchain accounts based on the Vector commitment algorithm Correspondingly, the cryptographic proof includes the proof obtained by performing cryptographic calculation based on the Vector commitment algorithm for the target account recorded in the full amount of blockchain ledger and the state data corresponding to the target account value.
以下结合图2-图4进一步介绍本说明书提供的无状态(Stateless)的交易验证方案,该方案适用于图1的区块链系统。The stateless (Stateless) transaction verification scheme provided by this specification is further introduced below in conjunction with FIG. 2-FIG. 4 , which is applicable to the blockchain system in FIG. 1 .
请参见图2所述的多方交互的示意图,所述多方对应了图1中的客户端、非共识节点、共识节点。所述示意图中的步骤至少包括:Please refer to the schematic diagram of multi-party interaction described in FIG. 2 , the multi-party corresponds to the client, non-consensus node, and consensus node in FIG. 1 . The steps in the schematic diagram include at least:
步骤310:客户端将待发布的交易发送给区块链的非共识节点。Step 310: the client sends the transaction to be published to the non-consensus nodes of the blockchain.
步骤320:所述非共识节点接收客户端发送的交易。Step 320: The non-consensus node receives the transaction sent by the client.
步骤322:所述非共识节点从本地存储的区块链账本中查询与所述交易相关的目标账户的账户状态。Step 322: The non-consensus node queries the account status of the target account related to the transaction from the locally stored blockchain ledger.
在本说明书中,所区块链账本记录了区块链中所有账户以及账户最新的账户状态。In this specification, the blockchain ledger records all accounts in the blockchain and the latest account status of the account.
在一实施例中,所述账户状态可以是指用户账户的Balance字段的值。In an embodiment, the account status may refer to the value of the Balance field of the user account.
步骤324:所述非共识节点获取本地存储的密码学承诺。Step 324: The non-consensus node obtains the locally stored cryptographic commitment.
其中,所述密码学承诺为区块链的共识节点同步的最新的密码学承诺(后续步骤中详细介绍);密码学承诺是对所述区块链的区块链账本中记录的所有区块链账户以及与所述区块链账户对应的账户状态的真实性的承诺。Wherein, the cryptographic commitment is the latest cryptographic commitment synchronized by the consensus node of the block chain (detailed in the subsequent steps); the cryptographic commitment is all blocks recorded in the block chain ledger of the block chain Commitment to the authenticity of the chain account and the account state corresponding to the blockchain account.
步骤326:所述非共识节点基于密码学算法对所查询到的账户状态和密码学承诺进行计算,得到密码学证明。Step 326: The non-consensus node calculates the queried account status and cryptographic commitment based on a cryptographic algorithm, and obtains a cryptographic proof.
基于密码学算法对所查询到的目标账户的账户状态和密码学承诺进行计算,得到用于证明与所述交易相关的目标账户和所述目标账户的账户状态包含在所述区块链的区块链账本中的密码学证明。Calculate the account status and cryptographic commitment of the queried target account based on the cryptographic algorithm, and obtain the target account related to the transaction and the account status of the target account included in the blockchain area Cryptographic proofs in blockchain ledgers.
步骤328:所述非共识节点将所述交易相关的目标账户的账户状态、密码学证明返回给所述客户端。Step 328: The non-consensus node returns the account status and cryptographic proof of the target account related to the transaction to the client.
步骤330:所述客户端接收所述非共识节点返回的目标账户的账户状态、密码学证明。Step 330: The client receives the account status and cryptographic proof of the target account returned by the non-consensus node.
步骤332:所述客户端将所述交易、所述交易相关的目标账户的账户状态、密码学证明以区块链交易的形式发送给区块链。Step 332: The client sends the transaction, the account status of the target account related to the transaction, and cryptographic proof to the blockchain in the form of a blockchain transaction.
也就是说,本说明书中客户端在将交易发送给区块链之前,需要先从区块链的非共识节点获取与交易相关的目标账户的账户状态进和密码学证明。That is to say, in this manual, before sending the transaction to the blockchain, the client needs to obtain the account status and cryptographic proof of the target account related to the transaction from the non-consensus node of the blockchain.
步骤340:所述共识节点接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中非共识节点(即不参与共识的节点设备)处获取的,用于证明与所述交易相关的目标账户和所述目标账户的账户状态包含在所述区块链的区块链账本中的密码学证明。Step 340: The consensus node receives the transaction sent by the client; wherein, the transaction includes that the client obtains from a non-consensus node (ie, a node device that does not participate in the consensus) in the blockchain, and is used to prove The target account associated with the transaction and the account status of the target account are included in the cryptographic proof of the blockchain ledger of the blockchain.
步骤342:所述共识节点针对所述交易进行合法性校验。Step 342: The consensus node checks the validity of the transaction.
其中,所述合法性校验可以包括基于密码学算法对所述密码学证明进行校验;也可以包括对所述交易的数据格式进行合法性校验,还可以对所述交易相关的账户状态进行合法性校验等等。Wherein, the legality check may include checking the cryptographic proof based on a cryptographic algorithm; it may also include checking the validity of the data format of the transaction, and it may also check the account status related to the transaction. Perform legality checks, etc.
在一示例性的实施例中,所述共识节点维护有与所述区块链账本对应的密码学承诺;其中,所述密码学承诺是对所述区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性的承诺。In an exemplary embodiment, the consensus node maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is recorded in the blockchain ledger A commitment to the authenticity of all blockchain accounts and the account states corresponding to said all blockchain accounts.
相应地,所述基于密码学算法对所述密码学证明进行校验,包括:Correspondingly, the verification of the cryptographic proof based on the cryptographic algorithm includes:
基于密码学算法对所述密码学证明进行计算得到密码学承诺;Calculate the cryptographic proof based on a cryptographic algorithm to obtain a cryptographic commitment;
确定计算出的密码学承诺,是否与所述参与共识的节点设备本地维护的与所述区块链账本对应的密码学承诺相同;Determine whether the calculated cryptographic commitment is the same as the cryptographic commitment corresponding to the blockchain account book locally maintained by the node device participating in the consensus;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
该示例中,基于密码学算法对客户端发送的密码学证明进行计算,确定计算得到的密码学承诺是否与共识节点维护的密码学承诺一致。In this example, the cryptographic proof sent by the client is calculated based on the cryptographic algorithm, and it is determined whether the calculated cryptographic commitment is consistent with the cryptographic commitment maintained by the consensus node.
这里共识节点、非共识节点采用的是相同的密码学算法。Here, consensus nodes and non-consensus nodes use the same cryptographic algorithm.
由于密码学证明是基于密码学算法对密码学承诺和目标账户的账户状态计算得到的;即密码学算法(密码学承诺+账户状态)→密码学证明。Since the cryptographic proof is calculated based on the cryptographic algorithm for the cryptographic commitment and the account status of the target account; that is, the cryptographic algorithm (cryptographic commitment + account status) → cryptographic proof.
而共识节点在获取到客户端发送的目标账户的账户状态和密码学证明的情况下,采用相同的密码学算法,就可以反推出非共识节点生成该密码学证明时的密码学承诺;即密码学承诺算法(密码学证明+账户状态)→密码学承诺。When the consensus node obtains the account status and cryptographic proof of the target account sent by the client, using the same cryptographic algorithm, it can reverse the cryptographic commitment when the non-consensus node generates the cryptographic proof; that is, the password Cryptographic commitment algorithm (cryptographic proof + account status) → cryptographic commitment.
通过比较本地存储的密码学承诺与计算结果(该反推出的密码学承诺),可以确定客户端发送的目标账户的账户状态是否为真。By comparing the cryptographic commitment stored locally with the calculation result (the deduced cryptographic commitment), it can be determined whether the account status of the target account sent by the client is true.
由于共识节点本地存储的密码学承诺与非共识节点本地存储的密码学承诺是完全相同,如果密码学承诺与计算结果一致,则说明密码学证明和账户状态是可信的。如果不一致,则说明客户端发送的密码学证明和目标账户的账户状态是被篡改过的。Since the cryptographic commitment stored locally by the consensus node is exactly the same as the cryptographic commitment stored locally by the non-consensus node, if the cryptographic commitment is consistent with the calculation result, it means that the cryptographic proof and account status are credible. If they are inconsistent, it means that the cryptographic proof sent by the client and the account status of the target account have been tampered with.
应用该示例可以确定客户端发送的密码学证明和目标账户的账户状态是否被篡改过,只有未被篡改时,才可以确定针对所述交易的合法性校验通过。By applying this example, it can be determined whether the cryptographic proof sent by the client and the account status of the target account have been tampered with. Only when they have not been tampered with can it be determined that the transaction has passed the legality verification.
在一示例性的实施例中,所述交易还包括所述客户端从所述区块链中不参与共识的节点设备处获取到的所述目标账户的最新账户状态;In an exemplary embodiment, the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
所述合法性校验还包括:The legality check also includes:
校验所述目标账户对应的最新账户状态是否与所述区块链中非共识节点(即不参与共识的节点设备)维护的所述目标账户对应的最新账户状态是否相同;Check whether the latest account state corresponding to the target account is the same as the latest account state corresponding to the target account maintained by a non-consensus node (ie, a node device that does not participate in the consensus) in the blockchain;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
该示例中,共识节点可以与非共识节点进行交互,以确定对客户端发送的目标账户对应的最新账户状态,是否与非共识节点维护的目标账户对应的最新账户状态相同。In this example, the consensus node can interact with the non-consensus node to determine whether the latest account status corresponding to the target account sent by the client is the same as the latest account status corresponding to the target account maintained by the non-consensus node.
由于客户端发送的最新账户状态是从非共识节点获取的,因此在正常情况下,目标账户的最新账户 状态应该是一致相同的;如果不一致,则说明客户端发送的最新账户状态是被篡改过的。Since the latest account status sent by the client is obtained from a non-consensus node, under normal circumstances, the latest account status of the target account should be consistent; if not, it means that the latest account status sent by the client has been tampered of.
应用该示例可以确定客户端发送的目标账户的最新账户状态是否被篡改过,只有未被篡改时,才可以确定针对所述交易的合法性校验通过。By applying this example, it can be determined whether the latest account status of the target account sent by the client has been tampered with. Only when it has not been tampered with can it be determined that the transaction has passed the legality check.
在一示例性的实施例中,所述合法性校验还包括:In an exemplary embodiment, the legality check also includes:
将所述交易中的所述目标账户的最新账户状态同步至所述区块链中非共识节点处,以由所述非共识节点基于密码学算法针对所述目标账户以及所述目标账户的最新账户状态进行计算得到密码学证明;Synchronize the latest account status of the target account in the transaction to the non-consensus node in the block chain, so that the non-consensus node can target the target account and the latest account status of the target account based on a cryptographic algorithm. Account status is calculated to obtain cryptographic proof;
获取所述非共识节点计算出的所述密码学证明,并确定该密码学证明与所述交易中的密码学证明是否相同;Obtain the cryptographic proof calculated by the non-consensus node, and determine whether the cryptographic proof is the same as the cryptographic proof in the transaction;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
该示例中,基于密码学算法对客户端发送的目标账户的最新账户状态进行计算,确定计算得到的密码学证明是否与客户端发送的密码学证明一致。In this example, the latest account status of the target account sent by the client is calculated based on a cryptographic algorithm, and it is determined whether the calculated cryptographic proof is consistent with the cryptographic proof sent by the client.
由于密码学证明是基于密码学算法对密码学承诺和目标账户的最新账户状态计算得到的;即密码学算法(密码学承诺+账户状态)→密码学证明。Since the cryptographic proof is calculated based on the cryptographic algorithm for the cryptographic commitment and the latest account status of the target account; that is, the cryptographic algorithm (cryptographic commitment + account status) → cryptographic proof.
而共识节点在获取到客户端发送的目标账户的最新账户状态和密码学证明的情况下,由非共识节点再次基于密码学算法对非共识节点本地维护的密码学承诺和客户端发送的目标账户的最新账户状态计算得到计算结果即密码学证明。In the case where the consensus node obtains the latest account status and cryptographic proof of the target account sent by the client, the non-consensus node makes the cryptographic commitment locally maintained by the non-consensus node and the target account sent by the client based on the cryptographic algorithm. The calculation result of the latest account status is the cryptographic proof.
通过比较客户端发送的密码学证明与计算结果(非共识节点计算得到密码学承诺),可以确定客户端发送的最新账户状态和密码学证明是否为真。By comparing the cryptographic proof sent by the client with the calculation result (the non-consensus node calculates the cryptographic commitment), it can be determined whether the latest account status and cryptographic proof sent by the client are true.
如果客户端发送的密码学证明与计算结果一致,则说明密码学证明和最新账户状态是可信的。如果不一致,则说明客户端发送的密码学证明和最新账户状态是被篡改过的。If the cryptographic proof sent by the client is consistent with the calculation result, it means that the cryptographic proof and the latest account status are credible. If not, it means that the cryptographic proof and the latest account status sent by the client have been tampered with.
应用该示例可以确定客户端发送的密码学证明和最新账户状态是否被篡改过,只有未被篡改时,才可以确定针对所述交易的合法性校验通过。By applying this example, it can be determined whether the cryptographic proof and the latest account status sent by the client have been tampered with, and only when it has not been tampered with can it be determined that the transaction has passed the legality check.
步骤344:所述共识节点在合法性校验通过的情况下,执行所述交易。Step 344: The consensus node executes the transaction if the validity check is passed.
由于合法性校验通过了,因此可以执行该交易,并将本轮记账的交易打包为最新区块;并将该最新区块追加到原有的区块链末尾,从而完成区块链的记账过程。Since the legitimacy check has passed, the transaction can be executed, and the transaction of this round of bookkeeping is packaged into the latest block; and the latest block is appended to the end of the original blockchain, thus completing the blockchain Bookkeeping process.
在一示例性的实施例中,所述执行所述交易,可以包括:In an exemplary embodiment, the execution of the transaction may include:
基于所述目标账户的最新账户状态计算所述目标账户的更新后的账户状态;以及,calculating an updated account status of the target account based on the latest account status of the target account; and,
基于所述更新后的账户状态和本地维护的与所述区块链账本对应的密码学承诺计算更新后的密码学承诺;calculating an updated cryptographic commitment based on the updated account state and a locally maintained cryptographic commitment corresponding to the blockchain ledger;
相应的,所述交易的执行结果包括所述更新后的账户状态和所述更新后的密码学承诺。Correspondingly, the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
该示例中,由于共识节点执行了客户端发送的交易,导致交易涉及的目标账户的账户状态发生了改变,以及由于账户状态改变,导致区块链账本也发生了改变;因此对区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性承诺的密码学承诺也需要更新。In this example, due to the consensus node executing the transaction sent by the client, the account status of the target account involved in the transaction has changed, and due to the change of the account status, the blockchain ledger has also changed; All blockchain accounts recorded in the blockchain ledger and the cryptographic commitments of the authenticity commitments of the account states corresponding to all the blockchain accounts also need to be updated.
具体地,基于密码学算法,对所述更新的账户状态和本地维护的密码学承诺进行计算,得到更新的密码学承诺;即密码学算法(密码学承诺(旧)+最新的账户状态)=最新的密码学承诺。Specifically, based on a cryptographic algorithm, the updated account status and the locally maintained cryptographic commitment are calculated to obtain an updated cryptographic commitment; that is, the cryptographic algorithm (cryptographic commitment (old) + latest account status) = The latest cryptography promises.
步骤346:所述共识节点在与所述区块链中其它共识节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中非共识节点处,以在所述区块链账本中进行存储。Step 346: After the consensus node reaches a consensus on the execution result of the transaction with other consensus nodes in the blockchain, send the transaction and the execution result of the transaction to the non-consensus node in the blockchain node to store in the blockchain ledger.
由于共识节点并不存储账户状态,而是由非共识节点进行存储,因此共识节点需要将最新的账户状态同步给非共识节点。即所述共识节点将所述更新的密码学承诺和所述更新的账户状态同步给所述非共识节点。Since consensus nodes do not store account status, but are stored by non-consensus nodes, consensus nodes need to synchronize the latest account status to non-consensus nodes. That is, the consensus node synchronizes the updated cryptographic commitment and the updated account status to the non-consensus node.
步骤352:所述非共识节点接收共识节点同步的交易的执行结果。其中,所述执行结果包括所述更新后的账户状态和所述更新后的密码学承诺。Step 352: The non-consensus node receives the execution result of the transaction synchronized by the consensus node. Wherein, the execution result includes the updated account status and the updated cryptographic commitment.
步骤354:所述非共识节点在与其它共识节点对所述交易的执行结果达成共识之后,基于所述更新后的密码学承诺对维护的所述密码学承诺进行更新。Step 354: After the non-consensus node reaches a consensus on the execution result of the transaction with other consensus nodes, update the maintained cryptographic commitment based on the updated cryptographic commitment.
非共识节点将本地存储的密码学承诺修改为所述更新的向量承诺;将本地区块链账本中目标账户的账户状态修改为所述更新的账户状态。The non-consensus node modifies the locally stored cryptographic commitment to the updated vector commitment; modifies the account state of the target account in the local blockchain ledger to the updated account state.
这样,非共识节点才可以更新本地维护的区块链账本中目标账户最新的账户状态,以及更新最新的密码学承诺。In this way, non-consensus nodes can update the latest account status of the target account in the locally maintained blockchain ledger, as well as update the latest cryptographic commitments.
通过上述步骤,在确定所述交易合法后可以执行交易,并在交易执行后更新非共识节点存储的密码学承诺和账户状态,以为下一轮验证做准备。Through the above steps, the transaction can be executed after it is determined that the transaction is legal, and the cryptographic commitment and account status stored by the non-consensus node are updated after the transaction is executed to prepare for the next round of verification.
在该示例中,不再基于账户状态数据来验证交易的合法性,而是通过与区块链账本对应的密码学承诺和密码学证明来验证交易的合法性。由于密码学证明不是基于账户的账户状态,因此区块链中参与共识的节点设备无需存储区块链账本中全量账户的账户状态,从而解决由于账户状态数据过多导致参与共识的节点设备的验证效率低的问题。In this example, the legitimacy of the transaction is no longer verified based on the account status data, but the legitimacy of the transaction is verified through the cryptographic commitment and cryptographic proof corresponding to the blockchain ledger. Since the cryptographic proof is not based on the account status of the account, the node devices participating in the consensus in the blockchain do not need to store the account status of the full account in the blockchain ledger, thus solving the verification of the node devices participating in the consensus due to too much account status data The problem of low efficiency.
以下结合图3介绍本说明书以参与共识的节点设备为主体的方法实施例,所述区块链的区块链账本存储在所述区块链中不参与共识的节点设备处,该方法包括:The following describes an embodiment of the method in which the node device participating in the consensus is the main body of this specification in conjunction with FIG. 3. The blockchain ledger of the blockchain is stored at the node device that does not participate in the consensus in the blockchain. The method includes:
步骤410:接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中不参与共识的节点设备处获取的,用于证明与所述交易相关的目标账户和所述目标账户的状态数据包含在所述区块链的区块链账本中的密码学证明。Step 410: Receive the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device that does not participate in the consensus in the block chain, and is used to prove the target account and the transaction related to the transaction. The state data of the target account is contained in the cryptographic proof in the blockchain ledger of the blockchain.
步骤420:针对所述交易进行合法性校验;其中,所述合法性校验包括基于密码学算法对所述密码学证明进行校验。Step 420: Perform a legality check on the transaction; wherein, the legality check includes checking the cryptographic proof based on a cryptographic algorithm.
步骤430:如果所述合法性校验通过,执行所述交易,并在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中不参与共识的节点设备处,在所述区块链账本中进行存储。Step 430: If the legality check passes, execute the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, post the transaction and the transaction The execution results are sent to the node devices in the blockchain that do not participate in the consensus, and stored in the blockchain ledger.
该实施例可以对应于前述图2,具体步骤细节也可以参考前述图2的实施例。This embodiment may correspond to the foregoing FIG. 2 , and details of specific steps may also refer to the foregoing embodiment in FIG. 2 .
在一示例性的实施例中,所述参与共识的节点设备维护了与所述区块链账本对应的密码学承诺;其中,所述密码学承诺是对所述区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性的承诺;In an exemplary embodiment, the node device participating in the consensus maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is a blockchain ledger for the blockchain Commitment to the authenticity of all blockchain accounts recorded in and the account status corresponding to all blockchain accounts;
所述基于密码学算法对所述密码学证明进行校验,包括:The verification of the cryptographic proof based on a cryptographic algorithm includes:
基于密码学算法对所述密码学证明进行计算得到密码学承诺;Calculate the cryptographic proof based on a cryptographic algorithm to obtain a cryptographic commitment;
确定计算出的密码学承诺,是否与所述参与共识的节点设备本地维护的与所述区块链账本对应的密 码学承诺相同;Determine whether the calculated cryptographic commitment is the same as the cryptographic commitment corresponding to the blockchain ledger locally maintained by the node device participating in the consensus;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
应用该示例可以确定客户端发送的密码学证明和目标账户的账户状态是否被篡改过,只有未被篡改时,才可以确定针对所述交易的合法性校验通过。By applying this example, it can be determined whether the cryptographic proof sent by the client and the account status of the target account have been tampered with. Only when they have not been tampered with can it be determined that the transaction has passed the legality verification.
在一示例性的实施例中,所述交易还包括所述客户端从所述区块链中不参与共识的节点设备处获取到的所述目标账户的最新账户状态;In an exemplary embodiment, the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
所述合法性校验还包括:The legality check also includes:
校验所述目标账户对应的最新账户状态是否与所述区块链中不参与共识的其它节点设备维护的所述目标账户对应的最新账户状态是否相同;Verifying whether the latest account status corresponding to the target account is the same as the latest account status corresponding to the target account maintained by other node devices in the blockchain that do not participate in the consensus;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
应用该示例可以确定客户端发送的目标账户的最新账户状态是否被篡改过,只有未被篡改时,才可以确定针对所述交易的合法性校验通过。By applying this example, it can be determined whether the latest account status of the target account sent by the client has been tampered with. Only when it has not been tampered with can it be determined that the transaction has passed the legality check.
在一示例性的实施例中,所述合法性校验还包括:In an exemplary embodiment, the legality check also includes:
将所述交易中的所述目标账户的最新账户状态数据同步至所述区块链中不参与共识的其它节点设备处,以由所述其它节点设备基于密码学算法针对所述目标账户以及所述目标账户的最新账户状态数据进行计算得到密码学证明;Synchronize the latest account status data of the target account in the transaction to other node devices in the blockchain that do not participate in the consensus, so that the other node devices can target the target account and the target account based on a cryptographic algorithm. Calculate the latest account status data of the target account to obtain cryptographic proof;
获取所述其它节点设备计算出的所述密码学证明,并确定该密码学证明与所述交易中的密码学证明是否相同;Obtain the cryptographic proof calculated by the other node device, and determine whether the cryptographic proof is the same as the cryptographic proof in the transaction;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
应用该示例可以确定客户端发送的密码学证明和最新账户状态是否被篡改过,只有未被篡改时,才可以确定针对所述交易的合法性校验通过。By applying this example, it can be determined whether the cryptographic proof and the latest account status sent by the client have been tampered with, and only when it has not been tampered with can it be determined that the transaction has passed the legality check.
在一示例性的实施例中,前述执行所述交易,包括:In an exemplary embodiment, the aforementioned execution of the transaction includes:
基于所述目标账户的最新账户状态计算所述目标账户的更新后的账户状态;以及,calculating an updated account status of the target account based on the latest account status of the target account; and,
基于所述更新后的账户状态和本地维护的与所述区块链账本对应的密码学承诺计算更新后的密码学承诺;calculating an updated cryptographic commitment based on the updated account state and a locally maintained cryptographic commitment corresponding to the blockchain ledger;
相应的,所述交易的执行结果包括所述更新后的账户状态和所述更新后的密码学承诺。Correspondingly, the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
该示例中,由于共识节点执行了客户端发送的交易,导致交易涉及的目标账户的账户状态发生了改变,以及由于账户状态改变,导致区块链账本也发生了改变;因此对区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性承诺的密码学承诺也需要更新。In this example, due to the consensus node executing the transaction sent by the client, the account status of the target account involved in the transaction has changed, and due to the change of the account status, the blockchain ledger has also changed; All blockchain accounts recorded in the blockchain ledger and the cryptographic commitments of the authenticity commitments of the account states corresponding to all the blockchain accounts also need to be updated.
在一示例性的实施例中,所述方法还包括:In an exemplary embodiment, the method also includes:
在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,基于所述更新后的密码学承诺对维护的所述密码学承诺进行更新。After reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the blockchain, the maintained cryptographic commitment is updated based on the updated cryptographic commitment.
该实施例中,需要在参与共识的其它节点对所述交易的执行结果达成共识之后,非共识节点才可以基于所述更新后的密码学承诺对维护的所述密码学承诺进行更新。In this embodiment, non-consensus nodes can update the maintained cryptographic commitment based on the updated cryptographic commitment after other nodes participating in the consensus reach a consensus on the execution result of the transaction.
在一示例性的实施例中,所述密码学算法包括Vector commitment算法;In an exemplary embodiment, the cryptographic algorithm includes a Vector commitment algorithm;
所述密码学承诺包括基于Vector commitment算法针对全量的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态进行密码学计算得到的承诺值;相应的,所述密码学证明包括基于Vector commitment算法针对全量的区块链账本中记录的所述目标账户以及所述目标账户对应的状态数据进行密码学计算得到的证明值。The cryptographic commitment includes the commitment value obtained by cryptographic calculation based on the Vector commitment algorithm for all blockchain accounts recorded in the full blockchain ledger and the account states corresponding to all blockchain accounts; correspondingly, The cryptographic proof includes a proof value obtained by cryptographically calculating the target account and the state data corresponding to the target account recorded in the full blockchain ledger based on the Vector commitment algorithm.
在一示例性的实施例中,所述区块链包括联盟链。In an exemplary embodiment, the block chain includes a consortium chain.
本说明书实施例,提供了一种基于区块链的交易验证方案,实现一个无状态的联盟链架构设计。通过与区块链账本对应的密码学承诺和密码学证明来验证交易的合法性。由于密码学证明不是基于账户的账户状态,因此区块链中参与共识的节点设备无需存储区块链账本中全量账户的账户状态,从而解决由于账户状态数据过多导致参与共识的节点设备的验证效率低的问题。The embodiment of this specification provides a blockchain-based transaction verification scheme to realize a stateless alliance chain architecture design. The legitimacy of the transaction is verified through the cryptographic commitment and cryptographic proof corresponding to the blockchain ledger. Since the cryptographic proof is not based on the account status of the account, the node devices participating in the consensus in the blockchain do not need to store the account status of the full account in the blockchain ledger, thus solving the verification of the node devices participating in the consensus due to too much account status data The problem of low efficiency.
与上述方法实施例相对应,本说明书还提供了一种基于区块链的交易验证装置的实施例。Corresponding to the above method embodiments, this specification also provides an embodiment of a blockchain-based transaction verification device.
本说明书的基于区块链的交易验证装置的实施例可以应用在电子设备上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在电子设备的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。The embodiment of the blockchain-based transaction verification device in this specification can be applied to electronic equipment. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for operation by the processor of the electronic device where it is located.
从硬件层面而言,如图4所示,为本说明书的基于区块链的交易验证装置所在电子设备的一种硬件结构图,除了图4所示的处理器、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的电子设备通常根据该电子设备的实际功能,还可以包括其他硬件,对此不再赘述。From the perspective of hardware, as shown in Figure 4, it is a hardware structure diagram of the electronic device where the blockchain-based transaction verification device in this specification is located, except for the processor, memory, network interface, and non- In addition to the volatile memory, the electronic device where the device in the embodiment is located usually may also include other hardware according to the actual function of the electronic device, which will not be repeated here.
图5是本说明书一示例性实施例示出的一种基于区块链的交易验证装置的框图。所述基于区块链的交易验证装置可以应用在前述图4所示的电子设备中,并与前述图3所示方法实施例对应,所述装置包括:Fig. 5 is a block diagram of a blockchain-based transaction verification device shown in an exemplary embodiment of this specification. The block chain-based transaction verification device can be applied to the electronic device shown in Figure 4 above, and corresponds to the method embodiment shown in Figure 3 above, and the device includes:
所述装置应用于区块链中参与共识的节点设备,所述区块链的区块链账本存储在所述区块链中不参与共识的节点设备处;所述装置包括:The device is applied to node devices participating in the consensus in the block chain, and the block chain ledger of the block chain is stored at the node device not participating in the consensus in the block chain; the device includes:
接收单元510,接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中不参与共识的节点设备处获取的,用于证明与所述交易相关的目标账户和所述目标账户的状态数据包含在所述区块链的区块链账本中的密码学证明;The receiving unit 510 is configured to receive a transaction sent by the client; wherein, the transaction includes that the client obtains from a node device in the block chain that does not participate in the consensus, and is used to prove the target account and transaction related to the transaction. The state data of the target account is included in the cryptographic proof in the blockchain ledger of the blockchain;
校验单元520,针对所述交易进行合法性校验;其中,所述合法性校验包括基于密码学算法对所述密码学证明进行校验;The verification unit 520 is configured to perform a legality verification on the transaction; wherein, the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
处理单元530,如果所述合法性校验通过,执行所述交易,并在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中不参与共识的节点设备处,在所述区块链账本中进行存储。The processing unit 530, if the validity check is passed, executes the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, transfers the transaction and the The execution result of the transaction is sent to the node device in the blockchain that does not participate in the consensus, and stored in the blockchain ledger.
在一示例性的实施例中,所述共识节点维护了与所述区块链账本对应的密码学承诺;其中,所述密码学承诺是对所述区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性的承诺;In an exemplary embodiment, the consensus node maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is recorded in the blockchain ledger A commitment to the authenticity of all blockchain accounts and the account status corresponding to said all blockchain accounts;
所述基于密码学算法对所述密码学证明进行校验,包括:The verification of the cryptographic proof based on a cryptographic algorithm includes:
基于密码学算法对所述密码学证明进行计算得到密码学承诺;Calculate the cryptographic proof based on a cryptographic algorithm to obtain a cryptographic commitment;
确定计算出的密码学承诺,是否与所述共识节点本地维护的与所述区块链账本对应的密码学承诺相同;Determine whether the calculated cryptographic commitment is the same as the cryptographic commitment corresponding to the blockchain ledger locally maintained by the consensus node;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
在一示例性的实施例中,所述交易还包括所述客户端从所述区块链中不参与共识的节点设备处获取到的所述目标账户的最新账户状态;In an exemplary embodiment, the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
所述合法性校验还包括:The legality check also includes:
校验所述目标账户对应的最新账户状态是否与所述区块链中不参与共识的其它节点设备维护的所述目标账户对应的最新账户状态是否相同;Verifying whether the latest account status corresponding to the target account is the same as the latest account status corresponding to the target account maintained by other node devices in the blockchain that do not participate in the consensus;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
在一示例性的实施例中,所述合法性校验还包括:In an exemplary embodiment, the legality check also includes:
将所述交易中的所述目标账户的最新账户状态同步至所述区块链中不参与共识的其它节点设备处,以由所述其它节点设备基于密码学算法针对所述目标账户以及所述目标账户的最新账户状态进行计算得到密码学证明;Synchronize the latest account status of the target account in the transaction to other node devices in the blockchain that do not participate in the consensus, so that the other node devices can target the target account and the target account based on cryptographic algorithms. The latest account status of the target account is calculated to obtain cryptographic proof;
获取所述其它节点设备计算出的所述密码学证明,并确定该密码学证明与所述交易中的密码学证明是否相同;Obtain the cryptographic proof calculated by the other node device, and determine whether the cryptographic proof is the same as the cryptographic proof in the transaction;
如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
在一示例性的实施例中,所述处理单元530中的执行所述交易,包括:In an exemplary embodiment, the execution of the transaction in the processing unit 530 includes:
基于所述目标账户的最新账户状态计算所述目标账户的更新后的账户状态;以及,calculating an updated account status of the target account based on the latest account status of the target account; and,
基于所述更新后的账户状态和本地维护的与所述区块链账本对应的密码学承诺计算更新后的密码学承诺;calculating an updated cryptographic commitment based on the updated account state and a locally maintained cryptographic commitment corresponding to the blockchain ledger;
相应的,所述交易的执行结果包括所述更新后的账户状态和所述更新后的密码学承诺。Correspondingly, the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
在一示例性的实施例中,所述装置还包括:In an exemplary embodiment, the device also includes:
更新单元,在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,基于所述更新后的密码学承诺对维护的所述密码学承诺进行更新。The updating unit is configured to update the maintained cryptographic commitment based on the updated cryptographic commitment after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain.
在一示例性的实施例中,所述密码学算法包括Vector commitment算法;In an exemplary embodiment, the cryptographic algorithm includes a Vector commitment algorithm;
所述密码学承诺包括基于Vector commitment算法针对全量的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态进行密码学计算得到的承诺值;相应的,所述密码学证明包括基于Vector commitment算法针对全量的区块链账本中记录的所述目标账户以及所述目标账户对应的状态数据进行密码学计算得到的证明值。The cryptographic commitment includes the commitment value obtained by cryptographic calculation based on the Vector commitment algorithm for all blockchain accounts recorded in the full blockchain ledger and the account states corresponding to all blockchain accounts; correspondingly, The cryptographic proof includes a proof value obtained by cryptographically calculating the target account and the state data corresponding to the target account recorded in the full blockchain ledger based on the Vector commitment algorithm.
在一示例性的实施例中,所述区块链包括联盟链。In an exemplary embodiment, the block chain includes a consortium chain.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules, or units described in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, 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, Compact Disc Read-Only Memory (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 that can be used to store information that can be accessed by computing devices. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实现方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible, or may be advantageous, in certain implementations.
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。Terms used in one or more embodiments of the present specification are for the purpose of describing specific embodiments only, and are not intended to limit the one or more embodiments of the present specification. As used in one or more embodiments of this specification and the appended claims, the singular forms "a", "the", and "the" are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of the present specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。The above descriptions are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modification, equivalent replacement, improvement, etc. should be included in the scope of protection of one or more embodiments of this specification.

Claims (17)

  1. 一种基于区块链的交易验证方法,所述方法应用于区块链中参与共识的节点设备,所述区块链的区块链账本存储在所述区块链中不参与共识的节点设备处;所述方法包括:A block chain-based transaction verification method, the method is applied to a node device participating in consensus in the block chain, and the block chain ledger of the block chain is stored in the node device not participating in the consensus in the block chain at; the method includes:
    接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中不参与共识的节点设备处获取的,用于证明与所述交易相关的目标账户和所述目标账户的状态数据包含在所述区块链的区块链账本中的密码学证明;Receiving the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device that does not participate in the consensus in the block chain, and is used to prove the target account and the target account related to the transaction Cryptographic proof that the state data of the said blockchain is contained in the blockchain ledger of said blockchain;
    针对所述交易进行合法性校验;其中,所述合法性校验包括基于密码学算法对所述密码学证明进行校验;Carry out legality verification for the transaction; wherein, the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
    如果所述合法性校验通过,执行所述交易,并在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中不参与共识的节点设备处,在所述区块链账本中进行存储。If the legality check is passed, execute the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, the transaction and the execution result of the transaction will be It is sent to a node device in the blockchain that does not participate in the consensus, and stored in the blockchain ledger.
  2. 根据权利要求1所述的方法,所述参与共识的节点设备维护了与所述区块链账本对应的密码学承诺;其中,所述密码学承诺是对所述区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性的承诺;According to the method according to claim 1, the node device participating in the consensus maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is a blockchain ledger for the blockchain Commitment to the authenticity of all blockchain accounts recorded in and the account status corresponding to all blockchain accounts;
    所述基于密码学算法对所述密码学证明进行校验,包括:The verification of the cryptographic proof based on a cryptographic algorithm includes:
    基于密码学算法对所述密码学证明进行计算得到密码学承诺;Calculate the cryptographic proof based on a cryptographic algorithm to obtain a cryptographic commitment;
    确定计算出的密码学承诺,是否与所述参与共识的节点设备本地维护的与所述区块链账本对应的密码学承诺相同;Determine whether the calculated cryptographic commitment is the same as the cryptographic commitment corresponding to the blockchain account book locally maintained by the node device participating in the consensus;
    如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
  3. 根据权利要求2所述的方法,所述交易还包括所述客户端从所述区块链中不参与共识的节点设备处获取到的所述目标账户的最新账户状态;According to the method according to claim 2, the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
    所述合法性校验还包括:The legality check also includes:
    校验所述目标账户对应的最新账户状态是否与所述区块链中不参与共识的其它节点设备维护的所述目标账户对应的最新账户状态是否相同;Verifying whether the latest account status corresponding to the target account is the same as the latest account status corresponding to the target account maintained by other node devices in the blockchain that do not participate in the consensus;
    如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
  4. 根据权利要求3所述的方法,所述合法性校验还包括:The method according to claim 3, said legality check further comprising:
    将所述交易中的所述目标账户的最新账户状态同步至所述区块链中不参与共识的其它节点设备处,以由所述其它节点设备基于密码学算法针对所述目标账户以及所述目标账户的最新账户状态进行计算得到密码学证明;Synchronize the latest account status of the target account in the transaction to other node devices in the blockchain that do not participate in the consensus, so that the other node devices can target the target account and the target account based on cryptographic algorithms. The latest account status of the target account is calculated to obtain cryptographic proof;
    获取所述其它节点设备计算出的所述密码学证明,并确定该密码学证明与所述交易中的密码学证明是否相同;Obtain the cryptographic proof calculated by the other node device, and determine whether the cryptographic proof is the same as the cryptographic proof in the transaction;
    如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
  5. 根据权利要求1所述的方法,执行所述交易,包括:The method of claim 1, performing said transaction comprising:
    基于所述目标账户的最新账户状态计算所述目标账户的更新后的账户状态;以及,calculating an updated account status of the target account based on the latest account status of the target account; and,
    基于所述更新后的账户状态和本地维护的与所述区块链账本对应的密码学承诺计算更新后的密码 学承诺;calculating an updated cryptographic commitment based on the updated account state and a locally maintained cryptographic commitment corresponding to the blockchain ledger;
    相应的,所述交易的执行结果包括所述更新后的账户状态和所述更新后的密码学承诺。Correspondingly, the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
  6. 根据权利要求5所述的方法,所述方法还包括:The method according to claim 5, said method further comprising:
    在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,基于所述更新后的密码学承诺对维护的所述密码学承诺进行更新。After reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the blockchain, the maintained cryptographic commitment is updated based on the updated cryptographic commitment.
  7. 根据权利要求2所述的方法,所述密码学算法包括Vector commitment算法;The method according to claim 2, the cryptographic algorithm comprises a Vector commitment algorithm;
    所述密码学承诺包括基于Vector commitment算法针对全量的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态进行密码学计算得到的承诺值;相应的,所述密码学证明包括基于Vector commitment算法针对全量的区块链账本中记录的所述目标账户以及所述目标账户对应的状态数据进行密码学计算得到的证明值。The cryptographic commitment includes the commitment value obtained by cryptographic calculation based on the Vector commitment algorithm for all blockchain accounts recorded in the full blockchain ledger and the account states corresponding to all blockchain accounts; correspondingly, The cryptographic proof includes a proof value obtained by cryptographically calculating the target account and the state data corresponding to the target account recorded in the full blockchain ledger based on the Vector commitment algorithm.
  8. 根据权利要求1所述的方法,所述区块链包括联盟链。The method of claim 1, said blockchain comprising a consortium chain.
  9. 一种基于区块链的交易验证装置,所述装置应用于区块链中参与共识的节点设备,所述区块链的区块链账本存储在所述区块链中不参与共识的节点设备处;所述装置包括:A block chain-based transaction verification device, the device is applied to a node device that participates in consensus in the block chain, and the block chain ledger of the block chain is stored in the node device that does not participate in the consensus in the block chain place; said device includes:
    接收单元,接收客户端发送的交易;其中,所述交易包括所述客户端从所述区块链中不参与共识的节点设备处获取的,用于证明与所述交易相关的目标账户和所述目标账户的状态数据包含在所述区块链的区块链账本中的密码学证明;The receiving unit receives the transaction sent by the client; wherein, the transaction includes that the client obtains from a node device in the block chain that does not participate in the consensus, and is used to prove the target account and the transaction related to the transaction. Cryptographic proof that the state data of the target account is included in the blockchain ledger of the blockchain;
    校验单元,针对所述交易进行合法性校验;其中,所述合法性校验包括基于密码学算法对所述密码学证明进行校验;A verification unit is configured to verify the legality of the transaction; wherein the legality verification includes verifying the cryptographic proof based on a cryptographic algorithm;
    处理单元,如果所述合法性校验通过,执行所述交易,并在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,将所述交易以及所述交易的执行结果发送至所述区块链中不参与共识的节点设备处,在所述区块链账本中进行存储。The processing unit, if the validity check is passed, executes the transaction, and after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain, transfers the transaction and the transaction The execution results are sent to the node devices in the blockchain that do not participate in the consensus, and stored in the blockchain ledger.
  10. 根据权利要求9所述的装置,所述参与共识的节点设备维护了与所述区块链账本对应的密码学承诺;其中,所述密码学承诺是对所述区块链的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态的真实性的承诺;According to the device according to claim 9, the node device participating in the consensus maintains a cryptographic commitment corresponding to the blockchain ledger; wherein, the cryptographic commitment is a blockchain ledger for the blockchain Commitment to the authenticity of all blockchain accounts recorded in and the account status corresponding to all blockchain accounts;
    所述基于密码学算法对所述密码学证明进行校验,包括:The verification of the cryptographic proof based on a cryptographic algorithm includes:
    基于密码学算法对所述密码学证明进行计算得到密码学承诺;Calculate the cryptographic proof based on a cryptographic algorithm to obtain a cryptographic commitment;
    确定计算出的密码学承诺,是否与所述参与共识的节点设备本地维护的与所述区块链账本对应的密码学承诺相同;Determine whether the calculated cryptographic commitment is the same as the cryptographic commitment corresponding to the blockchain account book locally maintained by the node device participating in the consensus;
    如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
  11. 根据权利要求10所述的装置,所述交易还包括所述客户端从所述区块链中不参与共识的节点设备处获取到的所述目标账户的最新账户状态;According to the device according to claim 10, the transaction further includes the latest account status of the target account obtained by the client from a node device that does not participate in the consensus in the blockchain;
    所述合法性校验还包括:The legality check also includes:
    校验所述目标账户对应的最新账户状态是否与所述区块链中不参与共识的其它节点设备维护的所述目标账户对应的最新账户状态是否相同;Verifying whether the latest account status corresponding to the target account is the same as the latest account status corresponding to the target account maintained by other node devices in the blockchain that do not participate in the consensus;
    如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
  12. 根据权利要求11所述的装置,所述合法性校验还包括:The device according to claim 11, said legality check further comprising:
    将所述交易中的所述目标账户的最新账户状态同步至所述区块链中不参与共识的其它节点设备处,以由所述其它节点设备基于密码学算法针对所述目标账户以及所述目标账户的最新账户状态进行计算得到密码学证明;Synchronize the latest account status of the target account in the transaction to other node devices in the blockchain that do not participate in the consensus, so that the other node devices can target the target account and the target account based on cryptographic algorithms. The latest account status of the target account is calculated to obtain cryptographic proof;
    获取所述其它节点设备计算出的所述密码学证明,并确定该密码学证明与所述交易中的密码学证明是否相同;Obtain the cryptographic proof calculated by the other node device, and determine whether the cryptographic proof is the same as the cryptographic proof in the transaction;
    如果相同,确定针对所述交易的合法性校验通过。If they are the same, it is determined that the legality verification for the transaction is passed.
  13. 根据权利要求9所述的装置,所述处理单元中的执行所述交易,包括:The apparatus according to claim 9, said execution of said transaction in said processing unit comprising:
    基于所述目标账户的最新账户状态计算所述目标账户的更新后的账户状态;以及,calculating an updated account status of the target account based on the latest account status of the target account; and,
    基于所述更新后的账户状态和本地维护的与所述区块链账本对应的密码学承诺计算更新后的密码学承诺;calculating an updated cryptographic commitment based on the updated account state and a locally maintained cryptographic commitment corresponding to the blockchain ledger;
    相应的,所述交易的执行结果包括所述更新后的账户状态和所述更新后的密码学承诺。Correspondingly, the execution result of the transaction includes the updated account status and the updated cryptographic commitment.
  14. 根据权利要求13所述的装置,所述装置还包括:The apparatus of claim 13, further comprising:
    更新单元,在与所述区块链中参与共识的其它节点对所述交易的执行结果达成共识之后,基于所述更新后的密码学承诺对维护的所述密码学承诺进行更新。The updating unit is configured to update the maintained cryptographic commitment based on the updated cryptographic commitment after reaching a consensus on the execution result of the transaction with other nodes participating in the consensus in the block chain.
  15. 根据权利要求10所述的装置,所述密码学算法包括Vector commitment算法;The device according to claim 10, said cryptographic algorithm comprising a Vector commitment algorithm;
    所述密码学承诺包括基于Vector commitment算法针对全量的区块链账本中记录的所有区块链账户以及与所述所有区块链账户对应的账户状态进行密码学计算得到的承诺值;相应的,所述密码学证明包括基于Vector commitment算法针对全量的区块链账本中记录的所述目标账户以及所述目标账户对应的状态数据进行密码学计算得到的证明值。The cryptographic commitment includes the commitment value obtained by cryptographic calculation based on the Vector commitment algorithm for all blockchain accounts recorded in the full blockchain ledger and the account states corresponding to all blockchain accounts; correspondingly, The cryptographic proof includes a proof value obtained by cryptographically calculating the target account and the state data corresponding to the target account recorded in the full blockchain ledger based on the Vector commitment algorithm.
  16. 根据权利要求9所述的装置,所述区块链包括联盟链。The apparatus of claim 9, the blockchain comprising a consortium chain.
  17. 一种电子设备,包括:An electronic device comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-8中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-8 by running the executable instruction.
PCT/CN2022/135627 2022-02-25 2022-11-30 Blockchain-based transaction verification method and apparatus, and electronic device WO2023160094A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210179227.1 2022-02-25
CN202210179227.1A CN114529415A (en) 2022-02-25 2022-02-25 Transaction verification method and device based on block chain and electronic equipment

Publications (1)

Publication Number Publication Date
WO2023160094A1 true WO2023160094A1 (en) 2023-08-31

Family

ID=81624409

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135627 WO2023160094A1 (en) 2022-02-25 2022-11-30 Blockchain-based transaction verification method and apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN114529415A (en)
WO (1) WO2023160094A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114529415A (en) * 2022-02-25 2022-05-24 蚂蚁区块链科技(上海)有限公司 Transaction verification method and device based on block chain and electronic equipment
CN115580412B (en) * 2022-11-24 2023-03-03 杭州蚂蚁酷爱科技有限公司 System, method and device for managing digital heritage based on block chain

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200145189A1 (en) * 2018-11-01 2020-05-07 International Business Machines Corporation Database encryption layer
CN112256800A (en) * 2020-12-21 2021-01-22 支付宝(杭州)信息技术有限公司 Vector commitment-based alliance link data processing method, device and equipment
CN114529415A (en) * 2022-02-25 2022-05-24 蚂蚁区块链科技(上海)有限公司 Transaction verification method and device based on block chain and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200145189A1 (en) * 2018-11-01 2020-05-07 International Business Machines Corporation Database encryption layer
CN112256800A (en) * 2020-12-21 2021-01-22 支付宝(杭州)信息技术有限公司 Vector commitment-based alliance link data processing method, device and equipment
CN114529415A (en) * 2022-02-25 2022-05-24 蚂蚁区块链科技(上海)有限公司 Transaction verification method and device based on block chain and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HUA LI: "Ethereum subverts Ethereum: introducing cryptography to achieve 2.0 performance breakthrough - Zhihu", 15 June 2020 (2020-06-15), XP093088532, Retrieved from the Internet <URL:https://zhuanlan.zhihu.com/P/148427643> *

Also Published As

Publication number Publication date
CN114529415A (en) 2022-05-24

Similar Documents

Publication Publication Date Title
TWI737944B (en) Block chain-based transaction execution method and device, and electronic equipment
WO2021017441A1 (en) Blockchain-based data authorization method and apparatus
US11398914B2 (en) Blockchain-based data authorization method and apparatus
EP3776437B1 (en) Blockchain-based asset transfer method and apparatus, and electronic device
TWI715892B (en) Block chain-based smart contract calling method and device, and electronic equipment
WO2021017444A1 (en) Blockchain-based data authorization method and device
WO2023160094A1 (en) Blockchain-based transaction verification method and apparatus, and electronic device
TWI746905B (en) Block chain-based smart contract calling method and device, and electronic equipment
WO2021017433A1 (en) Data authorization method and device employing smart contract
WO2021017436A1 (en) Blockchain state data synchronization method and apparatus, and electronic device
TWI759563B (en) Asset management method and device, electronic equipment
WO2020220760A1 (en) Blockchain-based payment withholding method and apparatus, electronic device and storage medium
US20200294143A1 (en) Transaction processing in a service blockchain
TWI724389B (en) Credit evaluation method and device, electronic equipment
WO2020220761A1 (en) Method and device for signing payment deduction agreement employing blockchain, and electronic apparatus.
EP3560143B1 (en) Data isolation in a blockchain network
Bozic et al. Securing virtual machine orchestration with blockchains
US11361054B2 (en) Blockchain-based infringement detection method, apparatus, and electronic device
WO2021017437A1 (en) Blockchain-based note verification method and apparatus, electronic device, and storage medium
WO2020220742A1 (en) Method and device for anchoring data on a block chain at a given time, and electronic device
US11429983B2 (en) Blockchain-based bill write-off method, apparatus, electronic device, and storage medium
TW202016819A (en) Block-chain transaction method and device and electronic device
WO2022077186A1 (en) Execution method and apparatus for smart contract in blockchain, and electronic device
WO2023160077A1 (en) Blockchain data recovery method and apparatus, and electronic device
US20200193430A1 (en) Determining generation time for blockchain data

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: 22928354

Country of ref document: EP

Kind code of ref document: A1