Search

CN-121997349-A - Block chain processing method, device, electronic equipment and medium

CN121997349ACN 121997349 ACN121997349 ACN 121997349ACN-121997349-A

Abstract

The disclosure provides a blockchain processing method, a blockchain processing device, electronic equipment and a medium. The blockchain processing method includes the steps of utilizing a trusted execution environment to extract a first total abstract from a first block head of a target block, conducting encryption processing based on the first total abstract to obtain a first ciphertext, storing the first ciphertext in a ciphertext storage space, recording the target block on a blockchain, responding to an acquisition request of a target terminal for a target transaction object state, utilizing the trusted execution environment to acquire the first ciphertext from the ciphertext storage space, conducting decryption processing based on the first ciphertext to obtain a recovered first total abstract, acquiring the target transaction object state and a second total abstract from a blockchain accounting program, responding to the first total abstract being consistent with the second total abstract, and returning the target transaction object state to the target terminal. The embodiment of the disclosure reduces encryption cost of the blockchain node while ensuring the security of the transaction object state query. The embodiment of the disclosure can be applied to scenes such as cloud service object state query and the like.

Inventors

  • ZHENG WEILIN
  • ZHOU GUIBIN
  • ZHANG ZIYANG
  • XU JIAHAO

Assignees

  • 腾讯科技(深圳)有限公司

Dates

Publication Date
20260508
Application Date
20241107

Claims (20)

  1. 1. A blockchain processing method, performed by a target blockchain link point, the target blockchain link point having a trusted execution environment, a blockchain billing program, and a ciphertext storage space, the blockchain processing method comprising: in response to generating a target block to be recorded into a blockchain, extracting a first total abstract from a first block header of the target block by utilizing the trusted execution environment, performing encryption processing based on the first total abstract to obtain a first ciphertext, and storing the first ciphertext into the ciphertext storage space, wherein the target block comprises one or more transactions, and the first total abstract refers to a total abstract of each transaction object state after the one or more transactions are executed; Recording the target block onto the blockchain; Responding to an acquisition request of a target terminal for the object state of the target transaction after the one or more transactions are executed, acquiring the first ciphertext from the ciphertext storage space by utilizing the trusted execution environment, and performing decryption processing based on the first ciphertext to obtain the recovered first total abstract; Obtaining a target transaction object state and a second total digest from the blockchain accounting program, wherein the second total digest refers to the total digest of each transaction object state when the target blockchain link point receives the obtaining request; and returning the target transaction object state to the target terminal in response to the first total digest being consistent with the second total digest.
  2. 2. The blockchain processing method of claim 1, wherein the first summary is generated by the blockchain accounting program by: Determining the abstract of the object state of each transaction after each transaction in the target block is executed; generating a first abstract tree, wherein the lowest node of the first abstract tree is the abstract of each transaction object state, and other nodes except the lowest node in the first abstract tree are generated by abstract operation after cascade connection of a plurality of adjacent nodes of the other nodes at the lower layer until a first root node at the uppermost layer is generated; the first summary is determined based on the first root node.
  3. 3. The blockchain processing method of claim 1 or 2, wherein the extracting a first summary from a first block header of the target block includes: Acquiring the first block header of the target block, and extracting a third total abstract from the first block header, wherein the third total abstract is a total abstract of each transaction object state before the transaction in the target block is executed; Acquiring a second block header of a previous block of the target block, and extracting a fourth total abstract from the second block header, wherein the fourth total abstract is a total abstract of each transaction object state after the transaction in the previous block is executed; and if the third total abstract is consistent with the fourth total abstract, determining that the first block head is valid, and extracting the first total abstract from the first block head.
  4. 4. The blockchain processing method of claim 3, wherein the determining that the first block header is valid if the third total digest is consistent with the fourth total digest comprises: acquiring a consensus protocol version number from the first block header in response to the third total digest being consistent with the fourth total digest; And if the acquired consensus protocol version number belongs to a preset version number set, determining that the first block header is valid.
  5. 5. The blockchain processing method of any of claims 1-4, wherein the performing encryption processing based on the first total digest to obtain a first ciphertext, storing the first ciphertext in the ciphertext storage space, includes: acquiring a first block identifier of a target block; integrating the first total abstract and the first block identifier to obtain a first integrated body; Encrypting the first integration body to obtain the first ciphertext; And storing the first ciphertext and the first block identifier in the ciphertext storage space correspondingly.
  6. 6. The blockchain processing method of claim 5, wherein the obtaining the first ciphertext from the ciphertext storage space, performing decryption processing based on the first ciphertext, and obtaining the recovered first total digest, includes: acquiring the first block identifier from the acquisition request; Acquiring a second ciphertext corresponding to the first block identifier from the ciphertext storage space; Performing decryption processing based on the second ciphertext to obtain a second integration body; Obtaining a fifth total abstract and a third block identifier from the second integration body; and in response to the third block identification being consistent with the first block identification, determining the fifth total digest as the recovered first total digest.
  7. 7. The blockchain processing method of claim 6, wherein the integrating the first summary and the first block identifier to obtain a first integrated body includes interleaving the first summary and the first block identifier according to a target interleaving rule to obtain the first integrated body; the step of obtaining the fifth total abstract and the third block identifier from the second integrated body comprises the step of de-interleaving the second integrated body according to the target interleaving rule to obtain the fifth total abstract and the third block identifier.
  8. 8. The blockchain processing method of claim 7, wherein interleaving the first summary and the first block identifier according to a target interleaving rule to obtain the first ensemble includes: extracting a target block type of the target block from the first block header; Determining the target interleaving rule based on the target block type; and interleaving the first total abstract and the first block identifier according to the determined target interleaving rule to obtain the first integration body.
  9. 9. The blockchain processing method of claim 7, wherein the de-interleaving the second ensemble according to the target interleaving rule to obtain the fifth total digest and the third block identifier, includes: Acquiring a target block type of a target block from the acquisition request; Determining the target interleaving rule based on the target block type; and de-interleaving the second integrated body according to the determined target interleaving rule to obtain the fifth total abstract and the third block identifier.
  10. 10. The blockchain processing method of claim 6, wherein the encrypting the first ensemble to obtain the first ciphertext includes symmetrically encrypting the first ensemble to obtain the first ciphertext using a private key of the trusted execution environment; The decryption processing is performed based on the second ciphertext to obtain a second integrated body, and the decryption processing comprises the step of symmetrically decrypting based on the second ciphertext by utilizing the private key to obtain the second integrated body.
  11. 11. The blockchain processing method of claim 6, wherein the integrating the first summary and the first blockidentifier to obtain a first ensemble includes concatenating the first summary and the first blockidentifier into a tuple as the first ensemble by a predetermined separator; The step of obtaining a fifth total abstract and a third block identifier from the second integrated body comprises the step of performing tuple analysis on the second integrated body based on the predetermined separator to obtain the fifth total abstract and the third block identifier.
  12. 12. The blockchain processing method of any of claims 1-11, wherein after recording the target block onto the blockchain, the blockchain processing method further comprises: The method comprises the steps of receiving a composite acquisition request of a target terminal for a composite state of a target block, wherein the composite state is associated with a plurality of target transaction object states, acquiring the first ciphertext from the ciphertext storage space by utilizing the trusted execution environment, decrypting based on the first ciphertext to obtain a recovered first total abstract, acquiring the plurality of target transaction object states and a sixth total abstract from a blockchain accounting program, generating the composite state by utilizing the plurality of acquired target transaction object states in response to the first total abstract being consistent with the sixth total abstract, and returning the composite state to the target terminal, wherein the sixth total abstract refers to the total abstract of each transaction object state when the target blockchain node receives the composite acquisition request.
  13. 13. The blockchain processing method of claim 12, wherein the compound acquisition request includes a compound state function that indicates a changing relationship of the compound state with the plurality of target transaction object states; The generating the composite state by using the obtained target transaction object states comprises substituting the obtained target transaction object states into the composite state function to obtain the composite state.
  14. 14. The blockchain processing method of any of claims 1-13, wherein the trusted execution environment has a built-in virtual machine; The responding to the first total abstract being consistent with the second total abstract, returning the target transaction object state to the target terminal comprises the following steps: And taking the first total abstract as a target context of the built-in virtual machine, enabling the built-in virtual machine to compare the second total abstract with the target context, and returning the target transaction object state to the target terminal in response to the second total abstract being consistent with the target context.
  15. 15. The blockchain processing method of any of claims 1-14, wherein the returning the target transaction object state to the target terminal includes: Signing the target transaction object state by utilizing a private key of the trusted execution environment to obtain a target signature; And returning the target signature to the target terminal together with the target transaction object state so that the target terminal can verify the target transaction object state by using the target signature.
  16. 16. The blockchain processing method of claim 15, wherein prior to extracting a first summary digest from a first block header of a target block with the trusted execution environment in response to generating the target block to be recorded to the blockchain, the blockchain processing method further comprises publishing a public key of the trusted execution environment; The target terminal verifies the target transaction object state by using the target signature, and the method comprises the following steps: decrypting the target signature by using the public key to obtain a decryption result; performing abstract operation on the target transaction object state by using a preset abstract algorithm to obtain a target transaction object state abstract; and if the decryption result is consistent with the state abstract of the target transaction object, the verification is successful.
  17. 17. A blockchain processing device executing at a target blockchain link point, the target blockchain link point having a trusted execution environment, a blockchain billing program, and a ciphertext storage space, the blockchain processing device comprising: the first response unit is used for responding to the generation of a target block to be recorded to a blockchain, extracting a first total digest from a first block head of the target block by utilizing the trusted execution environment, carrying out encryption processing based on the first total digest to obtain a first ciphertext, and storing the first ciphertext into the ciphertext storage space, wherein the target block comprises one or more transactions, and the first total digest refers to a total digest of the object states of all transactions after the one or more transactions are executed; A recording unit configured to record the target block onto the blockchain; The second response unit is used for responding to an acquisition request of the target terminal for the target transaction object state after the one or more transactions are executed, acquiring the first ciphertext from the ciphertext storage space by utilizing the trusted execution environment, and performing decryption processing based on the first ciphertext to obtain the recovered first total abstract; The acquiring unit is used for acquiring a target transaction object state and a second total abstract from the blockchain accounting program, wherein the second total abstract refers to the total abstract of each transaction object state when the target blockchain link point receives the acquisition request; and the third response unit is used for responding to the consistency of the first total abstract and the second total abstract and returning the target transaction object state to the target terminal.
  18. 18. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the blockchain processing method of any of claims 1 to 16 when executing the computer program.
  19. 19. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the blockchain processing method of any of claims 1 to 16.
  20. 20. A computer program product comprising a computer program, wherein the computer program is read and executed by a processor of a computer device to cause the computer device to perform the blockchain processing method of any of claims 1 to 16.

Description

Block chain processing method, device, electronic equipment and medium Technical Field The disclosure relates to the technical field of blockchain, and in particular relates to a blockchain processing method, a blockchain processing device, electronic equipment and a blockchain processing medium. Background In the current blockchain cloud service system, a cloud service node serves as a blockchain node, and a Remote Procedure Call (RPC) interface is provided for a user without running the blockchain node, so that the user can inquire the object state related to the transaction in the blockchain. For example, in the case where the blockchain records a resource interaction transaction, a user can query the resource status of each resource pool after execution of the blocktransaction through the RPC interface. Under the condition that the blockchain records the internet of things transaction, a user can inquire the state of each internet of things device (such as a signal lamp) after the internet of things transaction is executed through the RPC interface. In making such a status query, it is typically done through a blockchain accounting program of the blockchain node. The blockchain accounting program maintains the status of each transaction object in addition to the blockchain. For example, for the resource status of each resource pool, the blockchain accounting program maintains the resource status of each resource pool. After receiving the state query, the blockchain billing program looks up the maintained transaction object state and returns the query result. The transaction object state inquired by the mode is easy to be modified by the cloud service node, and the security is low. If the trusted execution environment is set in the cloud service node to ensure the security of the query result, the encryption cost is higher for the cloud service provider because all the transaction object states are generally required to be stored by using the trusted execution environment in an encryption mode at this time so as to be used for verifying the correctness of the query result. How to reduce encryption cost of cloud service providers while guaranteeing security of state query becomes a challenge. Disclosure of Invention The embodiment of the disclosure provides a blockchain processing method, a device, electronic equipment and a medium, which can reduce encryption cost of blockchain nodes while guaranteeing security of transaction object state query. According to an aspect of the present disclosure, there is provided a blockchain processing method performed by a target blockchain link point having a trusted execution environment, a blockchain billing program, and a ciphertext storage space, the blockchain processing method including: in response to generating a target block to be recorded into a blockchain, extracting a first total abstract from a first block header of the target block by utilizing the trusted execution environment, performing encryption processing based on the first total abstract to obtain a first ciphertext, and storing the first ciphertext into the ciphertext storage space, wherein the target block comprises one or more transactions, and the first total abstract refers to a total abstract of each transaction object state after the one or more transactions are executed; Recording the target block onto the blockchain; Responding to an acquisition request of a target terminal for the object state of the target transaction after the one or more transactions are executed, acquiring the first ciphertext from the ciphertext storage space by utilizing the trusted execution environment, and performing decryption processing based on the first ciphertext to obtain the recovered first total abstract; Obtaining a target transaction object state and a second total digest from the blockchain accounting program, wherein the second total digest refers to the total digest of each transaction object state when the target blockchain link point receives the obtaining request; and returning the target transaction object state to the target terminal in response to the first total digest being consistent with the second total digest. According to an aspect of the present disclosure, there is provided a blockchain processing device executing at a target blockchain link point, the target blockchain link point having a trusted execution environment, a blockchain billing program, and a ciphertext storage space, the blockchain processing device comprising: the first response unit is used for responding to the generation of a target block to be recorded to a blockchain, extracting a first total digest from a first block head of the target block by utilizing the trusted execution environment, carrying out encryption processing based on the first total digest to obtain a first ciphertext, and storing the first ciphertext into the ciphertext storage space, wherein the target block comprises one or more transactions, and