Transaction processing method, blockchain node and blockchain network

By decoupling the consensus layer and smart contract layer of blockchain nodes, transactions are executed in parallel, and a DAG is generated to optimize the transaction order. This solves the problem of low transaction processing efficiency in existing technologies and achieves more efficient, secure and private transaction processing.

CN115174067BActive Publication Date: 2024-11-05CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210794409.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-07
Publication Date
2024-11-05
Estimated Expiration
2042-07-07

AI Technical Summary

Technical Problem

The low efficiency of blockchain transaction processing in existing technologies is due to the coupling between the consensus layer and the smart contract layer, which leads to waiting for responses and thus low transaction processing efficiency.

Method used

By decoupling the consensus layer and the smart contract layer on blockchain nodes, transactions are executed in parallel using a Trusted Execution Environment (TEE), and the execution order of transactions is optimized by generating a Directed Acyclic Graph (DAG), thus achieving asynchronous execution of the smart contract layer and the consensus layer.

Benefits of technology

It improves the transaction processing efficiency of blockchain nodes, enhances the security and privacy of transaction processing, and ensures the parallel and asynchronous execution of transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115174067B_ABST
    Figure CN115174067B_ABST
Patent Text Reader

Abstract

The present disclosure provides a transaction processing method, a blockchain node and a blockchain network, which relate to the field of blockchain technology. The method includes: a first blockchain node receives a to-be-executed transaction sent by a client through a consensus layer, and the to-be-executed transaction includes a first transaction, and the first transaction is a smart contract-related transaction; the first blockchain node executes the to-be-executed transaction, including: the first blockchain node executes the first transaction through the smart contract layer, wherein, in the process of executing the first transaction through the smart contract layer, the first blockchain node performs a task through the consensus layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of blockchain technology, and in particular to a transaction processing method, a blockchain node, and a blockchain network. Background Art

[0002] Blockchain technology is a new distributed infrastructure that uses block chain data structures to verify and store data, distributed node consensus algorithms to generate and update data, cryptography to ensure the security of data transmission and access, and smart contracts composed of automated script codes to program and operate data.

[0003] Since blockchain has advantages such as data being difficult to tamper with and being decentralized, blockchain technology can be used in transaction processing scenarios. Summary of the invention

[0004] The inventors noticed that the efficiency of transaction processing based on blockchain in the related art is not high enough. After research, it was found that this is because the consensus layer and the smart contract layer of the blockchain node in the related art are coupled. Therefore, when processing transactions, after the consensus layer sends the transaction to the smart contract layer for execution, the consensus layer will wait without executing the task until it receives a response from the smart contract layer. In other words, the working process of the consensus layer and the smart contract layer is synchronized, which will lead to low efficiency of transaction processing.

[0005] In order to solve the above problems, the embodiments of the present disclosure propose the following solutions.

[0006] According to one aspect of an embodiment of the present disclosure, a transaction processing method is provided, including: a first blockchain node receives a to-be-executed transaction sent by a client through a consensus layer, the to-be-executed transaction includes a first transaction, and the first transaction is a smart contract-related transaction; the first blockchain node executes the to-be-executed transaction, including: the first blockchain node executes the first transaction through a smart contract layer, wherein, in the process of executing the first transaction through the smart contract layer, the first blockchain node performs a task through the consensus layer.

[0007] In some embodiments, the first blockchain node executes the first transaction in a trusted execution environment (TEE) through the smart contract layer.

[0008] In some embodiments, the execution task includes: executing consensus on the execution result, and the execution result is obtained by the first blockchain node executing the second transaction.

[0009] In some embodiments, the execution task includes: executing a third transaction, wherein the third transaction is a non-smart contract related transaction.

[0010] In some embodiments, the transaction to be executed includes multiple transactions, and the multiple transactions include the first transaction; the first blockchain node executes the transaction to be executed including: the first blockchain node executes at least two transactions in the multiple transactions that do not have transaction dependencies in parallel.

[0011] In some embodiments, the first blockchain node executes the to-be-executed transaction including: the first blockchain node generates a directed acyclic graph (DAG) based on the transaction dependencies between the multiple transactions; and executes the multiple transactions based on the DAG.

[0012] In some embodiments, the first blockchain node executes the to-be-executed transaction including: if the initiators of the at least two transactions both agree to execute in parallel, the first blockchain node executes the at least two transactions in parallel; if any initiator of the at least two transactions does not agree to execute in parallel, serially executing the transaction corresponding to any one initiator and other transactions in the multiple transactions.

[0013] In some embodiments, the first transaction is encrypted; before the first blockchain node executes the transaction to be executed, it also includes: the first blockchain node uses the key to decrypt the first transaction in the TEE through the smart contract layer.

[0014] In some embodiments, the first blockchain node decrypts the first transaction in the TEE using the key through the smart contract layer, including: the first blockchain node applies for authorization, and if the authorization is passed, obtains the key in the TEE; and decrypts the first transaction using the key.

[0015] In some embodiments, the key is managed by an enclave in the TEE.

[0016] In some embodiments, the key is divided to generate a first preset number of key pairs based on the Shamir threshold secret sharing algorithm; the first blockchain node obtains a second preset number of key pairs from at least one other TEE through the TEE to restore the key based on the Shamir threshold secret sharing algorithm, wherein the second preset number is greater than or equal to 2 and less than or equal to the first preset number.

[0017] In some embodiments, the first blockchain node is a node with write and read permissions; the blockchain network to which the first blockchain node belongs also includes a second blockchain node, and the second blockchain node is a node with read permissions but not write permissions.

[0018] According to another aspect of the present disclosure, a blockchain node is provided, including: a receiving module, configured to receive a to-be-executed transaction sent by a client through a consensus layer, the to-be-executed transaction including a first transaction, which is a smart contract-related transaction; an execution module, configured to execute the to-be-executed transaction, including: executing the first transaction through a smart contract layer, wherein, in the process of executing the first transaction through the smart contract layer, a task is executed through the consensus layer.

[0019] According to another aspect of an embodiment of the present disclosure, a blockchain node is provided, including: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the method described in any one of the above embodiments based on instructions stored in the memory.

[0020] According to another aspect of the embodiments of the present disclosure, a blockchain network is provided, comprising the blockchain node described in any one of the above embodiments.

[0021] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, comprising computer program instructions, wherein when the computer program instructions are executed by a processor, the method described in any one of the above embodiments is implemented.

[0022] According to another aspect of the embodiments of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0023] In the disclosed embodiment, the first blockchain node executes the first transaction through the smart contract layer and also executes the task through the consensus layer, so that the smart contract layer and the consensus layer can be decoupled. As a result, the smart contract layer and the consensus layer are not only parallel but also asynchronous in the process of executing the work task, which is conducive to improving the efficiency of the first blockchain node in transaction processing.

[0024] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0026] Figure 1 It is a flowchart of a transaction processing method according to some embodiments of the present disclosure.

[0027] Figure 2 is a schematic diagram of a directed acyclic graph according to some embodiments of the present disclosure.

[0028] Figure 3 It is a schematic diagram of the structure of a blockchain node according to some embodiments of the present disclosure.

[0029] Figure 4 It is a schematic diagram of the structure of a blockchain node according to some other embodiments of the present disclosure. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.

[0031] Unless specifically stated otherwise, the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure.

[0032] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0033] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.

[0034] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0035] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0036] Figure 1 It is a flowchart of a transaction processing method according to some embodiments of the present disclosure.

[0037] In step 102, the first blockchain node receives the pending transaction sent by the client through the consensus layer. Here, the pending transaction includes a first transaction, which is a smart contract related transaction.

[0038] The first blockchain node can be any blockchain node in the blockchain network. The client can be located outside the blockchain network or on a blockchain node in the blockchain network.

[0039] For example, after receiving the transaction to be executed, the first blockchain node can put the transaction to be executed into the transaction pool of the first blockchain node.

[0040] In step 104, the first blockchain node executes the transaction to be executed. In step 104, the first blockchain node executes the first transaction through the smart contract layer. In the process of executing the first transaction through the smart contract layer, the first blockchain node executes tasks through the consensus layer. The tasks executed by the consensus layer will be further described below in conjunction with some embodiments.

[0041] It should be understood that in step 104, after the first blockchain node sends the first transaction to the smart contract layer through the consensus layer, the consensus layer does not need to wait but can execute the task.

[0042] In the above embodiment, the first blockchain node executes the first transaction through the smart contract layer and also executes the task through the consensus layer, so that the smart contract layer and the consensus layer can be decoupled. Therefore, the smart contract layer and the consensus layer are not only parallel but also asynchronous in the process of executing the work tasks, which is conducive to improving the efficiency of the first blockchain node in transaction processing.

[0043] In some embodiments, the first blockchain node executes the first transaction in a trusted execution environment (TEE) through a smart contract layer.

[0044] It should be understood that TEE is an independent processing environment with computing and storage functions that can provide security and integrity protection. The following text will further introduce how to execute the first transaction in TEE in conjunction with some embodiments.

[0045] In the above embodiment, using TEE as the execution environment of the first transaction (smart contract related transaction) can ensure that the smart contract is in a completely isolated environment, thereby improving the security and privacy of transaction processing.

[0046] In some embodiments, the consensus layer performs tasks in a non-TEE environment, which ensures that the consensus layer and the smart contract layer are architecturally separated, thereby ensuring that the execution processes of the consensus layer and the smart contract layer are decoupled, further improving the efficiency of transaction processing.

[0047] In some embodiments, the first blockchain node determines whether the target address of the transaction to be executed includes a smart contract address, and if the target address includes the smart contract address, determines that the transaction to be executed includes the first transaction.

[0048] For example, the determination may be made based on the identifier of the target address.

[0049] For another example, a judgment can be made based on the content of the target address. The content of the target address is, for example, "0x6e...b79b1811dad9". The first blockchain node can query whether the target address is a smart contract-related address based on the content of the target address.

[0050] The following describes the tasks performed by the consensus layer in conjunction with some embodiments.

[0051] In some embodiments, executing the task includes executing consensus on the execution result, that is, the first blockchain node executes consensus through the consensus layer. Here, the execution result is obtained by the first blockchain node executing the second transaction. The second transaction is, for example, a smart contract related transaction, or, for example, a non-smart contract related transaction.

[0052] In some embodiments, executing the task includes executing a third transaction. Here, the third transaction is a non-smart contract related transaction, that is, the first blockchain node executes the non-smart contract related transaction through the consensus layer.

[0053] In the above embodiment, smart contract related transactions are executed through the smart contract layer, and non-smart contract related transactions are executed through the consensus layer, which is conducive to processing different transactions separately and is conducive to further improving the efficiency of transaction processing.

[0054] In some embodiments, the transaction to be executed includes multiple transactions, and the multiple transactions include the first transaction. In this case, the first blockchain node executes at least two transactions in the multiple transactions that do not have a transaction dependency in parallel.

[0055] The following introduces transaction dependencies with some examples.

[0056] For example, the transactions to be executed are A→B, C→D, A→F. Here, A, B, C, D, and F are user accounts, the one on the left of “→” is the initiator of the transaction, and the one on the right of “→” is the receiver of the transaction.

[0057] It can be seen that both transactions A→B and A→F involve A, and the execution of transaction A→F depends on the execution result of A→B, so transactions A→F and A→B have a transaction dependency relationship. However, the execution of transaction C→D does not depend on the execution result of transaction A→B, so transactions C→D and A→B do not have a transaction dependency relationship.

[0058] In the above embodiment, by executing transactions that do not have transaction dependencies in parallel, it is beneficial to further improve the efficiency of transaction processing.

[0059] As some implementations, when multiple transactions are smart contract-related transactions, the first blockchain node executes at least two transactions in the multiple transactions that do not have transaction dependencies in parallel through the smart contract layer.

[0060] As other implementations, when multiple transactions are non-smart contract related transactions, the first blockchain node executes at least two transactions in the multiple transactions that do not have transaction dependencies in parallel through the consensus layer.

[0061] As some other implementation methods, when there are both smart contract related transactions and non-smart contract related transactions in multiple transactions, the first blockchain executes at least two transactions that do not have transaction dependencies among the multiple smart contract related transactions in parallel through the smart contract layer, and executes at least two transactions that do not have transaction dependencies among the multiple non-smart contract related transactions in parallel through the consensus layer.

[0062] In some embodiments, the first blockchain node generates a directed acyclic graph (DAG) based on transaction dependencies between multiple transactions, and executes multiple transactions based on the DAG.

[0063] Figure 2 is a schematic diagram of a directed acyclic graph according to some embodiments of the present disclosure.

[0064] like Figure 2 As shown, the transactions to be executed are A→B, C→D, E→F, A→F, E→A.

[0065] When generating DAG, in order to avoid loops, it can be stipulated that transactions involving the same user account and ranked later must wait until the earlier transactions are completed before being executed. Figure 2 The DAG shown.

[0066] It should be understood that in DAG, each transaction has an in-degree and an out-degree. The in-degree indicates the number of other transactions pointing to the transaction, and the out-degree indicates the number of other transactions pointed to by the transaction from the transaction.

[0067] For example, Figure 2 In the figure, the in-degree of A→B is 0 and the out-degree is 1; the in-degree and out-degree of C→D are both 0; the in-degree of A→F is 2 and the out-degree is 1.

[0068] It should be understood that in the DAG, a transaction with an in-degree of 0 is a ready transaction that has no dependencies and can be executed immediately. When the number of ready transactions is greater than 1, the ready transactions can be put into different threads for parallel execution.

[0069] For example, Figure 2 There are currently three ready transactions: A→B, C→D, and E→F. These three ready transactions can be put into different threads and executed in parallel.

[0070] It should be understood that when a transaction is executed, the in-degree of all transactions that depend on it is reduced by 1. As transactions are continuously executed, ready transactions are continuously generated.

[0071] For example, when A→B and E→F ​​are executed, the in-degree of A→F becomes 0, that is, A→F becomes a ready transaction. When A→F is executed, the in-degree of E→A becomes 0, that is, E→A becomes a ready transaction.

[0072] In this way, multiple transactions can be executed based on the order shown by DAG.

[0073] In the above embodiment, the first blockchain node generates a DAG based on transaction dependencies, and executes multiple transactions based on the DAG, rationally planning the execution order of the transactions so that transactions without dependencies can be executed in parallel, which is conducive to further improving the efficiency of transaction processing.

[0074] In some embodiments, when the initiators of at least two transactions agree to parallel execution, the first blockchain node executes the at least two transactions in parallel; when any initiator of the at least two transactions does not agree to parallel execution, the transaction corresponding to any initiator and other transactions in the multiple transactions are executed serially.

[0075] For example, the transactions to be executed are A→B, C→D, and E→F. If the initiators A, C, and E of the transactions all agree to execute them in parallel, the first blockchain node can execute A→B, C→D, and E→F ​​in parallel.

[0076] For another example, the transactions to be executed are A→B, C→D, and E→F. If the initiator A of the transaction does not agree to parallel execution, but both C and E agree to parallel execution, then the first blockchain node can execute A→B and C→D in series, and can execute E→F in parallel during the execution of C→D.

[0077] For another example, the transactions to be executed are A→B, C→D, E→F, A→F, E→A. If the initiator A of the transaction does not agree to parallel execution, C and E both agree to parallel execution. At this time, the first blockchain node can execute transactions A→B, E→F, A→F, E→A in series, and C→D can be executed in parallel during the execution of E→F.

[0078] It should be understood that although parallel execution can improve efficiency, it has the probability of error. Although serial execution is not efficient, it can avoid errors.

[0079] In the above embodiment, if the initiator of the transaction agrees to parallel execution, the transactions without transaction dependencies are executed in parallel, and if the initiator of the transaction does not agree to parallel execution, the transactions are executed serially. This is conducive to fully respecting the wishes of the initiator of the transaction and improving customer satisfaction.

[0080] In some embodiments, a recommendation may also be made as to whether the initiator of the transaction agrees to parallel execution based on at least one of the nature of the transaction and the current transaction situation of the blockchain network.

[0081] For example, if the nature of the transaction requires a high success rate for transaction execution, or it is a transaction for evidence storage, it is recommended that the initiator of the transaction choose not to agree to parallel execution.

[0082] For another example, if the current transaction volume of the blockchain network is large, the initiator of the recommended transaction chooses to agree to parallel execution.

[0083] As another example, the nature of the transaction and the current transaction situation may be considered comprehensively to make recommendations.

[0084] In the above embodiment, based on at least one of the nature of the transaction and the business situation, a recommendation is made as to whether the initiator of the transaction agrees to parallel execution. This is conducive to making full use of information such as the nature of the transaction and / or the business situation, and making better trade-offs between improving efficiency and ensuring the success rate of the transaction, thereby further improving customer satisfaction.

[0085] Next, we will introduce how to execute the first transaction in TEE.

[0086] In some embodiments, the first transaction is encrypted. In this case, before the first blockchain node executes the to-be-executed transaction, the first blockchain node decrypts the first transaction using a key in the TEE through the smart contract layer.

[0087] For example, the first transaction sent by the client is encrypted. Therefore, when the first blockchain node receives the first transaction and subsequently sends the first transaction from the consensus layer to the smart contract layer, the first transaction is always encrypted, that is, the first transaction is encrypted before being sent to the TEE.

[0088] In the above embodiment, by encrypting the first transaction and having the smart contract layer decrypt the first transaction in the TEE, it is beneficial to ensure the security of the key and to facilitate the privacy and security of further transaction processing.

[0089] In some embodiments, the first blockchain node applies for authorization, and if the authorization is approved, obtains the key in the TEE and uses the key to decrypt the first transaction.

[0090] In the above embodiment, the first blockchain node needs to be authorized before it can obtain the key for decryption. This can ensure that the first blockchain node is an authorized and verified node, which is conducive to further ensuring the security and privacy of transaction processing.

[0091] In some embodiments, the keys are managed by an enclave in the TEE.

[0092] In some embodiments, the key is divided based on the Shamir threshold secret sharing algorithm to generate a first preset number of key pairs. In this case, the first blockchain node obtains a second preset number of key pairs from at least one other TEE through the TEE to restore the key based on the Shamir threshold secret sharing algorithm, wherein the second preset number is greater than or equal to 2 and less than or equal to the first preset number.

[0093] The above embodiment is introduced below in conjunction with the specific steps of Shamir's threshold secret sharing algorithm.

[0094] First, the encryption process, that is, the process of generating a key pair, is introduced.

[0095] First, the distributor of the key determines a binary number (k, n), where n is a first preset number, indicating that the key S is encrypted into n key pairs. k is a second preset number, indicating that at least k key pairs must be possessed simultaneously to decrypt the key S.

[0096] For the key to be encrypted s∈Z p , where p is a large prime number, randomly select k-1 random numbers a1, a2, ...a in the finite group GF(p) k-1 , and let a0 = s,

[0097] Construct the following polynomial:

[0098] f(x)=a0+a1x+a2x 2 +a3x 3 +…+a k-1 x k-1 mod(p)

[0099] For the above polynomial, select any n numbers x1, x2, ...x n Substitute the polynomials to obtain n key pairs: (x1, f(x1)), (x2, f(x2)), … (x n ,f(x n )), distribute these n key pairs to n TEEs.

[0100] Next, the decryption process is introduced.

[0101] The first blockchain node obtains a second preset number of key pairs from at least one TEE through TEE. For example, k key pairs are obtained from k other TEEs. For another example, the TEE of the first blockchain node stores a key pair, and then obtains K-1 key pairs from k-1 other TEEs through the TEE, obtaining a total of key pairs.

[0102] Assume that the key pair is: (x1, y1), (x2, y2), … (xk ,y k )

[0103] The following equation can be obtained

[0104]

[0105] .............................

[0107]

[0108] Matrix multiplication is used within GF(p) to obtain a0, where a0 is the key s. Thus, the first blockchain node can recover the key based on the Shamir threshold secret sharing algorithm.

[0109] In the above embodiment, Shamir's threshold secret sharing algorithm is used to realize key segmentation and recovery. The key is segmented to generate a first preset number of key pairs, and the key pairs are distributed to different TEEs for storage. Only by obtaining k key pairs can the key be recovered and decrypted. This makes the key difficult to crack, which is conducive to further improving the security and privacy of transaction processing.

[0110] In some embodiments, the consensus layer and the smart contract layer of the first blockchain node communicate with each other through a pre-agreed interface. For example, the first transaction is sent from the consensus layer to the smart contract layer through the interface, and for example, the execution result of the first transaction is sent from the smart contract layer to the consensus layer through the interface.

[0111] The consensus process is introduced below in conjunction with some embodiments.

[0112] In some embodiments, after the first blockchain node executes the transaction to be executed, a preliminary block can be generated based on the execution result.

[0113] In some embodiments, the consensus node in the blockchain network where the first blockchain node is located can verify the preliminary block and reach a consensus based on the consensus mechanism. In the case where the consensus node reaches a consensus, the preliminary block can be added to the blockchain. In the case where the consensus node does not reach a consensus, the preliminary block cannot be added to the blockchain. Here, the consensus node is the node responsible for consensus in the blockchain.

[0114] In the above embodiment, when consensus is reached, the prepared block is added to the blockchain, and when no consensus is reached, the prepared block cannot be added to the blockchain. This can establish an honest and trustworthy blockchain network, which is conducive to improving the security of transaction processing.

[0115] As some implementations, the Merkle tree root of the prepared block can be verified.

[0116] As some implementations, the consensus mechanism is, for example, Practical Byzantine Fault Tolerance (PBFT).

[0117] It should be understood that the first blockchain node may also be a consensus node. In the case where the first blockchain node is a consensus node, the first blockchain node verifies the prepared block through the consensus layer.

[0118] In some embodiments, the first blockchain node is a node with write and read permissions, and the blockchain network to which the first blockchain node belongs also includes a second blockchain node, which is a node with read permissions but not write permissions.

[0119] In the above embodiment, by assigning different rights and responsibilities to the first blockchain node and the second blockchain node, it is helpful to fully adapt to the needs of large-scale networking and better manage the first blockchain node and the second blockchain node deployed on a large scale.

[0120] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the blockchain node embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0121] Figure 3 It is a schematic diagram of the structure of a blockchain node according to some embodiments of the present disclosure.

[0122] like Figure 3 As shown, the blockchain node 300 includes a receiving module 301 and an execution module 302.

[0123] The receiving module 301 is configured to receive the pending transaction sent by the client through the consensus layer. Here, the pending transaction includes a first transaction, which is a smart contract related transaction.

[0124] The execution module 302 is configured to execute the transaction to be executed, which specifically includes the following contents: executing the first transaction through the smart contract layer, wherein in the process of executing the first transaction through the smart contract layer, executing the task through the consensus layer.

[0125] For other features and advantages of the blockchain node 300 according to an embodiment of the present invention, reference can be made to the various embodiments and advantages of the above-mentioned transaction processing method, which will not be described in detail here.

[0126] Figure 4 It is a schematic diagram of the structure of a blockchain node according to some other embodiments of the present disclosure.

[0127] like Figure 4 As shown, the blockchain node 400 includes a memory 401 and a processor 402 coupled to the memory 401 , and the processor 402 is configured to execute the method of any one of the aforementioned embodiments based on the instructions stored in the memory 401 .

[0128] The memory 401 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, and other programs.

[0129] The blockchain node 400 may also include an input / output interface 403, a network interface 404, a storage interface 405, etc. These interfaces 403, 404, 405, and the memory 401 and the processor 402 may be connected, for example, via a bus 506. The input / output interface 403 provides a connection interface for input / output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 404 provides a connection interface for various networked devices. The storage interface 405 provides a connection interface for external storage devices such as SD cards and USB flash drives.

[0130] The disclosed embodiments also provide a blockchain network, comprising the blockchain node described in any one of the above embodiments, such as the blockchain node 300 or the blockchain node 400.

[0131] In some embodiments, a blockchain network may also include nodes that have read permissions but not write permissions.

[0132] The embodiments of the present disclosure further provide a computer-readable storage medium, comprising computer program instructions, which implement the method of any one of the above embodiments when executed by a processor.

[0133] The embodiment of the present disclosure further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, any one of the above-mentioned methods is implemented.

[0134] So far, various embodiments of the present disclosure have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed here.

[0135] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable non-transient storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0136] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present disclosure. It should be understood that the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions specified in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0137] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0139] Although some specific embodiments of the present disclosure have been described in detail by way of examples, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It should be understood by those skilled in the art that the above embodiments may be modified or some technical features may be replaced by equivalents without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.

Claims

1. A transaction processing method, comprising: The first blockchain node receives a pending transaction sent by a client through a consensus layer, where the pending transaction includes a first transaction, and the first transaction is a smart contract-related transaction; The first blockchain node executes the transaction to be executed, including: The first blockchain node executes the first transaction in a trusted execution environment (TEE) through a smart contract layer, wherein, in the process of executing the first transaction through the smart contract layer, the first blockchain node executes tasks in a non-TEE environment through the consensus layer, so that the execution processes of the smart contract layer and the consensus layer are decoupled; The execution task includes at least one of executing consensus on the execution result and executing a third transaction, the execution result is obtained by the first blockchain node executing the second transaction, and the third transaction is a non-smart contract related transaction.

2. The method according to claim 1, wherein: The transaction to be executed includes a plurality of transactions, and the plurality of transactions includes the first transaction; The first blockchain node executing the transaction to be executed includes: The first blockchain node executes at least two transactions among the multiple transactions that have no transaction dependency in parallel.

3. The method according to claim 2, wherein: The first blockchain node executing the transaction to be executed includes: The first blockchain node generates a directed acyclic graph DAG based on the transaction dependency relationship between the multiple transactions; The plurality of transactions are executed based on the DAG.

4. The method according to claim 2, wherein: The first blockchain node executing the transaction to be executed includes: When the initiators of the at least two transactions agree to execute the transactions in parallel, the first blockchain node executes the at least two transactions in parallel; In the case that any initiator of the at least two transactions does not agree to execute the transactions in parallel, the transaction corresponding to the any initiator and other transactions in the multiple transactions are executed in series.

5. The method according to claim 1, wherein: The first transaction is encrypted; Before the first blockchain node executes the transaction to be executed, the method further includes: The first blockchain node decrypts the first transaction using a key in the TEE through the smart contract layer.

6. The method according to claim 5, wherein: The first blockchain node decrypts the first transaction in the TEE using a key through the smart contract layer, including: The first blockchain node applies for authorization, and if the authorization is passed, obtains the key in the TEE; The first transaction is decrypted using the secret key.

7. The method according to claim 5, wherein: The keys are managed by the enclave in the TEE.

8. The method according to any one of claims 5 to 7, wherein: The key is divided based on Shamir's threshold secret sharing algorithm to generate a first preset number of key pairs; The first blockchain node obtains a second preset number of key pairs from at least one other TEE through the TEE to recover the key based on the Shamir threshold secret sharing algorithm, wherein the second preset number is greater than or equal to 2 and less than or equal to the first preset number.

9. The method according to any one of claims 1 to 8, wherein: The first blockchain node is a node with write and read permissions; The blockchain network to which the first blockchain node belongs also includes a second blockchain node, which is a node with read permission but not write permission.

10. A blockchain node, comprising: A receiving module is configured to receive a pending transaction sent by a client through a consensus layer, wherein the pending transaction includes a first transaction, and the first transaction is a smart contract related transaction; An execution module is configured to execute the transaction to be executed, including: executing the first transaction in a trusted execution environment TEE through a smart contract layer, wherein, in the process of executing the first transaction through the smart contract layer, executing tasks in a non-TEE environment through the consensus layer, so that the execution process of the smart contract layer and the consensus layer is decoupled; The execution task includes at least one of executing consensus on the execution result and executing a third transaction, the execution result is obtained by the first blockchain node executing the second transaction, and the third transaction is a non-smart contract related transaction.

11. A blockchain node, comprising: Memory; as well as A processor coupled to the memory, configured to execute the method according to any one of claims 1 to 9 based on instructions stored in the memory.

12. A blockchain network comprising: The blockchain node of claim 10 or claim 11.

13. A computer-readable storage medium comprising computer program instructions, wherein: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

14. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.