CN108961052B - Verification method, storage method, device, equipment and medium of block chain data - Google Patents

Verification method, storage method, device, equipment and medium of block chain data Download PDF

Info

Publication number
CN108961052B
CN108961052B CN201810662650.0A CN201810662650A CN108961052B CN 108961052 B CN108961052 B CN 108961052B CN 201810662650 A CN201810662650 A CN 201810662650A CN 108961052 B CN108961052 B CN 108961052B
Authority
CN
China
Prior art keywords
transaction
block
identifier
transaction identifier
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810662650.0A
Other languages
Chinese (zh)
Other versions
CN108961052A (en
Inventor
肖伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing Co Ltd
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 Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN201810662650.0A priority Critical patent/CN108961052B/en
Publication of CN108961052A publication Critical patent/CN108961052A/en
Application granted granted Critical
Publication of CN108961052B publication Critical patent/CN108961052B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

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

Abstract

The embodiment of the invention discloses a verification method, a storage method, a device, equipment and a medium of block chain data. The verification method of the block chain data comprises the following steps: initiating a transaction data acquisition request to a blockchain network node and receiving feedback transaction data; sending a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block; extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array; and verifying the transaction data according to the extracted basic transaction identification and the additional transaction identification. When the embodiment of the invention verifies the transaction data, the additional transaction identifier is introduced in consideration of the transaction data in different forms, so that the transaction data contents of a plurality of parts stored in the block chain can be verified, and the method is suitable for the conditions of the transaction data in different forms.

Description

Verification method, storage method, device, equipment and medium of block chain data
Technical Field
The embodiments of the present invention relate to a technology for processing blockchain data, and in particular, to a method, an apparatus, a device, and a medium for verifying blockchain data.
Background
One typical feature of the blockchain technology is that the blockchain network nodes are required to store complete blockchain data, which obviously has high requirements on hardware storage capacity of the nodes and is not suitable for devices with low hardware configuration. E.g. not suitable for the user terminal to directly act as a blockchain network node. Therefore, when a device such as a ue wants to participate in the blockchain network, it needs to acquire blockchain data from the blockchain network node.
Based on the problems faced by the above solutions, when block data or transaction data needs to be obtained, a request for obtaining data needs to be sent to other nodes in the blockchain network, and the other nodes feed back the block data or the transaction data. An important issue in this process is how to verify that the data fed back is correct.
The transaction requests processed by the current common blockchain network are readable field transaction requests in the form of a bitcoin (UTXO) and intelligent contracts in the form of code segments represented by an Ethernet (EVM), and the transaction requests in combination of the two forms also exist, so that a data verification method suitable for the transaction requests in various forms needs to be provided.
Disclosure of Invention
The embodiment of the invention provides a verification method, a storage method, a device, equipment and a medium of block chain data, which are used for realizing effective verification of block chain data in various forms.
In a first aspect, an embodiment of the present invention provides a method for verifying blockchain data, where the method includes:
initiating a transaction data acquisition request to a blockchain network node, and receiving feedback transaction data;
initiating a transaction identifier array acquisition request to a block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block;
extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array;
and verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
In a second aspect, an embodiment of the present invention further provides a method for storing blockchain data, where the method is applied to a blockchain generation node, and the method includes:
acquiring a transaction request in a block chain network;
generating transaction data according to the transaction request and adding the transaction data into the block;
generating a basic transaction identifier according to the transaction data added to the block;
operating the intelligent contract in the transaction request, and adding an operation result into the block;
generating an additional transaction identifier according to the intelligent contract operation result added into the block;
and storing the association of the basic transaction identifier and the additional transaction identifier into a transaction identifier array of the block.
In a third aspect, an embodiment of the present invention further provides an apparatus for verifying block chain data, where the apparatus includes:
the system comprises a transaction data acquisition module, a block chain network node and a feedback module, wherein the transaction data acquisition module is used for initiating a transaction data acquisition request to the block chain network node and receiving feedback transaction data;
the transaction identifier array acquisition module is used for initiating a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data and acquiring the transaction identifier array in the block;
the transaction identifier extraction module is used for extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array;
and the transaction data verification module is used for verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
In a fourth aspect, an embodiment of the present invention further provides an apparatus for storing blockchain data, where the apparatus is configured at a blockchain generation node, and the apparatus includes:
the transaction request acquisition module is used for acquiring transaction requests in the block chain network;
the transaction data generation module is used for generating transaction data according to the transaction request and adding the transaction data into the block;
the basic transaction identifier generating module is used for generating a basic transaction identifier according to the transaction data added into the block;
the operation result generation module is used for operating the intelligent contract in the transaction request and adding the operation result into the block;
the additional transaction identifier generating module is used for generating an additional transaction identifier according to the intelligent contract operation result added into the block;
and the transaction identifier association storage module is used for storing the basic transaction identifier and the additional transaction identifier into the transaction identifier array of the block in an associated manner.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement a method for verifying blockchain data according to an embodiment of the first aspect of the present invention.
In a sixth aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement a method for storing blockchain data according to an embodiment of the second aspect of the present invention.
In a seventh aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method for verifying blockchain data provided in the embodiment of the first aspect of the present invention is implemented.
In an eighth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for storing blockchain data provided in the embodiment of the second aspect of the present invention.
The embodiment of the invention initiates a transaction data acquisition request to the block chain network node and receives the feedback transaction data; sending a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block; extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array; and verifying the transaction data according to the extracted basic transaction identification and the additional transaction identification. When the technical scheme is adopted to verify the transaction data, the additional transaction identifier is introduced in consideration of the transaction data in different forms, so that the contents of the transaction data of a plurality of parts stored in the block chain can be verified, and the method is suitable for verifying the transaction data in different forms.
Drawings
Fig. 1 is a flowchart illustrating a method for verifying block chain data according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a verification method of block chain data according to a second embodiment of the present invention;
fig. 3 is a flowchart illustrating a verification method of block chain data according to a third embodiment of the present invention;
fig. 4 is a flowchart illustrating a method for storing blockchain data according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a verification apparatus for blockchain data according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a device for storing blockchain data according to a sixth embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to a seventh embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart illustrating a method for verifying blockchain data according to an embodiment of the present invention, where the method is applicable to a case where an electronic device obtains data from a blockchain network node and verifies the obtained blockchain data, and the method may be executed by a device for verifying blockchain data, where the device is implemented by software and/or hardware and is specifically configured in the electronic device, and the electronic device may be a regular node or a lightweight node in a blockchain network, or may be a non-blockchain network node.
The embodiment of the invention can be suitable for processing transaction data verification in various forms, and is particularly suitable for the condition that the content of the transaction data cannot be singly subjected to hash signature to form a transaction identifier. The following illustrates a form of transaction data in the form of a bitcoin (UTXO) in combination with an Ethernet (EVM) smart contract.
Depending on the needs of the transaction, a form occurs in which the transaction request in the form of a readable field is combined with the transaction request in the form of a code segment. For example, the intelligent contract code of the EVM is embedded in some field of the UTXO. When the transaction request is processed, on one hand, the field content is processed to form transaction data, and on the other hand, the intelligent contract is operated to generate an operation result of the intelligent contract. The results of the operation are typically stored with the transaction data in the block, but not stored together. And usually, transaction data is generated and added into the block, the transaction data is subjected to hash calculation to generate a transaction identifier, then an intelligent contract is operated, and the operation result is continuously stored in the block. Therefore, the content of the operation result cannot be embodied in the transaction identifier, so that the verification is difficult in the prior art.
The embodiment of the invention provides a solution for the condition that the transaction data has various forms and can not be uniformly verified by a single transaction identifier. The method for verifying the block chain data specifically comprises the following steps:
s110, initiating a transaction data acquisition request to the blockchain network node, and receiving the feedback transaction data.
The block chain is a chain data structure formed by combining data blocks in a sequential connection mode according to a time sequence, and is a distributed storage system which is not falsifiable and counterfeitable and is ensured in a cryptographic mode. The generation process of the transaction data stored in the block can be understood as follows: when a transaction request is sent to the block generation node, the block generation node processes the transaction request and generates transaction data to be stored in the block.
A blockchain network node may be understood as a hardware carrier with certain data processing capabilities that participates in the processes of generating, storing, and/or verifying each block included in a blockchain. An exemplary regional blockchain network node may be a server, a mobile terminal, or a cluster of servers, among other electronic devices.
For an electronic device in or outside the blockchain network, or a client carried in the electronic device, it may be necessary to acquire transaction data stored in the blockchain network node. At this time, a transaction data acquisition request may be initiated to any one or more of the blockchain network nodes, so as to receive the fed back transaction data.
Illustratively, initiating a transaction data fetch request to a blockchain network node may be: and initiating a transaction data acquisition request to a trusted node of the self so as to improve the credibility of the acquired transaction data. The trusted node may be a node with higher credit or a node that the electronic device contacts frequently.
Illustratively, initiating a transaction data acquisition request to a blockchain network node may also be: and broadcasting a transaction data acquisition request to the blockchain network, and feeding back corresponding transaction data after the node with storage capacity receives the transaction data acquisition request. Certainly, in order to improve the efficiency of acquiring the transaction data and save network resources, the electronic device may also initiate a transaction data acquisition request only to a set number of selected nodes with storage capability.
S120, initiating a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block.
It should be noted that the data structure of the block includes a block header and a block body. The block generation node stores the transaction data generated by the transaction requests in the block body; storing a basic transaction identifier obtained by Hash signature calculation based on transaction data in a transaction identifier array of a block header; and the block identifier determined by the root of the Meckel tree formed by two Hash signatures based on each basic transaction identifier is also correspondingly stored in the block header.
The corresponding block identifier may be determined according to the transaction identifier of the transaction data to be acquired, and then the transaction identifier array may be acquired based on the block identifier requirement. Alternatively, the transaction identifier may be directly provided, so as to query the corresponding block identifier in the block chain network.
When the transaction identification array is obtained, the block chain network node can directly feed back the array, or can feed back the block head or the whole block, and then the electronic equipment can extract the transaction identification array.
Namely, according to the block identifier corresponding to the transaction data, a block acquisition request is sent to a block chain network node, and a feedback block is received; and extracting a transaction identification array from the block.
S130, extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array.
The transaction identification array is used for storing transaction identifications which uniquely represent transaction data. The transaction identifier may include a basic transaction identifier used for characterizing transaction data, and may further include an additional transaction identifier used for characterizing a running result of the intelligent contract.
It should be noted that, at least one transaction data may be stored in the same block, so that at least one corresponding basic transaction identifier is stored; the intelligent contracts embedded in the same transaction data are at least one, or the operation result is at least one, so that the corresponding additional transaction identification is at least one.
Generally, the identification address of the transaction data that can be queried refers to the basic transaction identification, so that the association relationship between the basic transaction identification and the additional transaction identification can be embodied in a way of associating storage locations or establishing indexes, and thus, the transaction data can be conveniently extracted together.
S140, verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
When the block generation node processes the transaction request, on one hand, the transaction data is formed by processing the content of the field, and on the other hand, the operation result is generated by operating the intelligent contract. And the transaction data and the operation result are stored in different storage areas of the block. Therefore, the transaction data corresponding to the field content and the intelligent contract operation result need to be verified respectively, so that the complete verification of the transaction data in the block is realized.
The verification method of the transaction data corresponding to the field content may be: and if the inquired basic transaction identifier is the same as the basic transaction identifier contained in the transaction data acquisition request or the inquired basic transaction identifier is the same as the basic transaction identifier locally stored in the electronic equipment, determining that the transaction data acquired by the electronic equipment is correct.
The verification method of the transaction data corresponding to the field content may also be: and performing hash calculation on the fed back transaction data to determine a corresponding transaction identifier, and comparing the calculated transaction identifier with a basic transaction identifier for verification to determine the correctness of the transaction data. Specifically, if the calculated transaction identifier is consistent with the basic transaction identifier, it indicates that the transaction data acquired by the electronic device is correct.
The method for verifying the intelligent contract operation result can be as follows: and if the additional transaction identification is determined to exist, determining that an intelligent contract operation result corresponding to the transaction data exists in the block where the transaction data is located. At this time, it can be determined that the intelligent contract is executed in the blockchain network, and the successful storage of the additional transaction identifier indicates that the correctness of the operation result of the intelligent contract is verified by each network node in the blockchain network, so the electronic device can directly determine that the operation result of each intelligent contract is correct.
The method for verifying the intelligent contract operation result can also be as follows: re-operating each intelligent contract and obtaining a corresponding operation result; performing hash calculation on the operation result to determine a corresponding hash value; and comparing the calculated hash value with the additional transaction identifier for verification so as to determine the correctness of the intelligent contract operation result. Specifically, if the determined hash value is consistent with the extracted additional transaction identifier, it indicates that the intelligent contracts in the transaction data are executed and the running result is correct.
The electronic device can determine which verification mode is specifically adopted according to the verification degree of the block, the hardware condition of the electronic device and the participation degree of the block chain network. Preferably, the execution subject of the embodiment of the present invention is a block chain network lightweight node. Wherein the blockchain network lightweight node does not store or store a portion of the blockchain data and the transaction data. The partial block data stored by the block chain network lightweight node may include a transaction identifier located in a block header, and the like.
It should be noted that, the embodiment of the present invention is only exemplarily illustrated in a transaction request form in which the UTXO is combined with the EVM intelligent contract, and when the transaction data generated after the transaction request is processed by the block generation node includes two parts and the storage areas are different, the verification method of the embodiment of the present invention may be adopted to verify the transaction data. Illustratively, when the transaction request is in the form of an intelligent contract in the form of an EVM code segment, since the transaction data corresponding to the intelligent contract itself is also different from the operation result storage area of the intelligent contract, the transaction data can be verified by using the verification method of the embodiment of the present invention.
Preferably, the transaction data corresponds to a digital currency transaction bill in the form of readable fields, said transaction data including the smart contract in the form of code segments.
The embodiment of the invention initiates a transaction data acquisition request to the block chain network node and receives the feedback transaction data; sending a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block; extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array; and verifying the transaction data according to the extracted basic transaction identification and the additional transaction identification. When the technical scheme is adopted to verify the transaction data, the additional transaction identifier is introduced in consideration of the transaction data in different forms, so that the contents of the transaction data of a plurality of parts stored in the block chain can be verified, and the method is suitable for verifying the transaction data in different forms.
Example two
Fig. 2 is a flowchart illustrating a verification method of block chain data according to a second embodiment of the present invention. The embodiment of the invention carries out additional optimization on the basis of the technical scheme of each embodiment. Further, after the operation of verifying the transaction data according to the basic transaction identifier and the additional transaction identifier, additionally initiating a block acquisition request to a block chain network node according to a block identifier corresponding to the transaction data; and verifying the block according to the current block identifier and the previous block identifier which are locally obtained and the current block identifier and the previous block identifier of the feedback block so as to verify whether the block in which the transaction data is positioned is valid.
The method for verifying the blockchain data shown in fig. 2 specifically includes:
s210, initiating a transaction data acquisition request to the blockchain network node, and receiving the feedback transaction data.
The electronic equipment directly obtains a locally stored basic transaction identifier, or directly obtains the basic transaction identifier from a transaction initiator, or obtains the basic transaction identifier from other block chain network nodes; forming a transaction data acquisition request based on the basic transaction identifier and sending the transaction data acquisition request to the blockchain network node; and when the block chain network node receives the transaction data acquisition request, feeding back the transaction data corresponding to the basic transaction identifier to the electronic equipment.
S220, initiating a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block.
And S230, extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array.
S240, verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
And S250, initiating a block acquisition request to a block chain network node according to the block identifier corresponding to the transaction data.
The electronic device may initiate a block acquisition request to other blockchain network nodes according to the block identifier corresponding to the acquired transaction data, and when the corresponding blockchain network node receives the block acquisition request, feed back the block corresponding to the block identifier to the electronic device.
This step may be performed together with S220, that is, the block obtaining request is equivalent to a transaction id array obtaining request, and the transaction id array may be extracted from the obtained block.
S260, verifying the block according to the current block identifier and the previous block identifier which are locally obtained and the current block identifier and the previous block identifier of the feedback block.
The verification method for the block in the embodiment of the invention can be determined by a mathematical induction method:
1) the block identification block [0] of created block [0] is acknowledged as valid, so the block data of the created block of each network node in the default blockchain network is valid.
2) When a previous block identifier (blockid [0] stored in a first block [1] connected after a created block [0] in block chains obtained from other block chain network nodes is the same as the previous block identifier (blockid [0] locally stored in the electronic equipment, and the first block [1] obtained from other block chain nodes conforms to a common identification algorithm and the digital signature of the first block [1] is equal to the current block identifier (blockid [1] locally stored in the electronic equipment, the first block [1] of the other block chain network nodes obtained by the electronic equipment is valid.
3) Assuming that any block [ i ] in the block chain acquired by the electronic device is correct and valid, a previous block identifier block [ i ] stored in a next block [ i +1] acquired by the electronic device from other block chain network nodes is the same as a previous block identifier block [ i ] stored locally by the electronic device, and a next block [ i +1] acquired from other block chain network nodes conforms to a consensus algorithm and a digital signature of the next block [ i +1] is equal to a current block identifier block [ i +1] stored locally by the electronic device, it indicates that the next block [ i +1] of the other block chain network nodes acquired by the electronic device is valid.
The step of conclusively determining whether the verification block is valid may be: the electronic equipment acquires a current block identifier from the acquired block, compares the current block identifier with a locally stored current block identifier, and acquires a first comparison result; the electronic equipment acquires a previous block identifier from the acquired block and compares the previous block identifier with a locally stored previous block identifier to acquire a second comparison result; when the first comparison result is the same and the second comparison result is the same, it is indicated that the acquired block is valid.
It should be noted that, when a blockchain network node generates a block, a certain consensus algorithm is required to be followed to generate set data into the block, so as to indicate which generation node of the block is. Therefore, at the time of verification, it is necessary to verify not only the correctness of the block data by the current block id but also whether the block data is generated by the correct node based on the data added by the consensus algorithm.
According to the technical scheme of the embodiment of the invention, the validity of the data of the block in which the transaction data is located is further verified by adding the block verification step, so that the situation that the block stored by the acquired transaction data is rolled back, namely the received transaction data is not really stored in the block chain is prevented, and the reliability of the transaction data verification result is improved.
EXAMPLE III
Fig. 3 is a flowchart illustrating a verification method of block chain data according to a third embodiment of the present invention. The embodiment of the invention carries out subdivision optimization on the basis of the technical scheme of each embodiment. This embodiment takes an electronic device as a lightweight node as an example for explanation
Further, the operation of extracting the basic transaction identifier and the additional transaction identifier from the transaction identifier array is refined into the operation of searching the corresponding basic transaction identifier in the transaction identifier array based on the locally acquired basic transaction identifier and extracting the basic transaction identifier; and extracting the additional transaction identifier at the position associated with the basic transaction identifier from the transaction identifier array so as to perfect the extraction mode of the basic transaction identifier and the additional transaction identifier.
The method for verifying the blockchain data shown in fig. 3 specifically includes:
s310, initiating a transaction data acquisition request to the blockchain network node, and receiving the feedback transaction data.
The lightweight node directly acquires a locally stored basic transaction identifier and generates a transaction data acquisition request based on the basic transaction identifier; the lightweight node sends the transaction data acquisition request to the blockchain network node; and when the block chain network node receives the transaction data acquisition request, feeding back the transaction data corresponding to the basic transaction identifier to the lightweight node.
Preferably, the blockchain network node is one or more blockchain network nodes that the lightweight node can trust.
S320, initiating a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block.
The lightweight node can directly obtain the block identifier corresponding to the transaction identifier while obtaining the transaction identifier, or the lightweight node obtains the block identifier corresponding to the transaction data according to the fed back transaction data; the lightweight node forms a block acquisition request based on the block identifier and sends the block acquisition request to the blockchain network node; when the block chain network node receives the block acquisition request, feeding back a block corresponding to the block identifier to the lightweight node; the lightweight node receives the block and extracts the transaction identification array from the block header of the block.
The blockchain network node involved in S320 may be the same as or different from the blockchain network node involved in S310.
S331, searching a corresponding basic transaction identifier in the transaction identifier array based on the locally acquired basic transaction identifier, and extracting.
Because the lightweight node needs to use the basic transaction identifier as an acquisition basis when acquiring the transaction data from other blockchain network nodes, in order to facilitate the search and acquisition of the transaction data, each basic transaction identifier stored in the block header may be correspondingly stored in the transaction identifier array according to the storage sequence of each transaction data in the block. Correspondingly, the lightweight node searches the same basic transaction identifier in the transaction identifier array based on the locally acquired basic transaction identifier, and extracts the basic transaction identifier.
S332, extracting the additional transaction identifier in the position associated with the basic transaction identifier from the transaction identifier array.
It will be appreciated that in order to facilitate distinguishing between the results of the execution of the intelligent contract in each transaction datum, the additional transaction identity of each transaction datum will also be stored in association with the base transaction identity.
Illustratively, extracting the additional transaction identifier associated with the base transaction identifier from the transaction identifier array may be: extracting pending information at a position associated with the basic transaction identifier from the transaction identifier array; and determining the pending information as an additional transaction identifier based on the content of the preset bits of the pending information.
Since the basic transaction identifier and the additional transaction identifier are both obtained by compressing data into a hash character string composed of numbers and letters by using a hash algorithm, in order to distinguish the basic transaction identifier from the additional transaction identifier, the block generation node usually sets a corresponding preset bit when the additional transaction identifier is stored when the block generation node stores the additional transaction identifier. The preset bit may be a byte or a special bit.
Illustratively, extracting the additional transaction identifier at the associated position with the base transaction identifier from the transaction identifier array may further be: extracting additional transaction identifications of continuous positions of the storage space of the basic transaction identification from the transaction identification array; or additional transaction identifiers which are extracted from the transaction identifier array and have an index relationship with the storage position of the basic transaction identifier. When the additional transaction identifier having an index relationship with the basic transaction identifier is stored in the additional transaction identifier array, only one preset identifier may be set to represent that the transaction identifier stored in the array is the additional transaction identifier.
Preferably, the base transaction identifier and the additional transaction identifier are stored continuously. Therefore, when the basic transaction identifier is found in the transaction identifier array, the subsequent additional transaction identifier can be immediately obtained, the query efficiency is improved, and the required index data is reduced.
S340, verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
The embodiment of the invention further perfects the verification method of the block chain data by refining the extraction operation of the basic transaction identifier and the additional transaction identifier. By adopting the technical scheme, the transaction data contents of a plurality of parts stored in the block chain can be verified when the transaction data is verified, and the method is suitable for verifying the transaction data in different forms.
Example four
Fig. 4 is a flowchart illustrating a method for storing blockchain data according to a fourth embodiment of the present invention, where the method is applicable to a situation where a blockchain node responds to a transaction request and generates transaction data, and the method can be executed by a device for storing blockchain data, where the device is implemented by software and/or hardware and is specifically configured in an electronic device serving as a blockchain node.
The embodiment of the invention can be suitable for processing transaction data verification in various forms, and is particularly suitable for the condition that the content of the transaction data cannot be singly subjected to hash signature to form a transaction identifier. The following illustrates a form of transaction data in the form of a bitcoin (UTXO) in combination with an Ethernet (EVM) smart contract.
The method for storing blockchain data shown in fig. 4 specifically includes:
s410, acquiring a transaction request in the block chain network.
When a user needs to process a transaction, a transaction request is sent in the blockchain network. After each node in the blockchain network determines a block generation node based on a consensus mechanism, the block generation node acquires a transaction request in the blockchain network.
And S420, generating transaction data according to the transaction request and adding the transaction data into the block.
The block generation node processes the transaction request to generate transaction data and adds the generated transaction data to the block of the block.
S430, generating a basic transaction identifier according to the transaction data added to the block.
And the block generation node generates a corresponding basic transaction identifier by adopting Hash calculation according to the transaction data added into the block body, and the basic transaction identifier is used as a unique identifier of the transaction data, so that the transaction data can be conveniently searched and verified.
S440, operating the intelligent contract in the transaction request, and adding the operation result into the block.
And the block generation node runs the intelligent contract in the transaction request and adds the running result of the intelligent contract to the block.
And S450, generating an additional transaction identifier according to the intelligent contract operation result added into the block.
And the block generation node performs hash calculation on the intelligent contract operation result added into the block to generate an additional transaction identifier which is used as a verification basis for the intelligent contract operation result.
S460, storing the basic transaction identifier and the additional transaction identifier into the transaction identifier array of the block in an associated manner.
Although the operation result of the intelligent contract and the transaction data are stored in the block, the operation result and the transaction data are not stored together. The base transaction identification and the additional transaction identification are stored by the block generation node in association with the transaction identification array in the block header.
It should be noted that, after the block generation node generates the block or the transaction data, it is verified whether the generated block or the added transaction data is correct through other nodes in the blockchain network in a conventional manner. When the block is verified by other nodes in the blockchain network, other nodes in the blockchain network store or partially store the block generated by the block generation node locally. When the electronic device obtains the transaction data in the block from the blockchain network, the technical solution of the above embodiments of the present invention may be adopted to verify the blockchain data.
Since the basic transaction identifier and the additional transaction identifier are both obtained by compressing data into a hash character string composed of numbers and letters by using a hash algorithm, in order to distinguish the basic transaction identifier from the additional transaction identifier, the block generation node usually sets a corresponding preset bit when the additional transaction identifier is stored when the block generation node stores the additional transaction identifier. The preset bit may be a byte or a special bit. Wherein the preset bit may set at least one.
Illustratively, when the first preset bit of the transaction identifier is a preset character, the current transaction identifier is indicated as the additional transaction identifier. The second preset bit of the transaction identifier may also be set to be the number of the intelligent contracts embedded in the transaction data corresponding to the current transaction identifier. Illustratively, the third preset bit of the transaction identifier can also be set as the number of the current additional transaction identifier. Or when the basic transaction identifier and the additional transaction identifier are stored respectively, the pointer of the basic transaction identifier can be stored through the preset bit in the additional transaction identifier, so that which basic transaction identifier corresponds to can be determined through the preset bit of the additional transaction identifier.
The number of the transaction identification arrays contained in the block can be at least one.
For example, when only one transaction identification array exists in the block, the block generation node may sequentially store the additional transaction identifications corresponding to the operation result of the intelligent contract after or before the storage space of the basic transaction identification corresponding to the transaction data according to the embedding order of the intelligent contract in which the transaction data is embedded when generating and storing the transaction data. Preferably, the additional transaction identity is stored in a contiguous memory space after the corresponding base transaction identity storage location.
For example, when there are two transaction identification arrays in a block, the block generation node may store the base transaction identification in the base transaction identification array when generating the transaction data; and sequentially storing the corresponding additional transaction identifications in the additional transaction identification array according to the embedding sequence or the running sequence of the intelligent contract embedded by the transaction data. It should be noted that the additional transaction identifier array may individually set a preset bit for identifying the array for storing each additional transaction identifier.
For example, when there are two transaction identification arrays in a block, the block generation node may store the base transaction identification in the base transaction identification array when generating the transaction data; the storage positions of the additional transaction identifications corresponding to the basic transaction identification are sequentially added into the index array; the additional transaction identifies a storage space corresponding to each index value stored in the index array.
Illustratively, when at least three transaction identification arrays exist in the block, the block generation node may further store the basic transaction identification in the basic transaction identification array when generating and storing the transaction data; sequentially adding the storage positions of the additional transaction identifications corresponding to the basic transaction identification into the index array; corresponding additional transaction identifications can be sequentially stored in the additional transaction identification array; a new additional transaction identification array can be created for the transaction data; the additional transaction identifications associated with the transaction data are then sequentially stored in the created additional transaction identification array.
It should be noted that, in the embodiment of the present invention, an exemplary description is only given in a form of a transaction request in which an UTXO is combined with an EVM intelligent contract, and when the transaction data generated after the transaction request is processed by the block generation node includes two parts and the storage areas are different, an additional transaction identifier may be introduced by using the storage method of the embodiment of the present invention, so as to store the transaction data identifier in the partition areas. Illustratively, when the transaction request is in the form of an intelligent contract in the form of an EVM code segment, since the transaction data corresponding to the intelligent contract itself is also different from the operation result storage area of the intelligent contract, the storage method of the embodiment of the present invention may also be used to store the transaction data in the identified partition area.
In the embodiment of the invention, the transaction request in the block chain network is obtained through the block generating node, and the transaction data is generated according to the transaction request and added to the block; generating a basic transaction identifier according to the transaction data added to the block; operating an intelligent contract in the transaction data, adding an operation result into the block, and generating an additional transaction identifier according to the operation result of the intelligent contract; and storing the association of the basic transaction identification and the additional transaction identification into a transaction identification array of the block. When the technical scheme is adopted to store the transaction data, the additional transaction identifier is introduced in consideration of the transaction data in different forms, so that the contents of the transaction data stored in the block chain can be verified when the transaction data is verified, and the method is suitable for verifying the transaction data in different forms.
On the basis of the technical solutions of the foregoing embodiments, further, the associating and storing the basic transaction identifier and the additional transaction identifier in the transaction identifier array of the block includes:
continuously storing the basic transaction identifier and the additional transaction identifier into a transaction identifier array of the block, and setting a preset bit in the additional transaction identifier; or
And respectively storing the basic transaction identifier and the additional transaction identifier into the transaction identifier array of the block, and establishing an index relationship between the basic transaction identifier and the additional transaction identifier.
According to the technical scheme of the embodiment of the invention, the steps of storing the association of the basic transaction identifier and the additional transaction identifier are refined into continuous association storage and the preset position of the additional service identifier is set so as to effectively distinguish the transaction identifiers, or the association relation between the basic transaction identifier and the additional transaction identifier is determined by introducing the index, so that the additional transaction identifier is introduced when the block generation node stores the transaction data in consideration of the transaction data in different forms, and therefore, when the transaction data is verified, the contents of a plurality of parts of the transaction data stored in a block chain can be verified, and the method is suitable for the verification of the transaction data in different forms.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a device for verifying blockchain data according to a fifth embodiment of the present invention, where the embodiment of the present invention is applied to a case where an electronic device acquires data from other blockchain network nodes and verifies the acquired blockchain data, and the device is implemented by software and/or hardware and configured in the electronic device. The verification device of the block chain data comprises: a transaction data acquisition module 510, a transaction identification array acquisition module 520, a transaction identification extraction module 530, and a transaction data validation module 540.
The transaction data obtaining module 510 is configured to initiate a transaction data obtaining request to a blockchain network node, and receive feedback transaction data;
a transaction identifier array obtaining module 520, configured to initiate a transaction identifier array obtaining request to a block link network node according to a block identifier corresponding to the transaction data, and obtain a transaction identifier array in a block;
a transaction identifier extracting module 530, configured to extract a base transaction identifier and an additional transaction identifier from the transaction identifier array;
and the transaction data verification module 540 is configured to verify the transaction data according to the basic transaction identifier and the additional transaction identifier.
The embodiment of the invention initiates a transaction data acquisition request to the blockchain network node through a transaction data acquisition module and receives feedback transaction data; sending a transaction identifier array acquisition request to the blockchain network node according to the block identifier corresponding to the transaction data through a transaction identifier array acquisition module, and acquiring the transaction identifier array in the block; extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array through a transaction identifier extraction module; and verifying the transaction data according to the extracted basic transaction identifier and the additional transaction identifier by using a transaction data verification module. When the technical scheme is adopted to verify the transaction data, the additional transaction identifier is introduced in consideration of the transaction data in different forms, so that the contents of the transaction data of a plurality of parts stored in the block chain can be verified, and the method is suitable for the conditions of the transaction data in different forms.
Further, the transaction data extraction module 530 includes:
the basic transaction identifier extraction unit is used for searching a corresponding basic transaction identifier in the transaction identifier array based on the locally acquired basic transaction identifier and extracting the basic transaction identifier;
and the additional transaction identifier extraction unit is used for extracting the additional transaction identifier which is in the position associated with the basic transaction identifier from the transaction identifier array.
Further, the additional transaction identifier extracting unit is specifically configured to:
extracting pending information at a position associated with the basic transaction identifier from the transaction identifier array;
and determining the pending information as an additional transaction identifier based on the content of the preset bits of the pending information.
Further, the additional transaction identifier extracting unit is specifically configured to:
extracting additional transaction identifications of continuous positions of the storage space of the basic transaction identification from the transaction identification array; or
And extracting the additional transaction identifier which has an index relation with the storage position of the basic transaction identifier from the transaction identifier array.
Further, the transaction identification array obtaining module 520 includes:
the block acquisition unit is used for initiating a block acquisition request to a block chain network node according to the block identifier corresponding to the transaction data and receiving a feedback block;
and the transaction identification array extracting unit is used for extracting the transaction identification array from the block.
Further, the apparatus further comprises a block verification module, specifically configured to:
initiating a block acquisition request to a block chain network node according to the block identifier corresponding to the transaction data;
and verifying the block according to the current block identifier and the previous block identifier which are locally obtained, and the current block identifier and the previous block identifier of the feedback block.
Further, the transaction data validation module 540 includes:
the transaction data verification unit is used for performing hash calculation on the fed back transaction data to determine a corresponding transaction identifier, and comparing and verifying the calculated transaction identifier with a basic transaction identifier to determine the correctness of the transaction data;
and the operation result verification unit is used for determining that the intelligent contract operation result corresponding to the transaction data exists in the block where the transaction data exists when the additional transaction identifier exists.
Further, the transaction data corresponds to a digital currency transaction bill in the form of a readable field, the transaction data including a smart contract in the form of a code segment.
Further, the device is configured on a lightweight node of the block chain network, and the lightweight node does not store or store part of block data and transaction data, wherein the transaction data comprises intelligent contracts in the form of code segments.
The verification device for blockchain data provided by the embodiment of the invention can execute the verification method for blockchain data provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the verification method for blockchain data.
EXAMPLE six
Fig. 6 is a schematic structural diagram of a block chain data storage device according to a sixth embodiment of the present invention. The embodiment of the invention can be suitable for the condition that the block generation node responds to the transaction request and generates the transaction data to be correspondingly stored in the block, and the device is realized by software and/or hardware and is specifically configured in the electronic equipment as the block generation node. The block chain data storage device specifically comprises: the system comprises a transaction request acquisition module 610, a transaction data generation module 620, a basic transaction identifier generation module 630, an operation result generation module 640, an additional transaction identifier generation module 650 and a transaction identifier association storage module 660.
The transaction request obtaining module 610 is configured to obtain a transaction request in a blockchain network;
a transaction data generating module 620, configured to generate transaction data according to the transaction request, and add the transaction data to the block;
a basic transaction identifier generating module 630, configured to generate a basic transaction identifier according to the transaction data added to the block;
the operation result generation module 640 is used for operating the intelligent contract in the transaction request and adding the operation result into the block;
an additional transaction identifier generating module 650, configured to generate an additional transaction identifier according to the intelligent contract operation result added to the block;
and a transaction identifier association storage module 660, configured to store the base transaction identifier and the additional transaction identifier in association with each other in the transaction identifier array of the block.
In the embodiment of the invention, the transaction request in the block chain network is acquired through the transaction request acquisition module; generating transaction data according to the transaction request by a transaction data generation module and adding the transaction data into the block; generating a basic transaction identifier according to the transaction data added to the block through a basic transaction identifier generating module; running an intelligent contract in the transaction data through a running result generating module, and adding a running result to the block; generating an additional transaction identifier according to an intelligent contract operation result through an additional transaction identifier generating module; and storing the basic transaction identification and the additional transaction identification into a transaction identification array of the block in an associated manner through a transaction identification association storage module. When the technical scheme is adopted to store the transaction data, the additional transaction identifier is introduced in consideration of the transaction data in different forms, so that the contents of the transaction data stored in the block chain can be verified when the transaction data is verified, and the method is suitable for verifying the transaction data in different forms.
Further, the transaction identifier association storage module 660 is specifically configured to:
continuously storing the basic transaction identifier and the additional transaction identifier into a transaction identifier array of the block, and setting a preset bit in the additional transaction identifier; or
And respectively storing the basic transaction identifier and the additional transaction identifier into the transaction identifier array of the block, and establishing an index relationship between the basic transaction identifier and the additional transaction identifier.
The device for storing blockchain data provided by the embodiment of the invention can execute the method for storing blockchain data provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method for storing blockchain data.
EXAMPLE seven
Fig. 7 is a schematic diagram of a hardware structure of an electronic device according to a seventh embodiment of the present invention. FIG. 7 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in FIG. 7, electronic device 12 is embodied in the form of a general purpose computing device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 7, and commonly referred to as a "hard drive"). Although not shown in FIG. 7, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, to implement the verification method of the blockchain data provided by the embodiment of the present invention.
Example eight
The embodiment of the invention provides another electronic device, and the structural schematic diagram of the electronic device can also refer to fig. 7.
The embodiment of the invention is different from the seventh embodiment only in that: the processing unit 16 executes programs stored in the system memory 28 to execute various functional applications and data processing, for example, to implement the block chain data storage method provided by the embodiment of the present invention.
Example nine
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is used to execute a method for verifying blockchain data when executed by a processor, and the method includes: initiating a transaction data acquisition request to a blockchain network node, and receiving feedback transaction data; initiating a transaction identifier array acquisition request to a block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block; extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array; and verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
An embodiment ninth of the present invention further provides another computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a method for storing blockchain data provided in any embodiment of the present invention, where the method includes: acquiring a transaction request in a block chain network; generating transaction data according to the transaction request and adding the transaction data into the block; generating a basic transaction identifier according to the transaction data added to the block; operating the intelligent contract in the transaction request, and adding an operation result into the block; generating an additional transaction identifier according to the intelligent contract operation result added into the block; and storing the association of the basic transaction identifier and the additional transaction identifier into a transaction identifier array of the block.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (17)

1. A method for verifying blockchain data, comprising:
initiating a transaction data acquisition request to a blockchain network node, and receiving feedback transaction data;
initiating a transaction identifier array acquisition request to a block chain network node according to the block identifier corresponding to the transaction data, and acquiring the transaction identifier array in the block;
extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array; the basic transaction identification is used for characterizing the transaction data; the additional transaction identification is used for representing an intelligent contract running result of an intelligent contract embedded in the transaction data;
and verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
2. The method of claim 1, wherein extracting the base transaction identifier and the additional transaction identifier from the transaction identifier array comprises:
searching a corresponding basic transaction identifier in the transaction identifier array based on a locally acquired basic transaction identifier, and extracting;
and extracting the additional transaction identification which is in the relevant position with the basic transaction identification from the transaction identification array.
3. The method of claim 2, wherein extracting additional transaction identifiers from the transaction identifier array in association with the base transaction identifier comprises:
extracting pending information at a position associated with the basic transaction identifier from the transaction identifier array;
and determining the pending information as an additional transaction identifier based on the content of the preset bits of the pending information.
4. The method of claim 2, wherein extracting additional transaction identifiers from the transaction identifier array in association with the base transaction identifier comprises:
extracting additional transaction identifications of continuous positions of the storage space of the basic transaction identification from the transaction identification array; or
And extracting the additional transaction identifier which has an index relation with the storage position of the basic transaction identifier from the transaction identifier array.
5. The method of claim 1, wherein the initiating a transaction identifier array obtaining request to a blockchain network node according to a block identifier corresponding to the transaction data, and obtaining a transaction identifier array in a block comprises:
according to the block identification corresponding to the transaction data, a block acquisition request is sent to a block chain network node, and a feedback block is received;
and extracting a transaction identification array from the block.
6. The method of claim 1, further comprising:
initiating a block acquisition request to a block chain network node according to the block identifier corresponding to the transaction data;
and verifying the block according to the current block identifier and the previous block identifier which are locally obtained, and the current block identifier and the previous block identifier of the feedback block.
7. The method according to any of claims 1-6, wherein said validating said transaction data based on said base transaction identity and additional transaction identities comprises:
performing hash calculation on the fed back transaction data to determine a corresponding transaction identifier, and comparing the calculated transaction identifier with a basic transaction identifier for verification to determine the correctness of the transaction data;
and if the additional transaction identification is determined to exist, determining that an intelligent contract operation result corresponding to the transaction data exists in the block where the transaction data is located.
8. The method of claim 7, wherein: the transaction data corresponds to a digital currency transaction bill in the form of a readable field, the transaction data including a smart contract in the form of a code segment.
9. The method according to any one of claims 1 to 6, wherein: the execution body of the method is a block chain network lightweight node, and the lightweight node does not store or stores partial block data and transaction data.
10. A method for storing blockchain data, the method being applied to a block generation node, the method comprising:
acquiring a transaction request in a block chain network;
generating transaction data according to the transaction request and adding the transaction data into the block;
generating a basic transaction identifier according to the transaction data added to the block;
operating the intelligent contract in the transaction request, and adding an operation result into the block;
generating an additional transaction identifier according to the intelligent contract operation result added into the block;
and storing the association of the basic transaction identifier and the additional transaction identifier into a transaction identifier array of the block.
11. The method of claim 10, wherein storing the base transaction identifier and additional transaction identifier association in a transaction identifier array of the block comprises:
continuously storing the basic transaction identifier and the additional transaction identifier into a transaction identifier array of the block, and setting a preset bit in the additional transaction identifier; or
And respectively storing the basic transaction identifier and the additional transaction identifier into the transaction identifier array of the block, and establishing an index relationship between the basic transaction identifier and the additional transaction identifier.
12. An apparatus for verifying blockchain data, comprising:
the system comprises a transaction data acquisition module, a block chain network node and a feedback module, wherein the transaction data acquisition module is used for initiating a transaction data acquisition request to the block chain network node and receiving feedback transaction data;
the transaction identifier array acquisition module is used for initiating a transaction identifier array acquisition request to the block chain network node according to the block identifier corresponding to the transaction data and acquiring the transaction identifier array in the block;
the transaction identifier extraction module is used for extracting a basic transaction identifier and an additional transaction identifier from the transaction identifier array; the basic transaction identification is used for characterizing the transaction data; the additional transaction identification is used for representing an intelligent contract running result of an intelligent contract embedded in the transaction data;
and the transaction data verification module is used for verifying the transaction data according to the basic transaction identifier and the additional transaction identifier.
13. An apparatus for storing block chain data, configured at a block generation node, the apparatus comprising:
the transaction request acquisition module is used for acquiring transaction requests in the block chain network;
the transaction data generation module is used for generating transaction data according to the transaction request and adding the transaction data into the block;
the basic transaction identifier generating module is used for generating a basic transaction identifier according to the transaction data added into the block;
the operation result generation module is used for operating the intelligent contract in the transaction request and adding the operation result into the block;
the additional transaction identifier generating module is used for generating an additional transaction identifier according to the intelligent contract operation result added into the block;
and the transaction identifier association storage module is used for storing the basic transaction identifier and the additional transaction identifier into the transaction identifier array of the block in an associated manner.
14. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of verifying blockchain data as recited in any one of claims 1-9.
15. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of storing blockchain data as claimed in claim 10 or 11.
16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of verifying blockchain data according to any one of claims 1 to 9.
17. A computer-readable storage medium on which a computer program is stored, which, when being executed by a processor, implements a method of storing blockchain data according to claim 10 or 11.
CN201810662650.0A 2018-06-25 2018-06-25 Verification method, storage method, device, equipment and medium of block chain data Active CN108961052B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810662650.0A CN108961052B (en) 2018-06-25 2018-06-25 Verification method, storage method, device, equipment and medium of block chain data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810662650.0A CN108961052B (en) 2018-06-25 2018-06-25 Verification method, storage method, device, equipment and medium of block chain data

Publications (2)

Publication Number Publication Date
CN108961052A CN108961052A (en) 2018-12-07
CN108961052B true CN108961052B (en) 2022-02-22

Family

ID=64486489

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810662650.0A Active CN108961052B (en) 2018-06-25 2018-06-25 Verification method, storage method, device, equipment and medium of block chain data

Country Status (1)

Country Link
CN (1) CN108961052B (en)

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109493057A (en) * 2018-12-10 2019-03-19 联动优势科技有限公司 A kind of method of commerce and device based on UTXO model
CN109863521A (en) 2018-12-13 2019-06-07 阿里巴巴集团控股有限公司 Data isolation in block chain network
CN109710695B (en) * 2018-12-26 2021-10-08 百度在线网络技术(北京)有限公司 Transaction request validity identification and initiation method, device, equipment and medium
CN109766389B (en) * 2019-01-09 2020-09-22 华东师范大学 Block chain light client verification query method based on bitmap index
CN109858914A (en) * 2019-01-18 2019-06-07 深圳壹账通智能科技有限公司 Block chain data verification method, device, computer equipment and readable storage medium storing program for executing
CN109981750B (en) * 2019-03-06 2021-09-17 北京百度网讯科技有限公司 Business process system, business data processing method and device
CN111695991B (en) * 2019-03-14 2024-02-06 北京沃东天骏信息技术有限公司 Block-based contract processing method and device, block chain node and storage medium
US10917231B2 (en) 2019-04-04 2021-02-09 Advanced New Technologies Co., Ltd. Data storage method, apparatus, system and device
CN109981673B (en) * 2019-04-04 2021-10-08 上海人行道网络信息技术有限公司 Block chain-based data evidence storage method, device, equipment and storage medium
CN112487492B (en) * 2019-04-04 2023-11-17 创新先进技术有限公司 Data verification method, system and equipment
US11055277B2 (en) 2019-04-04 2021-07-06 Advanced New Technologies Co., Ltd. Integrity verification method, apparatus, and system and device for data in a blockchain-type ledger
CN110099108B (en) * 2019-04-26 2022-04-01 深圳前海微众银行股份有限公司 Block chain event duplicate removal method and device, computer equipment and storage medium
CN110310205B (en) * 2019-06-28 2022-02-25 百度在线网络技术(北京)有限公司 Block chain data monitoring method, device, equipment and medium
CN110363687A (en) * 2019-07-12 2019-10-22 百度在线网络技术(北京)有限公司 Recording method, device, electronic equipment, terminal and the medium of travel information
CN110457396A (en) * 2019-08-15 2019-11-15 北京北科融智云计算科技有限公司 One kind being based on block chain scientific data processing method, device, equipment and storage medium
CN110535970B (en) * 2019-09-16 2022-04-12 百度在线网络技术(北京)有限公司 Evidence storing and processing method, device, equipment and medium of judicial chain
CN110808839B (en) * 2019-10-30 2022-07-12 百度在线网络技术(北京)有限公司 Processing method, device, equipment and medium for block chain abnormal data
CN110781192B (en) * 2019-10-30 2021-11-30 支付宝(杭州)信息技术有限公司 Verification method, device and equipment of block chain data
CN111212126B (en) * 2019-12-27 2023-05-26 百度在线网络技术(北京)有限公司 Data transmission method, device, equipment and medium of block chain network
CN111339202B (en) * 2020-02-28 2023-05-09 百度在线网络技术(北京)有限公司 Data access method, device, equipment and storage medium
CN111339114B (en) * 2020-02-28 2023-05-09 百度在线网络技术(北京)有限公司 Data access method, device, equipment and storage medium
CN112560078B (en) * 2020-08-05 2024-05-17 北京京东振世信息技术有限公司 Block chain data processing method, device, equipment and medium
CN113935069B (en) * 2021-12-10 2022-04-05 北京百度网讯科技有限公司 Data verification method, device and equipment based on block chain and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104111957A (en) * 2013-04-22 2014-10-22 阿里巴巴集团控股有限公司 Method and system for synchronizing distributed transaction
CN106682984A (en) * 2016-10-27 2017-05-17 上海亿账通区块链科技有限公司 Block chain-based transaction business processing method and system
CN106951307A (en) * 2017-03-06 2017-07-14 钱德君 A kind of intelligent contract virtual machine realization method
CN107273556A (en) * 2017-08-23 2017-10-20 上海点融信息科技有限责任公司 Block chain data index method and equipment
CN107360238A (en) * 2017-07-25 2017-11-17 光载无限(北京)科技有限公司 Intelligent contract gateway based on block chain CPOW common recognition algorithms
CN107368259A (en) * 2017-05-25 2017-11-21 阿里巴巴集团控股有限公司 A kind of method and apparatus that business datum is write in the catenary system to block
CN107464117A (en) * 2017-08-04 2017-12-12 平安科技(深圳)有限公司 Data managing method and block catenary system based on block chain
CN107833060A (en) * 2017-11-13 2018-03-23 中国银行股份有限公司 The verification method and system of intelligent contract transaction in a kind of block chain
CN107886006A (en) * 2017-11-28 2018-04-06 北京博晨技术有限公司 Data manipulation method, device and electronic equipment
CN107977910A (en) * 2017-12-04 2018-05-01 四川长虹电器股份有限公司 A kind of educational background based on block chain signs and issues method and system
CN108122159A (en) * 2017-12-22 2018-06-05 中链科技有限公司 A kind of factoring information processing method and system based on block chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170213221A1 (en) * 2016-01-26 2017-07-27 Bank Of America Corporation System for tracking and validation of multiple instances of an entity in a process data network

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104111957A (en) * 2013-04-22 2014-10-22 阿里巴巴集团控股有限公司 Method and system for synchronizing distributed transaction
CN106682984A (en) * 2016-10-27 2017-05-17 上海亿账通区块链科技有限公司 Block chain-based transaction business processing method and system
CN106951307A (en) * 2017-03-06 2017-07-14 钱德君 A kind of intelligent contract virtual machine realization method
CN107368259A (en) * 2017-05-25 2017-11-21 阿里巴巴集团控股有限公司 A kind of method and apparatus that business datum is write in the catenary system to block
CN107360238A (en) * 2017-07-25 2017-11-17 光载无限(北京)科技有限公司 Intelligent contract gateway based on block chain CPOW common recognition algorithms
CN107464117A (en) * 2017-08-04 2017-12-12 平安科技(深圳)有限公司 Data managing method and block catenary system based on block chain
CN107273556A (en) * 2017-08-23 2017-10-20 上海点融信息科技有限责任公司 Block chain data index method and equipment
CN107833060A (en) * 2017-11-13 2018-03-23 中国银行股份有限公司 The verification method and system of intelligent contract transaction in a kind of block chain
CN107886006A (en) * 2017-11-28 2018-04-06 北京博晨技术有限公司 Data manipulation method, device and electronic equipment
CN107977910A (en) * 2017-12-04 2018-05-01 四川长虹电器股份有限公司 A kind of educational background based on block chain signs and issues method and system
CN108122159A (en) * 2017-12-22 2018-06-05 中链科技有限公司 A kind of factoring information processing method and system based on block chain

Also Published As

Publication number Publication date
CN108961052A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108961052B (en) Verification method, storage method, device, equipment and medium of block chain data
EP3678346B1 (en) Blockchain smart contract verification method and apparatus, and storage medium
US10747721B2 (en) File management/search system and file management/search method based on block chain
CN109361734B (en) Data processing method, device, equipment and medium for block chain
CN109040341B (en) Intelligent contract address generation method and device, computer equipment and readable storage medium
CN109241192B (en) Data modification and block verification method, device, equipment and medium for block chain
CN109361740B (en) Block generation method, device, equipment and medium of block chain
US10073916B2 (en) Method and system for facilitating terminal identifiers
CN111163182B (en) Block chain-based device registration method and apparatus, electronic device, and storage medium
CN108960797B (en) Block generation and verification method, device, equipment and storage medium
CN109213901B (en) Data synchronization method, device, equipment and medium of block chain
EP3767483A1 (en) Method, device, system, and server for image retrieval, and storage medium
CN109766707B (en) Data processing method, device, equipment and medium based on block chain
CN109101664B (en) Data transmission method, device, equipment and medium for lightweight node
CN109635256B (en) Method and device for verifying data
CN109002349B (en) Application program interaction method, implementation method, device, equipment and medium
CN110019873B (en) Face data processing method, device and equipment
CN111597567A (en) Data processing method, data processing device, node equipment and storage medium
CN109347803B (en) Data processing method, device, equipment and medium for block chain
CN110597922A (en) Data processing method, device, terminal and storage medium
CN109254999B (en) Data processing method, device, equipment and medium for block chain
CN109858285B (en) Block chain data processing method, device, equipment and medium
CN112559482A (en) Binary data classification processing method and system based on distribution
US8572231B2 (en) Variable-length nonce generation
CN110020040B (en) Method, device and system for querying data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant