WO2020093809A1 - 一种区块链数据读取方法及装置 - Google Patents

一种区块链数据读取方法及装置 Download PDF

Info

Publication number
WO2020093809A1
WO2020093809A1 PCT/CN2019/108054 CN2019108054W WO2020093809A1 WO 2020093809 A1 WO2020093809 A1 WO 2020093809A1 CN 2019108054 W CN2019108054 W CN 2019108054W WO 2020093809 A1 WO2020093809 A1 WO 2020093809A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
data
blockchain
target
hash
Prior art date
Application number
PCT/CN2019/108054
Other languages
English (en)
French (fr)
Inventor
杨新颖
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Priority to SG11202100744VA priority Critical patent/SG11202100744VA/en
Priority to EP19882651.3A priority patent/EP3813296B1/en
Publication of WO2020093809A1 publication Critical patent/WO2020093809A1/zh
Priority to US17/162,760 priority patent/US11108547B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3821Electronic credentials
    • G06Q20/38215Use of certificates or encrypted proofs of transaction rights
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3263Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements
    • H04L9/3265Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements using certificate chains, trees or paths; Hierarchical trust model
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the embodiments of the present specification relate to the field of information technology, and in particular, to a blockchain data reading method and device.
  • Blockchain network is a decentralized distributed data storage system with multiple nodes participating. Once the data is written to the blockchain on each node, on the one hand, it means that the data is public on the entire network, on the other hand, the data written to the blockchain is also difficult to delete and tamper with. Based on this, blockchain technology has great application prospects in the field of data storage.
  • the embodiments of the present specification provide a blockchain data reading method and device.
  • the technical solution is as follows:
  • a method for querying transactions written to the blockchain For any transaction written to the blockchain, each node in the blockchain network has the record in advance The correspondence between the transaction ID of the transaction and the transaction storage location of the exchange in the blockchain, the method includes:
  • Any node in the blockchain network receives the data read request
  • the read data is the concealed data
  • the concealed data includes the corresponding to the target transaction identifier Transaction hash of the transaction
  • the operation of replacing the transaction corresponding to the target transaction identifier with the concealed data is executed by a node with transaction concealment authority in the blockchain network.
  • a blockchain data reading device is provided.
  • the device is any node in the blockchain network.
  • the block The correspondence between the transaction identifier of the transaction and the transaction storage location of the exchange in the blockchain is pre-recorded on each node in the chain network.
  • the device includes:
  • Receive module receive data read request
  • the determining module determines the transaction storage location corresponding to the target transaction identifier as the target transaction storage location according to the target transaction identifier included in the data reading request and the correspondence between the pre-recorded transaction identifier and the transaction storage location;
  • the reading module reads data from the target transaction storage location in the blockchain as the queried data
  • the read data is the concealed data
  • the concealed data includes the corresponding to the target transaction identifier Transaction hash of the transaction
  • the operation of replacing the transaction corresponding to the target transaction identifier with the concealed data is executed by a node with transaction concealment authority in the blockchain network.
  • a blockchain system including a blockchain network composed of multiple nodes; for any transaction written to the blockchain, each node in the blockchain network The correspondence between the transaction ID of the transaction and the transaction storage location of the exchange in the blockchain is recorded in advance;
  • Any node in the blockchain network receives a data read request; according to the target transaction ID contained in the data read request and the correspondence between the pre-recorded transaction ID and the transaction storage location, the target transaction ID is determined The corresponding transaction storage location is used as the target transaction storage location; data is read from the target transaction storage location in the blockchain;
  • the read data is the concealed data
  • the concealed data includes the corresponding to the target transaction identifier Transaction hash of the transaction
  • the operation of replacing the transaction corresponding to the target transaction identifier with the concealed data is executed by a node with transaction concealment authority in the blockchain network.
  • each node in the blockchain network can replace the transaction with the transaction hash of the transaction.
  • the transaction hash of the transaction is calculated using a one-way hash algorithm (ie, a hash algorithm) for the transaction.
  • the transaction hash of the transaction cannot be reversed to the transaction, so the transaction is replaced by the
  • the transaction hash of the transaction is equivalent to encrypting and concealing the plaintext content of the transaction published on the blockchain.
  • Figure 1 is a schematic diagram of the structure of the Merkel tree provided by this description
  • FIG. 2 is a schematic flowchart of a method for concealing transactions written in a blockchain provided by an embodiment of the present specification
  • FIG. 3 is a schematic diagram of a process of constructing hidden data provided by an embodiment of the present specification
  • FIG. 4 is a schematic diagram of another process of constructing hidden data provided by an embodiment of the present specification.
  • FIG. 5 is a schematic flowchart of a method for reading blockchain data provided by an embodiment of the present specification
  • FIG. 6 is a schematic flowchart of a method for constructing a Merkel tree provided by an embodiment of this specification
  • FIG. 8 is a schematic structural diagram of an apparatus for hiding transactions written in a blockchain provided by an embodiment of the present specification
  • FIG. 9 is a schematic structural diagram of an apparatus for hiding transactions written in a blockchain provided by an embodiment of this specification.
  • FIG. 10 is a schematic structural diagram of a blockchain data reading device provided by an embodiment of this specification.
  • FIG. 11 is a schematic structural diagram of an apparatus for constructing a Merkel tree provided by an embodiment of this specification.
  • FIG. 12 is a schematic structural diagram of a simple payment verification device provided by an embodiment of this specification.
  • FIG. 13 is a schematic structural diagram of a blockchain system provided by an embodiment of this specification.
  • FIG. 14 is a schematic structural diagram of a computer device for configuring an apparatus of an embodiment of this specification.
  • the transaction described in this specification refers to a piece of data that a user creates through a client of the blockchain and needs to be finally released to the distributed database of the blockchain.
  • a transaction is a data structure agreed in the blockchain protocol. To store a piece of data in the blockchain, it needs to be encapsulated into a transaction.
  • the narrow sense of the transaction refers to a value transfer issued by the user to the blockchain; for example, in the traditional Bitcoin blockchain network, the transaction can be a transfer initiated by the user in the blockchain.
  • the generalized transaction refers to a piece of business data with business intent published by the user to the blockchain; for example, the operator can build an alliance chain based on actual business needs, relying on the alliance chain to deploy some other types that have nothing to do with value transfer Online business (for example, rental business, vehicle scheduling business, insurance claims business, credit service, medical service, etc.), and in this type of alliance chain, the transaction can be a business with business intent issued by the user in the alliance chain Message or business request.
  • each block includes both the block header and the block body; each transaction in the block is stored in the block body and is constructed based on each transaction in the block
  • the root hash of the Merkle tree is stored in the block header.
  • there is no complete data backup in the light node blockchain that is, each block has only a block header and no block body.
  • simple payment verification refers broadly to verifying whether a transaction has been written to the blockchain for a certain transaction.
  • the principle of simple payment verification is that the light node requests the full node to verify whether a transaction (called a target transaction) has been written into the blockchain.
  • the full node will first locate the block where the target exchange is located (called the target area) Block), then construct a Merkle tree based on each transaction in the target block, and then determine the Merkel verification path corresponding to the target transaction, and associate the hash value associated with the Merkel path corresponding to the target transaction Return to the light node.
  • the light node will verify whether the Merkel path corresponding to the target transaction is correct based on the hash value returned by the full node, that is, calculate the root hash of the Merkel tree based on the transaction hash of the target transaction and the hash value returned by the full node , And determine whether the calculated root hash is consistent with the root hash in the block header of the target block stored by itself. If they are consistent, it is deemed that the verification has passed, proving that the target transaction has indeed been written into the blockchain.
  • the target transaction includes transaction 1.
  • the light node needs to verify whether transaction 1 is written into the blockchain. Therefore, the light node sends a request to any full node.
  • the full node first determines the target block and constructs the Merkle tree as shown in FIG. 1. Then, the full node will determine the hash value associated with the Merkel path corresponding to transaction 1 as Hash2, Hash10, Hash14, and return Hash2, Hash10, Hash14 to the light node.
  • the light node can calculate the root hash of the Merkel tree according to Hash1 (transaction hash of transaction 1), Hash2, Hash10, Hash14. Then, if the light node finds the calculated root hash and the area of the target block If the root hashes stored in the block header are consistent, it is determined that transaction 1 has indeed been written to the blockchain.
  • the full node usually needs to construct a Merkel tree based on each transaction in the target block.
  • the hash value associated with the Merkel path corresponding to the target transaction can be returned to the light node, thereby triggering simple payment verification for the target transaction.
  • This also means that if any one of transactions 1 to 8 is tampered with or deleted, the root hash of the Merkel tree (Hash 1-8) will change, which affects the accuracy of simple payment verification.
  • transaction 2 contains sensitive data. If transaction 2 is directly deleted from the blockchain, then when simple payment verification is required for any of transactions 1, transactions 3 to 8, due to In the absence of transaction 2, the Merkel tree can only be constructed based on transactions 1, transactions 3 to 8. Thus, the root hash of the constructed Merkel tree is inconsistent with the root hash stored in the block header of the target block. This caused an error in simple payment verification.
  • this specification can realize the concealment of a transaction in the blockchain on the premise that it does not interfere with the simple payment verification in the blockchain system.
  • the core technical means of this manual is to replace the transaction that needs to be hidden in the blockchain with the transaction hash of the transaction. In this way, it is possible to stop publishing the clear text of the transaction without interfering with the smooth operation of the simple payment verification system in the blockchain system.
  • FIG. 2 is a schematic flowchart of a method for concealing transactions written in a blockchain provided by an embodiment of the present specification, including the following steps:
  • the scenarios used in this manual are blockchain-based data certification scenarios.
  • the blockchain network including multiple nodes performs distributed certificate storage of data.
  • the transaction hiding authority may be granted to at least one node in the blockchain network.
  • a node with transaction hiding authority is called an execution node.
  • each node in the blockchain network may be an execution node.
  • the transaction identification of the transaction is used to uniquely identify the transaction.
  • the transaction identifier of the transaction may be a transaction hash obtained after hashing the transaction, or may be a unique number assigned to the transaction.
  • the target transaction identifier may be a transaction identifier of any transaction.
  • the execution node constructs a hidden instruction including the target transaction identifier, and broadcasts the hidden instruction to the blockchain network.
  • the node can specifically perform signature verification on the hidden instruction. If the signature verification is passed, it is confirmed that the hidden instruction is issued by the execution node, and the node needs to confirm The execution node does have transaction hiding authority. Then, the node will perform the transaction concealment operation.
  • the execution node may specifically encapsulate the concealment instruction into a transaction and submit it to the blockchain Webcast. In this way, each node in the blockchain network can write the hidden instruction encapsulated into a transaction into the blockchain.
  • the blockchain used for storing data certification transactions and the blockchain used for storing hidden instruction transactions may not be the same blockchain. In this way, for each node in the blockchain network, two blockchains need to be maintained on the node.
  • the node after receiving the concealment instruction, the node needs to construct the concealment data, and replace the transaction corresponding to the target transaction identifier with the constructed concealment data.
  • the hidden data includes the transaction hash of the transaction corresponding to the target transaction identifier.
  • the transaction hash of a transaction refers to the operation result obtained after performing a hash operation on the transaction.
  • each node may directly use the transaction hash as the hidden data. If the target transaction identifier is not the transaction hash of the corresponding transaction, then each node may first hash the transaction corresponding to the target transaction identifier to obtain a transaction hash, and then use the transaction hash as the Describe hidden data.
  • each node will replace the transaction corresponding to the target transaction identifier in the blockchain with the hidden data.
  • the so-called transaction storage location refers to the storage space or storage address used to store transactions in the blockchain. Assuming that N transactions are written in the blockchain (N is a natural number greater than 1), then there are also N transaction storage locations in the blockchain, which are used to store these N transactions.
  • each node can traverse each transaction in the blockchain according to the target transaction identifier to search for the transaction corresponding to the target transaction identifier, that is, locate the target transaction identifier The transaction storage location of the corresponding exchange. Subsequently, the transaction corresponding to the target transaction identifier is deleted from the located transaction storage location, and the transaction hash of the transaction corresponding to the target transaction identifier is stored in the located transaction storage location.
  • the transaction storage location of the exchange in the blockchain is generally the height of the block where the exchange is located (that is, the block number of the block in the blockchain) And the serial number of the transaction in the block.
  • the transaction storage location corresponding to transaction A may be (5, 10).
  • Each node in the blockchain network may determine the transaction storage location corresponding to the target transaction identifier as the target transaction according to the target transaction identifier contained in the concealed instruction and the correspondence between the pre-recorded transaction identifier and the transaction storage location Storage location; then, directly locate the target transaction storage location in the blockchain, and replace the transactions stored in the target transaction storage location in the blockchain with hidden data.
  • the concealed data may include more information in addition to the transaction hash of the transaction corresponding to the target transaction identifier.
  • FIG. 4 is a schematic diagram of another process of constructing hidden data provided by an embodiment of the present specification.
  • each node can obtain the transaction hash of the transaction corresponding to the target transaction identifier; stitch the pre-marked characters to the header of the transaction hash, and stitch the pre-marked characters To the end of the transaction hash, and stitch the remark information to the end of the post-mark character; then, stitch the pre-mark character, the transaction hash, the post-mark character, and the remark information The resulting data is determined as the concealed data.
  • front-marking characters and back-marking characters can be specified according to actual needs.
  • the front mark character may be "OE”
  • the rear mark character may be "OF”.
  • the remark information may specifically be information added for realizing a specific service.
  • the remark information may be "hidden", indicating that the transaction corresponding to the target transaction identifier has been hidden.
  • the remark information may prompt the user that the transaction is not visible.
  • the role of the above pre-marked characters is that when a node reads data for a transaction storage location, if the transaction at the transaction storage location has been replaced with hidden data, then it is equivalent to the The pre-marked characters in the concealed data reveal information to the node: "What is stored in the transaction storage location is not the plaintext content of the transaction, but the transaction hash.”
  • the role of the above-mentioned post-mark character is to distinguish the transaction hash in the concealed data from the comment information when the concealed data includes remark information, so as to distinguish the nodes.
  • the logic code corresponding to the transaction concealment operation performed by each node may be written into the firmware of each node in advance, or may be deployed in the form of a smart contract in advance Nodes.
  • FIG. 5 is a schematic flowchart of a method for reading blockchain data provided by an embodiment of the present specification, including the following steps:
  • S500 Any node in the blockchain network receives a data read request.
  • the data reading request may be sent by the user.
  • a transaction query request containing the transaction identifier of the transaction needs to be sent to any node in the blockchain network.
  • the transaction ID of any transaction that the user wants to query is called the target transaction ID.
  • S502 Determine the transaction storage location corresponding to the target transaction identifier as the target transaction storage location according to the target transaction identifier included in the data reading request and the correspondence between the pre-recorded transaction identifier and the transaction storage location.
  • each node in the blockchain network can pre-record the transaction identifier of the transaction and the exchange in the blockchain. Correspondence between transaction storage locations. In this way, the node can directly locate the transaction storage location in the blockchain that the user wants to query based on the target transaction identifier in the transaction query request.
  • S504 Read data from the target transaction storage location in the blockchain as the queried data.
  • the node After locating the target transaction storage location, the node can directly read data from the target transaction storage location, and then return the read data in response to the data read request.
  • the data read by the node is the hidden data. If the transaction corresponding to the target transaction identifier in the blockchain has not been replaced with concealed data, the data read by the node is the transaction corresponding to the target transaction identifier.
  • the node may return a prompt message for the data read request to indicate that the transaction corresponding to the target transaction identifier of the user has been replaced with hidden data. In this case, the node does not need to return the hidden data, but only returns a prompt message for explanation.
  • the node can return the remark information to the Scription user.
  • the node may not return hidden data to the user.
  • the remark information is "hidden", and after the remark information returned by the user node, it will be known that the transaction corresponding to the target transaction identifier has been hidden.
  • the Merkel tree shown in Figure 1 will be constructed based on the transactions in the block, and the Merkel will be calculated.
  • the root hash of the tree is written into the block header of the block.
  • the root hash of the Merkel tree constructed based on the transactions in the block will change, which is different from the block header.
  • 'S root hash is inconsistent. Because of this, the data in the blockchain is difficult to tamper with and delete.
  • the full node When the light node needs to use the full node for simple payment verification, the full node will determine the block of the exchange corresponding to the target transaction ID according to the target transaction ID provided by the light node, and build based on each transaction in the block Merkel tree. Then, based on the constructed Merkel tree, simple payment verification for the transaction corresponding to the target transaction identifier is triggered.
  • FIG. 6 is a schematic flowchart of a method for constructing a Merkel tree provided by an embodiment of this specification, including the following steps:
  • S600 The target full node reads data from the transaction storage location for each transaction storage location in the target block.
  • the target full node is any full node in the blockchain network
  • the target block is any block in the target full node's blockchain.
  • each transaction is stored in its own transaction storage location. If a transaction is replaced with stealth data, the stealth data is currently stored in the transaction storage location where the transaction was originally stored.
  • a target full node When a target full node needs to construct a Merkel tree corresponding to the target block, it will read data from each transaction storage location of the target block.
  • S602 Analyze the data read from the transaction storage location.
  • the target full node will analyze the data read from the transaction storage location for each transaction storage location to determine whether the data read from the transaction storage location is a transaction or a hidden data.
  • the target full node can then determine whether the data read from the transaction storage location is a transaction, and if it is not a transaction, it is hidden data.
  • the target full node can also determine whether the data read from the transaction storage location is concealed data, if it contains the pre-marked characters, it is concealed The data, if it does not contain pre-marked characters, is a transaction.
  • the transaction hash extracted from the hidden data is the transaction hash of the transaction originally stored in the transaction storage location.
  • the operation of replacing the originally stored transaction in the transaction storage location with the concealed data is instructed by a node with transaction concealment authority in the blockchain network to execute each node.
  • the target full node may specifically determine the data after the pre-marked characters in the concealed data Hash and extract transactions.
  • the target full node may specifically locate the pre-marked characters and the post-marked data in the concealed data
  • the data between the marked characters is determined as a transaction hash and extracted.
  • S608 Construct a Merkel tree corresponding to the target block based on the transaction hash corresponding to each transaction storage location in the target block.
  • S700 The target full node receives the verification request.
  • the target full node is any full node in the blockchain network.
  • the verification request may be specifically sent by any light node in the blockchain network.
  • S702 According to the verification request, determine the block where the exchange corresponding to the target transaction identifier is located in its own blockchain, and construct a Merkel tree corresponding to the block.
  • the target full node Before triggering a simple payment verification process for the transaction corresponding to the target transaction ID, the target full node needs to locate the block of the exchange corresponding to the target transaction ID, and based on the current The various transactions to construct the Merkel tree. It should be noted that, in step S702, the target full node constructs a Merkle tree based on the method shown in FIG. 5.
  • the target full node may determine the transaction storage location corresponding to the target transaction identifier as the target transaction storage location according to the target transaction identifier and the correspondence relationship between the pre-recorded transaction identifier and the transaction storage location; then, determine The block to which the target transaction storage location belongs serves as the block where the exchange corresponds to the target transaction identifier.
  • S704 Based on the constructed Merkel tree, trigger a simple payment verification SPV process for the transaction corresponding to the target transaction identifier.
  • the target full node can trigger a simple payment verification SPV process for the transaction corresponding to the target transaction identifier.
  • the target full node determines the Merkel verification path corresponding to the target transaction identifier according to the constructed Merkel tree, and returns the hash value associated with the Merkel path to the light node, so that The light node calculates the root hash of the Merkel tree according to the transaction hash of the transaction corresponding to the target transaction identifier and the hash value returned by the target full node, and compares the calculated root hash with the target The root hash in the block header of the block where the exchange corresponds to the transaction ID is compared. If they match, it is deemed to have passed verification, and if they are not consistent, it is deemed to have failed to pass verification.
  • FIG. 8 is a schematic structural diagram of a device for hiding transactions written in a blockchain provided by an embodiment of the present specification.
  • the device is a node in a blockchain network with transaction hiding authority.
  • the device includes:
  • the obtaining module 801 obtains the target transaction identifier
  • the execution module 802 constructs a hidden instruction containing the target transaction identifier, and broadcasts the hidden instruction to the blockchain network, so that each node in the blockchain network will divide the area according to the hidden instruction
  • the transactions corresponding to the target transaction identifier in the block chain are replaced with hidden data; the hidden data includes the transaction hash of the transaction corresponding to the target transaction identifier.
  • FIG. 9 is a schematic structural diagram of a device for hiding transactions written in a blockchain provided by an embodiment of the present specification.
  • the device is any node in a blockchain network.
  • the device includes:
  • the processing module 901 replaces the transaction corresponding to the target transaction identifier in the blockchain with the concealed data according to the concealment instruction; the concealed data includes the transaction hash of the transaction corresponding to the target transaction identifier;
  • the hiding instruction is constructed by the execution node according to the acquired target transaction identifier and broadcast to the blockchain network; the execution node is a node in the blockchain network with transaction hiding authority.
  • a blockchain system provided by an embodiment of this specification includes a blockchain network composed of multiple nodes
  • a node in the blockchain network with transaction hiding authority obtains a target transaction identifier; constructs a hidden instruction containing the target transaction identifier, and broadcasts the hidden instruction to the blockchain network;
  • Each node in the blockchain network replaces the transaction corresponding to the target transaction identifier in the blockchain with the concealed data according to the concealment instruction; the concealed data includes the correspondence of the target transaction identifier Transaction hash of the transaction.
  • FIG. 10 is a schematic structural diagram of a blockchain data reading device provided by an embodiment of the present specification.
  • the device is any node in the blockchain network.
  • the device For any transaction written to the blockchain, the device The correspondence between the transaction identifier of the transaction and the transaction storage location of the exchange in the blockchain is pre-recorded on each node in the blockchain network.
  • the device includes:
  • the receiving module 1001 receives the data reading request
  • the determining module 1002 determines the transaction storage location corresponding to the target transaction identifier as the target transaction storage location according to the target transaction identifier included in the data reading request and the correspondence between the pre-recorded transaction identifier and the transaction storage location;
  • the reading module 1003 reads data from the target transaction storage location in the blockchain as the queried data
  • the read data is the concealed data
  • the concealed data includes the corresponding to the target transaction identifier Transaction hash of the transaction
  • the operation of replacing the transaction corresponding to the target transaction identifier with the concealed data is executed by a node with transaction concealment authority in the blockchain network.
  • the concealed data is determined according to the data of the pre-marked character and the hash of the transaction, specifically including:
  • the concatenated data is determined by concatenating the pre-marked characters, the transaction hash, the post-marked characters, and the remark information.
  • the device also includes:
  • the prompting module 100 if the read data contains the pre-marked characters, then returns prompting information for the data reading request to indicate that the transaction corresponding to the target transaction identifier has been replaced with concealed data.
  • the device also includes:
  • the return module 1005 returns the read data in response to the data read request.
  • a blockchain system including a blockchain network composed of multiple nodes; for any transaction written to the blockchain, each node in the blockchain network pre-records the transaction ID and block of the transaction The correspondence between the transaction storage locations of the exchange in the chain;
  • Any node in the blockchain network receives a data read request; according to the target transaction ID contained in the data read request and the correspondence between the pre-recorded transaction ID and the transaction storage location, the target transaction ID is determined The corresponding transaction storage location is used as the target transaction storage location; data is read from the target transaction storage location in the blockchain;
  • the read data is the concealed data
  • the concealed data includes the corresponding to the target transaction identifier Transaction hash of the transaction
  • the operation of replacing the transaction corresponding to the target transaction identifier with the concealed data is executed by a node with transaction concealment authority in the blockchain network.
  • FIG. 11 is a schematic structural diagram of an apparatus for constructing a Merkel tree provided by an embodiment of the present specification.
  • the apparatus is any full node in a blockchain network.
  • the apparatus includes:
  • the reading module 1101 reads data from the transaction storage location for each transaction storage location in the target block; the target block is any block in the device's blockchain;
  • the analysis module 1102 analyzes the data read from the transaction storage location
  • the Merkel tree construction module 1104 constructs a Merkel tree corresponding to the target block based on the transaction hash corresponding to each transaction storage location in the target block.
  • the concealed data is determined according to the data of the pre-marked character and the hash of the transaction, specifically including:
  • the concatenated data is determined by concatenating the pre-marked characters, the transaction hash, the post-marked characters, and the remark information.
  • the analysis module 1102 determines that the data read from the transaction storage location is a transaction if the data read from the transaction storage location does not include the pre-mark character; if the data read from the transaction storage location includes all If the preceding mark character is described, it is determined that the data read from the transaction storage location is concealed data.
  • the transaction hash determination module 1103 determines and extracts the data after the pre-mark character in the concealed data as a transaction hash.
  • the transaction hash determination module 1103 determines and extracts the data between the front mark character and the back mark character in the concealed data as a transaction hash.
  • the device is any full node in a blockchain network.
  • the device includes:
  • the receiving module 1201 receives a verification request; the verification request includes a target transaction identifier;
  • the determination building module 1202 determines the block of the exchange corresponding to the target transaction identifier in its own blockchain according to the verification request, and constructs the Merkel tree corresponding to the block based on the foregoing method;
  • the triggering module 1203 based on the constructed Merkel tree, triggers a simple payment verification SPV process for the transaction corresponding to the target transaction identifier.
  • the correspondence between the transaction ID of the transaction and the transaction storage location of the exchange in the blockchain is pre-recorded on each node in the blockchain network;
  • the determination building module 1202 determines the transaction storage location corresponding to the target transaction identifier as the target transaction storage location according to the target transaction identifier and the correspondence relationship between the pre-recorded transaction identifier and the transaction storage location; and determines the target transaction The block to which the storage location belongs is the block where the exchange corresponds to the target transaction identifier.
  • a blockchain system including: a blockchain network composed of multiple nodes;
  • Any full node in the blockchain network reads data from the transaction storage location for each transaction storage location in the target block, the target block is in the target full node's blockchain Any of the blocks; analyze the data read from the transaction storage location; if it is determined that the data read from the transaction storage location is a transaction, then hash the transaction to obtain the transaction hash; if it is determined If the data read from the transaction storage location is hidden data, the transaction hash is extracted from the hidden data.
  • the transaction hash extracted from the hidden data is originally stored in the transaction storage location
  • the transaction hash of the transaction; the operation of replacing the transaction stored in the transaction storage location with the hidden data is executed by a node with transaction hiding authority in the blockchain network instructing each node; based on the target block
  • the transaction hashes corresponding to the storage locations of each transaction in the transaction construct a Merkel tree corresponding to the target block.
  • a blockchain system including: a blockchain network composed of multiple nodes;
  • Any full node in the blockchain network receives a verification request, and the verification request includes a target transaction identifier; according to the verification request, it is determined in its own blockchain that the exchange corresponding to the target transaction identifier is Based on the aforementioned method, the Merkel tree corresponding to the block is constructed; based on the constructed Merkel tree, a simple payment verification SPV process for the transaction corresponding to the target transaction identifier is triggered.
  • FIG. 13 is a schematic structural diagram of a blockchain system provided by an embodiment of this specification.
  • Embodiments of the present specification also provide a computer device, which includes at least a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the program to implement FIG. 2, 5-7 The function of the method shown.
  • the device may include: a processor 1410, a memory 1420, an input / output interface 1430, a communication interface 1440, and a bus 1450.
  • the processor 1410, the memory 1420, the input / output interface 1430, and the communication interface 1440 realize the communication connection between the devices within the device through the bus 1450.
  • the processor 1410 may be implemented by a general-purpose CPU (Central Processing Unit, central processing unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. Programs to implement the technical solutions provided by the embodiments of this specification.
  • the memory 1420 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory, random access memory), static storage devices, and dynamic storage devices.
  • the memory 1420 may store an operating system and other application programs. When the technical solutions provided by the embodiments of the present specification are implemented by software or firmware, related program codes are saved in the memory 1420 and called and executed by the processor 1410.
  • the input / output interface 1430 is used to connect input / output modules to realize information input and output.
  • the input / output / module can be configured as a component in the device (not shown in the figure), or can be externally connected to the device to provide corresponding functions.
  • the input device may include a keyboard, mouse, touch screen, microphone, various sensors, etc.
  • the output device may include a display, a speaker, a vibrator, an indicator light, and so on.
  • the communication interface 1440 is used to connect a communication module (not shown in the figure) to implement communication interaction between the device and other devices.
  • the communication module can realize communication through a wired method (such as USB, network cable, etc.), and can also realize communication through a wireless method (such as mobile network, WIFI, Bluetooth, etc.).
  • the bus 1450 includes a path for transferring information between various components of the device (eg, processor 1410, memory 1420, input / output interface 1430, and communication interface 1440).
  • the device may also include the necessary Other components.
  • the above-mentioned device may also include only the components necessary to implement the solutions of the embodiments of the present specification, rather than including all the components shown in the figures.
  • Embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the functions of the methods shown in FIGS. 2, 5-7.
  • Computer-readable media including permanent and non-permanent, removable and non-removable media, can store information by any method or technology.
  • the information may be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
  • computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
  • the system, method, module or unit explained in the above embodiments may be implemented by a computer chip or entity, or by a product with a certain function.
  • a typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email sending and receiving device, and a game control Desk, tablet computer, wearable device, or any combination of these devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Business, Economics & Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Theoretical Computer Science (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Power Engineering (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

公开了一种区块链数据读取方法及装置。如果写入区块链的某个交易是不宜公开的敏感数据,那么,区块链网络中的各节点可以将区块链中的该交易替换成该交易的交易哈希,使得当请求从区块链中读取包含敏感数据的交易时,区块链网络中的节点返回的数据不是交易的明文内容。

Description

一种区块链数据读取方法及装置 技术领域
本说明书实施例涉及信息技术领域,尤其涉及一种区块链数据读取方法及装置。
背景技术
区块链网络是一种去中心化的、由多个节点参与的分布式数据存储系统。数据一旦被写入每个节点上的区块链,一方面,意味着数据在全网公开,另一方面,写入区块链的数据也难以被删除与篡改。基于此,在数据存证领域,区块链技术具有很大的应用前景。
然而,在实际应用中,有些数据(本文称之为敏感数据)一旦被写入区块链,就会造成不可消除的危害后果。例如,张三对李四进行诽谤,并将诽谤言论的文本文件上传到区块链网络进行存证,导致该文本文件被写入区块链,区块链网络中的任一节点都可以从区块链中读取该文本文件,这相当于给李四的名誉造成不可消除的伤害。又如,A公司盗取B公司的商业机密,并将盗取的商业机密上传到区块链网络进行存证,导致该商业机密被写入区块链,区块链网络中的任一节点都可以从区块链中读取该商业机密,这相当于给B公司造成不可挽回的损失。
发明内容
为了解决敏感数据被写入区块链容易造成危害后果的问题,本说明书实施例提供一种区块链数据读取方法及装置,技术方案如下:
根据本说明书实施例的第1方面,提供一种对写入区块链的交易进行查询的方法,针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系,所述方法包括:
所述区块链网络中的任一节点接收数据读取请求;
根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;
从区块链中的所述目标交易存储位置读取数据;
其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读 取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
根据本说明书实施例的第2方面,提供一种区块链数据读取装置,所述装置为所述区块链网络中的任一节点,针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系,所述装置包括:
接收模块,接收数据读取请求;
确定模块,根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;
读取模块,从区块链中的所述目标交易存储位置读取数据,作为查询到的数据;
其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
根据本说明书实施例的第3方面,提供一种区块链系统,包括由多个节点组成的区块链网络;针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系;
所述区块链网络中的任一节点,接收数据读取请求;根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;从区块链中的所述目标交易存储位置读取数据;
其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
本说明书实施例所提供的技术方案,如果写入区块链的某个交易是不宜公开的敏感数据,那么,区块链网络中的各节点可以将该交易替换成该交易的交易哈希。一方面, 该交易的交易哈希是对该交易采用单向散列算法(即哈希算法)计算得到的,由该交易的交易哈希无法逆推出该交易,因此,将该交易替换成该交易的交易哈希,相当于将区块链中公示的该交易的明文内容加密后隐匿起来。另一方面,将该交易替换成该交易的交易哈希,并不会影响该交易所在区块对应的梅克尔树的稳定性,也就不会影响到针对其他交易(与该交易位于同一区块中的交易)的简单支付验证(Simplified Payment Verification,SPV)的准确性,从而保证了数据存证业务的正常运行。当请求从区块链中读取的交易包含有敏感数据时,区块链网络中的节点向用户返回的数据实际上并不是该交易的明文内容。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书实施例。
此外,本说明书实施例中的任一实施例并不需要达到上述的全部效果。
附图说明
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。
图1是本说明提供的梅克尔树的结构示意图;
图2是本说明书实施例提供的一种对写入区块链的交易进行隐匿的方法,的流程示意图;
图3是本说明书实施例提供的构造隐匿化数据的过程示意图;
图4是本说明书实施例提供的构造隐匿化数据的另一过程示意图;
图5是本说明书实施例提供的一种区块链数据读取方法的流程示意图;
图6是本说明书实施例提供的一种构建梅克尔树的方法的流程示意图;
图7是本说明书实施例提供的一种简单支付验证方法的流程示意图;
图8是本说明书实施例提供的一种对写入区块链的交易进行隐匿的装置的结构示意图;
图9本说明书实施例提供的一种对写入区块链的交易进行隐匿的装置的结构示意 图;
图10是本说明书实施例提供的一种区块链数据读取装置的结构示意图;
图11是本说明书实施例提供的一种构建梅克尔树的装置的结构示意图;
图12是本说明书实施例提供的一种简单支付验证装置的结构示意图;
图13是本说明书实施例提供的区块链系统的结构示意图;
图14是用于配置本说明书实施例装置的一种计算机设备的结构示意图。
具体实施方式
需要说明的是,在本说明书中所描述的交易(transaction),是指用户通过区块链的客户端创建,并需要最终发布至区块链的分布式数据库中的一笔数据。交易是区块链协议中所约定的一种数据结构,一笔数据要存入区块链,就需要被封装成交易。
区块链中的交易,存在狭义的交易以及广义的交易之分。狭义的交易是指用户向区块链发布的一笔价值转移;例如,在传统的比特币区块链网络中,交易可以是用户在区块链中发起的一笔转账。而广义的交易是指用户向区块链发布的一笔具有业务意图的业务数据;例如,运营方可以基于实际的业务需求搭建一个联盟链,依托于联盟链部署一些与价值转移无关的其它类型的在线业务(比如,租房业务、车辆调度业务、保险理赔业务、信用服务、医疗服务等),而在这类联盟链中,交易可以是用户在联盟链中发布的一笔具有业务意图的业务消息或者业务请求。
在基于区块链的数据存证场景下,交易一旦被写入区块链,就会被永久存证下来,不可被删除与篡改。然而,在实际应用中,如果写入区块链的交易后续被认定包含不宜公开的敏感数据,那么,如何使得写入区块链的敏感数据停止公开,就成为一个难以解决的技术问题。
假设将写入区块链的敏感交易(包含敏感数据的交易)直接删除,那么很容易导致基于区块链所运行的数据存证业务无法正常运行。原因具体为:
众所周知,考虑到有的节点的存储能力较弱,区块链网络中的节点存在全节点与轻节点之分。全节点的区块链中有完整的数据备份,即每个区块既包括区块头,也包括区块体;区块中的各交易存储于区块体中,基于区块中的各交易构建的梅克尔树的根哈希存储于区块头中。然而,轻节点的区块链中并没有完整的数据备份,即每个区块仅有 区块头,并没有区块体。
当用户向某个轻节点请求验证自己之前上传的数据是否已被写入区块链时,由于轻节点的区块链中的每个区块仅包括区块头,因此,轻节点需要借助于全节点,才能针对某个交易是否已被写入区块链进行验证,这就是所谓的简单支付验证SPV。
值得强调的是,在区块链技术领域,所谓简单支付验证,广义上是指针对某个交易,验证该交易是否已写入区块链。简单支付验证的原理是,轻节点向全节点请求验证某个交易(称为目标交易)是否已写入区块链,全节点首先会定位所述目标交易所在的区块(称为目标区块),然后基于目标区块中的各交易构建梅克尔树(Merkle trees),然后确定目标交易对应的梅克尔验证路径,并将目标交易对应的梅克尔路径所关联的哈希值返回给轻节点。轻节点会根据全节点返回的哈希值,验证目标交易对应的梅克尔路径是否正确,即根据目标交易的交易哈希与全节点返回的哈希值,计算梅克尔树的根哈希,并判断计算得到的根哈希与自身存储的目标区块的区块头中的根哈希是否一致,如果一致,就认定验证通过,证明目标交易确实已经被写入区块链中。
图1是本说明提供的梅克尔树的结构示意图。如图1所示,在梅克尔树中,各叶子节点与目标区块中存储的各交易一一对应。每个叶子节点上的哈希值是对相应的交易进行哈希运算得到的交易哈希。而针对每个父节点,该父节点上的哈希值是对该父节点的两个子节点上的哈希值进行哈希运算得到的。
假设目标交易包括交易1。轻节点需要验证交易1是否被写入区块链中。于是,轻节点向任一全节点发送请求,全节点首先会确定目标区块并构建出如图1所示的梅克尔树。然后,全节点会确定交易1对应的梅克尔路径所关联的哈希值为Hash2、Hash10、Hash14,并将Hash2、Hash10、Hash14返回给轻节点。轻节点根据Hash1(交易1的交易哈希)、Hash2、Hash10、Hash14,就可以计算得到梅克尔树的根哈希,然后,轻节点若发现计算得到的根哈希与目标区块的区块头中存储的根哈希一致,就认定交易1确实已经被写入区块链。
显然,在触发针对目标交易的简单支付验证之前,全节点通常需要基于目标区块中的各交易构建梅克尔树。这样,才能把目标交易对应的梅克尔路径所关联的哈希值返回给轻节点,从而触发针对目标交易的简单支付验证。这也意味着,交易1~交易8中的任一交易被篡改或被删除,梅克尔树的根哈希(即Hash1-8)就会发生改变,从而影响到简单支付验证的准确性。
例如,如图1所示,交易2包含敏感数据,如果直接将交易2从区块链中删除,那么,当需要针对交易1、交易3~8中的任一交易进行简单支付验证时,由于缺少交易2,只能基于交易1、交易3~8构建梅克尔树,如此,构建的梅克尔树的根哈希与目标区块的区块头中存储的根哈希是不一致的,会导致简单支付验证出错。
为此,本说明书可以在对区块链系统中的简单支付验证不构成干扰的前提下,实现了对区块链中某个交易的隐匿。本说明书的核心技术手段是将区块链中需要被隐匿的交易替换成该交易的交易哈希。如此,既可以停止公开该交易的明文内容,又不会干扰到区块链系统中的简单支付验证体系的平稳运行。
为了使本领域技术人员更好地理解本说明书实施例中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行详细地描述,显然,所描述的实施例仅仅是本说明书的一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于保护的范围。
以下结合附图,详细说明本说明书各实施例提供的技术方案。
图2是本说明书实施例提供的一种对写入区块链的交易进行隐匿的方法,的流程示意图,包括以下步骤:
S200:执行节点获取目标交易标识。
本说明书所应用的场景为基于区块链的数据存证场景。在此场景下,由包括多个节点的区块链网络对数据进行分布式存证。
在本说明书实施例中,可以将交易隐匿权限授予区块链网路中的至少一个节点。本文将具有交易隐匿权限的节点称为执行节点。进一步地,区块链网络中的每个节点都可以是执行节点。
在本说明书实施例中,交易的交易标识用于唯一标识交易。具体地,交易的交易标识可以是对交易进行哈希运算后得到的交易哈希,也可以是为交易分配的唯一编号。
在步骤S200中,所述目标交易标识可以是某个用户发送给执行节点的。该用户可以是上传敏感数据的用户,也可以是有权要求隐匿敏感数据的主体(如法院、受害人等)。也就是说,在需要隐匿敏感数据的场景下,所述目标交易标识可以是包含所述敏感数据的交易的交易标识。
当然,本方案不仅可以实现对敏感数据的隐匿,也可以实现对非敏感数据的隐匿。 因此,广义上讲,所述目标交易标识可以是任一交易的交易标识。
S202:所述执行节点构建包含所述目标交易标识的隐匿指令,并向所述区块链网络广播所述隐匿指令。
具体地,所述执行节点可以对所述隐匿指令进行签名,并向所述区块链网络广播签名后的所述隐匿指令。
S204:针对所述区块链网络中的每个节点,该节点根据所述隐匿指令,将区块链中对应于所述目标交易标识的交易替换成隐匿化数据。
针对区块链网络中的每个节点,该节点具体可以先对所述隐匿指令进行签名验证,若签名验证通过,则确认所述隐匿指令是所述执行节点发出的,并且,该节点需要确认所述执行节点确实具有交易隐匿权限。然后,该节点才会执行交易隐匿操作。
进一步地,在实际应用中,如果每次交易隐匿操作的记录也需要写入区块链进行存证,那么,所述执行节点具体可以将所述隐匿指令封装成交易并向所述区块链网络广播。这样,区块链网络中的每个节点可以将封装成交易的所述隐匿指令写入区块链。
此处需要说明,在本说明书实施例,用于存储数据存证交易的区块链与用于存储隐匿指令交易的区块链可以不是同一区块链。这样,针对所述区块链网络中的每个节点,该节点上需要维护两个区块链。
在本说明书实施例中,针对每个节点,该节点在接收到所述隐匿指令之后,需要构造隐匿化数据,并将所述目标交易标识对应的交易替换成构造的隐匿化数据。所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希。在本文中,交易的交易哈希是指,对交易进行一次哈希运算后得到的运算结果。
具体地,如果所述目标交易标识是相应的交易的交易哈希,那么,每个节点可以直接将所述交易哈希作为所述隐匿化数据。如果所述目标交易标识不是相应的交易的交易哈希,那么,每个节点可以先对所述目标交易标识对应的交易进行哈希运算,得到交易哈希,然后将所述交易哈希作为所述隐匿化数据。
随后,每个节点会将区块链中对应于所述目标交易标识的交易替换成隐匿化数据。
在本文中,所谓交易存储位置,是指区块链中,用于存储交易的存储空间或存储地址。假设区块链中写入了N个交易(N为大于1的自然数),那么,区块链中也同时有N个交易存储位置,分别用于存储这N个交易。
在本说明书实施例中,每个节点可以根据所述目标交易标识,在区块链中的各交易中进行遍历,以搜索所述目标交易标识对应的交易,也就是定位到所述目标交易标识对应的交易所在的交易存储位置。随后,从定位到的交易存储位置删除所述目标交易标识对应的交易,并向定位到的交易存储位置存入所述目标交易标识对应的交易的交易哈希。
进一步地,由于对于节点而言,根据目标交易标识在区块链中以遍历的方式定位交易效率较低,因此,在本说明书实施例中,每个节点可以预先针对写入区块链的任一交易,在区块链之外,另行记录该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系。
其中,针对写入区块链的任一交易,区块链中该交易所在的交易存储位置,一般是该交易所在的区块的高度(即区块链中区块的顺位号)以及该交易在区块中的顺位号。例如,打包有交易A的区块被写入到区块链中第4个区块之后,即打包有交易A的区块的高度是5,并且,交易A是区块中的第10个交易。因此,交易A对应的交易存储位置可以是(5,10)。
区块链网络中的每个节点可以根据所述隐匿指令中包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;然后,在区块链中直接定位到所述目标交易存储位置,并将区块链中存储于所述目标交易存储位置的交易替换成隐匿化数据。
此外,在本说明书实施例中,所述隐匿化数据除了包括所述目标交易标识对应的交易的交易哈希之外,还可以包括更多信息。
具体地,图3是本说明书实施例提供的构造隐匿化数据的过程示意图。每个节点在构造隐匿化数据时,可以获取所述目标交易标识对应的交易的交易哈希;将预设的前标记字符拼接到所述交易哈希的首部;根据所述前标记字符与所述交易哈希拼接成的数据,确定所述隐匿化数据。
进一步地,图4是本说明书实施例提供的构造隐匿化数据的另一过程示意图。每个节点在构造隐匿化数据时,可以获取所述目标交易标识对应的交易的交易哈希;将预设的前标记字符拼接到所述交易哈希的首部,将预设的后标记字符拼接到所述交易哈希的尾部,并且,将备注信息拼接到所述后标记字符的尾部;然后,将所述前标记字符、所述交易哈希、所述后标记字符以及所述备注信息拼接成的数据确定为所述隐匿化数据。
需要说明的是,上述的前标记字符与后标记字符可以根据实际需要进行指定。例如,所述前标记字符可以为“OE”,所述后标记字符可以为“OF”。
还需要说明的是,所述备注信息具体可以是为实现特定业务需要所添加的信息。例如,所述备注信息可以是“hidden”,表明所述目标交易标识对应的交易已经被隐匿。当用户查询所述目标交易标识对应的交易时,所述备注信息可以提示用户交易是不可见的。
值得强调的是,上述的前标记字符的作用是,当节点针对某个交易存储位置进行数据读取时,如果该交易存储位置的交易已经被替换成了隐匿化数据,那么,相当于所述隐匿化数据中的前标记字符向节点透露出信息:“该交易存储位置所存储的不是交易的明文内容,而是交易哈希”。此外,上述的后标记字符的作用是,当隐匿化数据中包括备注信息时,将隐匿化数据中的交易哈希与备注信息进行区隔,以便节点进行区分。
另外需要说明的是,在本说明书实施例中,每个节点执行的交易隐匿操作所对应的逻辑代码,可以预先被写入每个节点的固件中,也可以预先以智能合约的形式部署于每个节点上。
图5是本说明书实施例提供的一种区块链数据读取方法的流程示意图,包括如下步骤:
S500:所述区块链网络中的任一节点接收数据读取请求。
在图5所示的方法中,所述数据读取请求可以是用户发送的。当用户想要查询区块链中的某个交易时,需要将包含该交易的交易标识的交易查询请求发送给所述区块链网络中的任一节点。为了描述的方便,在对图5所示的方法的说明中,将用户想要查询的任一交易的交易标识称为目标交易标识。
S502:根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置。
如前文所述,在本说明书实施例中,针对写入区块链的任一交易,区块链网络中的各节点上可以预先记录该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系。如此,节点可以直接根据所述交易查询请求中的目标交易标识,定位到区块链中所述用户所要查询的交易存储位置。
S504:从区块链中的所述目标交易存储位置读取数据,作为查询到的数据。
节点在定位到目标交易存储位置之后,可以直接从目标交易存储位置读取数据,然后针对所述数据读取请求,返回读取到的数据。
其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则节点读取到的数据为隐匿化数据。若区块链中对应于所述目标交易标识的交易未已被替换成隐匿化数据,则节点读取到的数据为所述目标交易标识对应的交易。
显然,如果所述目标交易标识对应的交易因为包含有敏感数据已经被隐匿,那么,用户查询所述目标交易标识对应的交易时,节点返回给所述用户的实际上是隐匿化数据,用户并不能看到所述目标交易标识对应的交易的明文内容。
此外,如果隐匿化数据中不仅包括交易哈希,还包括前标记字符,那么,节点从所述目标交易存储位置读取隐匿化数据之后,可以分析出所述隐匿化数据中包含前标记字符,于是,节点可以针对所述数据读取请求,返回提示信息,以表明所述用户所述目标交易标识对应的交易已被替换成隐匿化数据。这种情况下,节点可以不返回隐匿化数据,仅返回一个提示信息进行说明即可。
或者,如果隐匿化数据中不仅包括交易哈希,还包括前标记字符、后标记字符与备注信息,节点从所述目标交易存储位置读取隐匿化数据之后,可以将所述备注信息返回给所述用户。这种情况下,节点也可以不向用户返回隐匿化数据。例如,所述备注信息是“hidden”,用户节点返回的备注信息后,就会得知所述目标交易标识对应的交易已经被隐匿。
此外,众所周知,针对区块链中的每个区块,在该区块被创设之初,会基于该区块中的各交易构建如图1所示的梅克尔树,并计算梅克尔树的根哈希,将根哈希写入该区块的区块头中。该区块被写入区块链之后,一旦该区块中的交易被篡改或删除,就会导致基于区块中的各交易构建的梅克尔树的根哈希发生变化,与区块头中的根哈希不一致。正是因为如此,区块链中的数据是难以篡改与删除的。
当轻节点需要借助全节点进行简单支付验证时,全节点会根据轻节点提供的目标交易标识,确定所述目标交易标识对应的交易所在的区块,并基于该区块中的各交易构建梅克尔树。随后,才会基于构建的梅克尔树触发针对所述目标交易标识对应的交易的简单支付验证。
然而,在本说明书实施例中,针对区块链中的任一区块,该区块中的某个交易可能被替换成了隐匿化数据,基于此,本说明书相应提供一种改进后的构建梅克尔树的方 法以及一种改进后的简单支付验证方法。
图6是本说明书实施例提供的一种构建梅克尔树的方法的流程示意图,包括如下步骤:
S600:目标全节点针对目标区块中的每个交易存储位置,从该交易存储位置读取数据。
在图6所示的方法中,所述目标全节点是是区块链网络中的任一全节点,所述目标区块是所述目标全节点的区块链中的任一区块。
在目标区块中,通常,每个交易都存储于各自的交易存储位置。如果某个交易被替换成了隐匿化数据,则原本存储该交易的交易存储位置当前存储的是该隐匿化数据。
目标全节点当需要构建所述目标区块对应的梅克尔树时,会从所述目标区块的每个交易存储位置读取数据。
S602:对从该交易存储位置读取的数据进行分析。
目标全节点会针对每个交易存储位置,对从该交易存储位置读取的数据进行分析,以判断从该交易存储位置读取的数据是交易还是隐匿化数据。
具体地,由于交易是区块链协议中约定的一种数据结构,因此,目标全节点可以据此判断从该交易存储位置读取的数据是否为交易,如果不是交易,则是隐匿化数据。
此外,如果隐匿化数据不仅包括交易哈希,还包括前标记字符,那么,目标全节点也可以判断从该交易存储位置读取的数据是否为隐匿化数据,如果包含前标记字符,就是隐匿化数据,如果不包含前标记字符,就是交易。
S604:若确定从该交易存储位置读取的数据为交易,则对读取的交易进行哈希计算,得到交易哈希。
S606:若确定从该交易存储位置读取的数据为隐匿化数据,则从所述隐匿化数据中提取交易哈希。
其中,从所述隐匿化数据中提取的交易哈希,是该交易存储位置原本存储的交易的交易哈希。将该交易存储位置原本存储的交易替换成所述隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
此处需要说明的是,如果所述隐匿化数据是由前标记字符与交易哈希拼接成的,那么,目标全节点具体可以将所述隐匿化数据中位于所述前标记字符之后的数据确定为 交易哈希并提取。
如果所述隐匿化数据是由前标记字符、交易哈希、后标记字符、备注信息拼接成的,那么,目标全节点具体可以将所述隐匿化数据中位于所述前标记字符与所述后标记字符之间的数据确定为交易哈希并提取。
S608:基于所述目标区块中各交易存储位置分别对应的交易哈希,构建所述目标区块对应的梅克尔树。
图7是本说明书实施例提供的一种简单支付验证方法的流程示意图,包括如下步骤:
S700:目标全节点接收验证请求。
所述目标全节点是区块链网络中的任一全节点。所述验证请求具体可以是所述区块链网络中的任一轻节点发送的。
S702:根据所述验证请求,在自身的区块链中确定所述目标交易标识对应的交易所在的区块,构建所述区块对应的梅克尔树。
一般而言,目标全节点在触发针对所述目标交易标识对应的交易的简单支付验证流程之前,需要先定位所述目标交易标识对应的交易所在的区块,并基于该区块中当前包括的各交易,构建梅克尔树。需要说明的是,在步骤S702中,目标全节点基于图5所示的方法构建梅克尔树。
在步骤S702中,目标全节点可以根据所述目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;然后,确定所述目标交易存储位置所属的区块,作为所述目标交易标识对应的交易所在的区块。
S704:基于构建的梅克尔树,触发针对所述目标交易标识对应的交易的简单支付验证SPV流程。
在构建梅克尔树之后,目标全节点就可以触发针对所述目标交易标识对应的交易的简单支付验证SPV流程。
具体地,目标全节点会根据构建的梅克尔树,确定所述目标交易标识对应交易的梅克尔验证路径,并将所述梅克尔路径所关联的哈希值返回给轻节点,以便所述轻节点根据所述目标交易标识对应的交易的交易哈希以及所述目标全节点返回的哈希值,计算 梅克尔树的根哈希,并将计算的根哈希与所述目标交易标识对应的交易所在的区块的区块头中的根哈希进行比对,如果一致,就认定通过验证,如果不一致,就认定未通过验证。
图8是本说明书实施例提供的一种对写入区块链的交易进行隐匿的装置的结构示意图,所述装置是区块链网络中具有交易隐匿权限的节点,所述装置包括:
获取模块801,获取目标交易标识;
执行模块802,构建包含所述目标交易标识的隐匿指令,并向所述区块链网络广播所述隐匿指令,以使所述区块链网络中的每个节点根据所述隐匿指令,将区块链中对应于所述目标交易标识的交易替换成隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希。
图9本说明书实施例提供的一种对写入区块链的交易进行隐匿的装置的结构示意图,所述装置是区块链网络中的任一节点,所述装置包括:
处理模块901,根据隐匿指令,将区块链中对应于所述目标交易标识的交易替换成隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;
其中,所述隐匿指令是执行节点根据获取的目标交易标识构建并向所述区块链网络广播的;所述执行节点是所述区块链网络中具有交易隐匿权限的节点。
本说明书实施例提供的一种区块链系统,包括由多个节点组成的区块链网络;
所述区块链网络中具有交易隐匿权限的节点,获取目标交易标识;构建包含所述目标交易标识的隐匿指令,并向所述区块链网络广播所述隐匿指令;
所述区块链网络中的每个节点,根据所述隐匿指令,将区块链中对应于所述目标交易标识的交易替换成隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希。
图10是本说明书实施例提供的一种区块链数据读取装置的结构示意图,所述装置为所述区块链网络中的任一节点,针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系,所述装置包括:
接收模块1001,接收数据读取请求;
确定模块1002,根据所述数据读取请求包含的目标交易标识以及预先记录的交易 标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;
读取模块1003,从区块链中的所述目标交易存储位置读取数据,作为查询到的数据;
其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
将所述目标交易标识对应的交易替换成隐匿化数据的操作如下:
获取所述目标交易标识对应的交易的交易哈希;
将预设的前标记字符拼接到所述交易哈希的首部;
根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据;
将所述目标交易标识对应的交易替换成隐匿化数据。
根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据,具体包括:
将预设的后标记字符拼接到所述交易哈希的尾部,并且,将备注信息拼接到所述后标记字符的尾部;
将所述前标记字符、所述交易哈希、所述后标记字符以及所述备注信息拼接成的数据确定为所述隐匿化数据。
所述装置还包括:
提示模块1004,若读取到的数据包含所述前标记字符,则针对所述数据读取请求,返回提示信息,以表明所述目标交易标识对应的交易已被替换成隐匿化数据。
所述装置还包括:
返回模块1005,针对所述数据读取请求,返回读取到的数据。
一种区块链系统,包括由多个节点组成的区块链网络;针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系;
所述区块链网络中的任一节点,接收数据读取请求;根据所述数据读取请求包含 的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;从区块链中的所述目标交易存储位置读取数据;
其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
图11是本说明书实施例提供的一种构建梅克尔树的装置的结构示意图,所述装置是区块链网络中的任一全节点,所述装置包括:
读取模块1101,针对目标区块中的每个交易存储位置,从该交易存储位置读取数据;所述目标区块是所述装置的区块链中的任一区块;
分析模块1102,对从该交易存储位置读取的数据进行分析;
交易哈希确定模块1103,若确定从该交易存储位置读取的数据为交易,则对所述交易进行哈希计算,得到交易哈希;若确定从该交易存储位置读取的数据为隐匿化数据,则从所述隐匿化数据中提取交易哈希;其中,从所述隐匿化数据中提取的交易哈希,是该交易存储位置原本存储的交易的交易哈希;将该交易存储位置存储的交易替换成所述隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的;
梅克尔树构建模块1104,基于所述目标区块中各交易存储位置分别对应的交易哈希,构建所述目标区块对应的梅克尔树。
将该交易存储位置存储的交易替换成所述隐匿化数据的操作如下:
获取该交易存储位置存储的交易的交易哈希;
将预设的前标记字符拼接到所述交易哈希的首部;
根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据;
将该交易存储位置存储的交易替换成所述隐匿化数据。
根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据,具体包括:
将预设的后标记字符拼接到所述交易哈希的尾部,并且,将备注信息拼接到所述后标记字符的尾部;
将所述前标记字符、所述交易哈希、所述后标记字符以及所述备注信息拼接成的数据确定为所述隐匿化数据。
所述分析模块1102,若从该交易存储位置读取的数据不包含所述前标记字符,则确定从该交易存储位置读取的数据为交易;若从该交易存储位置读取的数据包含所述前标记字符,则确定从该交易存储位置读取的数据为隐匿化数据。
所述交易哈希确定模块1103,将所述隐匿化数据中位于所述前标记字符之后的数据确定为交易哈希并提取。
所述交易哈希确定模块1103,将所述隐匿化数据中位于所述前标记字符与所述后标记字符之间的数据确定为交易哈希并提取。
图12是本说明书实施例提供的一种简单支付验证装置的结构示意图,所述装置是区块链网络中的任一全节点,所述装置包括:
接收模块1201,接收验证请求;所述验证请求包含目标交易标识;
确定构建模块1202,根据所述验证请求,在自身的区块链中确定所述目标交易标识对应的交易所在的区块,并基于前述方法构建所述区块对应的梅克尔树;
触发模块1203,基于构建的梅克尔树,触发针对所述目标交易标识对应的交易的简单支付验证SPV流程。
针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系;
所述确定构建模块1202,根据所述目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;确定所述目标交易存储位置所属的区块,作为所述目标交易标识对应的交易所在的区块。
一种区块链系统,包括:由多个节点组成的区块链网络;
所述区块链网络中的任一全节点,针对目标区块中的每个交易存储位置,从该交易存储位置读取数据,所述目标区块是所述目标全节点的区块链中的任一区块;对从该交易存储位置读取的数据进行分析;若确定从该交易存储位置读取的数据为交易,则对所述交易进行哈希计算,得到交易哈希;若确定从该交易存储位置读取的数据为隐匿化数据,则从所述隐匿化数据中提取交易哈希,其中,从所述隐匿化数据中提取的交易哈 希,是该交易存储位置原本存储的交易的交易哈希;将该交易存储位置存储的交易替换成所述隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的;基于所述目标区块中各交易存储位置分别对应的交易哈希,构建所述目标区块对应的梅克尔树。
一种区块链系统,包括:由多个节点组成的区块链网络;
所述区块链网络中的任一全节点,接收验证请求,所述验证请求包含目标交易标识;根据所述验证请求,在自身的区块链中确定所述目标交易标识对应的交易所在的区块,并基于前述方法构建所述区块对应的梅克尔树;基于构建的梅克尔树,触发针对所述目标交易标识对应的交易的简单支付验证SPV流程。
图13是本说明书实施例提供的区块链系统的结构示意图。
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现图2,5~7所示方法的功能。
图14示出了本说明书实施例所提供的一种更为具体的计算设备硬件结构示意图,该设备可以包括:处理器1410、存储器1420、输入/输出接口1430、通信接口1440和总线1450。其中处理器1410、存储器1420、输入/输出接口1430和通信接口1440通过总线1450实现彼此之间在设备内部的通信连接。
处理器1410可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。
存储器1420可以采用ROM(Read Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1420可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1420中,并由处理器1410来调用执行。
输入/输出接口1430用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包 括显示器、扬声器、振动器、指示灯等。
通信接口1440用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。
总线1450包括一通路,在设备的各个组件(例如处理器1410、存储器1420、输入/输出接口1430和通信接口1440)之间传输信息。
需要说明的是,尽管上述设备仅示出了处理器1410、存储器1420、输入/输出接口1430、通信接口1440以及总线1450,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现图2,5~7所示方法的功能。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本说明书实施例可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本说明书实施例各个实施例或者实施例的某些部分所述的方法。
上述实施例阐明的系统、方法、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式 可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于方法和设备实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的方法实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,在实施本说明书实施例方案时可以把各模块的功能在同一个或多个软件和/或硬件中实现。也可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上所述仅是本说明书实施例的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本说明书实施例原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本说明书实施例的保护范围。

Claims (12)

  1. 一种区块链数据读取方法,针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系,所述方法包括:
    所述区块链网络中的任一节点接收数据读取请求;
    根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;
    从区块链中的所述目标交易存储位置读取数据;
    其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
  2. 如权利要求1所述的方法,将所述目标交易标识对应的交易替换成隐匿化数据的操作如下:
    获取所述目标交易标识对应的交易的交易哈希;
    将预设的前标记字符拼接到所述交易哈希的首部;
    根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据;
    将所述目标交易标识对应的交易替换成隐匿化数据。
  3. 如权利要求2所述的方法,根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据,具体包括:
    将预设的后标记字符拼接到所述交易哈希的尾部,并且,将备注信息拼接到所述后标记字符的尾部;
    将所述前标记字符、所述交易哈希、所述后标记字符以及所述备注信息拼接成的数据确定为所述隐匿化数据。
  4. 如权利要求2或3所述的方法,所述方法还包括:
    若读取到的数据包含所述前标记字符,则针对所述数据读取请求,返回提示信息,以表明所述目标交易标识对应的交易已被替换成隐匿化数据。
  5. 如权利要求1所述的方法,所述方法还包括:
    针对所述数据读取请求,返回读取到的数据。
  6. 一种区块链数据读取装置,所述装置为所述区块链网络中的任一节点,针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链 中该交易所在的交易存储位置之间的对应关系,所述装置包括:
    接收模块,接收数据读取请求;
    确定模块,根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;
    读取模块,从区块链中的所述目标交易存储位置读取数据,作为查询到的数据;
    其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
  7. 如权利要求6所述的装置,将所述目标交易标识对应的交易替换成隐匿化数据的操作如下:
    获取所述目标交易标识对应的交易的交易哈希;
    将预设的前标记字符拼接到所述交易哈希的首部;
    根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据;
    将所述目标交易标识对应的交易替换成隐匿化数据。
  8. 如权利要求7所述的装置,根据所述前标记字符与所述交易哈希拼接成的数据,确定隐匿化数据,具体包括:
    将预设的后标记字符拼接到所述交易哈希的尾部,并且,将备注信息拼接到所述后标记字符的尾部;
    将所述前标记字符、所述交易哈希、所述后标记字符以及所述备注信息拼接成的数据确定为所述隐匿化数据。
  9. 如权利要求7或8所述的装置,所述装置还包括:
    提示模块,若读取到的数据包含所述前标记字符,则针对所述数据读取请求,返回提示信息,以表明所述目标交易标识对应的交易已被替换成隐匿化数据。
  10. 如权利要求6所述的装置,所述接收模块,接收用户发送的数据读取请求;
    所述装置还包括:
    返回模块,针对所述数据读取请求,返回读取到的数据。
  11. 一种区块链系统,包括由多个节点组成的区块链网络;针对写入区块链的任一交易,区块链网络中的各节点上预先记录有该交易的交易标识与区块链中该交易所在的交易存储位置之间的对应关系;
    所述区块链网络中的任一节点,接收数据读取请求;根据所述数据读取请求包含的目标交易标识以及预先记录的交易标识与交易存储位置的对应关系,确定所述目标交易标识对应的交易存储位置,作为目标交易存储位置;从区块链中的所述目标交易存储位置读取数据;
    其中,若区块链中对应于所述目标交易标识的交易已被替换成隐匿化数据,则读取到的数据为所述隐匿化数据;所述隐匿化数据包括所述目标交易标识对应的交易的交易哈希;将所述目标交易标识对应的交易替换成隐匿化数据的操作,是所述区块链网络中具有交易隐匿权限的节点指令各节点执行的。
  12. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求1~5任一项所述的方法。
PCT/CN2019/108054 2018-11-07 2019-09-26 一种区块链数据读取方法及装置 WO2020093809A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
SG11202100744VA SG11202100744VA (en) 2018-11-07 2019-09-26 Methods and apparatuses for reading blockchain data
EP19882651.3A EP3813296B1 (en) 2018-11-07 2019-09-26 Methods and apparatuses for reading blockchain data
US17/162,760 US11108547B2 (en) 2018-11-07 2021-01-29 Methods and apparatuses for reading blockchain data

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811320468.3 2018-11-07
CN201811320468.3A CN110011800B (zh) 2018-11-07 2018-11-07 一种区块链数据读取方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/162,760 Continuation US11108547B2 (en) 2018-11-07 2021-01-29 Methods and apparatuses for reading blockchain data

Publications (1)

Publication Number Publication Date
WO2020093809A1 true WO2020093809A1 (zh) 2020-05-14

Family

ID=67164906

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/108054 WO2020093809A1 (zh) 2018-11-07 2019-09-26 一种区块链数据读取方法及装置

Country Status (6)

Country Link
US (1) US11108547B2 (zh)
EP (1) EP3813296B1 (zh)
CN (1) CN110011800B (zh)
SG (1) SG11202100744VA (zh)
TW (1) TW202018620A (zh)
WO (1) WO2020093809A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110011800B (zh) * 2018-11-07 2020-04-14 阿里巴巴集团控股有限公司 一种区块链数据读取方法及装置
US11251966B2 (en) 2019-06-28 2022-02-15 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
CN110311790B (zh) * 2019-06-28 2020-07-28 阿里巴巴集团控股有限公司 一种跨链发送可认证消息的方法和装置
US11356282B2 (en) 2019-06-28 2022-06-07 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
CN111858602B (zh) * 2020-07-23 2023-04-21 浙江永旗区块链科技有限公司 区块链的数据读取更新方法及系统
CN114531260A (zh) * 2020-11-09 2022-05-24 腾讯科技(深圳)有限公司 基于联盟链系统的信息处理方法及相关设备
US11902426B2 (en) * 2021-06-26 2024-02-13 Ceremorphic, Inc. Efficient storage of blockchain in embedded device
CN113362068B (zh) * 2021-08-10 2022-03-29 北京连琪科技有限公司 一种轻节点验证区块链状态转移的方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016106752A1 (zh) * 2014-12-31 2016-07-07 深圳大学 一种共享数据的访问控制方法、装置及系统
CN106534085A (zh) * 2016-10-25 2017-03-22 杭州云象网络技术有限公司 一种基于区块链技术的隐私保护方法
CN107579958A (zh) * 2017-08-15 2018-01-12 中国联合网络通信集团有限公司 数据管理方法、装置及系统
CN110011800A (zh) * 2018-11-07 2019-07-12 阿里巴巴集团控股有限公司 一种区块链数据读取方法及装置
CN110046517A (zh) * 2018-11-07 2019-07-23 阿里巴巴集团控股有限公司 一种对写入区块链的交易进行隐匿的方法及装置

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9824031B1 (en) * 2016-10-28 2017-11-21 International Business Machines Corporation Efficient clearinghouse transactions with trusted and un-trusted entities
CN106991334B (zh) * 2016-11-24 2021-03-02 创新先进技术有限公司 一种数据存取的方法、系统及装置
CN107391292B (zh) * 2017-03-24 2020-09-15 北京瑞卓喜投科技发展有限公司 针对保持区块体数据实现勘误的区块链验证方法及系统
CN107239479B (zh) 2017-03-28 2020-03-13 创新先进技术有限公司 一种基于区块链的数据存储以及查询的方法及装置
CN107426170B (zh) * 2017-05-24 2019-08-09 阿里巴巴集团控股有限公司 一种基于区块链的数据处理方法及设备
CN107562775B (zh) * 2017-07-14 2020-04-24 创新先进技术有限公司 一种基于区块链的数据处理方法及设备
US10296248B2 (en) * 2017-09-01 2019-05-21 Accenture Global Solutions Limited Turn-control rewritable blockchain
US11455643B2 (en) * 2017-10-09 2022-09-27 Koninklijke Kpn N.V. Blockchain with transaction cancellation
WO2019075560A1 (en) * 2017-10-16 2019-04-25 Btl Group Ltd. METHOD AND SYSTEM FOR FACILITATING DATA TRANSFER BETWEEN BLOCK CHAINS
CN108171494A (zh) * 2017-11-23 2018-06-15 阿里巴巴集团控股有限公司 一种数据处理方法和装置
CN107918666B (zh) 2017-11-24 2020-05-12 中钞信用卡产业发展有限公司杭州区块链技术研究院 一种区块链上的数据同步方法和系统
CN108550038A (zh) * 2018-04-18 2018-09-18 杭州秘猿科技有限公司 一种应用于区块链的数据传播系统及方法
CN108646983B (zh) * 2018-05-08 2021-04-06 北京融链科技有限公司 在区块链上存储业务数据的处理方法和装置
US10747609B1 (en) * 2018-07-10 2020-08-18 Wells Fargo Bank, N.A. Systems and methods for blockchain repair assurance tokens

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016106752A1 (zh) * 2014-12-31 2016-07-07 深圳大学 一种共享数据的访问控制方法、装置及系统
CN106534085A (zh) * 2016-10-25 2017-03-22 杭州云象网络技术有限公司 一种基于区块链技术的隐私保护方法
CN107579958A (zh) * 2017-08-15 2018-01-12 中国联合网络通信集团有限公司 数据管理方法、装置及系统
CN110011800A (zh) * 2018-11-07 2019-07-12 阿里巴巴集团控股有限公司 一种区块链数据读取方法及装置
CN110046517A (zh) * 2018-11-07 2019-07-23 阿里巴巴集团控股有限公司 一种对写入区块链的交易进行隐匿的方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3813296A4 *

Also Published As

Publication number Publication date
EP3813296A1 (en) 2021-04-28
CN110011800A (zh) 2019-07-12
TW202018620A (zh) 2020-05-16
SG11202100744VA (en) 2021-02-25
US20210184837A1 (en) 2021-06-17
EP3813296B1 (en) 2023-06-14
EP3813296A4 (en) 2021-11-24
CN110011800B (zh) 2020-04-14
US11108547B2 (en) 2021-08-31

Similar Documents

Publication Publication Date Title
WO2020093808A1 (zh) 一种构建梅克尔树、简单支付验证方法及装置
WO2020093809A1 (zh) 一种区块链数据读取方法及装置
WO2020093807A1 (zh) 一种对写入区块链的交易进行隐匿的方法及装置
AU2019295815C1 (en) Blockchain-based data verification method and apparatus, and electronic device
JP6963006B2 (ja) データ保存、データチェック、及びデータ連結の方法及び装置
TW201937436A (zh) 基於區塊鏈的交易執行方法及裝置、電子設備
JP2020511017A (ja) ブロックチェーンベースのデジタル証明書を実装するためのシステム及び方法
WO2020134628A1 (zh) 一种基于区块链对结构化作品进行存证的方法及装置
WO2020125233A1 (zh) 字段更新方法及装置、电子设备
WO2021000578A1 (zh) 一种块链式账本中的用户创建方法、装置及设备
CN110347678B (zh) 一种金融数据的存储方法、系统、装置及设备
GB2592500A (en) Object storage for guaranteed content for backup and retention
CN110059088A (zh) 一种块链式账本中的数据属性标识方法、装置及设备
CN110059087B (zh) 一种块链式账本中的数据属性标识方法、装置及设备
CN110688664B (zh) 一种块链式账本中的权限管理方法、装置及设备
CN111444194B (zh) 一种块链式账本中索引的清除方法、装置及设备
CN110636042B (zh) 一种服务端已验证块高的更新方法、装置及设备
CN110009341B (zh) 一种对写入块链的交易进行隐匿的方法及装置
CN111783134B (zh) 一种对写入区块链的交易进行隐匿的方法及装置
CN112364010B (zh) 一种重要业务记录的存在性验证方法及装置
CN111444195B (zh) 一种块链式账本中索引的清除方法、装置及设备
CN112632055A (zh) 一种基于可信账本数据库的业务记录删除方法

Legal Events

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

Ref document number: 19882651

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019882651

Country of ref document: EP

Effective date: 20210120

NENP Non-entry into the national phase

Ref country code: DE