CN116361383A - Block generation method, block chain system, storage medium and related equipment - Google Patents
Block generation method, block chain system, storage medium and related equipment Download PDFInfo
- Publication number
- CN116361383A CN116361383A CN202111626204.2A CN202111626204A CN116361383A CN 116361383 A CN116361383 A CN 116361383A CN 202111626204 A CN202111626204 A CN 202111626204A CN 116361383 A CN116361383 A CN 116361383A
- Authority
- CN
- China
- Prior art keywords
- target
- transaction
- block
- processing sequence
- transaction data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000012545 processing Methods 0.000 claims abstract description 146
- 238000012795 verification Methods 0.000 claims description 84
- 238000004590 computer program Methods 0.000 claims description 15
- 238000004806 packaging method and process Methods 0.000 claims description 13
- 230000010365 information processing Effects 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 8
- 238000012856 packing Methods 0.000 description 6
- 230000005540 biological transmission Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000005336 cracking Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Finance (AREA)
- Databases & Information Systems (AREA)
- Accounting & Taxation (AREA)
- General Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Development Economics (AREA)
- Bioethics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- General Health & Medical Sciences (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- General Business, Economics & Management (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a block generation method, a block chain system, a storage medium and related equipment, which are applied to the technical field of information processing. When the blockchain node acquires the information of the new transaction, the processing sequence of the new transaction is determined and used for representing the sequence of the information of the new transaction acquired by the blockchain node, signature is carried out on the information of the new transaction according to the processing sequence to acquire signature information of the new transaction, so that the signature information comprises the processing sequence, further transaction data acquired based on the signature information also comprises the processing sequence of the new transaction, and the transaction data is packaged according to the processing sequence to form a block. In this way, when generating the block, the block link point packages the corresponding transaction data according to the processing sequence of each transaction, that is, packages the transaction data according to the sequence in which the block link node obtains the information of the corresponding transaction, so that all the transaction data can be processed without missing some transaction data.
Description
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a block generating method, a block chain system, a storage medium, and related devices.
Background
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. The essence is a decentralised database, which is a series of blocks generated by using cryptography, each block containing a batch of information of network transactions.
In the existing blockchain platform, nodes can perform operations of packaging transaction to form blocks, and each block can comprise a block head and data content.
However, in the existing block generation process, some nodes always put the transaction of a certain address at the end of the transaction pool (or queue) so that the transaction is not packed all the time, and thus the generated block always does not contain the transactions, and further the transaction cannot be executed all the time.
Disclosure of Invention
The embodiment of the invention provides a block generation method, a block chain system, a storage medium and related equipment, which ensure that all transaction data are processed.
An aspect of an embodiment of the present invention provides a block generating method, including:
When information of a new transaction of the application terminal is acquired,
determining a processing sequence of the new transaction, wherein the processing sequence is used for identifying the sequence of the block link points for acquiring the information of the new transaction;
signing according to the processing sequence and the information of the new transaction to obtain signature information corresponding to the new transaction;
returning the signature information to the application terminal so that the application terminal can acquire transaction data of the new transaction according to the signature information;
and when the transaction data sent by the application terminal is received, packaging the transaction data according to the processing sequence contained in the transaction data to form a block.
Another aspect of an embodiment of the present invention provides a blockchain node, including:
the sequence determining unit is used for determining the processing sequence of the new transaction when the information of the new transaction of the application terminal is acquired, wherein the processing sequence is used for identifying the sequence of the block link point for acquiring the information of the new transaction;
the signature acquisition unit is used for signing according to the processing sequence and the information of the new transaction to obtain signature information corresponding to the new transaction;
the data return unit is used for returning the signature information to the application terminal so that the application terminal can acquire the transaction data of the new transaction according to the signature information;
And the packaging unit is used for packaging the transaction data according to the processing sequence contained in the transaction data to form a block when the transaction data sent by the application terminal is received.
Another aspect of an embodiment of the present invention also provides a blockchain system, including: an application terminal and a plurality of blockchain nodes, the blockchain nodes being blockchain nodes as described in another aspect of the embodiments of the invention.
Another aspect of the embodiments of the present invention also provides a computer readable storage medium storing a plurality of computer programs adapted to be loaded by a processor and to perform the block generating method according to the one aspect of the embodiments of the present invention.
In another aspect, the embodiment of the invention further provides a server, which comprises a processor and a memory;
the memory is used for storing a plurality of computer programs, and the computer programs are used for being loaded by a processor and executing the block generating method according to one aspect of the embodiment of the invention; the processor is configured to implement each of the plurality of computer programs.
It can be seen that, in the method of this embodiment, when the blockchain node obtains the information of the new transaction, the processing sequence of the new transaction is determined, which is used to indicate the sequence of obtaining the information of the new transaction by the blockchain node, and signature information of the new transaction is obtained by signing the information of the new transaction according to the processing sequence, so that the signature information includes the processing sequence, and further transaction data obtained based on the signature information includes the processing sequence of the new transaction, and then the transaction data is packaged according to the processing sequence to form a block. In this way, when generating the block, the block link point packages the corresponding transaction data according to the processing sequence of each transaction, that is, packages the transaction data according to the sequence in which the block link node obtains the information of the corresponding transaction, so that all the transaction data can be processed without missing some transaction data.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a schematic diagram of a system to which a block generating method according to an embodiment of the present invention is applied;
FIG. 2 is a flow chart of a block generation method according to an embodiment of the present invention;
FIG. 3 is a flow chart of a method of verifying a target block in one embodiment of the invention;
FIG. 4 is a schematic diagram of a block chain system in one application embodiment of the invention;
FIG. 5 is a schematic diagram of a block generation method in an application embodiment of the invention;
FIG. 6 is a schematic diagram of verifying a target block according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a distributed system to which a block generation method is applied in another application embodiment of the present invention;
FIG. 8 is a schematic diagram of a block structure in another embodiment of the invention;
FIG. 9 is a schematic diagram of a block chain node according to an embodiment of the present invention;
fig. 10 is a schematic logic structure diagram of a server according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented, for example, in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment of the invention provides a block generating method, which is mainly applied to a block chain system as shown in fig. 1, wherein the system can comprise an application terminal 10 and a plurality of (n in the figure are taken as examples) block chain nodes 11, wherein:
the application terminal 10 is mainly used for initiating a transaction, acquiring transaction data of the initiated transaction and sending the transaction data to the blockchain node 11.
In particular, transactions initiated by the application terminal 10 may refer to blockchain transactions, typically embodied as transferring a certain amount of money from certain specific accounts to other specific accounts, as well as the invocation of certain smart contracts. The execution process of the transaction in the blockchain is executed according to the arrangement sequence of the blockchain in the blocks, the blockchain is a data structure formed by connecting a plurality of blocks by hash values, each block is composed of transaction data for generating the transaction in a period of time, and the transaction data are packed by the blockchain nodes 11 for obtaining the accounting rights and are independently verified by the blockchain nodes 11.
The blockchain node 11 is configured to receive transaction data of a transaction initiated by the application terminal 10 of each user, and package the transaction data to form a block. In this embodiment, the blockchain node 11 allocates corresponding processing sequences for different transactions initiated by the application terminals 10 of different users according to a preset policy, so that transaction data of a plurality of transactions are packaged according to the processing sequences to form a block, so that all the transaction data received by the blockchain node 11 can be processed without missing transaction data.
In general, for a transaction initiated by the application terminal 10, transaction data for the transaction may be packaged by one or more blockchain nodes 11.
Specifically, as shown in fig. 2, the blockchain node 11 of the present embodiment may form a block according to the following steps:
It can be understood that, by operating any application terminal 10, the user may make the application terminal 10 initiate various types of transactions, when the application terminal 10 initiates a new transaction, information of the new transaction may be respectively sent to all blockchain nodes 11 having the block-out authority for the new transaction, and then the blockchain nodes 11 initiate the block generation flow in this embodiment.
The block-out authority refers to the authority of packing and storing the transaction data of the new transaction, and one or more block chain nodes 11 with block-out authority for a new transaction, and the block-out authority may be determined by the specific application or the selection of the application terminal 10. The information of the new transaction may be metadata of the new transaction, or a hash value of the metadata, etc., where the metadata of the new transaction may include: the transaction amount of the new transaction, the transaction source, the transaction purpose, the transaction object, the time generated by the new transaction, the commission fee and the like.
In this embodiment, when any blockchain node 11 initiates the flow of this embodiment, the processing sequence of the new transaction is determined first, and the processing sequence is used to describe the sequence of the blockchain node 11 when packaging the transaction data of the new transaction. In determining the processing order of any transaction, rather than randomly forming a processing order, it is necessary to ensure that the processing order of any transaction can identify the order in which the blockchain node 11 obtained the information for that transaction.
Specifically, in one case, the blockchain node 11 may directly determine the preset identifier as the processing order of the new transaction, in which case the blockchain node 11 also needs to increase the preset identifier by a fixed value, such as 1. In another case, the blockchain node 11 may determine that the preset identification is increased by a fixed value as the processing order of the new transaction, in which case the blockchain node 11 also needs to update the preset identification as the processing order of the current new transaction. Thus, when the blockchain node 11 next initiates the flow of the present embodiment, the determined processing order for another transaction is ordered after the processing order for the new transaction.
Wherein the preset identification is stored in advance in the blockchain node 11, the preset identification may be any natural number greater than zero initially.
And 102, signing according to the processing sequence and the information of the new transaction to obtain signature information corresponding to the new transaction.
Specifically, when signing the processing sequence and the information of the new transaction according to the preset secret key, corresponding signature information is obtained, and thus the signature information contains the processing sequence of the new transaction.
After all the blockchain nodes 11 with the block-out authority for the transaction data of the new transaction return corresponding signature information to the application terminal 10, the application terminal 10 acquires the transaction data of the new transaction according to the signature information returned by each blockchain node 11 and broadcasts the transaction data.
When transaction data is acquired, signature information obtained by each blockchain node 11 can be added into a sequence of metadata of a new transaction, so that transaction data of the new transaction can be obtained, and the transaction data of the new transaction can comprise a processing sequence determined by each blockchain node 11 for the new transaction.
When any blockchain node 11 receives transaction data, the new transaction may be added to the out-block queue, which may include transactions that do not have transaction data packed. And when the data packing condition is reached, the current unpacked transaction data may be packed, specifically, the blockchain node 11 may sort the transaction data according to the processing sequence contained in the current unpacked transaction data, and further pack the transaction data according to the sorting to form a block, so that the transaction data of a plurality of different application terminals may be packed in one block. The data packing condition may include, but is not limited to, any of the following conditions: the corresponding transaction number of the currently unpacked transaction data reaches a threshold value, the period of the currently packed transaction data reaches, and the like.
Not all blockchain nodes 11 with block-out authority for the transaction data of the new transaction need to package the transaction data of the new transaction, and which blockchain nodes 11 need to generate blocks are determined according to the specific application or the selection of the application terminal 10. When a block is generated by a blockchain node 11, the block may be sent to other blockchain nodes 11 with block-out authority for storage.
It can be seen that, in the method of this embodiment, when the blockchain node 11 obtains the information of the new transaction, the processing sequence of the new transaction is determined, which is used to indicate the sequence of obtaining the information of the new transaction by the blockchain node 11, signature is performed on the information of the new transaction according to the processing sequence to obtain signature information of the new transaction, so that the signature information includes the processing sequence, and further, transaction data obtained based on the signature information includes the processing sequence of the new transaction, and then the transaction data is packaged according to the processing sequence to form a block. In this way, when the blockchain node 11 generates the block, the corresponding transaction data is packed according to the processing sequence of each transaction, that is, the transaction data is packed according to the sequence in which the blockchain node 11 obtains the information of the corresponding transaction, so that all the transaction data can be processed without missing some transaction data.
It should be noted that, in the above steps 101 to 104 are methods for packaging data of new transactions to form a block, in a specific embodiment, when a block is formed by packaging transaction data of a plurality of transactions by a certain blockchain node 11, the block may be sent to other blockchain nodes 11, and the other blockchain nodes 11 need to verify the received block, verify the validity of the received block, and store the received block after the verification is passed. Specifically, as shown in fig. 3, any blockchain node 11 may verify any block as follows:
Specifically, when verifying the transaction data of each target transaction, it is mainly verified whether the target processing sequence of each target transaction and the information of the target transaction determined by the target blockchain node 11 in the transaction data are tampered, specifically, signature information corresponding to the blockchain node 11 in the transaction data of each target transaction included in the target block may be decrypted first to obtain a decrypted target processing sequence and decrypted target transaction information, if the decrypted target processing sequence is consistent with the processing sequence generated by the target blockchain node based on the target transaction, and if the decrypted target processing sequence is consistent with the information of the target blockchain node, verification of the transaction data of the target transaction is passed, otherwise, verification of the transaction data of the target transaction is not passed.
When decrypting the corresponding signature information in the target block, the decryption key can be obtained according to the address information of the target blockchain node 11, and then the corresponding signature information can be directly decrypted according to the decryption key.
Specifically, the blockchain node 11 may first acquire target processing sequences corresponding to a plurality of target transactions included in the target block, and detect whether the target processing sequences of the plurality of target transactions are consistent with sequences of transaction data of the plurality of target transactions in the target block, and if so, verify that the target processing sequences are passed; if the target processing sequences are inconsistent, the verification of the target processing sequences is not passed.
For example, the transaction data of the plurality of target transactions (such as a1, a2, … …, an) are arranged in a block in the order of 1, 2, … …, n, and the target processing order of the plurality of target transactions is b1, b2, … …, bn respectively, and if the order between 1, 2, … …, n and b1, b2, … …, bn is consistent, the verification of the target processing order is passed, otherwise the verification is not passed. For example, bi (i is a natural number between 1 and n) is less than or equal to bi-1, etc., and is inconsistent.
In a specific implementation, the blockchain node 11 may calculate a verification parameter for any target transaction, specifically, the verification parameter of the target transaction in the first order in the target block may be 1; in addition to the target transactions arranged in the first order in the target block, the verification parameter of any other target transaction may be that the difference between the target processing order of any target transaction and the target processing order of the previous target transaction of any target transaction is less than zero, so as to determine that the verification of the target processing order is not passed. When all verification parameters of the target transaction are larger than zero, the verification of the target processing sequence is passed. Wherein any one target transaction and the previous target transaction are target transactions that are arranged adjacent in a target block.
When the verification of the target block is passed, the target block is considered to be reliable, the target block can be directly stored, and each target transaction in the target block is executed.
Further, if the second verification result is that the verification of the target processing sequence of the target transactions is not passed, or the first verification result includes that the verification of the transaction data of any target transaction is not passed, the verification of the target block is not passed. In this case, each target transaction in the target block is rejected.
It can be seen that by verifying the target block on two-way basis, the reliability of the target block stored in the blockchain node 11 is ensured.
The block generation method of the present invention is described below in a specific embodiment, in which the blockchain system is shown in fig. 4, and includes: an application terminal 20 and a plurality of blockchain nodes 21, such as blockchain nodes A, B and C, etc., wherein:
the blockchain node (also called mining node) 21 is mainly a server, and may include a trusted hardware execution environment 210 and an accounting program 211, and is externally represented as a unified node for handling communication, broadcasting, consensus, etc. between the external and other P2P nodes.
The trusted hardware execution environment 210 (TEE, trusted Execution Environment) mainly protects operations and operations related to private data through a hardware isolation means, and an attacker cannot directly read the private data and a system key in the trusted hardware execution environment on the premise of not cracking hardware, so that confidentiality of the data is guaranteed, and meanwhile, the attacker cannot tamper detection through solidified hardware logic and a hardware level, so that the running process of a related system is guaranteed not to be tampered maliciously. The method is characterized by comprising the steps of physically isolating key storage space and physically isolating code running environment.
In a specific application, the transaction processed by the accounting program 211 is mainly a blockchain transaction, and the blockchain transaction is sent by a transaction sender, so that the accounting program 211 packages the transaction into the blockchain, and takes the transaction of the account model as an example, the sending address, the target address, the amount, the contract call parameters and the like of the transaction are included.
As shown in fig. 5, the block generating method in this embodiment may include the following steps:
In step 301, when the user initiates a new transaction through the application terminal 20 by operating the application terminal 20, the hash value txrawhhash of the metadata of the new transaction may be calculated, and the calculated hash value may be sent to all blockchain nodes 21 with block authority, such as blockchain nodes A, B and C.
In step 302, each blockchain node 21 obtains signature information of the new transaction through the trusted hardware execution environment 210, and then returns the signature information of the new transaction to the application terminal 20. Specifically:
the blockchain node 21 will determine the processing sequence of the new transaction first, in this embodiment, the identifier encraveid preset in the blockchain node 21 is directly used X Determining a TrustId as a processing order for a new transaction X Specifically, the expression can be represented by the following formula 1:
TrustId X =EnclaveId X (1)
then the blockchain node 21 signs according to the processing sequence of the new transaction and the hash value of the metadata to obtain signature information Touser of the new transaction X Specifically, the blockchain node 21 may hash the hash value TxRawHash and the processing order trust id of the metadata of the new transaction with a preset key X Signature generation Signature information is performed, and the Signature information is used as Signature information of a new transaction. Specifically, the expression can be expressed as the following formula 2:
ToUser X =<TxRawHash,TrustId X ,Signature> (2)
Meanwhile, the blockchain node 21 alsoWill preset the identification encraveid X Adding a fixed value, such as 1, and encrypting the updated preset identifier, which can be expressed by the following formula 3, and storing the obtained encrypted storage information tostore X :
ToStorage X =Crypto(EnclaveId X ) (3)
In step 303, the application terminal 20 receives the signature information of the new transaction based on each blockchain node 21, obtains the transaction data of the new transaction according to the received signature information, and broadcasts the obtained transaction data.
Specifically, the application terminal 20 may add the signature information returned by each blockchain node 21 to the sequence of the metadata TxRaw of the new transaction, to obtain a new sequence TxNew, which may be specifically expressed by the following formula 4:
TxNew=TxRaw+ToUser A +ToUser B +ToUser C +.... (4)
further, the application terminal 20 may sign the new sequence TxNew again to obtain the transaction data of the new transaction. When the new sequence TxNew is signed again, the new sequence may be signed according to a key preset in the application terminal 20, and the obtained signature information is the transaction data of the new transaction.
In step 304, when the blockchain node 21 receives the transaction data of the new transaction, and when the data packing condition of the transaction data is reached, a block may be generated by the trusted hardware execution environment 210 and the accounting program 211, in this embodiment, unpacked transaction data is packed according to the processing sequence included in the transaction data to form a block, and the block may be sent to other blockchain nodes 21.
Specifically, the unpacked transaction data are ordered according to the processing sequence contained in the unpacked transaction data, and the unpacked transaction data are packed according to the ordering sequence to form a block. Since the blockchain node 21 determines the processing order of each transaction mainly monotonically increases in the order in which the blockchain node 21 receives the information of each transaction (specifically, the hash value of the metadata of the transaction), the packing order of the transaction data is also based on the order in which the information of each transaction was received.
As shown in FIG. 6, the blockchain node 21 may implement verification of blocks sent by other blockchain nodes as follows:
in step 401, the blockchain node 21 receives the target blocks sent by other target blockchain nodes 21, where the target blocks include transaction data of a plurality of target transactions (m target transactions are illustrated in the figure).
Step 402, verifying the transaction data of each target transaction in the target block to obtain a first verification result, where the first verification result includes information about whether the verification of the transaction data of any target transaction is passed, and rejecting the target block if the verification of the transaction data of any target transaction is not passed.
Specifically, the blockchain node 21 first obtains address information address (X) of the target blockchain node, and obtains a decryption key pubkey X according to the address information, as shown in the following formula 5:
PubkeyX=PubkeyOf(AddressOf(X)) (5)
the blockchain node 21 then decrypts the Signature information Signature corresponding to the link points of the target block in the target block, so as to obtain the decrypted target processing sequence and the decrypted target transaction information.
Further, the blockchain node 21 detects whether the decrypted target processing order is consistent with the processing order generated by the target blockchain node based on the target transaction, and if so, the verification of the transaction data of the target transaction is passed.
Specifically, whether the asymmetric encryption verification function value obtained by the following formula 6 is true is detected, and if true, verification of transaction data of the target transaction is passed:
step 403, if the first verification result indicates that the verification of the transaction data of each target transaction is passed, continuing to obtain the second verification result, wherein the blockchain node 21 will first obtain the target processing sequence corresponding to each target transaction included in the target block
In step 404, the blockchain node 21 verifies the target processing orders of the target transactions obtained in step 403 to obtain a second verification result, where the second verification result includes information about whether the verification of the target processing order is passed, and if the verification of the target processing order is not passed, the target block is rejected.
Specifically, the blockchain node 21 may first calculate a verification parameter Check for each target transaction i Specifically, the following formula 7 may be expressed, that is, the verification parameters of other target transactions except for the verification parameter of the first target transaction in the target block is 1 are the difference between the target processing sequence and the target processing sequence of the previous target transaction:
the order of a certain target transaction in the target block is legal when the verification parameter of the certain target transaction is greater than 0, and the order of the target transaction in the target block is illegal when the verification parameter of the certain target transaction is less than 0. Further, when a certain target transaction is illegal, verification of the target processing order of the plurality of target transactions is not passed.
In step 405, the blockchain node 21 may further perform conventional verification on each target transaction in the target block to obtain a third verification result, where the third verification result includes information about whether verification on the target transaction is passed, and reject the target block if the conventional verification on any target transaction is not passed.
Specifically, the regular verification of the target block by the blockchain node 21 of the target transaction may include, but is not limited to, the following verification: detecting whether the information of each target transaction after execution is consistent with the information recorded in the block header, if so, passing the conventional verification of the target transaction, and if not, rejecting the target block without passing the conventional verification of the target transaction. The information of any target transaction after the execution can include information such as the status root, receipt root, transaction tree root and the like of the target transaction after the execution.
Because the target block link point places the relevant information of the target transaction (which may include information such as the status root of the target transaction) into the block header of the target block when the target block is generated, the current block chain node 21 needs to perform conventional verification on the information in the block header after receiving the target block.
The verification between the steps 403 to 405 is not absolutely related to the order, and may be performed simultaneously, sequentially, or in a different order.
It can be seen that through the verification of the target block in this embodiment, the following aspects can be ensured:
(1) The intra-block ordering is reliable, and the processing sequence determined by the block link points is added into the transaction data to be packaged, so that when the transaction data are packaged to form a block, the transaction data can be packaged based on the processing sequence corresponding to each transaction data, and the ordering of the transaction data of different transactions is reliable.
(2) The intra-block ordering can verify, and the target processing sequence of a plurality of target transactions and the transaction data of each target transaction can be verified by including the target processing sequence in the transaction data of each target transaction in any block (such as the target block), so that the reliability of each block is further ensured.
In the following, another specific application example is described to illustrate the block generation method in the present invention, where the blockchain system in the embodiment of the present invention is mainly a distributed system 100, and the distributed system may include a client 300 and a plurality of nodes 200 (any type of computing devices in an access network, such as a server and a user terminal), where the client 300 and the nodes 200 are connected by a network communication.
Taking the distributed system as an example of a blockchain system, referring To fig. 7, an optional structural schematic diagram of the application of the distributed system 100 To the blockchain system according To the embodiment of the present invention is formed by a plurality of nodes 200 (any type of computing devices in an access network, such as servers and user terminals) and clients 300, where a Peer-To-Peer (P2P, peer To Peer) network is formed between the nodes, and the P2P protocol is an application layer protocol running on top of a transmission control protocol (TCP, transmission Control Protocol) protocol. In a distributed system, any machine, such as a server, a terminal, may join to become a node, including a hardware layer, an intermediate layer, an operating system layer, and an application layer.
Referring to the functionality of each node in the blockchain system shown in fig. 7, the functions involved include:
1) The routing, the node has basic functions for supporting communication between nodes.
Besides the routing function, the node can also have the following functions:
2) The application is used for being deployed in a block chain to realize specific service according to actual service requirements, recording data related to the realization function to form recorded data, carrying a digital signature in the recorded data to represent the source of task data, sending the recorded data to other nodes in the block chain system, and adding the recorded data into a temporary block when the source and the integrity of the recorded data are verified by the other nodes.
For example, the service implemented by the application includes code for implementing a block generation function, and the information processing function mainly includes:
when the information of the new transaction of the application terminal is acquired, determining the processing sequence of the new transaction, wherein the processing sequence is used for identifying the sequence of the block link points for acquiring the information of the new transaction; signing according to the processing sequence and the information of the new transaction to obtain signature information corresponding to the new transaction; returning the signature information to the application terminal so that the application terminal can acquire transaction data of the new transaction according to the signature information; and when the transaction data sent by the application terminal is received, packaging the transaction data according to the processing sequence contained in the transaction data to form a block.
3) The blockchain comprises a series of blocks (blocks) which are connected with each other according to the generated sequence time, the new blocks are not removed once being added into the blockchain, and record data submitted by nodes in the blockchain system are recorded in the blocks.
Referring to fig. 8, an optional Block Structure (Block Structure) provided in an embodiment of the present invention is shown, where each Block includes a hash value of a transaction record stored in the Block (hash value of the Block) and a hash value of a previous Block, and each Block is connected by the hash value to form a blockchain. In addition, the block may include information such as a time stamp at the time of block generation. The Blockchain (Blockchain), which is essentially a de-centralized database, is a string of blocks, i.e., blocks, that are generated in association using cryptographic methods, each of which contains associated information that is used to verify the validity of its information (anti-counterfeit) and to generate the next block.
The embodiment of the invention also provides a blockchain node, the structural schematic diagram of which is shown in fig. 9, and the blockchain node specifically can comprise:
and a sequence determining unit 30, configured to determine, when information of a new transaction of the application terminal is acquired, a processing sequence of the new transaction, where the processing sequence is used to identify a sequence in which the block link points acquire the information of the new transaction.
The order determination unit 30 is in particular arranged to determine a preset identification as the processing order of the new transaction, in which case the preset identification is also increased by a fixed value.
Alternatively, the sequence determining unit 30 is specifically configured to determine that the preset identifier is increased by a fixed value as the processing sequence of the new transaction; in this case also for updating the processing order of the preset identity as the new transaction.
And a signature obtaining unit 31, configured to sign according to the processing sequence determined by the sequence determining unit 30 and the information of the new transaction, and obtain signature information corresponding to the new transaction.
And a data returning unit 32, configured to return the signature information acquired by the signature acquiring unit 31 to the application terminal, so that the application terminal acquires the transaction data of the new transaction according to the signature information.
And the packaging unit 33 is configured to, when receiving the transaction data sent by the application terminal, package the transaction data according to the processing sequence included in the transaction data to form a block.
Further, the blockchain node of the embodiment may further include:
a verification unit 34, configured to obtain a target block of the target blockchain node, where the target block includes transaction data of a plurality of target transactions; verifying the transaction data of each target transaction in the plurality of target transactions to obtain a first verification result; if the first verification result is that the verification of the transaction data of each target transaction is passed, verifying the target processing sequences of the target transactions to obtain a second verification result; and if the second verification result is that the verification of the target processing sequence is passed, the verification of the target block is passed.
The verification unit 34 verifies the transaction data of each target transaction in the plurality of target transactions to obtain a first verification result, and is specifically configured to decrypt signature information corresponding to the link points of the target block in the transaction data of the target transaction included in the target block to obtain a decrypted target processing sequence; and if the decrypted target processing sequence is consistent with the processing sequence generated by the target block link point based on the target transaction, verifying the transaction data of the target transaction.
The verification unit 34 verifies the target processing sequences of the target transactions to obtain a second verification result, and is specifically configured to obtain target processing sequences corresponding to the target transactions included in the target block; and if the target processing sequence of the target transactions is consistent with the sequence of the transaction data of the target transactions in the target block, verifying the target processing sequence.
If the target processing orders of the target transactions are consistent with the orders of the transaction data of the target transactions in the target block, the verification unit 34 verifies that the target processing orders pass, specifically including:
If the difference between the target processing sequence of any target transaction and the target processing sequence of the previous target transaction of any target transaction is smaller than zero, the verification of the target processing sequence is not passed;
the any one target transaction and the previous target transaction are adjacent target transactions in the target block.
After the node in this embodiment obtains the information of the new transaction, the sequence determining unit 30 determines the processing sequence of the new transaction, which is used to indicate the sequence of obtaining the information of the new transaction by the block link point, the signature obtaining unit 31 signs the information of the new transaction according to the processing sequence to obtain the signature information of the new transaction, so that the signature information includes the processing sequence, and the data returning unit 32 further includes the processing sequence of the new transaction in the transaction data obtained based on the signature information, and the packing unit 33 packs the transaction data according to the processing sequence to form a block. In this way, when generating the block, the block link point packages the corresponding transaction data according to the processing sequence of each transaction, that is, packages the transaction data according to the sequence in which the block link node obtains the information of the corresponding transaction, so that all the transaction data can be processed without missing some transaction data.
Embodiments of the present invention also provide a server, whose structure is schematically shown in fig. 10, where the server may have a relatively large difference due to different configurations or performances, and may include one or more central processing units (central processing units, CPU) 40 (e.g., one or more processors) and a memory 41, and one or more storage media 42 (e.g., one or more mass storage devices) storing application 421 or data 422. Wherein the memory 41 and the storage medium 42 may be transitory or persistent storage. The program stored on the storage medium 42 may include one or more modules (not shown), each of which may include a series of instruction operations on the server. Still further, the central processor 40 may be arranged to communicate with a storage medium 42, executing a series of instruction operations on the server in the storage medium 42.
Specifically, the application 421 stored in the storage medium 42 includes an application for block generation, and the program may include the order determining unit 30, the signature acquiring unit 31, the data returning unit 32, the packaging unit 33, and the verifying unit 34 in the above-described blockchain node, which will not be described in detail herein. Still further, the central processor 40 may be configured to communicate with the storage medium 42 and execute a series of operations corresponding to the block-generated application program stored in the storage medium 42 on the server.
The server may also include one or more power supplies 43, one or more wired or wireless network interfaces 44, one or more input/output interfaces 45, and/or one or more operating systems 423, such as Windows ServerTM, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
The steps performed by the blockchain node described in the method embodiments above may be based on the structure of the server shown in fig. 10.
Still further, another aspect of the embodiments of the present invention provides a computer readable storage medium storing a plurality of computer programs adapted to be loaded by a processor and to perform a block generation method as performed by a blockchain node as described above.
In another aspect, the embodiment of the invention further provides a server, which comprises a processor and a memory;
the memory is used for storing a plurality of computer programs, and the computer programs are used for being loaded by a processor and executing the block generation method executed by the block chain node; the processor is configured to implement each of the plurality of computer programs.
The embodiment of the invention also provides a block chain system, which comprises: an application terminal and a plurality of blockchain nodes, the blockchain nodes being blockchain nodes as shown in fig. 9 or servers as shown in fig. 10.
Further, according to an aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the block generation method provided in the various alternative implementations described above.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like.
The above description of the block generating method, the blockchain system, the storage medium and the related devices provided by the embodiments of the present invention has been provided in detail, and specific examples are applied to illustrate the principles and the implementation of the present invention, and the above description of the embodiments is only used to help understand the method and the core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
Claims (12)
1. A block generation method, comprising:
when the information of the new transaction of the application terminal is acquired, determining the processing sequence of the new transaction, wherein the processing sequence is used for identifying the sequence of the block link points for acquiring the information of the new transaction;
signing according to the processing sequence and the information of the new transaction to obtain signature information corresponding to the new transaction;
returning the signature information to the application terminal so that the application terminal can acquire transaction data of the new transaction according to the signature information;
and when the transaction data sent by the application terminal is received, packaging the transaction data according to the processing sequence contained in the transaction data to form a block.
2. The method of claim 1, wherein said determining the processing order of the new transaction, in particular, comprises: determining a preset identification as the processing sequence of the new transaction,
the method further comprises the steps of: and adding a fixed value to the preset mark.
3. The method of claim 1, wherein said determining the processing order of the new transaction, in particular, comprises: adding a fixed value to a preset mark to determine the processing sequence of the new transaction;
The method further comprises the steps of: updating the preset identification as the processing sequence of the new transaction.
4. A method according to any one of claims 1 to 3, wherein the method further comprises:
acquiring a target block of a target block chain node, wherein the target block comprises transaction data of a plurality of target transactions;
verifying the transaction data of each target transaction in the plurality of target transactions to obtain a first verification result;
if the first verification result is that the verification of the transaction data of each target transaction is passed, verifying the target processing sequences of the target transactions to obtain a second verification result;
and if the second verification result is that the verification of the target processing sequence is passed, the verification of the target block is passed.
5. The method of claim 4, wherein verifying the transaction data for each of the plurality of target transactions results in a first verification result, specifically comprising:
decrypting signature information corresponding to the link points of the target block in the transaction data of the target transaction contained in the target block to obtain a decrypted target processing sequence;
And if the decrypted target processing sequence is consistent with the processing sequence generated by the target block link point based on the target transaction, verifying the transaction data of the target transaction.
6. The method of claim 4, wherein verifying the target processing order of the plurality of target transactions results in a second verification result, specifically comprising:
acquiring target processing sequences respectively corresponding to a plurality of target transactions contained in the target block;
and if the target processing sequence of the target transactions is consistent with the sequence of the transaction data of the target transactions in the target block, verifying the target processing sequence.
7. The method of claim 6, wherein if the target processing order of the plurality of target transactions is consistent with the order of the transaction data of the plurality of target transactions in the target block, the verification of the target processing order is passed, specifically comprising:
if the difference between the target processing sequence of any target transaction and the target processing sequence of the previous target transaction of any target transaction is smaller than zero, the verification of the target processing sequence is not passed;
The any one target transaction and the previous target transaction are adjacent target transactions in the target block.
8. A blockchain node, comprising:
the sequence determining unit is used for determining the processing sequence of the new transaction when the information of the new transaction of the application terminal is acquired, wherein the processing sequence is used for identifying the sequence of the block link point for acquiring the information of the new transaction;
the signature acquisition unit is used for signing according to the processing sequence and the information of the new transaction to obtain signature information corresponding to the new transaction;
the data return unit is used for returning the signature information to the application terminal so that the application terminal can acquire the transaction data of the new transaction according to the signature information;
and the packaging unit is used for packaging the transaction data according to the processing sequence contained in the transaction data to form a block when the transaction data sent by the application terminal is received.
9. A blockchain system, comprising: an application terminal and a plurality of blockchain nodes, the blockchain nodes being the blockchain nodes of claim 8.
10. A computer readable storage medium storing a plurality of computer programs adapted to be loaded by a processor and to perform the block generation method according to any of claims 1 to 7.
11. A server comprising a processor and a memory;
the memory is used for storing a plurality of computer programs for loading and executing the block generating method according to any one of claims 1 to 7 by a processor; the processor is configured to implement each of the plurality of computer programs.
12. A computer program product comprising computer instructions stored in a computer readable storage medium, the computer instructions being adapted to be loaded by a processor and to perform the block generation method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111626204.2A CN116361383A (en) | 2021-12-28 | 2021-12-28 | Block generation method, block chain system, storage medium and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111626204.2A CN116361383A (en) | 2021-12-28 | 2021-12-28 | Block generation method, block chain system, storage medium and related equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116361383A true CN116361383A (en) | 2023-06-30 |
Family
ID=86938017
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111626204.2A Pending CN116361383A (en) | 2021-12-28 | 2021-12-28 | Block generation method, block chain system, storage medium and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116361383A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116634025A (en) * | 2023-07-25 | 2023-08-22 | 杭州趣链科技有限公司 | Method, equipment, system and storage medium for determining transaction sequence |
-
2021
- 2021-12-28 CN CN202111626204.2A patent/CN116361383A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116634025A (en) * | 2023-07-25 | 2023-08-22 | 杭州趣链科技有限公司 | Method, equipment, system and storage medium for determining transaction sequence |
CN116634025B (en) * | 2023-07-25 | 2023-12-29 | 武汉趣链数字科技有限公司 | Method, equipment, system and storage medium for determining transaction sequence |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10747721B2 (en) | File management/search system and file management/search method based on block chain | |
US11956357B2 (en) | Traceable key block-chain ledger | |
US10824701B2 (en) | System and method for mapping decentralized identifiers to real-world entities | |
EP3721603B1 (en) | System and method for creating decentralized identifiers | |
US11455627B2 (en) | System of security using blockchain protocol | |
US20200118096A1 (en) | System and method for providing privacy and security protection in blockchain-based private transactions | |
US11706035B2 (en) | Signature verification using blockchain | |
WO2019133308A1 (en) | Secure management of content distribution data blocks on a blockchain | |
CN110839029B (en) | Micro-service registration method and device | |
CN109472164A (en) | The verification method and its network and electronic equipment of contract dataset | |
CN110264192B (en) | Receipt storage method and node based on transaction type | |
CN111476573B (en) | Account data processing method, device, equipment and storage medium | |
CN110580411B (en) | Permission query configuration method and device based on intelligent contract | |
CN110601855B (en) | Root certificate management method and device, electronic equipment and storage medium | |
CN109491965A (en) | The storage method and its network and electronic equipment of purchase sale of electricity contract | |
CN111597567B (en) | Data processing method, data processing device, node equipment and storage medium | |
CN109754226B (en) | Data management method, device and storage medium | |
CN116361383A (en) | Block generation method, block chain system, storage medium and related equipment | |
US12051061B2 (en) | Method for operating a distributed database system, distributed database system, and industrial automation system | |
CN116980155A (en) | Data processing method, device, product, equipment and medium of block chain network | |
CN112241513B (en) | Digital asset processing system to be authenticated | |
CN117040930B (en) | Resource processing method, device, product, equipment and medium of block chain network | |
CN118154304A (en) | Transaction processing method, device, product, equipment and medium of blockchain network | |
JP2023036489A (en) | Data storage system using blockchain, and method thereof | |
CN116996226A (en) | Virtual asset processing method, device, equipment and medium in blockchain |
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 |