CN108960797B - Block generation and verification method, device, equipment and storage medium - Google Patents

Block generation and verification method, device, equipment and storage medium Download PDF

Info

Publication number
CN108960797B
CN108960797B CN201810790428.9A CN201810790428A CN108960797B CN 108960797 B CN108960797 B CN 108960797B CN 201810790428 A CN201810790428 A CN 201810790428A CN 108960797 B CN108960797 B CN 108960797B
Authority
CN
China
Prior art keywords
block
transaction data
fee
identifier
signature identifier
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
CN201810790428.9A
Other languages
Chinese (zh)
Other versions
CN108960797A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201810790428.9A priority Critical patent/CN108960797B/en
Publication of CN108960797A publication Critical patent/CN108960797A/en
Application granted granted Critical
Publication of CN108960797B publication Critical patent/CN108960797B/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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/085Payment architectures involving remote charge determination or related payment systems
    • G06Q20/0855Payment architectures involving remote charge determination or related payment systems involving a third party
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • 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)
  • General Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Theoretical Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the invention discloses a block generation and verification method, a block generation and verification device, block generation and verification equipment and a storage medium, wherein the method comprises the following steps: acquiring and processing a first transaction request to obtain first transaction data, and generating a basic signature identifier of the first transaction data to be added to the block; determining the rollback cost according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback cost to a set account; processing the second transaction request to obtain second transaction data, and generating an additional signature identifier of the second transaction data to be added to the block; establishing association between the basic signature identifier and the additional signature identifier; and transmitting the block in the block chain network, and verifying the second transaction data by other nodes according to the associated signature identification. By adopting the technical scheme, the user can be prevented from bearing higher handling fee than actually required, meanwhile, a scheme for verifying the second transaction data is provided, and a fee payment scheme in the block chain network is optimized.

Description

Block generation and verification method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of block chains, in particular to a block generation and verification method, a block generation and verification device, block generation and verification equipment and a storage medium.
Background
In a block chain currently represented by UTXO (outstanding Transaction Output), a Transaction request is formed using a readable field. The user may fill in a transaction request with a charge amount that the block link point deducts from the user account after processing the transaction request.
For the case where the readable field transaction request has an intelligent contract code segment embedded therein, the block chain node runs the intelligent contract by calling the virtual machine. The virtual machine typically determines the workload according to the number of steps in operation, and thus the fee to be charged. It is seen that the fee charged for the smart contract is not predetermined. The running of smart contracts requires the consumption of a large amount of resources and therefore can be costly.
Under the existing model, if the fee amount filled by the user is larger than the fee amount required by the actual running of the intelligent contract, the intelligent contract can be smoothly executed. If the amount of the fee filled by the user is less than the amount of the fee required by the actual running of the intelligent contract, the intelligent contract is refused to be executed, and the amount of the fee filled by the user is deducted because the virtual machine is already running the intelligent contract, so that the loss is brought to the user.
In order to ensure the smooth operation of the intelligent contract, the user fills in a large fee amount, and although the intelligent contract can be ensured to be executed to a certain extent by the method, the user does not need to pay the large fee amount under all conditions, that is, the existing fee payment scheme is unreasonable.
Disclosure of Invention
The embodiment of the invention provides a block generation and verification method, a block generation and verification device, block generation and verification equipment and a storage medium, which are used for optimizing a charge payment scheme in a block chain network.
In a first aspect, an embodiment of the present invention provides a block generation method, which is applied to a block generation node, and the method includes:
acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier into a block;
determining a rollback fee according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback fee to a set account;
processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into a block;
establishing an incidence relation between the basic signature identifier and the additional signature identifier;
and transmitting the block in a block chain network to inform other nodes to verify second transaction data of the rollback expense according to the associated basic signature identification and additional signature identification.
In a second aspect, an embodiment of the present invention further provides a block verification method applied to a block chain network node, where the method includes:
receiving a block sent by a block generation node, and acquiring first transaction data in the block;
acquiring a basic signature identification of first transaction data from the block;
acquiring an associated additional signature identifier according to the basic signature identifier;
determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring rollback cost to a set account;
and verifying the second transaction data according to the first transaction data.
In a third aspect, an embodiment of the present invention further provides a block generation apparatus configured at a block generation node, where the apparatus includes:
the basic signature generation module is used for acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature of the first transaction data, and adding the basic signature to a block;
the second transaction request generation module is used for determining the rollback fee according to the processing of the first transaction request and generating a second transaction request for transferring the rollback fee to a set account;
an additional signature identifier generating module, configured to process the second transaction request, obtain second transaction data, generate an additional signature identifier of the second transaction data, and add the additional signature identifier to the block;
the incidence relation establishing module is used for establishing the incidence relation between the basic signature identifier and the additional signature identifier;
and the block transmission module is used for transmitting the block in a block chain network so as to inform other nodes of verifying the second transaction data of the rollback expense according to the associated basic signature identifier and the additional signature identifier.
In a fourth aspect, an embodiment of the present invention further provides a block verification apparatus configured at a blockchain network node, where the apparatus includes:
the first transaction data acquisition module is used for receiving the block sent by the block generation node and acquiring first transaction data in the block;
a basic signature identification obtaining module, configured to obtain a basic signature identification of the first transaction data from the block;
the additional signature identifier acquisition module is used for acquiring the associated additional signature identifier according to the basic signature identifier;
the second transaction data determining module is used for determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring the backspacing cost to a set account;
and the second transaction data verification module is used for verifying the second transaction data according to the first transaction data.
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 block generation method provided in the embodiments 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 block verification method provided in the second aspect of the present invention.
In a seventh aspect, an 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 a block generation method provided in the embodiment of the first aspect of the present invention.
In an eighth aspect, an 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 a block verification method provided in the embodiment of the second aspect of the present invention.
In the embodiment of the invention, a block generation node acquires and processes a first transaction request to obtain first transaction data and a corresponding basic signature identifier and then adds the first transaction data and the corresponding basic signature identifier to a block; determining the rollback fee according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback fee to the set account; processing the second transaction request to obtain second transaction data and a corresponding additional signature identifier, and then adding the second transaction data and the corresponding additional signature identifier to the block; establishing an incidence relation between the basic signature identifier and the additional signature identifier; the block is transmitted to the blockchain network to inform other nodes to verify the second transaction data of the fallback cost according to the associated signature. By adopting the technical scheme, a cost rollback mechanism is introduced in the block generation process, so that the situation that a user bears a higher commission than actually required can be avoided, meanwhile, other nodes can verify second transaction data of the rollback cost according to the basic signature identifier and the additional signature identifier with the incidence relation, and a cost payment scheme in the block chain network is optimized.
Drawings
Fig. 1 is a flowchart illustrating a block generation method according to a first embodiment of the present invention;
fig. 2 is a flowchart illustrating a block generating method according to a second embodiment of the present invention;
fig. 3 is a flowchart illustrating a block generation method according to a third embodiment of the present invention;
fig. 4 is a flowchart illustrating a block verification method according to a fourth embodiment of the present invention;
fig. 5 is a flowchart illustrating a block verification method according to a fifth embodiment of the present invention;
fig. 6 is a flowchart illustrating a block verification method according to a sixth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a block generation apparatus according to a seventh embodiment of the present invention;
fig. 8 is a schematic structural diagram of a block verification apparatus according to an eighth embodiment of the present invention;
fig. 9 is a schematic diagram of a hardware structure of an electronic device according to a ninth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting 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 block generation method according to a first embodiment of the present invention. The embodiment is suitable for the situation that when a block generation node in a block chain network processes a transaction request, the surplus charge paid by a user exceeding the handling charge required for processing the transaction request is returned. The blockchain network may be a public chain, a federation chain, or a private chain, and the blockchain network generally includes a plurality of nodes that obtain the block generation right to become the block generation node based on a consensus mechanism. The method may be performed by a block generating apparatus, where the apparatus is implemented by software and/or hardware and is specifically configured in a device bearing a block generating node, and for example, the device bearing the block generating node may be an electronic device such as a server, a mobile terminal, or a server cluster. The block generation method shown in fig. 1 is applied to a block generation node, and the method includes:
s110, acquiring and processing the first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier to the block.
The first transaction request may be a readable field transaction request in the form of UTXO, an intelligent contract in the form of a code segment represented by Ethernet (EVM), or a combination of the two forms, that is, a transaction request in which an intelligent contract is embedded in a readable field transaction request.
It should be noted that the data structure of the block includes a block header and a block body. When a block generation node acquires a first transaction request initiated by a user in a block chain network, processing the first transaction request to generate first transaction data, and storing the first transaction data into a block; and the block generation node calculates a basic signature identifier through a hash signature based on the first transaction data and stores the basic signature identifier into the block header.
And S120, determining the back-off cost according to the processing of the first transaction request, and generating a second transaction request for transferring the back-off cost to a set account.
The first transaction request comprises the charge amount filled by the user when the user initiates the first transaction request.
Wherein, determining the fallback cost according to the processing of the first transaction request may be: and the block generation node determines the handling charge actually required to be paid by the user according to at least one of the time, the resource occupation amount and the workload of processing the first transaction request, and further determines the backspacing charge according to the difference value between the filled charge amount and the determined handling charge.
And the block generation node generates a second transaction request which needs to transfer the rollback fee from the account of the block generation node to the set account according to the rollback fee, the account of the block generation node and the set account. Wherein the account is set as the account of the initiator of the first transaction request.
S130, processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into the block.
The block generation node processes the second transaction request generated by the block generation node, generates second transaction data and stores the second transaction data into a block body of the block; and the block generation node obtains an additional signature identifier through hash signature calculation based on the second transaction data, and adds the additional signature identifier into the block header of the block.
And S140, establishing an incidence relation between the basic signature identifier and the additional signature identifier.
By establishing the association relationship between the basic signature identifier and the additional signature identifier, the block generation node can acquire the corresponding additional signature identifier or the basic signature identifier according to the association relationship when other block chain network nodes acquire the basic signature identifier or the additional signature identifier.
S150, the block is transmitted in a block chain network to inform other nodes to verify second transaction data of the fallback cost according to the associated basic signature identifier and the associated additional signature identifier.
When the block generation node generates the block, the block is connected to a locally stored block chain, and then the block is transmitted to the block chain network, so that other nodes in the block chain network can verify the block data generated by the block generation node based on a consensus mechanism. The block data comprises first transaction data and second transaction data.
It should be noted that, after the block generation node generates the second transaction request, the block generation node may further transmit the second transaction request in the block chain network, and the receiving of the second transaction request sent by the block generation node and the verification of the second transaction data by the other nodes of the block may include: processing the received second transaction request to obtain transaction data, and comparing a transaction identifier obtained by the transaction data through Hash calculation with the additional signature identifier in the block; the validation of the second transaction data by the other node may further include: the amount of the fallback fee and/or the participant in the second transaction data is verified according to the first transaction data, and a specific verification method can be seen in an embodiment of a subsequent block verification method.
According to the embodiment of the invention, the first transaction request is acquired and processed through the block generation node, so that the first transaction data and the corresponding basic signature identification are added to the block; determining the rollback charge according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback charge to the set account; processing the second transaction request to obtain second transaction data and corresponding additional signature identification, and adding the second transaction data and the corresponding additional signature identification to the block; establishing an incidence relation between the basic signature identifier and the additional signature identifier; the block is transmitted to the blockchain network to inform other nodes to verify the second transaction data of the fallback cost according to the associated signature. By adopting the technical scheme, a cost rollback mechanism is introduced in the block generation process, so that the situation that a user bears a higher commission than actually required can be avoided, meanwhile, other nodes can verify second transaction data of the rollback cost according to the basic signature identifier and the additional signature identifier with the incidence relation, and a cost payment scheme in the block chain network is optimized.
Example two
Fig. 2 is a flowchart illustrating a block generation method according to a second embodiment of the present invention. The embodiment of the invention carries out subdivision optimization on the basis of the technical scheme of each embodiment.
Further, the first transaction request is embedded with an intelligent contract, and correspondingly, the characteristic "determining the rollback fee according to the processing of the first transaction request" is refined into "operating the intelligent contract, and the first fee amount required to be paid for operating the intelligent contract is determined; wherein the first transaction request includes a second fee amount; and if the first fee amount is less than the second fee amount, determining the difference value between the second fee amount and the first fee amount as the back-off fee so as to optimize a determination mechanism of the back-off fee, so that after the block is generated, the block chain network node can verify the amount of the back-off fee in the second transaction request.
Further, the feature "generating a second transaction request to transfer the fallback costs to the set account" is refined to "generating a second transaction request to transfer the fallback costs from the account of the block generation node to the account of the first transaction request initiator" to define the content of the second transaction request, so that after block generation, the block-chain network node can authenticate the participant of the fallback costs.
The block generating method shown in fig. 2 specifically includes:
s210, acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier to a block.
Wherein the first transaction request is a first transaction request embedded with an intelligent contract. Specifically, the first transaction request is a transaction request in the form of a readable field having at least one intelligent contract code embedded in at least one field.
It should be noted that, the block generation node obtains and processes the first transaction request, and the obtained first transaction data may be understood as transaction data formed by processing field contents, and generates the base signature identifier by performing hash calculation on the first transaction data.
S221, operating the intelligent contract, and determining a first fee amount required to be paid for operating the intelligent contract; wherein the first transaction request includes a second fee amount.
Wherein the second fee amount is the fee amount filled in the fee field of the first transaction request by the initiator of the first transaction request.
After the block generation node generates the first transaction data, operating each intelligent contract contained in the first transaction request according to a set sequence; determining the workload according to the steps executed by the virtual machine in the process of running all the intelligent contracts; and the block generation node determines the handling fee required to be paid by the first transaction request initiator as the first fee amount according to the workload.
Of course, the block generation node may also determine a workload for the number of steps executed by the virtual machine during the operation of each intelligent contract, determine the sub-fees that the user needs to pay when operating each intelligent contract according to the workloads, and calculate the sum of the sub-fees as the first fee amount.
It should be noted that, after the intelligent contracts are run, the running results of the intelligent contracts may also be stored in the block bodies of the blocks, and the running results are subjected to hash calculation respectively to generate corresponding running result signature identifiers, which are stored in the block headers.
S222, if the first fee amount is smaller than the second fee amount, determining that the difference value between the second fee amount and the first fee amount is the rollback fee.
And when the first expense amount is less than the second expense amount, indicating that the expense amount filled by the first transaction request initiator exceeds the payment amount required by the block generation node for processing the first transaction request initiated by the user. At this time, the block generation node determines the rollback fee according to the difference value between the first fee amount and the second fee amount; the block generation node returns the rollback fee to the user to ensure the reasonability of the fee paid by the user.
And S230, generating a second transaction request for transferring the rollback charge from the account of the block generation node to the account of the first transaction request initiator.
And the block generation node generates a second transaction request for transferring the rollback fee from the account of the block generation node to the account of the first transaction request initiator according to the rollback fee, the account of the block generation node and the account of the first transaction request initiator.
S240, processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into the block.
And the block generation node executes processing operation of transferring the amount of money equal to the return charge from the account of the block generation node to the account of the first transaction request initiator based on the amount to be transferred of the charge transfer-out account of the block generation node, the charge transfer-in account of the first transaction request initiator and the return charge contained in the second transaction request, and obtains second transaction data. And the block generation node performs hash calculation on the second transaction data to generate an additional signature identifier, and stores the additional signature identifier into a block header of the block.
And S250, establishing an association relation between the basic signature identifier and the additional signature identifier.
It should be noted that, when the block header further stores the operation result signature identifier of the intelligent contract, the block generation node may also establish an association relationship between the basic signature identifier and the operation result signature identifier when establishing an association relationship between the basic signature identifier and the additional signature identifier.
And S260, transmitting the block in a block chain network to inform other nodes to verify second transaction data of the rollback cost according to the associated basic signature identifier and additional signature identifier.
The embodiment of the invention determines the first fee amount by operating the intelligent contract, and determines the backspacing cost according to the difference value between the second fee amount and the first fee amount, so that after the block is generated, the block chain network node can verify the backspacing cost amount in the second transaction request; by defining the account of the blockchain network node and the account of the initiator of the first transaction request contained in the second transaction request, it is facilitated that after the creation of the block, the blockchain network node can authenticate the participant of the fallback cost.
EXAMPLE III
Fig. 3 is a schematic flow chart of a block generation method in the third embodiment of the present invention, and the third embodiment of the present invention performs subdivision optimization based on the technical solutions of the above embodiments.
Further, the feature "establishing the association relationship between the basic signature identifier and the additional signature identifier" is refined to "store the association between the basic signature identifier and the additional signature identifier in the identifier array in the block header of the block" so as to perfect the corresponding relationship between the basic signature identifier and the additional signature identifier.
The block generating method shown in fig. 3 specifically includes:
s310, acquiring and processing the first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier to the block.
S320, determining the rollback fee according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback fee to a set account.
Illustratively, determining a fallback cost from the processing of the first transaction request may be: running the intelligent contract in the first transaction request, and determining a first fee amount required to be paid by running the intelligent contract; wherein the first transaction request includes a second fee amount; and if the first fee amount is smaller than the second fee amount, determining the difference value between the second fee amount and the first fee amount as the backspacing fee.
For example, the second transaction request for transferring the rollback fee to the set account may be generated by: a second transaction request is generated to transfer a fallback charge from the account of the block generation node to the first transaction request initiator account.
S330, processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into the block.
And S340, storing the association of the basic signature identifier and the additional signature identifier in an identifier array in the block header of the block.
The basic signature identification and the additional signature identification are both data compressed into a hash character string formed by combining numbers and letters by adopting a hash algorithm. Therefore, in order to distinguish the base signature identifier from the attached signature identifier, the block generation node sets a preset bit when storing the attached signature identifier or the base signature identifier. The preset bit may be a byte or a special bit. Illustratively, when the preset bit of the signature identifier is a preset character, it indicates that the current signature identifier is the additional signature identifier. The associating and storing the base signature identifier and the additional signature identifier in an identifier array in the block header of the block may be: and storing the basic signature identifier and the additional signature identifier in an identifier array in the block head of the block according to a set position relationship.
Illustratively, when an identifier array exists in the block, the block generation node stores the additional signature identifier directly to a continuous storage space before or after the storage location of the corresponding basic signature identifier after generating the additional signature identifier. Preferably, the additional signature identifications are stored in a contiguous memory space after the corresponding base signature identification memory location. Wherein, those skilled in the art can set corresponding preset bits as required to distinguish the basic signature identifier from the additional signature identifier.
Wherein, storing the association between the basic signature identifier and the additional signature identifier in the identifier array in the block header of the block may further be: and storing the basic signature identifier and the additional signature identifier and index information between the basic signature identifier and the additional signature identifier in an identifier array in a block header of the block.
For example, when there are two identifier arrays in the block, the block generation node may store the base signature identifier in the base signature identifier array after generating the first transaction data; and storing the corresponding additional signature identifications into the additional signature identification array. Each additional signature identifier in the additional signature identifier array may individually set a first preset bit, which is used to identify that the array is used to store each additional signature identifier.
For example, when there are two identifier arrays in the block, the block generation node may store the base signature identifier in the base signature identifier array after generating the first transaction data; the storage location of the corresponding additional signature identification is stored in an index array. Wherein each additional signature in the chunk identifies any storage location in the chunk header that can be hashed.
For example, when there are at least three identification arrays in the block, the block generation node may store the base signature identification in the base signature identification array after generating and storing the first transaction data; sequentially adding storage positions of additional signature identifications corresponding to the basic signature identifications into the index array; accordingly, each additional signature identity may be stored sequentially in an array of additional signature identities.
It should be noted that, when the block header of the block further includes other signature identifiers, for example, a running result signature identifier generated by hashing a running result of each smart contract, a second association relationship between each running result signature identifier and the basic signature identifier may be reestablished, or a third association relationship between each running result signature identifier and the additional signature identifier may be established.
The method for establishing the second association relationship or the third association relationship may be: sequentially storing corresponding operation result signature identifications in a continuous storage space before or after the basic signature identification or the additional signature identification; the method can also be characterized in that a running result signature identification array is added again, and the running result signature identification array is used for sequentially storing corresponding running results in the running result signature identification array according to the embedding sequence or the running sequence of the intelligent contract embedded by the first transaction data; and the second index array is used for storing the storage positions of the basic signature identifications or the additional signature identifications corresponding to the operation result signature identifications, or storing the storage positions corresponding to the operation result signature identifications corresponding to the basic signature identifications or the additional signature identifications.
It should be noted that the second index array may be a part of the storage area in the index array, or another new array created separately from the index array.
Preferably, a mode of continuously storing the basic signature identifier and the additional signature identifier is adopted, so that when the basic signature identifier is found in the identifier array, the subsequent additional signature identifiers can be immediately obtained, the query efficiency is improved, and the required index data is reduced.
And S350, transmitting the block in a block chain network to inform other nodes to verify second transaction data of the rollback cost according to the associated basic signature identifier and additional signature identifier.
According to the embodiment of the invention, the block generation method is enriched by refining the association relationship establishment operation between the basic signature identifier and the additional signature identifier, so that after the block is generated, the block chain network node can correspondingly find the corresponding additional signature identifier through the basic signature identifier to verify the second transaction data.
Example four
Fig. 4 is a flowchart illustrating a block verification method according to a fourth embodiment of the present invention. The embodiment of the invention is suitable for the condition that other nodes in the block chain network verify the block generated by the block generation node. The method may be performed by a block verification apparatus, which is implemented by software and/or hardware and is specifically configured in a device carrying a node of a blockchain network.
A blockchain network node may be understood as a node with certain data processing capability that participates in the processes of generating, storing, and/or verifying each block included in a blockchain. Illustratively, the device bearing the blockchain network node may be an electronic device such as a server, a mobile terminal, or a server cluster. The blockchain network node may be a regular blockchain network node with full storage capability or may be a lightweight node.
The block verification method shown in fig. 4 is applied to a block chain network node, and includes:
s410, receiving the block sent by the block generation node, and acquiring first transaction data in the block.
The first transaction data may be transaction data containing a readable field transaction request in the form of a UTXO, transaction data containing an intelligent contract in the form of a code segment typified by an Ethernet (EVM), or transaction data containing a transaction request in which two forms are combined, that is, a transaction request in which an intelligent contract is embedded in a readable field transaction request.
When the block generation node generates the block, the block is connected to a locally stored block chain, and then the block is transmitted to a block chain network, so that other nodes in the block chain network can verify the block data generated by the block generation node based on a consensus mechanism.
It should be noted that, when the blockchain network node is a lightweight node, the block is actively acquired by sending a block acquisition request to the block generation node.
And S420, acquiring a basic signature identifier of the first transaction data from the block.
When the blockchain network node receives the block, the first transaction data may be verified. Specifically, the blockchain network node processes the first transaction request to generate transaction data, and performs hash calculation on the generated transaction data again to determine a corresponding transaction identifier; and comparing and verifying the calculated transaction identifier and the basic signature identifier to determine the correctness of the first transaction data in the block. Specifically, when the calculated transaction identifier is consistent with the base signature identifier, it indicates that the first transaction data stored in the block is correct.
When the first transaction data stored in the block is verified to be correct, the first transaction data is obtained from the block body.
And S430, acquiring the associated additional signature identifier according to the basic signature identifier.
The block generation node establishes the association relationship between the basic signature identifier and the additional signature identifier in the block in advance. Thus, the blockchain network node may obtain an additional signature identity corresponding to the base signature identity based on the pre-established association.
S440, determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring the rollback fee to the set account.
And the block chain network node acquires corresponding second transaction data from the block body of the block according to the acquired additional signature identification.
After obtaining the second transaction data, the blockchain network node may validate the second transaction data. Specifically, the blockchain network node may process the second transaction request to generate transaction data, determine a corresponding transaction identifier by performing hash calculation on the generated transaction data again, and perform verification by comparing the calculated transaction identifier with the additional signature identifier to determine correctness of the second transaction data in the block. Specifically, when the calculated transaction identifier is consistent with the appended signature identifier, it indicates that the second transaction data stored in the block is correct.
S450, verifying the second transaction data according to the first transaction data.
Since the second transaction request corresponding to the second transaction data is determined based on the generation process of the first transaction data, after determining that both the first transaction data and the second transaction data in the block are correct, the blockchain network node further verifies the second transaction data according to the first transaction data to determine whether the amount of the rollback fee and/or the participant in the second transaction data is correct.
The embodiment of the invention generates the block sent by the node through the receiving block and acquires the first transaction data in the block; acquiring a basic signature identifier of the first transaction data from the block; acquiring an associated additional signature identifier based on the basic signature identifier through an additional signature identifier acquisition module; determining corresponding second transaction data for transferring the rollback charge to the set account according to the additional signature; and validating the second transaction data based on the first transaction data. By adopting the technical scheme, the block chain network node can verify the second transaction data of the rollback cost according to the received basic signature identifier and the additional signature identifier which have the incidence relation in the block, namely verify the content of the transaction data generated after a cost rollback mechanism is introduced into the block generation process, realize the monitoring of the commission cost of deducting the transaction request of the block generation node and the effective tracking of the rollback cost, and optimize the cost payment scheme in the block chain network.
EXAMPLE five
Fig. 5 is a flowchart illustrating a block verification method according to a fifth embodiment of the present invention. The embodiment of the invention carries out subdivision optimization on the basis of the technical scheme of each embodiment.
Further, the feature "validating the second transaction data according to the first transaction data" is refined to "determine a first fee amount to be paid for running the intelligent contract in the first transaction data; wherein, the first transaction data comprises a second fee amount; if the first expense amount is less than the second expense amount, determining the difference value between the second expense amount and the first expense amount as the backspacing expense; comparing whether the back-off fee in the second transaction data matches the back-off fee determined by the calculation to verify the amount of the back-off fee in the second transaction data by the first transaction data.
Further, the feature "verify the second transaction data according to the first transaction data" is refined to "acquire an account of a block generation node from the block; determining a first transaction request initiator account from the first transaction data; and determining whether the roll-out account of the second transaction data is the account of the block generation node and whether the roll-in account is the account of the first transaction request initiator, so as to realize the verification of the participants of the rollback fee in the second transaction data through the first transaction data.
The block verification method shown in fig. 5 includes:
s510, receiving a block sent by the block generation node, and acquiring first transaction data in the block.
Wherein, the first transaction data comprises an intelligent contract. Specifically, the first transaction data is the transaction data corresponding to the transaction request in which the intelligent contract code is embedded in the field of the transaction request in the readable field form.
S520, acquiring a basic signature identifier of the first transaction data from the block.
S530, acquiring the associated additional signature identification according to the basic signature identification.
And the block head of the block comprises an identification array, and the basic signature identification corresponding to the first transaction data and the additional signature identification corresponding to the second transaction data are stored in the identification array in an associated manner.
And S540, determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring the rollback fee to the set account.
Specifically, the second transaction data is the transaction data generated when the block generation node processes the second transaction request. The second transaction request is a transaction request for transferring the rollback fee from the account of the block generation node to the account of the first transaction request initiator.
S551A, determining the first fee amount needed to be paid by running the intelligent contract; wherein, the first transaction data comprises a second fee amount.
Wherein the second fee amount is the fee amount filled in the fee field of the first transaction request by the first transaction request initiator.
When verifying the first transaction data, the blockchain network node processes the first transaction request and generates transaction data; after the transaction data is generated, the block chain network node runs each intelligent contract according to the set sequence of the intelligent contracts embedded in the transaction data, and determines the workload according to the steps executed by the virtual machines in the process of running all the intelligent contracts; and the block generation node determines the handling charge required to be paid by the first transaction request initiator as the first fee amount according to the workload.
It should be noted that after the intelligent contracts are run, corresponding hash values can be generated through hash calculation according to the running results of the intelligent contracts; and comparing the calculated hash value with the operation result signature identification stored in the block header for verification so as to determine the correctness of the operation result of the intelligent contract. Specifically, if the calculated hash value is consistent with the extracted signature identifier of the running result, it indicates that the intelligent contracts in the transaction data are executed and the running result is correct.
S552A, if the first fee amount is smaller than the second fee amount, determining that the difference between the second fee amount and the first fee amount is the fallback fee.
And when the first fee amount is less than the second fee amount, the block generation node is indicated to transfer a certain rollback fee from the account of the block generation node to the account of the first transaction request initiator after processing the first transaction data. Therefore, the block chain network node determines the rollback fee by calculating a difference between the second fee amount and the first fee amount included in the acquired first transaction data.
S553A, comparing whether the fallback costs within the second transaction data match the computationally determined fallback costs.
When the calculated rollback fee is consistent with the rollback fee contained in the second transaction data, the calculated rollback fee indicates that the amount of the rollback fee is correct when the block generation node generates the current block.
S551B, obtaining the account of the block generation node from the block.
When a block is generated, the block generation node stores its own account information in the block. Thus, the blockchain network node may obtain the account of the chunk generating node that generated the chunk directly from the chunk.
S552B, determining a first transaction request initiator account from the first transaction data.
When a first transaction request is initiated by a first transaction request initiator to a blockchain network, an account of the first transaction request initiator is included in the first transaction request. When the block generation node processes the first transaction request and generates first transaction data, the information of the account of the initiator of the first transaction request is correspondingly stored in the first transaction data. Thus, the blockchain network node may determine the account of the first transaction request initiator from the first transaction data.
S553B, determining whether the roll-out account of the second transaction data is an account of the tile generating node and whether the roll-in account is a first transaction request originator account.
The block chain network node determines whether a transfer account in the second transaction data is an account of the block generation node or not so as to determine whether a transfer party of the rollback fee has an error or not; the blockchain network node determines whether the transferred account in the second transaction data is the account of the initiator of the first transaction request so as to determine whether the transferred party of the rollback fee has an error.
It should be noted that only S551A to S553A may be performed, or only S551B to S553B may be performed; the execution order of S551B to S553B is not limited at all. Specifically, S551B through S553B may be performed before or after S551A through S553A, and S551B through S553B may also be performed simultaneously with S551A through S553A.
The method comprises the steps of determining a first fee amount required to be paid by an intelligent contract, determining a backspacing fee according to a difference value between a second fee amount and the first fee amount, and verifying the amount of the backspacing fee in second transaction data; and comparing the account of the block generation node and the account of the first transaction request initiator with the roll-out account and the roll-in account in the second transaction data respectively to verify the participants of the rollback fee.
EXAMPLE six
Fig. 6 is a flowchart illustrating a block verification method according to a sixth embodiment of the present invention. The embodiment of the invention carries out subdivision optimization on the basis of the technical schemes of the embodiments.
Further, the feature "acquiring associated additional signature identifier according to basic signature identifier" is refined into "finding out the additional signature identifier according to the set position relationship of the basic signature identifier and the additional signature identifier in the identifier array; or, according to the index information between the basic signature identifier and the additional signature identifier, the additional signature identifier is found in the identifier array, so as to perfect the specific way of acquiring the additional signature identifier.
The block verification method shown in fig. 6 includes:
s610, receiving a block sent by the block generation node, and acquiring first transaction data in the block.
S620, acquiring a basic signature identifier of the first transaction data from the block; execution continues with S630A or S630B.
S630A, finding the additional signature identifier according to the set position relationship between the basic signature identifier and the additional signature identifier in the identifier array; execution continues with S640.
The block chain network node extracts information to be determined which is positioned at a set position with the basic signature identifier from the identifier array; and determining the pending information as an additional signature identifier based on the preset bits of the to-be-positioned position. Wherein the set location may be a storage space before or after the base signature identification storage location.
S630B, according to the index information between the basic signature identifier and the additional signature identifier, finding the additional signature identifier in the identifier array; execution continues with S640.
Index information of the basic signature identification and the additional signature identification is obtained, and the additional signature identification corresponding to the basic signature identification is searched in the identification array based on the index information.
And S640, determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring the rollback fee to a set account.
S650, verifying the second transaction data according to the first transaction data.
The embodiment of the invention further perfects the block verification method by refining the acquisition operation of the additional signature identifier. By adopting the technical scheme, the content of the transaction data generated after a cost rollback mechanism is introduced in the block generation process can be verified, and the monitoring of the commission charge of deducting the transaction processing request of the block generation node and the effective tracking of the rollback cost are realized.
EXAMPLE seven
Fig. 7 is a schematic structural diagram of a block generating apparatus according to a seventh embodiment of the present invention. The embodiment of the invention is suitable for returning the extra fee which is paid by the user and exceeds the handling fee required by processing the transaction request when the block generation node processes the transaction request of the user. The apparatus is implemented by software and/or hardware and is specifically configured in a device carrying a block generation node of a blockchain network. The block generating apparatus shown in fig. 7 specifically includes: a basic signature generation module 710, a second transaction request generation module 720, an additional signature generation module 730, an association relationship establishment module 740, and a block transmission module 750.
The basic signature generation module 710 is configured to obtain and process a first transaction request to obtain first transaction data, generate a basic signature of the first transaction data, and add the basic signature to a block;
a second transaction request generating module 720, configured to determine a rollback fee according to the processing of the first transaction request, and generate a second transaction request for transferring the rollback fee to a set account;
an additional signature identifier generating module 730, configured to process the second transaction request, obtain second transaction data, generate an additional signature identifier of the second transaction data, and add the additional signature identifier to the block;
an association relationship establishing module 740, configured to establish an association relationship between the basic signature identifier and the additional signature identifier;
a block transmission module 750, configured to transmit the block in a blockchain network, so as to notify other nodes to verify the second transaction data of the fallback cost according to the associated base signature identifier and additional signature identifiers.
According to the embodiment of the invention, a basic signature identifier generation module is used for acquiring and processing a first transaction request to obtain first transaction data, and generating a basic signature identifier of the first transaction data to be added to a block; determining the rollback cost according to the processing of the first transaction request through a second transaction request generating module, and generating a second transaction request for transferring the rollback cost to a set account; processing the second transaction request through an additional signature generation module to obtain second transaction data, generating an additional signature of the second transaction data, and adding the additional signature to the block; establishing an incidence relation between the basic signature identifier and the additional signature identifier through an incidence relation establishing module; and transmitting the block to the blockchain network through the block transmission module so as to inform other nodes to verify the second transaction data of the rollback expense according to the basic signature identification and the additional signature identification. By adopting the technical scheme, a cost rollback mechanism is introduced in the block generation process, so that the situation that a user bears a higher commission than actually required can be avoided, meanwhile, other nodes can verify second transaction data of the rollback cost according to the basic signature identifier and the additional signature identifier with the incidence relation, and a cost payment scheme in the block chain network is optimized.
Further, the first transaction request is a first transaction request embedded with an intelligent contract, and accordingly, the second transaction request generating module 720 includes:
the first fee amount determining unit is used for operating the intelligent contract and determining a first fee amount required to be paid by operating the intelligent contract; wherein the first transaction request includes a second fee amount;
and the backspacing expense determining unit is used for determining the difference value between the second expense amount and the first expense amount as the backspacing expense when the first expense amount is smaller than the second expense amount.
Further, the second transaction request generating module 720 includes:
and the second transaction request generating unit is used for generating a second transaction request for transferring the rollback charge from the account of the block generating node to the account of the first transaction request initiator.
Further, the association relationship establishing module 740 includes:
and the association relation storage unit is used for storing the basic signature identifier and the additional signature identifier in an identifier array in the block head of the block in an associated manner.
Further, the association relation storage unit is specifically configured to:
storing the basic signature identifier and the additional signature identifier in an identifier array in the block head of the block according to a set position relationship; alternatively, the first and second electrodes may be,
storing the base signature identifier and the additional signature identifier, and index information between the base signature identifier and the additional signature identifier in an identifier array in a block header of the block.
The block generation device can execute the block generation method provided by all the embodiments of the invention, and has the corresponding functional modules and beneficial effects of executing the block generation method. For the technical details that are not described in detail in this embodiment, reference may be made to the block generation methods provided in all the foregoing embodiments of the present invention.
Example eight
Fig. 8 is a schematic structural diagram of a block verification apparatus in an eighth embodiment of the present invention. The embodiment of the invention is suitable for the condition that other nodes in the block chain network verify the block generated by the block generation node. The apparatus is implemented in software and/or hardware and is specifically configured in a device that carries a blockchain network node. The block verification apparatus shown in fig. 8 specifically includes: a first transaction data obtaining module 810, a base signature identification obtaining module 820, an additional signature identification obtaining module 830, a second transaction data determining module 840, and a second transaction data verifying module 850.
The first transaction data obtaining module 810 is configured to receive a block sent by a block generation node, and obtain first transaction data in the block;
a basic signature identifier obtaining module 820, configured to obtain a basic signature identifier of the first transaction data from the block;
an additional signature identifier obtaining module 830, configured to obtain an associated additional signature identifier according to the basic signature identifier;
a second transaction data determining module 840, configured to determine corresponding second transaction data according to the additional signature identifier, where the second transaction data is used to transfer a fallback charge to a set account;
a second transaction data verification module 850, configured to verify the second transaction data according to the first transaction data.
In the embodiment of the invention, a first transaction data acquisition module receives a block sent by a block generation node and acquires first transaction data in the block; acquiring a basic signature identifier of the first transaction data from the block through a basic signature identifier acquisition module; acquiring an associated additional signature identifier based on the basic signature identifier through an additional signature identifier acquisition module; determining corresponding second transaction data for transferring the rollback charge to the set account by a second transaction data determination module according to the additional signature identifier; and verifying the second transaction data according to the first transaction data through a second transaction data verification module. By adopting the technical scheme, the block chain network node can verify the second transaction data of the rollback cost according to the received basic signature identifier and the additional signature identifier which have the incidence relation in the block, namely verify the content of the transaction data generated after a cost rollback mechanism is introduced into the block generation process, realize the monitoring of the commission cost of deducting the transaction request of the block generation node and the effective tracking of the rollback cost, and optimize the cost payment scheme in the block chain network.
Further, an intelligent contract is embedded in the first transaction data; accordingly, the second transaction data validation module 850 includes:
a first fee amount determining unit, configured to determine a first fee amount to be paid for running the intelligent contract in the first transaction data; wherein, the first transaction data comprises a second fee amount;
a fallback charge determining unit, configured to determine, when the first fee amount is less than the second fee amount, that a difference between the second fee amount and the first fee amount is the fallback charge;
and the rollback expense matching unit is used for comparing whether the rollback expense in the second transaction data is matched with the calculated and determined rollback expense.
Further, the second transaction data verification module 850 further includes:
a first account acquisition unit, configured to acquire an account of a block generation node from the block;
a second account obtaining unit, configured to determine a first transaction request initiator account from the first transaction data;
and the account comparison unit is used for determining whether the transferred account of the second transaction data is the account of the block generation node and whether the transferred account is the account of the first transaction request initiator.
Further, the block header of the block includes an identification array, and the base signature corresponding to the first transaction data and the additional signature corresponding to the second transaction data are stored in the identification array in an associated manner.
Further, the additional signature identifier obtaining module 830 is specifically configured to:
finding the additional signature identification according to the set position relation of the basic signature identification and the additional signature identification in the identification array; alternatively, the first and second electrodes may be,
and searching the additional signature identifier in the identifier array according to the index information between the basic signature identifier and the additional signature identifier.
The block verification device can execute the block verification method provided by all the embodiments of the invention, and has the corresponding functional modules and beneficial effects of executing the block verification method. For the technical details that are not described in detail in this embodiment, reference may be made to the block verification methods provided in all the foregoing embodiments of the present invention.
Example nine
Fig. 9 is a schematic diagram of a hardware structure of an electronic device according to a ninth embodiment of the present invention. FIG. 9 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. 9 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. 9, the electronic device 12 is 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. 9, and commonly referred to as a "hard drive"). Although not shown in FIG. 9, 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.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and/or any device (e.g., network card, modem, etc.) that enables the 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 block generation method provided by the embodiment of the present invention:
acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier to a block;
determining a rollback fee according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback fee to a set account;
processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into a block;
establishing an incidence relation between the basic signature identifier and the additional signature identifier;
and transmitting the block in a block chain network to inform other nodes to verify second transaction data of the rollback expense according to the associated basic signature identification and additional signature identification.
EXAMPLE ten
The embodiment of the invention provides another electronic device, and the structural schematic diagram of the electronic device can also refer to fig. 9.
The embodiment of the invention is different from the tenth embodiment only in that: 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 block verification method provided by the embodiment of the present invention:
receiving a block sent by a block generation node, and acquiring first transaction data in the block;
acquiring a basic signature identification of first transaction data from the block;
acquiring an associated additional signature identifier according to the basic signature identifier;
determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring rollback cost to a set account;
and verifying the second transaction data according to the first transaction data.
EXAMPLE eleven
An eleventh embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, the computer program being executed by a processor to perform a block generation method, the method including: acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier into a block; determining a rollback fee according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback fee to a set account; processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into a block; establishing an incidence relation between the basic signature identifier and the additional signature identifier; and transmitting the block in a block chain network to inform other nodes to verify second transaction data of the rollback expense according to the associated basic signature identification and additional signature identification.
An eleventh embodiment 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 block verification method provided in any embodiment of the present invention, where the method includes: receiving a block sent by a block generation node, and acquiring first transaction data in the block; acquiring a basic signature identifier of first transaction data from the block; acquiring an associated additional signature identifier according to the basic signature identifier; determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring rollback cost to a set account; and verifying the second transaction data according to the first transaction data.
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 description is only exemplary of the invention and that the principles of the technology may be 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 (16)

1. A block generation method applied to a block generation node, the method comprising:
acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature identifier of the first transaction data, and adding the basic signature identifier to a block; wherein the first transaction request includes a fee amount filled in when the first transaction request is initiated;
determining a rollback fee according to the processing of the first transaction request, and generating a second transaction request for transferring the rollback fee to a set account; wherein the rollback fee is higher than the actually required fee amount in the filled fee amount;
processing the second transaction request to obtain second transaction data, generating an additional signature identifier of the second transaction data, and adding the additional signature identifier into a block;
establishing an incidence relation between the basic signature identifier and the additional signature identifier;
and transmitting the block in a block chain network to inform other nodes of verifying the amount of the rollback fee and/or whether the participant is correct in the second transaction data according to the associated basic signature identifier and additional signature identifier.
2. The method of claim 1, wherein the first transaction request is a first transaction request embedded with a smart contract, and wherein determining a fallback cost based on processing the first transaction request comprises:
running the intelligent contract and determining a first fee amount required to be paid by running the intelligent contract; wherein the first transaction request includes a second fee amount; wherein the second fee amount is the filled fee amount;
and if the first fee amount is smaller than the second fee amount, determining the difference value between the second fee amount and the first fee amount as the backspacing fee.
3. The method of claim 2, wherein generating a second transaction request to transfer the fallback charge to a set account comprises:
a second transaction request is generated to transfer a fallback charge from the account of the block generation node to the first transaction request initiator account.
4. The method according to any of claims 1-3, wherein establishing the association between the base signature identity and the additional signature identity comprises:
and storing the association of the basic signature identifier and the additional signature identifier in an identifier array in a block header of the block.
5. The method of claim 4, wherein storing the base signature tag and the additional signature tag association in a tag array in a block header of the block comprises:
storing the basic signature identifier and the additional signature identifier in an identifier array in the block head of the block according to a set position relationship; alternatively, the first and second electrodes may be,
and storing the basic signature identifier and the additional signature identifier and index information between the basic signature identifier and the additional signature identifier in an identifier array in a block header of the block.
6. A method for block verification, applied to a blockchain network node, the method comprising:
receiving a block sent by a block generation node, and acquiring first transaction data in the block; wherein, the first transaction data comprises the fee amount filled when the corresponding first transaction request is initiated;
acquiring a basic signature identification of first transaction data from the block;
acquiring an associated additional signature identifier according to the basic signature identifier;
determining corresponding second transaction data according to the additional signature identification, wherein the second transaction data is used for transferring rollback cost to a set account; wherein the rollback fee is higher than the actually required fee amount in the filled fee amount;
and verifying the second transaction data according to the first transaction data to determine whether the amount of the rollback fee and/or the participant in the second transaction data are correct.
7. The method of claim 6, wherein validating the second transaction data based on the first transaction data to determine whether the amount of the fallback cost in the second transaction data is correct comprises:
determining a first fee amount to be paid for running the intelligent contract in the first transaction data; wherein, the first transaction data comprises a second fee amount; wherein the second fee amount is the filled fee amount;
if the first expense amount is less than the second expense amount, determining the difference value between the second expense amount and the first expense amount as the backspacing expense;
comparing whether the fallback costs within the second transaction data match the computationally determined fallback costs.
8. The method of claim 6, wherein validating the second transaction data based on the first transaction data to determine whether a participant in the second transaction data that rolls back a fee is correct comprises:
acquiring an account of a block generation node from the block;
determining a first transaction request initiator account from the first transaction data;
determining whether the roll-out account of the second transaction data is an account of the block generation node and whether the roll-in account is an account of a first transaction request initiator.
9. The method according to any one of claims 6 to 8, wherein a block header of the block includes an identification array, and the base signature identifier corresponding to the first transaction data and the additional signature identifier corresponding to the second transaction data are stored in association in the identification array.
10. The method of claim 9, wherein obtaining the associated additional signature identifications from the base signature identification comprises:
finding the additional signature identification according to the set position relation of the basic signature identification and the additional signature identification in the identification array; alternatively, the first and second electrodes may be,
and searching the additional signature identifier in the identifier array according to the index information between the basic signature identifier and the additional signature identifier.
11. An apparatus for block generation, which is arranged at a block generation node, comprising:
the basic signature generation module is used for acquiring and processing a first transaction request to obtain first transaction data, generating a basic signature of the first transaction data, and adding the basic signature to a block; wherein the first transaction request includes a fee amount filled in when the first transaction request is initiated;
the second transaction request generation module is used for determining the rollback fee according to the processing of the first transaction request and generating a second transaction request for transferring the rollback fee to a set account; wherein the rollback fee is higher than the actually required fee amount in the filled fee amount;
an additional signature identifier generating module, configured to process the second transaction request, obtain second transaction data, generate an additional signature identifier of the second transaction data, and add the additional signature identifier to the block;
the incidence relation establishing module is used for establishing the incidence relation between the basic signature identifier and the additional signature identifier;
and the block transmission module is used for transmitting the block in a block chain network so as to inform other nodes of verifying the amount of the rollback fee in the second transaction data and/or whether the participant is correct or not according to the associated basic signature identifier and additional signature identifier.
12. An apparatus configured at a blockchain network node for block verification, the apparatus comprising:
the first transaction data acquisition module is used for receiving the blocks sent by the block generation node and acquiring first transaction data in the blocks; wherein, the first transaction data comprises the fee amount filled when the corresponding first transaction request is initiated;
a basic signature identification obtaining module, configured to obtain a basic signature identification of the first transaction data from the block;
the additional signature identifier acquisition module is used for acquiring the associated additional signature identifier according to the basic signature identifier;
the second transaction data determining module is used for determining corresponding second transaction data according to the additional signature identifier, wherein the second transaction data is used for transferring the rollback fee to a set account; wherein the rollback expense is higher than the actually required amount in the filled amount;
and the second transaction data verification module is used for verifying the second transaction data according to the first transaction data so as to determine whether the amount of the rollback fee in the second transaction data and/or the participant is correct.
13. 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 block generation method as claimed in any one of claims 1 to 5.
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 block verification method as claimed in any one of claims 6-10.
15. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a block generation method according to any one of claims 1 to 5.
16. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a block verification method according to any one of claims 6 to 10.
CN201810790428.9A 2018-07-18 2018-07-18 Block generation and verification method, device, equipment and storage medium Active CN108960797B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810790428.9A CN108960797B (en) 2018-07-18 2018-07-18 Block generation and verification method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810790428.9A CN108960797B (en) 2018-07-18 2018-07-18 Block generation and verification method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108960797A CN108960797A (en) 2018-12-07
CN108960797B true CN108960797B (en) 2022-08-23

Family

ID=64481770

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810790428.9A Active CN108960797B (en) 2018-07-18 2018-07-18 Block generation and verification method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108960797B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3905165A4 (en) * 2018-12-27 2022-08-10 Hefei Dappworks Technology Co., Ltd. Data processing method and apparatus for block chain
CN111695991B (en) * 2019-03-14 2024-02-06 北京沃东天骏信息技术有限公司 Block-based contract processing method and device, block chain node and storage medium
CN112487080A (en) * 2019-08-20 2021-03-12 厦门本能管家科技有限公司 Difference value backspacing method and system for block chain
CN111126978B (en) * 2019-12-28 2023-03-14 飞天诚信科技股份有限公司 Method and device for realizing rapid transaction processing on block chain
CN111352705B (en) * 2020-02-25 2023-10-31 百度在线网络技术(北京)有限公司 Transaction processing method, device, equipment and medium of block chain
CN112769758B (en) * 2020-12-21 2022-04-29 浙江大学 Credible Internet of things gas meter based on block chain and credible method of local and cloud

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107103473A (en) * 2017-04-27 2017-08-29 电子科技大学 A kind of intelligent contract implementation method based on block chain
CN107993149A (en) * 2017-12-18 2018-05-04 深圳前海微众银行股份有限公司 Account information management method, system and readable storage medium storing program for executing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10713654B2 (en) * 2016-01-21 2020-07-14 International Business Machines Corporation Enterprise blockchains and transactional systems
US10255108B2 (en) * 2016-01-26 2019-04-09 International Business Machines Corporation Parallel execution of blockchain transactions

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107103473A (en) * 2017-04-27 2017-08-29 电子科技大学 A kind of intelligent contract implementation method based on block chain
CN107993149A (en) * 2017-12-18 2018-05-04 深圳前海微众银行股份有限公司 Account information management method, system and readable storage medium storing program for executing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链技术:架构及进展;邵奇峰等;《计算机学报》;20171115(第05期);第3-22页 *

Also Published As

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

Similar Documents

Publication Publication Date Title
CN108960797B (en) Block generation and verification method, device, equipment and storage medium
CN108961052B (en) Verification method, storage method, device, equipment and medium of block chain data
CN108984645B (en) Block chain processing method, device, equipment and storage medium
EP3796188A1 (en) Blockchain network transaction processing method, apparatus, device, and storage medium
WO2021031473A1 (en) Blockchain asset processing method based on multiple asset models and related device
CN109002349B (en) Application program interaction method, implementation method, device, equipment and medium
CN109101664B (en) Data transmission method, device, equipment and medium for lightweight node
CN112101942B (en) Transaction request processing method, system, device and equipment based on block chain
CN111460504B (en) Service processing method, device, node equipment and storage medium
CN112953981A (en) Node selection method, block chain consensus method, device, system and equipment
CN111541756B (en) Block generation method, block generation device, node equipment and storage medium
CN114327803A (en) Method, apparatus, device and medium for accessing machine learning model by block chain
CN109858285B (en) Block chain data processing method, device, equipment and medium
CN109710502B (en) Log transmission method, device and storage medium
CN112565370A (en) Method and system for verifying calculation result based on wireless communication and block chain scene
CN113935069B (en) Data verification method, device and equipment based on block chain and storage medium
CN114338051B (en) Method, device, equipment and medium for acquiring random number by block chain
CN114363988B (en) Clustering method and device and electronic equipment
JP2023031248A (en) Edge computing network, data transmission method, apparatus, device, and storage medium
CN114282968A (en) Serial number acquisition method, device, server and storage medium
CN111242778B (en) Data processing method, device, computer equipment and storage medium
CN111401889B (en) Credit data processing method, device, equipment and medium based on block chain
CN112995932A (en) Short message link monitoring method, device, equipment and medium based on Hash algorithm
CN112950171A (en) Bank business processing system and method
CN107958142B (en) User account generation method and device

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