Method for executing transactions in blockchain and blockchain system

By introducing a trusted storage device into the blockchain node to verify the permission information and data requests in the transaction, ensuring that the request and data correspond to the same block, the problem of untrustworthy transaction execution under malicious behavior of blockchain nodes is solved. Achieving more reliable transaction execution results.

CN113658005BActive Publication Date: 2024-10-29ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111109486.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-28
Publication Date
2024-10-29
Estimated Expiration
2041-04-28

AI Technical Summary

Technical Problem

In a blockchain system that supports private transactions, when blockchain nodes execute transactions in a trusted execution environment, the credibility of the transaction execution results cannot be guaranteed, especially in the case of malicious nodes, which may provide false storage data. input, resulting in the inability to verify the user's permission information and data.

Method used

By introducing a trusted storage device into the blockchain node, the permission information and data requests in the transaction are obtained and verified to ensure that the request and data correspond to the same block, thereby preventing malicious nodes from using expired permissions to access new data and implement transactions. Credibility of execution results.

Benefits of technology

By binding permission information access requests and data access requests to trusted storage access, it ensures that matching permission information and access data are sent to the trusted execution environment for verification, preventing malicious nodes from using expired permissions to access the blockchain. The data makes the transaction execution results more credible.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113658005B_ABST
    Figure CN113658005B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a method and a blockchain system for executing transactions in a blockchain, the method comprising: a trusted execution environment obtains a first transaction, the first transaction is sent by a user device based on a first account, a first contract is called in the first transaction, a request is made in the first contract to read permission information and first data of the first account, and it is limited that the permission information and the first data correspond to the same block; the trusted execution environment sends the data read request in the first contract to a trusted storage device through a computing device; the trusted storage device reads the data after receiving the data read request, and sends the read result to the trusted execution environment through the computing device; after receiving the read result, the trusted execution environment verifies the permission of the first account based on the permission information according to the verification logic in the first contract, and returns the first data to the user device through the computing device if the verification passes.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with application number 202110465875.9 filed on April 28, 2021, and entitled “Method for executing transactions in blockchain and blockchain system”. Technical Field

[0002] The embodiments of this specification relate to the field of blockchain technology, and more specifically, to a method for executing transactions in a blockchain and a blockchain system. Background Art

[0003] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is a chain data structure that combines data blocks in a sequential manner in chronological order, and a distributed ledger that is tamper-proof and unforgeable by cryptography. Due to the characteristics of blockchain such as decentralization, information immutability, and autonomy, blockchain has also received more and more attention and application.

[0004] In a blockchain system that supports private transactions, blockchain nodes execute transactions in a trusted execution environment (TEE). TEE can ensure that the data related to private transactions cannot be snooped by the outside world, but it cannot guarantee the credibility of the transaction execution results because TEE cannot guarantee that it can obtain trusted storage data input. In particular, when the blockchain node is a malicious node, the storage data input provided by the blockchain node to TEE may be false. Malicious nodes may be able to trick TEE into outputting information that users cannot currently access by initiating query transactions to TEE and providing partially outdated information for these query transactions. Summary of the invention

[0005] The embodiments of this specification are intended to provide a more efficient solution for executing transactions in a blockchain to provide more reliable transaction execution results.

[0006] To achieve the above objectives, in one aspect, this specification provides a method for executing a transaction in a blockchain, which is executed by a blockchain node, wherein the blockchain node includes a trusted execution environment in a computing device, and the method includes:

[0007] The trusted execution environment obtains a first transaction, the first transaction is sent by a user device based on a first account, a first contract is called in the first transaction, the first contract includes a data read request for reading permission information of the first account and first data, and the permission information and the first data are limited to the same block through the data read request;

[0008] The trusted execution environment sends a data read request in the first contract to a trusted storage device through the computing device, and the trusted storage device stores the data of the blockchain;

[0009] The trusted storage device reads the data after receiving the data read request, and sends the read result to the trusted execution environment through the computing device, wherein the read result includes the permission information and the first data corresponding to the same block;

[0010] After receiving the read result, the trusted execution environment verifies the authority of the first account based on the authority information according to the verification logic in the first contract, and returns the first data to the user device through the computing device if the verification passes.

[0011] In one implementation, the first contract includes a first read request, and the first read request is used to request batch reading of the permission information and the first data.

[0012] In one embodiment, the first contract includes a second read request and a third read request, wherein the second read request is used to request to read permission information corresponding to the first block, and the third read request is used to request to read first data corresponding to the first block.

[0013] In one embodiment, the trusted execution environment sending the data read request in the first contract to the trusted storage device through the computing device includes: the trusted execution environment signing the data read request, and sending the data read request and its signature to the trusted storage device through the computing device;

[0014] The trusted storage device reads data after receiving the data read request and sends the read result to the trusted execution environment through the computing device, including: after receiving the data read request and its signature, the trusted storage device verifies the signature, and if the verification passes, reads data based on the data read request, signs the read result, and sends the read result and its signature to the trusted execution environment through the computing device.

[0015] In one embodiment, the first data is a second variable, and the first contract defines that the permission information and the value of the second variable correspond to a world state determined by the same block.

[0016] In one implementation, the first data is a first block, and the first contract defines that the permission information corresponds to the first block.

[0017] In one embodiment, the first data is a second variable, the data read request also includes a block identifier of the second block, and the trusted storage device reads data based on the data read request, including the trusted storage device reading data corresponding to the second block based on the block identifier of the second block.

[0018] In one implementation, the read result includes a block identifier of the second block, and the method further includes, after receiving the read result, the trusted execution environment verifying whether the block identifier in the read result is consistent with the block identifier in the data read request.

[0019] In one embodiment, the blockchain node includes the trusted storage device.

[0020] On the other hand, the present specification provides a blockchain system, including a computing device and a trusted storage device, wherein the computing device includes a trusted execution environment, and the trusted storage device stores the data of the blockchain, wherein:

[0021] The trusted execution environment is used to obtain a first transaction, the first transaction is sent by a user device based on a first account, a first contract is called in the first transaction, the first contract includes a data read request for reading permission information of the first account and first data, and the permission information and the first data are limited to correspond to the same block through the data read request; the data read request in the first contract is sent to the trusted storage device through the computing device;

[0022] The trusted storage device is used to read the data after receiving the data read request, and send the read result to the trusted execution environment through the computing device, wherein the read result includes the permission information and the first data corresponding to the same block;

[0023] The trusted execution environment is also used to verify the authority of the first account based on the authority information according to the verification logic in the first contract after receiving the read result, and if the verification passes, return the first data to the user device through the computing device.

[0024] In one implementation, the first contract includes a first read request, and the first read request is used to request batch reading of the permission information and the first data.

[0025] In one embodiment, the first contract includes a second read request and a third read request, wherein the second read request is used to request to read permission information corresponding to the first block, and the third read request is used to request to read first data corresponding to the first block.

[0026] In one embodiment, the trusted execution environment is used to send the data read request in the first contract to the trusted storage device through the computing device, including: the trusted execution environment is used to sign the data read request, and send the data read request and its signature to the trusted storage device through the computing device;

[0027] The trusted storage device is used to read data after receiving the data read request, and send the read result to the trusted execution environment through the computing device, including: the trusted storage device is used to verify the signature after receiving the data read request and its signature, and when the verification passes, read data based on the data read request, sign the read result, and send the read result and its signature to the trusted execution environment through the computing device.

[0028] In one embodiment, the first data is a second variable, and the first contract defines that the permission information and the value of the second variable correspond to a world state determined by the same block.

[0029] In one implementation, the first data is a first block, and the first contract defines that the permission information corresponds to the first block.

[0030] In one embodiment, the first data is a second variable, the data read request also includes a block identifier of the second block, and the trusted storage device is used to read data based on the data read request, including the trusted storage device being used to read data corresponding to the second block based on the block identifier of the second block.

[0031] In one implementation, the read result includes a block identifier of the second block, and the trusted execution environment is further configured to verify, after receiving the read result, whether the block identifier in the read result is consistent with the block identifier in the data read request.

[0032] In one embodiment, the blockchain system includes a blockchain node, and the blockchain node includes the computing device and the trusted storage device.

[0033] On the other hand, the present specification provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed in a computer, the computer is caused to execute any one of the above methods.

[0034] Another aspect of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, any one of the above methods is implemented.

[0035] By executing transactions according to the embodiments of this specification, permission information access requests and data access requests are bound to each other and sent to trusted storage access, so that the trusted storage access sends matching permission information and access data to the trusted execution environment, and the trusted execution environment verifies the user's permissions. As a result, malicious blockchain nodes cannot use expired permissions to access newly added data on the blockchain, making the transaction execution results more credible. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The embodiments of this specification are described in conjunction with the accompanying drawings to make the embodiments of this specification clearer:

[0037] Figure 1 A schematic diagram showing a blockchain system according to an embodiment of this specification;

[0038] Figure 2 A flow chart of a method for executing a transaction in a blockchain according to an embodiment of this specification;

[0039] Figure 3 This is an architecture diagram of a blockchain system according to an embodiment of this specification;

[0040] Figure 4 A structural diagram of a blockchain node according to an embodiment of the present specification is shown. DETAILED DESCRIPTION

[0041] The embodiments of this specification will be described below with reference to the accompanying drawings.

[0042] Figure 1 A schematic diagram of a blockchain system according to an embodiment of this specification is shown. Figure 1As shown, the blockchain system includes a computing device 11 and a trusted storage device 12. Among them, the computing device 11 includes a TEE, and the TEE enables the user to verify that the data is processed in the expected manner in the TEE. The TEE is, for example, a secure container (Enclave) based on the trusted computing base (software guard extensions, SGX) technology, a trusted space based on the TrustZone technology, and other specific forms. The TEE is provided with a hardware private key inside, and the TEE uses its private key to sign the output data, so that the recipient of the data can verify that the data has not been tampered with through the public key of the TEE. The trusted storage device 12 can, for example, provide a trusted storage service through user state storage access (SPDK). Similarly, the trusted storage device 12 can sign the output data to ensure that the data is not tampered with. In the blockchain system, in one embodiment, the computing device 11 is a blockchain node, and the trusted storage device 12 is a device independent of the blockchain node. The blockchain node accesses the blockchain data by connecting to the trusted storage device 12. In another embodiment, the computing device 11 and the trusted storage device 12 together constitute a blockchain node, wherein the computing device 11 and the trusted storage device 12 may be two separate physical devices, or the computing device 11 and the trusted storage device 12 may also be two virtual or physical modules in a single physical device.

[0043] in a Figure 1 In the scheme for executing transactions in the blockchain system shown, the user device 13 sends a transaction to query data in the blockchain. In the transaction, a contract is called to query the data in the blockchain. The contract needs to read the permission information of the transaction sending account and determines whether to return the queried data to the user device 13 based on the permission information. Specifically, when the TEE in the computing device 11 executes the transaction, the TEE requests the computing device 11 to read the permission information of the transaction sending account to verify the permission of the sending account. After receiving the read request from the TEE, the receiving device 11 can Figure 1 Operation ① in the above example sends a request to the trusted storage device to read the account authority information, so that the trusted device 12 returns the signed account authority information to the computing device 11, and the computing device 11 then sends the signed account authority information to the trusted storage device 12. Figure 1Operation ② in the above process provides the received account permission information to TEE. After receiving the account permission information, TEE can verify the signature of the information. However, in this process, if the blockchain node is a malicious node, the computing device 11 of the blockchain node may perform malicious operations through operation ① or operation ②. For example, the computing device 11 sends the past permission information of the account received from the trusted storage device 12 to TEE through operation ②. The past permission information also has the signature of the trusted storage device 12, or tampers with the storage access request, requiring the storage system to return permission information based on previous blocks. Therefore, TEE cannot verify the correctness of the permission information.

[0044] In the scheme for executing transactions in a blockchain according to the embodiments of the present specification, by limiting the permission information to be read and the data to be read to correspond to the same block in the data read request included in the contract, the blockchain node cannot provide permissions that do not match the data to be read, so that attackers cannot use old permissions to access newly added data.

[0045] The following is a detailed description of the method for executing transactions in a blockchain according to an embodiment of the present specification.

[0046] Figure 2 A flowchart of a method for executing a transaction in a blockchain according to an embodiment of this specification includes:

[0047] Step S201, TEE obtains transaction Tx1, which is sent by the user device based on account A. Contract 1 is called in transaction Tx1, and the contract 1 requests to read the permission information and data D1 of account A, and binds the permission information and data D1 to the same block through the data reading request;

[0048] Step S203, TEE sends a data read request for the binding data in the contract 1 to a trusted storage device through the computing device. The trusted storage device, for example, provides SPDK services. Hereinafter, SPDK is used to represent the trusted storage device. The SPDK stores the data of the blockchain. The reason for using SPDK is that it is convenient to implement trusted storage access at this time.

[0049] Step S205, SPDK reads data after receiving the data read request;

[0050] Step S207, the SPDK sends the read result to the trusted execution environment through the computing device, wherein the read result includes the permission information and the data D1 corresponding to the same block;

[0051] Step S209, after receiving the read result, TEE verifies the authority of the account A based on the authority information according to the verification logic in the contract 1;

[0052] Step S211, if the verification is successful, the TEE returns the data D1 to the user equipment through the computing device.

[0053] First, in step S201, TEE obtains transaction Tx1, which is sent by the user device based on account A. Contract 1 is called in transaction Tx1, and contract 1 requests to read permission information and data D1 of account A, and binds the permission information and data D1 to the same block.

[0054] In the blockchain of the embodiment of this specification, a smart contract (such as contract 1) for data query can be pre-deployed, and the smart contract can be used to read data and return data to the user after the user's authority is verified. In one embodiment, the blockchain is used to store private data, that is, the data stored in the blockchain is encrypted data. In this case, the above-mentioned smart contract can also decrypt the encrypted data read after the user's authority is verified, and return the decrypted data to the user.

[0055] refer to Figure 1 , when the user corresponding to account A wants to query data from the blockchain, he can send a transaction Tx1 that calls the above contract 1 to any node in the blockchain. After receiving the transaction Tx1, the node of the blockchain executes it and returns the execution result of the transaction to the user. For example, for transaction Tx1, the accounting node returns the data queried through contract 1 to the user device. Since transaction Tx1 is a query transaction, the node receiving transaction Tx1 does not need to broadcast transaction Tx1 to other nodes in the blockchain, nor does it need to package transaction Tx1 into a block for storage, and the execution of transaction Tx1 does not change the world state.

[0056] In the process of executing transactions, in order to prevent the blockchain nodes from doing evil as described above, in the embodiment of this specification, the transaction Tx1 of calling contract 1 is executed in TEE, and the permission information of account A to be read and the data to be read by the user are bound in the data reading request in contract 1. Figure 1As shown, after obtaining the transaction Tx1 to be executed, the computing device 11 of the blockchain node provides the transaction Tx1 to the TEE therein, so that the transaction Tx1 is executed in the TEE. Among them, the sending account of the transaction Tx1 is account A, the receiving account is the contract address of contract 1, and the data (Data) field includes a call to a function in contract 1 (for example, a data reading function Read()). When the function is executed, the permission information and the data to be read D1 of the bound account A are first read, that is, the permission information and the data to be read D1 correspond to the same block, and then the permission of account A is verified based on the permission information. If the verification passes, the read data D1 is returned.

[0057] In order to bind the permission information and the data to be read, in one implementation, the contract 1 includes, for example, the following read function Read(b):

[0058] Read(b)

[0059] {

[0060] GetMultiKey(a,b)

[0061] if(Value a>10){return Value b}

[0062] else{return "insufficient permissions"},

[0063] }

[0064] Among them, GetMultiKey(a,b) is a batch data access interface provided by the blockchain node, which can read at least two data and make the at least two read data correspond to the same block. Contract 1 uses this batch data access interface to achieve the binding of at least two read data.

[0065] In another embodiment, the read function Read(b) may include GetMultiKey(a, b / block 100) to indicate reading the values ​​of the variables a and b corresponding to the block 100.

[0066] For example, the "a" represents variable a, which corresponds to the permission information of account A, for example, variable a is the balance of account A, and the "b" represents variable b, which is the variable to be read. In the blockchain, usually, after each new block is deposited, the values ​​of each variable in the state database are updated based on the execution results of each transaction in the block. Therefore, multiple values ​​corresponding to the variables and each block can be stored in the blockchain. By binding variables a and b to correspond to the same block, it is defined that the permissions of account A match the value of variable b, and there is no situation where the updated value of variable b is read through the past permissions of account A (i.e., the permissions corresponding to the previous block of the above block).

[0067] It can be understood that although the reading of variable b is described as an example here, the embodiments of this specification are not limited to reading variables. For example, data such as blocks and transactions can also be read. For example, the b can represent the block number of the block to be read. For example, when the function Read(b) of contract 1 is called in transaction Tx1, Read(100) can be included in the data field of transaction Tx1 to indicate the reading of block 100. In this case, the function Read(100) includes the interface GetMultiKey(a,100), which means binding variable a to block 100, that is, reading the value of variable a corresponding to block 100.

[0068] In the above Read(b) function, after reading the values ​​of variables a and b corresponding to the same block through the GetMultiKey(a,b) interface, permission verification is performed based on the value of variable a. For example, it is preset that an account has permission to access data only when the balance is greater than 10. In this case, the if...else... statement is used in the Read(b) function to determine whether the value of variable a is greater than 10. If it is greater than 10, the value of the read variable b is returned. Otherwise, insufficient permission is returned, that is, the reading fails.

[0069] In another embodiment, the contract 1 includes, for example, the following read function Read(b):

[0070]

[0071] In this implementation, the read interfaces GetKey(a / block 100) and GetKey(b / block 100) provided by the blockchain node are called, and when the read interface is called, the value of the variable a to be read is bound to block 100, and the value of the variable b to be read is bound to block 100, that is, the value of the variable a to be read and the value of the variable b to be read are bound to the same block, thereby similarly preventing the node from doing evil. Similarly, if a block (such as block 100) is read through the Read function, variable a can be bound to block 100 through GetKey(a / block 100), and the data of block 100 can be read through GetKey(block 100).

[0072] In step S203, TEE sends a data read request for the binding data in the contract 1 to SPDK through the computing device, and the SPDK stores the data of the blockchain.

[0073] After acquiring the above transaction Tx1, TEE executes transaction Tx1, and in the process of executing transaction Tx1, executes the data reading function Read(b) in contract 1 called by transaction Tx1. In the above first implementation, function Read(b) includes a call to the interface GetMultiKey(a,b), which is equivalent to a batch data read request for variables a and b. Figure 1 As shown in , TEE can use the private key to sign the interface GetMultiKey(a,b) and pass Figure 1 Operation ① in the above example sends the interface GetMultiKey(a,b) and its signature to SPDK. In this way, the access request for permission information and the access request for reading data D1 are sent to SPDK as a whole, and the signature is used to ensure that the whole cannot be tampered with. SPDK will also return the signed permission information corresponding to a block and the read data D1, so that the blockchain node cannot provide the TEE with expired permissions of account A that do not match data D1, and the blockchain node cannot use the old permissions to access the newly added data.

[0074] In the above another embodiment, function Read(b) includes GetKey(a / block 100) and GetKey(b / block 100), and TEE can use the private key to sign GetKey(a / block 100) and GetKey(b / block 100) respectively, and send GetKey(a / block 100) and GetKey(b / block 100) and their respective signatures to SPDK. In this embodiment, the access request for permission information and the access request for the data D1 to be read are respectively bound to the same block, thereby ensuring the matching of permission information and the read data D1, thereby achieving the same effect as the above embodiment.

[0075] In step S205 , the SPDK reads data after receiving the data read request.

[0076] In one embodiment, SPDK receives GetMultiKey(a,b) and its signature. SPDK first verifies the signature using the public key of TEE. Through the verification, it can be determined whether GetMultiKey(a,b) has been tampered with, thereby preventing attacks on blockchain nodes. After the verification, SPDK reads the value of variable a and the value of variable b corresponding to the same block based on the setting of the batch data reading interface. If the computing device 11 does not specify the corresponding block when sending GetMultiKey(a,b) and its signature, SPDK can read the value of variable a and the value of variable b corresponding to the latest block. If the computing device 11 specifies the corresponding block when sending GetMultiKey(a,b) and its signature, SPDK can read the value of variable a and the value of variable b corresponding to the specified block.

[0077] In another embodiment, SPDK receives GetMultiKey(a,b / block 100) and its signature. SPDK first verifies the signature using the public key of TEE. After the verification is passed, SPDK reads the value of variable a corresponding to block 100 and the value of variable b corresponding to block 100 respectively.

[0078] In another embodiment, SPDK receives GetKey(a / block 100) and GetKey(b / block 100) and their respective signatures. SPDK first verifies each signature using the public key of TEE. After the verification is passed, SPDK reads the value of variable a corresponding to block 100 and the value of variable b corresponding to block 100 respectively.

[0079] Step S207: SPDK sends the read result to the trusted execution environment through the computing device, wherein the read result includes the permission information and the data D1 corresponding to the same block.

[0080] refer to Figure 1 After reading the values ​​of variables a and b corresponding to the same block, SPDK uses its own private key to sign the reading result consisting of the values ​​of variables a and b, and sends the reading result and its signature to the computing device 11, which then provides the reading result and its signature to TEE. In the reading result, as described above, the value of variable a corresponds to the authority of account A, and the value of variable b is the data D1 to be read.

[0081] In one embodiment, when the block corresponding to the data is defined in the data read request, the SPDK may also include the block number of the block in the read result. For example, for the above read request GetMultiKey(a,b / block 100), GetMultiKey(a,100) or GetKey(a / block 100), the SPDK may include the block number of block 100 in the corresponding read result. It can be understood that the block number is used as an example to represent the block identification in the above text, and the embodiments of this specification are not limited to this. In the embodiments of this specification, other block identifications, such as block hash values, etc., may be used.

[0082] Step S209, after receiving the read result, TEE verifies the authority of the account A based on the authority information according to the verification logic in the contract 1.

[0083] After receiving the read result and its signature, TEE first verifies the signature using the public key of SPDK. If the verification is successful, the value of variable a is used to verify the permissions of account A. For example, in Read(b) described above, the permission verification logic is defined by the if...else... statement, that is, if the value of variable a is greater than 10, the value of variable b is returned, otherwise "insufficient permissions" is returned. According to the verification logic, it is first determined whether the value of variable a is greater than 10. If it is greater than 10, the computing device 11 is instructed to return the value of variable b to the user device, otherwise the computing device 11 is instructed to return insufficient permissions to the user device.

[0084] In one embodiment, in order to protect private data, encrypted data is stored in the SPDK. In this case, after the TEE verifies the signature, it first uses a predetermined key to decrypt the read encrypted data to obtain the value of variable a and the value of variable b, and verifies the authority of account A based on the value of variable a.

[0085] In another embodiment, when the read result includes a block number, the TEE may verify whether the block number is consistent with the block number in the data read request, and if they are consistent, verify the account authority.

[0086] Step S211, if the verification is successful, the TEE returns the data D1 to the user equipment through the computing device.

[0087] If the verification is successful, TEE signs the value of variable b and provides the value of variable b to computing device 11, instructing computing device 11 to return the value of variable b and its signature to the user device. By providing the value of variable b and its signature, the blockchain node is prevented from tampering with the value of variable b.

[0088] By executing transactions according to the embodiments of this specification, permission information access requests and data access requests are bound to each other and sent to trusted storage access, so that the trusted storage access sends matching permission information and access data to the trusted execution environment, and the trusted execution environment verifies the user's permissions. As a result, malicious blockchain nodes cannot use expired permissions to access newly added data on the blockchain, making the transaction execution results more credible.

[0089] Figure 3 The blockchain system is an architecture diagram according to an embodiment of the present specification, including a computing device 31 and a trusted storage device 32, wherein the computing device 31 includes a trusted execution environment 311, and the trusted storage device 32 stores the data of the blockchain. The blockchain system is used to execute Figure 2 The method shown, wherein

[0090] The trusted execution environment 311 is used to obtain a first transaction, which is sent by a user device based on a first account. The first transaction calls a first contract, which includes a data read request for reading permission information of the first account and first data, and through the data read request, it is limited that the permission information and the first data correspond to the same block; the data read request in the first contract is sent to the trusted storage device 32 through the computing device 31;

[0091] The trusted storage device 32 is used to read the data after receiving the data read request, and send the read result to the trusted execution environment 311 through the computing device 31, wherein the read result includes the permission information and the first data corresponding to the same block;

[0092] The trusted execution environment 311 is also used to verify the authority of the first account based on the authority information according to the verification logic in the first contract after receiving the read result, and if the verification passes, return the first data to the user device through the computing device 31.

[0093] In one implementation, the first contract includes a first read request, and the first read request is used to request batch reading of the permission information and the first data.

[0094] In one embodiment, the first contract includes a second read request and a third read request, wherein the second read request is used to request to read permission information corresponding to the first block, and the third read request is used to request to read first data corresponding to the first block.

[0095] In one embodiment, the trusted execution environment 311 is used to send the data read request in the first contract to the trusted storage device through the computing device, including: the trusted execution environment is used to sign the data read request, and send the data read request and its signature to the trusted storage device through the computing device;

[0096] The trusted storage device 32 is used to read data after receiving the data read request, and send the read result to the trusted execution environment through the computing device, including: the trusted storage device is used to verify the signature after receiving the data read request and its signature, and when the verification passes, read data based on the data read request, sign the read result, and send the read result and its signature to the trusted execution environment through the computing device.

[0097] In one embodiment, the first data is a second variable, and the first contract defines that the permission information and the value of the second variable correspond to a world state determined by the same block.

[0098] In one implementation, the first data is a first block, and the first contract defines that the permission information corresponds to the first block.

[0099] In one embodiment, the first data is a second variable, the data read request also includes a block identifier of the second block, and the trusted storage device 32 is used to read data based on the data read request, including the trusted storage device 32 being used to read data corresponding to the second block based on the block identifier of the second block.

[0100] In one implementation, the read result includes a block identifier of the second block, and the trusted execution environment 311 is further configured to verify whether the block identifier in the read result is consistent with the block identifier in the data read request after receiving the read result.

[0101] Figure 4 The block chain node according to the embodiment of the present specification is shown in the block chain node structure diagram, the block chain node includes the above-mentioned computing device 31 and the trusted storage device 32, wherein the computing device 31 includes a trusted execution environment 311, and the block chain node is used to execute Figure 2 The method shown.

[0102] On the other hand, the present specification provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed in a computer, the computer is caused to execute any one of the above methods.

[0103] Another aspect of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, any one of the above methods is implemented.

[0104] It should be understood that the descriptions such as “first” and “second” in this article are only used to distinguish similar concepts for the sake of simplicity of description and do not have any other limiting effect.

[0105] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0106] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0107] Those of ordinary skill in the art should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art can use different methods to implement the described functions for each specific application, but this implementation should not be considered to be beyond the scope of the present application. Among them, the software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0108] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for executing a transaction in a blockchain, performed by a blockchain node, the blockchain node comprising a trusted execution environment in a computing device, the method comprising: The trusted execution environment obtains a first transaction, the first transaction is sent by a user device based on a first account, a first contract is called in the first transaction, the first contract includes a data read request for reading permission information for verifying the permission of the first account and first data, and the permission information and the first data are limited to the same block through the data read request; The trusted execution environment sends the data read request to a trusted storage device through the computing device, and the trusted storage device stores the data of the blockchain; The trusted storage device reads the data after receiving the data read request, and sends the read result to the trusted execution environment through the computing device, wherein the read result includes the permission information and the first data corresponding to the same block; After receiving the read result, the trusted execution environment verifies the authority of the first account based on the authority information according to the verification logic in the first contract, and returns the first data to the user device through the computing device if the verification passes.

2. The method according to claim 1, wherein: The first contract includes a first read request, and the first read request is used to request batch reading of the permission information and the first data.

3. The method according to claim 1, wherein: The first contract includes a second read request and a third read request, wherein the second read request is used to request to read permission information corresponding to the first block, and the third read request is used to request to read first data corresponding to the first block.

4. The method according to any one of claims 1 to 3, wherein: The trusted execution environment sending the data read request in the first contract to the trusted storage device through the computing device includes: the trusted execution environment signing the data read request, and sending the data read request and its signature to the trusted storage device through the computing device; The trusted storage device reads data after receiving the data read request and sends the read result to the trusted execution environment through the computing device, including: after receiving the data read request and its signature, the trusted storage device verifies the signature, and if the verification passes, reads data based on the data read request, signs the read result, and sends the read result and its signature to the trusted execution environment through the computing device.

5. The method according to any one of claims 1 to 3, wherein: The blockchain node includes the trusted storage device.

6. A blockchain system, comprising a computing device and a trusted storage device, wherein the computing device comprises a trusted execution environment, and the trusted storage device stores the data of the blockchain, wherein: The trusted execution environment is used to obtain a first transaction, the first transaction is sent by a user device based on a first account, a first contract is called in the first transaction, the first contract includes permission information for requesting to read permissions for the first account and a data read request for first data, and the permission information and the first data are limited to correspond to the same block through the data read request; Sending the data read request to the trusted storage device through the computing device; The trusted storage device is used to read the data after receiving the data read request, and send the read result to the trusted execution environment through the computing device, wherein the read result includes the permission information and the first data corresponding to the same block; The trusted execution environment is also used to verify the authority of the first account based on the authority information according to the verification logic in the first contract after receiving the read result, and if the verification passes, return the first data to the user device through the computing device.

7. The system according to claim 6, wherein: The first contract includes a first read request, and the first read request is used to request batch reading of the permission information and the first data.

8. The system according to claim 6, wherein: The first contract includes a second read request and a third read request, wherein the second read request is used to request to read permission information corresponding to the first block, and the third read request is used to request to read first data corresponding to the first block.

9. The system according to any one of claims 6 to 8, wherein: The trusted execution environment is used to send the data read request in the first contract to the trusted storage device through the computing device, including: the trusted execution environment is used to sign the data read request, and send the data read request and its signature to the trusted storage device through the computing device; The trusted storage device is used to read data after receiving the data read request, and send the read result to the trusted execution environment through the computing device, including: the trusted storage device is used to verify the signature after receiving the data read request and its signature, and when the verification passes, read data based on the data read request, sign the read result, and send the read result and its signature to the trusted execution environment through the computing device.

10. The system according to any one of claims 6 to 8, wherein: The blockchain system includes a blockchain node, and the blockchain node includes the computing device and the trusted storage device.

11. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method for executing transaction in block chain and block chain system

    CN112884585A