A block generation method, a blockchain system, a storage medium, and related equipment.

By determining the processing order and signing blockchain transactions, the problem of unpackaged transactions is solved, achieving complete processing of all transaction data and ensuring the reliability of the blockchain system.

CN116361383BActive Publication Date: 2025-12-02TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111626204.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-12-02
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

In existing blockchain platforms, some transactions are not packaged, leading to the problem of them being unable to be executed.

Method used

By determining the processing order of transactions, signing and returning signature information to the application terminal, the application terminal obtains transaction data based on the signature information and packages it into blocks according to the processing order.

Benefits of technology

This ensures that all transaction data is processed, prevents data omissions, and improves the reliability of the blockchain system and the integrity of transaction execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116361383B_ABST
    Figure CN116361383B_ABST
Patent Text Reader

Abstract

This invention discloses a block generation method, a blockchain system, a storage medium, and related equipment, applicable to the field of information processing technology. When a blockchain node receives information about a new transaction, it determines the processing order of that new transaction, representing the order in which the blockchain node received the information about the new transaction. Based on this processing order, the new transaction information is signed to obtain the signature information of the new transaction. This signature information contains the processing order, and the transaction data obtained based on the signature information also contains the processing order of the new transaction. The transaction data is then packaged according to this processing order to form a block. In this way, when generating a block, the blockchain node packages the corresponding transaction data according to the processing order of each transaction, that is, according to the order in which the blockchain node received the information about the corresponding transaction, ensuring that all transaction data is processed without missing any transaction data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information processing technology, and in particular to a block generation method, a blockchain system, a storage medium, and related equipment. Background Technology

[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, it is a decentralized database, a series of blocks linked together using cryptographic methods, with each block containing information about a batch of network transactions.

[0003] Existing blockchain platforms allow nodes to package transactions into blocks, with each block including a block header and data content.

[0004] However, in the existing block generation process, some nodes may keep placing transactions for a certain address at the end of the transaction pool (or queue), so that the transaction is never packaged and therefore will never be included in the generated block, thus preventing the transaction from being executed. Summary of the Invention

[0005] This invention provides a block generation method, a blockchain system, a storage medium, and related equipment, ensuring that all transaction data is processed.

[0006] One embodiment of the present invention provides a block generation method, comprising:

[0007] When new transaction information is obtained from the application terminal

[0008] The processing order of the new transaction is determined, and the processing order is used to identify the order in which blockchain nodes obtain information about the new transaction;

[0009] The signature information corresponding to the new transaction is obtained by signing according to the processing order and the information of the new transaction.

[0010] The signature information is returned to the application terminal so that the application terminal can obtain the transaction data of the new transaction based on the signature information;

[0011] When transaction data is received from the application terminal, the transaction data is packaged into blocks according to the processing order contained in the transaction data.

[0012] Another embodiment of the present invention provides a blockchain node, comprising:

[0013] The sequence determination unit is used to determine the processing order of a new transaction when the application terminal obtains the new transaction information. The processing order is used to identify the order in which the blockchain nodes obtain the new transaction information.

[0014] A signature acquisition unit is used to sign according to the processing order and the information of the new transaction to obtain the signature information corresponding to the new transaction;

[0015] A data return unit is used to return the signature information to the application terminal so that the application terminal can obtain the transaction data of the new transaction based on the signature information;

[0016] The packaging unit is used to package the transaction data into blocks according to the processing order contained in the transaction data when it receives transaction data sent by the application terminal.

[0017] Another aspect of the present invention provides a blockchain system, including: an application terminal and multiple blockchain nodes, wherein the blockchain nodes are as described in another aspect of the present invention.

[0018] Another aspect of the present invention provides a computer-readable storage medium storing a plurality of computer programs adapted for loading by a processor and executing the block generation method as described in one aspect of the present invention.

[0019] Another embodiment of the present invention provides a server, including a processor and a memory;

[0020] The memory is used to store multiple computer programs, which are loaded by a processor and executed as described in one aspect of the block generation method of the present invention; the processor is used to implement each of the multiple computer programs.

[0021] As can be seen, in the method of this embodiment, when a blockchain node obtains information about a new transaction, it determines the processing order of the new transaction, which represents the order in which the blockchain node obtained the information about the new transaction. Based on the processing order, the information about the new transaction is signed to obtain the signature information of the new transaction. This signature information contains the processing order, and thus the transaction data obtained based on the signature information also contains the processing order of the new transaction. The transaction data is then packaged according to this processing order to form a block. In this way, when generating a block, the blockchain node packages the corresponding transaction data according to the processing order of each transaction, that is, according to the order in which the blockchain node obtained the information about the corresponding transaction, ensuring that all transaction data is processed without missing any transaction data. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of a system to which a block generation method provided in an embodiment of the present invention is applied;

[0024] Figure 2 This is a flowchart of a block generation method provided in one embodiment of the present invention;

[0025] Figure 3 This is a flowchart of a method for verifying a target block in one embodiment of the present invention;

[0026] Figure 4 This is a schematic diagram of a blockchain system in one application embodiment of the present invention;

[0027] Figure 5 This is a schematic diagram of a block generation method in one application embodiment of the present invention;

[0028] Figure 6 This is a schematic diagram illustrating the verification of a target block in one application embodiment of the present invention;

[0029] Figure 7 This is a schematic diagram of a distributed system to which the block generation method of this invention is applied in another application embodiment of the invention;

[0030] Figure 8 This is a schematic diagram of the block structure in another application embodiment of the present invention;

[0031] Figure 9 This is a schematic diagram of the logical structure of a blockchain node provided in an embodiment of the present invention;

[0032] Figure 10 This is a schematic diagram of the logical structure of a server provided in an embodiment of the present invention. Detailed Implementation

[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0034] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0035] This invention provides a block generation method, which can be mainly applied to, for example... Figure 1 The blockchain system shown may include application terminals 10 and multiple (n in the diagram) blockchain nodes 11, wherein:

[0036] Application terminal 10 is mainly used to initiate transactions and obtain transaction data for the initiated transactions and send it to blockchain node 11.

[0037] Specifically, the transaction initiated by application terminal 10 can refer to a blockchain transaction, which generally manifests as the transfer of a certain amount of money from certain specific accounts to other specific accounts, or as the invocation of a smart contract. The execution process of a transaction in the blockchain is carried out according to its order of arrangement within the block. The blockchain is a data structure composed of several blocks linked together by hash values. Each block consists of transaction data generated within a certain period of time, packaged by the blockchain node 11 that has the right to record transactions, and independently verified by each blockchain node 11.

[0038] Blockchain node 11 is used to receive transaction data initiated by application terminals 10 of various users, and package the transaction data to form blocks. In this embodiment, blockchain node 11 will assign corresponding processing order to different transactions initiated by application terminals 10 of different users according to a preset strategy, thereby packaging the transaction data of multiple transactions into blocks according to the processing order, so that all transaction data received by blockchain node 11 will be processed and no transaction data will be missed.

[0039] Generally, a transaction initiated by application terminal 10 can be packaged by one or more blockchain nodes 11.

[0040] Specifically, such as Figure 2 As shown, the blockchain node 11 in this embodiment can form a block according to the following steps:

[0041] Step 101: When new transaction information is obtained from application terminal 10, the processing order of the new transaction is determined. This processing order is used to identify the order in which blockchain node 11 obtains the information.

[0042] It is understood that users can operate any application terminal 10 to make the application terminal 10 initiate various types of transactions. When the application terminal 10 initiates a new transaction, it can send the information of the new transaction to all blockchain nodes 11 that have block production permissions for the new transaction. Then, the blockchain nodes 11 will initiate the block generation process of this embodiment.

[0043] Block creation permission refers to the authority to package and store the transaction data of a new transaction. One or more blockchain nodes 11 may have block creation permission for a given new transaction, and this permission can be determined by the specific application or application terminal 10. The information of the new transaction can be its metadata or its hash value. The metadata may include: the transaction amount, source, purpose, counterparty, and the time and fees incurred by the transaction.

[0044] In this embodiment, when any blockchain node 11 initiates the process of this embodiment, it first determines the processing order of new transactions. This processing order describes the order in which the blockchain node 11 packages the transaction data of the new transaction. The processing order of any transaction is not randomly generated; it must be ensured that the processing order of any transaction can identify the order in which the blockchain node 11 obtains the information of that transaction.

[0045] Specifically, in one scenario, blockchain node 11 can directly determine the processing order of new transactions using a pre-set identifier. In this case, blockchain node 11 also needs to increment the pre-set identifier by a fixed value, such as 1. In another scenario, blockchain node 11 can increment the pre-set identifier by a fixed value to determine the processing order of new transactions. In this case, blockchain node 11 also needs to update the pre-set identifier to reflect the current processing order of new transactions. Thus, when blockchain node 11 initiates the process of this embodiment again, the processing order determined for another transaction will be placed after the processing order of the aforementioned new transaction.

[0046] The preset identifier is stored in blockchain node 11 beforehand. Initially, the preset identifier can be any natural number greater than zero.

[0047] Step 102: Sign the transaction according to the processing order and the information of the new transaction to obtain the signature information corresponding to the new transaction.

[0048] Specifically, when signing the processing order and information of a new transaction based on a preset key, the corresponding signature information can be obtained, and the processing order of the new transaction is contained in the signature information.

[0049] Step 103: Return the obtained signature information to the application terminal 10 so that the application terminal 10 can obtain the transaction data of the new transaction based on the signature information.

[0050] Once all blockchain nodes 11 with block-producing permissions for the aforementioned new transaction data return the corresponding signature information to the application terminal 10, the application terminal 10 will obtain the transaction data of the new transaction based on the signature information returned by each blockchain node 11 and broadcast the transaction data.

[0051] In the process of acquiring transaction data, the signature information obtained by each blockchain node 11 can be added to the sequence of metadata of the new transaction to obtain the transaction data of the new transaction. In this way, the transaction data of the new transaction will contain the processing order determined by each blockchain node 11 for the new transaction.

[0052] Step 104: When the transaction data sent by the application terminal 10 is received, the transaction data is packaged into blocks according to the processing order contained in the transaction data.

[0053] When any blockchain node 11 receives transaction data, it can add the new transaction to the block queue, which may include transactions without packaged transaction data. Furthermore, when the data packaging conditions are met, the currently unpackaged transaction data can be packaged. Specifically, blockchain node 11 can sort the transaction data according to the processing order contained in the currently unpackaged transaction data, and then package the transaction data according to the sorting to form a block. A single block can package transaction data from multiple different application terminals. The data packaging conditions may include, but are not limited to, any of the following: the number of transactions corresponding to the currently unpackaged transaction data reaches a threshold, the period for packaging the current transaction data reaches a certain threshold, etc.

[0054] Not all blockchain nodes 11 with block-generating authority will necessarily package the transaction data of the new transaction. Which blockchain nodes 11 need to generate blocks depends on the specific application or application terminal 10. Once a blockchain node 11 generates a block, it can send the block to other blockchain nodes 11 with block-generating authority for storage.

[0055] As can be seen, in the method of this embodiment, when blockchain node 11 obtains information about a new transaction, it determines the processing order of the new transaction, which represents the order in which blockchain node 11 obtains the information about the new transaction. Based on the processing order, the information about the new transaction is signed to obtain the signature information of the new transaction. This signature information contains the processing order, and thus the transaction data obtained based on the signature information also contains the processing order of the new transaction. The transaction data is then packaged according to this processing order to form a block. In this way, when blockchain node 11 generates a block, it packages the corresponding transaction data according to the processing order of each transaction, that is, according to the order in which blockchain node 11 obtains the information about the corresponding transaction, ensuring that all transaction data is processed without missing any transaction data.

[0056] It should be noted that steps 101 to 104 above describe a method for packaging new transaction data into blocks. In a specific embodiment, after a blockchain node 11 packages transaction data from multiple transactions into a block, it can send the block to other blockchain nodes 11. The other blockchain nodes 11 need to verify the received block to confirm its legality. If the verification is successful, they store the received block. Specifically, as shown... Figure 3 As shown, any blockchain node 11 can verify any block in the following way:

[0057] Step 201: Obtain the target block of the target blockchain node. The target block includes transaction data of multiple target transactions.

[0058] Step 202: Verify the transaction data of each of the multiple target transactions to obtain the first verification result.

[0059] Specifically, when verifying the transaction data of each target transaction, the main focus is on verifying whether the target processing order of each target transaction determined by the target blockchain node 11 and the information of the target transaction have been tampered with. Specifically, the signature information corresponding to the blockchain node 11 in the transaction data of each target transaction contained in the target block can be decrypted first to obtain the decrypted target processing order and the decrypted target transaction information. If the decrypted target processing order is consistent with the processing order generated by the target blockchain node based on the target transaction, and whether the decrypted target processing order is consistent with the information of the target blockchain node, then the verification of the transaction data of the target transaction is successful; otherwise, the verification of the transaction data of the target transaction fails.

[0060] Specifically, when decrypting the corresponding signature information in the target block, the decryption key can be obtained based on the address information of the target blockchain node 11, and then the corresponding signature information can be decrypted directly based on the decryption key.

[0061] Step 203: If the first verification result is that the verification of the transaction data of each target transaction is passed, the target processing order of multiple target transactions is verified to obtain the second verification result.

[0062] Specifically, blockchain node 11 can first obtain the target processing order corresponding to the multiple target transactions contained in the target block, and check whether the target processing order of the multiple target transactions is consistent with the order of the transaction data of the multiple target transactions in the target block. If they are consistent, the verification of the target processing order is successful; if they are inconsistent, the verification of the target processing order is unsuccessful.

[0063] For example, the transaction data of multiple target transactions (such as a1, a2, ..., an) are arranged in the order 1, 2, ..., n in a block, while the target processing order of the multiple target transactions is b1, b2, ..., bn. If the order 1, 2, ..., n is consistent with the order b1, b2, ..., bn, then the verification of the target processing order passes; otherwise, the verification fails. For example, if bi (where i is a natural number between 1 and n) is less than or equal to bi-1, then they are inconsistent.

[0064] In its implementation, blockchain node 11 can calculate a verification parameter for any target transaction. Specifically, the verification parameter for the target transaction that is first in the target block can be 1. For any other target transaction, the verification parameter can be determined by the difference between the target processing order of that target transaction and the target processing order of its preceding target transaction being less than zero; otherwise, the verification of the target processing order fails. When the verification parameters of all target transactions are greater than zero, the verification of the target processing order passes. Here, any target transaction and its preceding target transaction are adjacent in the target block.

[0065] Step 204: If the second verification result is that the verification of the target processing order of multiple target transactions is successful, the verification of the target block is successful.

[0066] When the target block passes verification, it is considered reliable and can be directly stored, and the target transactions in the target block can be executed.

[0067] Furthermore, if the second verification result fails to verify the target processing order of multiple target transactions, or if the first verification result fails to verify the transaction data of any target transaction, then the verification of the target block fails. In this case, all target transactions in the target block are rejected.

[0068] As can be seen, by verifying the target block based on two aspects, the reliability of the target block stored in blockchain node 11 is guaranteed.

[0069] The following specific embodiment illustrates the block generation method of the present invention. In this embodiment, the blockchain system is as follows: Figure 4 As shown, it includes: application terminal 20 and multiple blockchain nodes 21, such as blockchain nodes A, B, and C, etc., wherein:

[0070] A blockchain node (also known as a proof-of-work computing node) 21 is mainly a server, which may include a trusted hardware execution environment 210 and an accounting program 211. It appears as a unified node to the outside world and is used to handle communication, broadcasting, consensus and other functions with other P2P nodes.

[0071] The Trusted Execution Environment (TEE) primarily protects operations involving privacy-related data through hardware isolation. Without compromising the hardware, attackers cannot directly read the privacy data and system keys, thus ensuring data confidentiality. Furthermore, attackers cannot bypass the fixed hardware logic and hardware-level tamper detection, ensuring that the system's operation is not maliciously altered. Specifically, this involves physically isolated key storage and a physically isolated code execution environment.

[0072] Ledger program 211, which is the computer program used to maintain the blockchain and package and verify transactions, is generally a single binary executable program.

[0073] In practical applications, the transactions processed by the accounting program 211 are mainly blockchain transactions. Since blockchain transactions are sent by the transaction sender, the accounting program 211 will package the transactions into the blockchain. Taking the account model transaction as an example, it includes the transaction's sending address, destination address, amount, contract call parameters, etc.

[0074] like Figure 5 As shown, the block generation method in this embodiment may include the following steps:

[0075] Step 301: When a user initiates a new transaction through the application terminal 20, the user can calculate the hash value TxRawHash of the new transaction's metadata and send the calculated hash value to all blockchain nodes 21 with block production permissions, such as blockchain nodes A, B, and C.

[0076] Step 302: Each blockchain node 21 obtains the 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:

[0077] Blockchain node 21 will first determine the processing order of new transactions. In this embodiment, the pre-set identifier in blockchain node 21 is directly used. Determine the processing order for new transactions Specifically, it can be represented by the following formula 1:

[0078] (1)

[0079] Then, blockchain node 21 signs the new transaction based on the processing order of the new transaction and the hash value of the metadata, thus obtaining the signature information of the new transaction. Specifically, blockchain node 21 can use a pre-set key to determine the hash value TxRawHash of the metadata of a new transaction and the processing order. Generate signature information This signature information will be used as the signature information for the new transaction. Specifically, this can be represented by Formula 2:

[0080] (2)

[0081] At the same time, blockchain node 21 will also use the pre-set identifier. Add a fixed value, such as 1, and then encrypt the updated preset identifier. This can be represented by the following formula 3, and the resulting encrypted information is stored. :

[0082] (3)

[0083] Step 303: The application terminal 20 receives the signature information of each blockchain node 21 based on the new transaction, obtains the transaction data of the new transaction based on the received signature information, and broadcasts the obtained transaction data.

[0084] Specifically, the application terminal 20 can add the signature information returned by each blockchain node 21 to the metadata of the new transaction. From the sequence, a new sequence is obtained. Specifically, it can be represented by the following formula 4:

[0085] (4)

[0086] Furthermore, application terminal 20 can process new sequences. The transaction data for the new transaction can be obtained by re-signing. This involves the new sequence... When signing again, the new sequence can be signed using the key preset in the application terminal 20, and the resulting signature information is the transaction data of the new transaction.

[0087] Step 304: After receiving the transaction data of a new transaction, the blockchain node 21 generates a block through the trusted hardware execution environment 210 and the accounting program 211 when the data packaging conditions are met. In this embodiment, the unpackaged transaction data is packaged into a block according to the processing order contained in the transaction data, and the block can be sent to other blockchain nodes 21.

[0088] Specifically, the unpacked transaction data is sorted according to the processing order it contains, and then packaged into a block according to the sorted order. Since the blockchain node 21 determines the processing order of each transaction mainly according to the monotonically increasing order of the information received by the blockchain node 21 for each transaction (specifically, the hash value of the transaction's metadata), the packaging order of the transaction data is also based on the order in which the information of each transaction is received.

[0089] like Figure 6 As shown, blockchain node 21 can verify blocks sent by other blockchain nodes by following these steps:

[0090] Step 401: Blockchain node 21 receives the target block sent by other target blockchain nodes 21. The target block contains transaction data of multiple target transactions (the figure illustrates m target transactions as an example).

[0091] Step 402: Verify the transaction data of each target transaction in the target block to obtain a first verification result. The first verification result includes information on whether the verification of the transaction data of any target transaction is successful. If the verification of the transaction data of any target transaction fails, the target block is rejected.

[0092] Specifically, blockchain node 21 first obtains the address information AddressOf(X) of the target blockchain node, and then obtains the decryption key PubkeyX based on the address information, as shown in Formula 5 below:

[0093] (5)

[0094] Then blockchain node 21 will verify the signature information in the target block that corresponds to the target blockchain node. By decrypting, the decrypted target processing order and the decrypted target transaction information can be obtained.

[0095] Furthermore, blockchain node 21 will check whether the decrypted target processing order is consistent with the processing order generated by the target blockchain node based on the target transaction, and whether the decrypted target processing order is consistent with the information of the target blockchain node. If they are consistent, the verification of the transaction data of the target transaction is successful.

[0096] Specifically, it checks whether the asymmetric encryption verification function value obtained from Formula 6 is true. If it is true, the verification of the target transaction's transaction data passes:

[0097] (6)

[0098] Step 403: If the first verification result is that the verification of the transaction data of each target transaction is successful, then continue to obtain the second verification result. Blockchain node 21 will first obtain the target processing order corresponding to each target transaction included in the target block. .

[0099] Step 404: Blockchain node 21 verifies the target processing order of multiple target transactions obtained in step 403 to obtain a second verification result. The second verification result includes information on whether the verification of the target processing order is successful. If the verification of the target processing order fails, the target block is rejected.

[0100] Specifically, blockchain node 21 can first calculate a verification parameter for each target transaction. Specifically, this can be represented by Formula 7, where the verification parameter for the first target transaction in the target block is 1, and the verification parameter for other target transactions is the difference between the target processing order and the target processing order of the preceding target transaction:

[0101] (7)

[0102] If the verification parameter of a target transaction is greater than 0, the order of that target transaction in the target block is valid; if the verification parameter of a target transaction is less than 0, the order of that target transaction in the target block is invalid. Furthermore, if a target transaction is invalid, the verification of the target processing order of multiple target transactions fails.

[0103] In step 405, blockchain node 21 can also perform routine verification on each target transaction in the target block to obtain a third verification result. The third verification result includes information on whether the verification of the target transaction has passed. If the routine verification of any target transaction fails, the target block is rejected.

[0104] Specifically, the routine verification of the target transaction by blockchain node 21 may include, but is not limited to, the following verifications: checking whether the information of each target transaction after execution is consistent with the information recorded in the block header. If they are consistent, the routine verification of the target transaction passes; if they are inconsistent, the routine verification of the target transaction fails, and the target block is rejected. The information of any target transaction after execution may include the target transaction's state root, receipt root, transaction tree root, etc.

[0105] Since the target blockchain node places relevant information about the target transaction (including information such as the state root of the target transaction) into the block header of the target block when generating the target block, the current blockchain node 21 needs to perform routine verification on the information in the block header after receiving the target block.

[0106] The verification steps 403 to 405 above do not have an absolute order; they can be executed simultaneously, sequentially, or in different orders.

[0107] As can be seen, the following aspects can be guaranteed by verifying the target block in this embodiment:

[0108] (1) Reliable intra-block sorting: By adding the processing order determined by the blockchain nodes to the transaction data that needs to be packaged, the transaction data can be packaged based on the processing order corresponding to each transaction data when packaging the transaction data to form a block, thereby making the sorting of transaction data of different transactions reliable.

[0109] (2) Intra-block sorting is verifiable. By including the target processing order in the transaction data of each target transaction in any block (such as the target block), the target processing order of multiple target transactions and the transaction data of each target transaction can be verified, further ensuring the reliability of each block.

[0110] The following uses another specific application example to illustrate the block generation method in this invention. The blockchain system in this embodiment is mainly a distributed system 100, which may include a client 300 and multiple nodes 200 (any form of computing device in the network, such as a server or user terminal). The client 300 and the nodes 200 are connected through network communication.

[0111] Taking a distributed system as an example, see blockchain system. Figure 7 This is an optional structural diagram of the distributed system 100 provided in this embodiment of the invention applied to a blockchain system. It consists of multiple nodes 200 (any form of computing device connected to the network, such as servers or user terminals) and clients 300. The nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In the distributed system, any machine, such as a server or terminal, can join and become a node. A node includes a hardware layer, a middleware layer, an operating system layer, and an application layer.

[0112] See Figure 7The functions of each node in the blockchain system shown include:

[0113] 1) Routing: A basic function of nodes used to support communication between nodes.

[0114] In addition to routing capabilities, nodes can also have the following functions:

[0115] 2) Applications are deployed in the blockchain to implement specific business needs. They record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system. When other nodes successfully verify the source and integrity of the record data, they add the record data to a temporary block.

[0116] For example, the application's business logic includes code that implements block generation functionality, which mainly includes:

[0117] When new transaction information is obtained from the application terminal, the processing order of the new transaction is determined, and the processing order is used to identify the order in which blockchain nodes obtain the information of the new transaction; a signature is performed according to the processing order and the information of the new transaction to obtain the signature information corresponding to the new transaction; the signature information is returned to the application terminal so that the application terminal can obtain the transaction data of the new transaction according to the signature information; when the transaction data sent by the application terminal is received, the transaction data is packaged into a block according to the processing order contained in the transaction data.

[0118] 3) A blockchain consists of a series of blocks that are sequentially generated. Once a new block is added to the blockchain, it will not be removed. The blocks contain the data submitted by the nodes in the blockchain system.

[0119] See Figure 8 This is an optional schematic diagram of the block structure provided in an embodiment of the present invention. Each block includes the hash value of the transaction records stored in this block (the hash value of this block) and the hash value of the previous block. The blocks are connected through their hash values ​​to form a blockchain. Additionally, the block may also include information such as a timestamp when it was generated. A blockchain is essentially a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains relevant information used to verify the validity of the information (anti-counterfeiting) and to generate the next block.

[0120] This invention also provides a blockchain node, the structural diagram of which is shown below. Figure 9 As shown, it can specifically include:

[0121] The sequence determination unit 30 is used to determine the processing order of a new transaction when the application terminal obtains the new transaction information. The processing order is used to identify the order in which the blockchain nodes obtain the new transaction information.

[0122] The sequence determination unit 30 is specifically used to determine the preset identifier as the processing order of the new transaction. In this case, it is also used to add a fixed value to the preset identifier.

[0123] Alternatively, the sequence determination unit 30 may be specifically used to add a fixed value to a preset identifier to determine the processing order of the new transaction; in this case, it may also be used to update the preset identifier to the processing order of the new transaction.

[0124] The signature acquisition unit 31 is used to sign the new transaction according to the processing order determined by the sequence determination unit 30 and the information of the new transaction, so as to obtain the signature information corresponding to the new transaction.

[0125] The data return unit 32 is used to return the signature information obtained by the signature acquisition unit 31 to the application terminal, so that the application terminal can obtain the transaction data of the new transaction based on the signature information.

[0126] Packaging unit 33 is used to package the transaction data into blocks according to the processing order contained in the transaction data when it receives transaction data sent by the application terminal.

[0127] Furthermore, the blockchain node in this embodiment may also include:

[0128] Verification unit 34 is used to obtain the target block of the target blockchain node, the target block including transaction data of multiple target transactions; verify the transaction data of each of the multiple 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, verify the target processing order of the multiple target transactions to obtain a second verification result; if the second verification result is that the verification of the target processing order is passed, the verification of the target block is passed.

[0129] The verification unit 34 verifies the transaction data of each of the plurality of target transactions to obtain a first verification result. Specifically, it decrypts the signature information corresponding to the target blockchain node in the transaction data of the target transaction contained in the target block to obtain the decrypted target processing order. If the decrypted target processing order is consistent with the processing order generated by the target blockchain node based on the target transaction, the verification of the transaction data of the target transaction is successful.

[0130] The verification unit 34 verifies the target processing order of the multiple target transactions to obtain a second verification result. Specifically, it is used to obtain the target processing order corresponding to the multiple target transactions contained in the target block. If the target processing order of the multiple target transactions is consistent with the order of the transaction data of the multiple target transactions in the target block, then the verification of the target processing order is passed.

[0131] Specifically, if the target processing order of the multiple target transactions is consistent with the order of the transaction data of the multiple target transactions in the target block, the verification of the target processing order by the verification unit 34 is successful. This specifically includes:

[0132] If the difference between the target processing order of any target transaction and the target processing order of the preceding target transaction is less than zero, then the verification of the target processing order fails.

[0133] The target transaction is an adjacent target transaction in the target block to the previous target transaction.

[0134] After a node in this embodiment obtains information about a new transaction, the sequence determination unit 30 determines the processing order of the new transaction, which represents the order in which the blockchain nodes obtain the information about the new transaction. The signature acquisition unit 31 signs the information about the new transaction according to the processing order to obtain the signature information of the new transaction, so that the signature information contains the processing order. Consequently, the transaction data obtained by the data return unit 32 based on the signature information also contains the processing order of the new transaction. The packaging unit 33 then packages the transaction data according to the processing order to form a block. In this way, when generating a block, the blockchain node packages the corresponding transaction data according to the processing order of each transaction, that is, according to the order in which the blockchain node obtains the information about the corresponding transaction, so that all transaction data is processed without missing any transaction data.

[0135] This invention also provides a server, the structural diagram of which is shown below. Figure 10As shown, the server can vary considerably depending on its configuration or performance, and may include one or more central processing units (CPUs) 40 (e.g., one or more processors) and memory 41, and one or more storage media 42 (e.g., one or more mass storage devices) for storing application programs 421 or data 422. The memory 41 and storage media 42 can be temporary or persistent storage. The program stored in the storage media 42 may include one or more modules (not shown in the figure), each module including a series of instruction operations on the server. Furthermore, the CPU 40 may be configured to communicate with the storage media 42 and execute the series of instruction operations in the storage media 42 on the server.

[0136] Specifically, the application 421 stored in storage medium 42 includes a block-generating application, and this application may include the sequence determination unit 30, signature acquisition unit 31, data return unit 32, packaging unit 33, and verification unit 34 in the aforementioned blockchain node, which will not be elaborated here. Furthermore, the central processing unit 40 may be configured to communicate with storage medium 42 and execute a series of operations corresponding to the block-generating application stored in storage medium 42 on a server.

[0137] 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 Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0138] The steps performed by the blockchain node in the above method embodiments can be based on this. Figure 10 The server structure is shown.

[0139] Furthermore, in another aspect, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of computer programs adapted for loading by a processor and executing a block generation method as described above for blockchain nodes.

[0140] Another embodiment of the present invention provides a server, including a processor and a memory;

[0141] The memory is used to store multiple computer programs, which are loaded and executed by a processor using a block generation method as described above, such as that performed by the blockchain node; the processor is used to implement each of the multiple computer programs.

[0142] This invention also provides a blockchain system, including: an application terminal and multiple blockchain nodes, wherein the blockchain nodes are as described above. Figure 9 The blockchain node shown or such Figure 10 The server shown.

[0143] Additionally, according to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the block generation method provided in the various optional implementations described above.

[0144] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0145] The block generation method, blockchain system, storage medium, and related devices provided by the embodiments of the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A block generation method, characterized in that, include: When information about a new transaction is obtained from the application terminal, the processing order of the new transaction is determined. The processing order is used to identify the order in which the blockchain nodes obtain the information about the new transaction. The signature information corresponding to the new transaction is obtained by signing according to the processing order and the information of the new transaction. The signature information is returned to the application terminal so that the application terminal can obtain the transaction data of the new transaction based on the signature information; When transaction data is received from the application terminal, the transaction data is packaged into blocks according to the processing order contained in the transaction data. Obtain the target block of the target blockchain node, wherein the target block includes transaction data of multiple target transactions; The transaction data of each of the plurality of target transactions is verified 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, the target processing order corresponding to the multiple target transactions contained in the target block is obtained; If the difference between the target processing order of any target transaction and the target processing order of the preceding target transaction is less than zero, then the verification of the target processing order fails; the target transaction and the preceding target transaction are adjacent target transactions in the target block. If the second verification result is that the target processing order is verified as passed, the target block is verified as passed.

2. The method as described in claim 1, characterized in that, Determining the processing order of the new transactions specifically includes: setting a preset identifier as the processing order of the new transactions. The method further includes: adding a fixed value to the preset identifier.

3. The method as described in claim 1, characterized in that, The process of determining the processing order of the new transaction specifically includes: adding a fixed value to a preset identifier to determine the processing order of the new transaction; The method further includes updating the preset identifier to the processing order of the new transaction.

4. The method as described in claim 1, characterized in that, The step of verifying the transaction data of each of the plurality of target transactions to obtain a first verification result specifically includes: The signature information corresponding to the target blockchain node in the transaction data of the target transaction contained in the target block is decrypted to obtain the decrypted target processing order; If the decrypted target processing order is consistent with the processing order generated by the target blockchain node based on the target transaction, the verification of the transaction data of the target transaction is successful.

5. A blockchain node, characterized in that, include: The sequence determination unit is used to determine the processing order of a new transaction when the application terminal obtains the new transaction information. The processing order is used to identify the order in which the blockchain nodes obtain the new transaction information. A signature acquisition unit is used to sign according to the processing order and the information of the new transaction to obtain the signature information corresponding to the new transaction; A data return unit is used to return the signature information to the application terminal so that the application terminal can obtain the transaction data of the new transaction based on the signature information; The packaging unit is used to package the transaction data into blocks according to the processing order contained in the transaction data when it receives transaction data sent by the application terminal. The blockchain node is further configured to obtain a target block of the target blockchain node, the target block including transaction data of multiple target transactions; verify the transaction data of each of the multiple target transactions to obtain a first verification result; if the first verification result indicates that the verification of the transaction data of each target transaction is successful, obtain the target processing order corresponding to each of the multiple target transactions contained in the target block; if the difference between the target processing order of any target transaction and the target processing order of the preceding target transaction of any target transaction is less than zero, then the verification of the target processing order is unsuccessful; any target transaction and the preceding target transaction are adjacent target transactions in the target block; if the second verification result indicates that the verification of the target processing order is successful, then the verification of the target block is successful.

6. A blockchain system, characterized in that, include: The application terminal and multiple blockchain nodes, wherein the blockchain nodes are as described in claim 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of computer programs adapted to be loaded by a processor and executed as described in any one of claims 1 to 4.

8. A server, characterized in that, Including processor and memory; The memory is used to store a plurality of computer programs, which are loaded by a processor and executed as described in any one of claims 1 to 4; the processor is used to implement each of the plurality of computer programs.

9. A computer program product, characterized in that, It includes computer instructions stored in a computer-readable storage medium, the computer instructions being adapted to be loaded by a processor and executed as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Transaction processing method of block chain network and blockchain network

    CN110544095A