Block chain data processing method and device, equipment and storage medium

By using secure hardware clients in blockchain node devices for encryption and decryption, and performing effectiveness verification in secure hardware areas, the problem of blockchain nodes being vulnerable to attacks is solved, and high security transmission and storage of transaction data is achieved.

CN120256514APending Publication Date: 2025-07-04TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410012936.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-02
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

Blockchain nodes are prone to stolen or tampered with transaction data when they are invaded, resulting in lower security of transaction data.

Method used

By installing a secure hardware client in the node devices in the blockchain network, encrypting and decrypting transaction data using the hardware public key and hardware private key, and verifying effectiveness in the secure hardware area, ensuring the security of transaction data during transmission and storage.

Benefits of technology

Improve the security and integrity of transaction data transmission, prevent illegal users from stealing or tampering with transaction data, and even if the target node device is invaded by an attacker, it cannot obtain plaintext data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256514A_ABST
    Figure CN120256514A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a block chain data processing method and device, equipment and a storage medium, and is applied to the block chain technology, and the method comprises the steps: receiving an uplink request for uploading transaction data to a block chain in a block chain network; in a first security hardware area associated with the first security hardware client, decrypting the first ciphertext data by adopting a first hardware private key of the target node equipment to obtain plaintext data of the transaction data; in the first security hardware area, carrying out validity verification on plaintext data of the transaction data to obtain a validity verification result; and when the validity verification result indicates that the plaintext data of the transaction data is valid, encrypting the plaintext data of the transaction data by using the first hardware public key in the first security hardware region to obtain first ciphertext data of the transaction data, and storing the first ciphertext data to the block chain. According to the invention, the security of the transaction data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of blockchain technology and the like, and in particular, to a blockchain data processing method, apparatus, device, and storage medium. Background Art

[0002] Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a string of data blocks generated by using cryptographic methods, and each data block contains multiple transaction data. The blockchain nodes to which the blockchain belongs are used to verify the validity (anti-counterfeiting) of its transaction data and generate the next block. It is found in practice that when the blockchain nodes are invaded, the transaction data is easily stolen or tampered with, resulting in relatively low security of the transaction data. Summary of the Invention

[0003] Embodiments of this application provide a blockchain data processing method, apparatus, device, and storage medium, which can improve the security of transaction data.

[0004] On the one hand, an embodiment of this application provides a blockchain data processing method, including:

[0005] Receiving a blockchain request for uploading transaction data to a blockchain in a blockchain network; the blockchain request carries first ciphertext data of the transaction data; the first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of a target node device, the target node device is a node device in the blockchain network that receives the blockchain request, and the first hardware public key is generated by a first secure hardware client in the target node device;

[0006] Through the first secure hardware client, in a first secure hardware area associated with the first secure hardware client, decrypting the first ciphertext data with the first hardware private key of the target node device to obtain plaintext data of the transaction data;

[0007] Through the first secure hardware client, in the first secure hardware area, validating the plaintext data of the transaction data to obtain a validity verification result;

[0008] When the validity verification result indicates that the plaintext data of the transaction data is valid, through the first secure hardware client, in the first secure hardware area, encrypting the plaintext data of the transaction data with the first hardware public key to obtain the first ciphertext data of the transaction data, and storing the first ciphertext data on the blockchain.

[0009] One aspect of an embodiment of the present application provides a blockchain data processing device, including:

[0010] A receiving module, configured to receive a blockchain request for uploading transaction data to a blockchain in a blockchain network; the blockchain request carries first ciphertext data of the transaction data; the first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of a target node device, the target node device is a node device in the blockchain network that receives the blockchain request, and the first hardware public key is generated by a first secure hardware client in the target node device;

[0011] A decryption module, configured to decrypt the first ciphertext data with the first hardware private key of the target node device in a first secure hardware area associated with the first secure hardware client through the first secure hardware client to obtain plaintext data of the transaction data;

[0012] A verification module, configured to perform validity verification on the plaintext data of the transaction data in the first secure hardware area through the first secure hardware client to obtain a validity verification result;

[0013] An uploading module, configured to, when the validity verification result indicates that the plaintext data of the transaction data is valid, encrypt the plaintext data of the transaction data with the first hardware public key in the first secure hardware area through the first secure hardware client to obtain the first ciphertext data of the transaction data, and store the first ciphertext data on the blockchain.

[0014] One aspect of an embodiment of the present application provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0015] Optionally, the verification module may include a verification unit, an encryption unit, and a first determination unit;

[0016] A verification unit, configured to perform validity verification on the plaintext data of the transaction data in the first secure hardware area through the first secure hardware client to obtain a first validity verification result;

[0017] An encryption unit, which is used to encrypt the plaintext data of the transaction data by using the second hardware public key of the remaining node devices in the first security hardware area through the first security hardware client, so as to obtain the second ciphertext data of the transaction data, and send the second ciphertext data to the remaining node devices; the remaining node devices are devices other than the target node device in the blockchain network; the remaining node devices are used to decrypt the second ciphertext data by using the second hardware private key of the remaining node devices in the second security hardware area through the second security hardware client, so as to obtain the plaintext data of the transaction data, and perform validity verification on the plaintext data of the transaction data to obtain a second validity verification result;

[0018] A first determination unit, which is used to receive the second validity verification result returned by the remaining node devices, and determine the validity verification result of the plaintext data of the transaction data according to the first validity verification result and the second validity verification result.

[0019] Optionally, the on-chain request further carries the device attribute information of the first terminal that sends the on-chain request, and the transaction signature of the transaction data;

[0020] Optionally, the verification unit is specifically used for:

[0021] Read the permission database from the blockchain; the permission database includes the device attribute information corresponding to the permission terminals with the on-chain request permission for the transaction data;

[0022] Through the first security hardware client, in the first security hardware area, verify the on-chain request permission of the first terminal for the transaction data according to the device attribute information in the permission database and the device attribute information carried by the on-chain request, so as to obtain a permission verification result;

[0023] Verify the transaction signature of the transaction data according to the public key of the first terminal and the plaintext data of the transaction data, so as to obtain a signature verification result;

[0024] Determine the first validity verification result of the plaintext data of the transaction data according to the permission verification result and the signature verification result.

[0025] Optionally, the first determination unit is specifically used for

[0026] According to the first validity verification result and the second validity verification result, count the number of valid devices in the blockchain network that determine that the plaintext data of the transaction data is valid;

[0027] Count the number of participating device corresponding to the node devices in the blockchain network that participate in the legitimacy verification of the plaintext data of the transaction data, and the total number of device corresponding to the node devices in the blockchain network;

[0028] Determine the validity verification result of the plaintext data of the transaction data according to the number of participating device, the number of valid device, and the total number of device.

[0029] Optionally, the encryption unit is specifically configured to:

[0030] Obtain N hardware sub-public keys derived from the second hardware public keys of the remaining node devices;

[0031] Divide the plaintext data of the transaction data in the first secure hardware area through the first secure hardware client to obtain N plaintext data segments of the transaction data;

[0032] Encrypt the N plaintext data segments of the transaction data by using the N hardware sub-public keys to obtain N ciphertext data segments of the transaction data; one ciphertext data segment is obtained by encrypting one plaintext data segment with one hardware sub-public key; the second ciphertext data includes the N ciphertext data segments;

[0033] Batch send the N ciphertext data segments to the remaining node devices; the remaining node devices are further configured to decrypt the N ciphertext data segments by using the second hardware private keys of the remaining node devices in the second secure hardware area to obtain the N plaintext data segments, and merge the N plaintext data segments to obtain the plaintext data of the transaction data.

[0034] Optionally, the on-chain request further carries transaction attribute information of the transaction data; the on-chain module may include a second determination unit and an on-chain unit;

[0035] The second determination unit is configured to determine, from the node devices in the blockchain network, the accounting node device for on-chain of the transaction data according to the transaction attribute information carried in the on-chain request;

[0036] The on-chain unit is configured to store the first ciphertext data on the blockchain when the target node device is the accounting node device.

[0037] Optionally, the second determination unit is specifically configured to:

[0038] Determine the institution to which the transaction data belongs according to the transaction attribute information carried in the on-chain request;

[0039] Select the node devices associated with the above-mentioned institution from the node devices of the above-mentioned blockchain network as candidate node devices;

[0040] Determine the accounting node device for uploading the above-mentioned transaction data to the blockchain from the above-mentioned candidate node devices according to the occupancy rate of the device resources of the above-mentioned candidate node devices.

[0041] Optionally, the second determination unit is specifically used for:

[0042] Obtain the occupancy rate and weight corresponding to each of the M types of device resources of the above-mentioned candidate node devices; M is an integer greater than 1;

[0043] Perform a weighted summation process on the occupancy rates corresponding to the M types of device resources of the above-mentioned candidate node devices according to the weights corresponding to the M types of device resources, to obtain the total occupancy rate of the M types of device resources of the above-mentioned candidate node devices;

[0044] Determine the candidate node device with the minimum total occupancy rate as the accounting node device for uploading the above-mentioned transaction data to the blockchain.

[0045] Optionally, the device may further include a reading module and an encryption module;

[0046] The receiving module is further configured to receive a acquisition request from a second terminal regarding the above-mentioned transaction data;

[0047] The reading module is configured to read the first ciphertext data of the above-mentioned transaction data from the above-mentioned blockchain according to the above-mentioned acquisition request;

[0048] The decryption module is further configured to decrypt the above-mentioned first ciphertext data by using the first hardware private key of the above-mentioned target node device in the above-mentioned first secure hardware area through the above-mentioned first secure hardware client to obtain the plaintext data of the above-mentioned transaction data;

[0049] The encryption module is configured to encrypt the plaintext data of the above-mentioned transaction data by using the public key of the above-mentioned second terminal in the above-mentioned first secure hardware area through the above-mentioned first secure hardware client to obtain the third ciphertext data of the above-mentioned transaction data, and send the third ciphertext data to the above-mentioned second terminal.

[0050] Optionally, the above-mentioned acquisition request carries the device attribute information of the above-mentioned second terminal and the transaction attribute information of the above-mentioned transaction data;

[0051] The reading module is specifically configured to verify the acquisition permission of the above-mentioned second terminal for the above-mentioned transaction data according to the device attribute information of the above-mentioned second terminal; when the above-mentioned second terminal has the acquisition permission for the above-mentioned transaction data, read the first ciphertext data of the above-mentioned transaction data from the above-mentioned blockchain according to the above-mentioned transaction attribute information.

[0052] Optionally, the device may further include a synchronization module;

[0053] The synchronization module is used to synchronize the mirror image file of the first secure hardware client to the management node device in the blockchain network; when the target node device is in an abnormal state and receives a recovery signature request, the management node device is used to run the mirror image file of the first secure hardware client to recover the first hardware private key; the recovery signature request is used to indicate that a specified number of node devices in the blockchain network need to recover the first hardware private key;

[0054] The management node device is further used to decrypt the first ciphertext data to obtain the plaintext data of the transaction data by using the recovered first hardware private key in the second secure hardware area through the second secure hardware client; encrypt the plaintext data of the transaction data by using the public key of the second terminal in the second secure hardware area through the second secure hardware client to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

[0055] On the one hand, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0056] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0057] In the present application, each node device in the blockchain network is installed with a secure hardware client, and the secure hardware client is associated with the secure hardware area of the node device. The secure hardware client can be used to generate a hardware key pair for each node device. The hardware key pair includes a hardware private key and a hardware public key, and the hardware private key is stored in the secure hardware area. Through the hardware public key, encrypted transmission of transaction data can be realized, which can avoid the transaction data being stolen by illegal users or non-secure hardware areas in the node device during the transmission process, and improve the transmission security of the transaction data. At the same time, through the secure hardware client, the ciphertext data (i.e., the first ciphertext data) of the transaction data is decrypted by using the hardware private key in the secure hardware area, and the validity of the transaction data is verified in the secure hardware area. When it is determined that the transaction data is valid, the ciphertext data of the transaction data is stored on the blockchain. The decryption process and validity verification process of the transaction data are both implemented in the secure hardware area. At the same time, the ciphertext data of the transaction data is uploaded to the blockchain. Even if the target node device is illegally invaded by an attacker, the attacker cannot obtain the plaintext data of the transaction data, which can improve the security of the transaction data. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0059] Figure 1 It is a schematic diagram of a blockchain data processing system provided by the present application;

[0060] Figure 2 It is a schematic diagram of the interaction scenario between devices in a blockchain data processing system provided by the present application;

[0061] Figure 3 It is a schematic flowchart of a blockchain data processing method provided by the present application;

[0062] Figure 4 It is a schematic flowchart of a blockchain data processing method provided by the present application;

[0063] Figure 5 It is a schematic diagram of the scenario where a target node device sends second ciphertext data to the remaining node devices in the blockchain network;

[0064] Figure 6 It is a schematic diagram of the scenario for determining the validity verification result of transaction data according to the first validity verification result and the second validity verification result;

[0065] Figure 7 It is a schematic structural diagram of a blockchain data processing device provided by an embodiment of the present application;

[0066] Figure 8 It is a schematic structural diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0067] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0068] First, introduce the blockchain data processing system to which this solution is applied. Please refer to Figure 1 , Figure 1Schematic diagram of the structure of a blockchain data processing system provided by an embodiment of the present application. The blockchain data processing system may include a blockchain network and a terminal.

[0069] Among them, the blockchain network is an end-to-end decentralized network jointly composed of multiple node devices (which can also be called blockchain nodes). The number of node devices in the blockchain network can be deployed according to actual needs, and the present application does not limit the number of node devices; for Figure 1 example, taking the case where there are 4 node devices in the blockchain network as an example for illustration, the 4 node devices are node device 101, node device 102, node device 103, and node device 104 respectively.

[0070] It can be understood that the functions involved in each node device in the blockchain network include:

[0071] 1) Routing, which is a basic function of the node device and is used to support communication between node devices.

[0072] For example, as Figure 1 shown, data or blocks can be transmitted between node devices through network connections. The above network connections between node devices can perform data transmission based on node identifiers. Each node device has its corresponding node identifier, and each of the above node devices can store the node identifiers of other node devices that are connected to itself, so as to broadcast the obtained data or generated blocks to other node devices according to the node identifiers of other node devices in the future. For example, node device 101 can maintain a node identifier list, and this node identifier list stores the node names and node identifiers of other node devices, as shown in Table 1:

[0073] Table 1

[0074]

[0075]

[0076] As shown in Table 1, assuming that the node identifier of node device 101 is aaaa, then node device 101 can send a data synchronization request to node device 102 through aaaa, and node device 102 can know that this data synchronization request is sent by node device 101 through the node identifier aaaa; similarly, node device 102 can send transaction data A to node device 101 through the node identifier bbbb, and node device 101 can know that this transaction data A is sent by node device 102 through the node identifier bbbb. The data transmission between other node devices is also the same, so it will not be elaborated one by one.

[0077] 2) An application, which is used to be deployed in a blockchain, implements specific services according to actual business requirements, records data related to the implemented functions to form recorded data, carries a digital signature in the recorded data to indicate the source of the task data, and sends the recorded data to other node devices in the blockchain network. When other node devices verify the source and integrity of the recorded data successfully, they add the recorded data to a temporary block.

[0078] For example, the services implemented by the application include:

[0079] 2.1) Resource management service. The node device may include a resource client, which can be used to implement the resource management service function and establish a communication connection with a decentralized application client based on this resource management service function. The resource client is a tool for managing and storing users' digital resources. For example, digital resources can be transferred to other accounts based on the resource client, or digital resources transferred from other accounts can be received based on the resource client. The resource client can be a hardware device or a software program.

[0080] It can be understood that with the wide deployment of various decentralized applications on the blockchain and the increase in users' activities on the blockchain, when ordinary users use decentralized applications, they can log in using a blockchain key management tool. The address in the blockchain key management tool corresponds to a user on the blockchain. The decentralized application can obtain the user address from the key management tool through some interfaces. To solve the problem that the Dapp background cannot trust the user address used when the decentralized application logs in.

[0081] 2.2) A shared ledger, which is used to provide functions such as storage, query, and modification of account data (i.e., transaction data). It sends the recorded data of the operations on the account data to other nodes in the blockchain network. After other nodes verify its validity, as a response to acknowledging the validity of the account data, they deposit the recorded data into a temporary block and can also send a confirmation to the node device that initiated the operation.

[0082] For example, each node device can receive data to be recorded during normal operation and maintain a shared ledger (i.e., the blockchain) based on the received data to be recorded. To ensure information intercommunication within the shared ledger network, there can be a network connection between each node device in the shared ledger network, and data can be transmitted between node devices through the above network connection. For example, when any node device in the shared ledger network receives data to be recorded, other node devices in the shared ledger network verify the data to be recorded according to the consensus algorithm. After successful verification (i.e., after reaching a consensus), the data to be recorded is stored as data in the shared ledger, so that the data stored on all node devices in the shared ledger network is consistent.

[0083] 2.3) A smart contract, which is a computerized protocol that can execute the terms of a certain contract. It is implemented through code deployed on a shared ledger and executed when certain conditions are met. According to actual business requirements, the code is used to complete automated transactions, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's digital resources to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.

[0084] Among them, a secure hardware client is installed in each node device of the blockchain network in this application. The secure hardware client is associated with the secure hardware area in the node device. The secure hardware client is used to process the data in the secure hardware area and isolate the secure hardware area from the non-secure hardware area based on encryption technology and secure isolation technology, effectively preventing the data in the secure hardware area from being illegally stolen. Specifically, the secure hardware client has the following functions: (1) Generate the hardware public key and hardware private key of the node device. The hardware public key is publicly available. For example, the node device can send the hardware public key to the terminal and node device associated with the node device. The hardware private key is not publicly available and can be burned into the secure hardware area. The non-secure hardware area other than the secure hardware area in the node device and other devices cannot obtain the hardware private key. (2) In the secure hardware area, decrypt the ciphertext data of the transaction data using the hardware private key. (3) In the secure hardware area, verify the validity of the plaintext data of the transaction data.

[0085] Among them, the transaction data can be data used to indicate a transaction of digital assets. For example, the transaction data can be used to indicate a buy operation or a sell operation on digital assets. The digital assets can refer to coupons, digital collections, game coins, game themes, stocks, etc. Or, the transaction data can refer to electronic invoices, etc.

[0086] Among them, the number of terminals can be deployed according to actual needs, and this application does not limit the number of terminals. For example, Figure 1 in this system, 3 terminals are taken as an example for illustration. The 3 terminals are Terminal 111, Terminal 112, and Terminal 113 respectively. The terminal can include a blockchain application, which can also be called a blockchain client. It can be used to encrypt the transaction data using the hardware public key of the node device to obtain the ciphertext data of the transaction data, generate an on-chain request for the transaction data, and send the on-chain request to the node device in the blockchain network. The on-chain request carries the ciphertext data of the transaction data.

[0087] Among them, the node devices in the blockchain network can refer to terminals or servers. The server can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. The terminals in this application can include: smart phones, tablets, laptop computers, desktop computers, intelligent voice interaction devices, smart home appliances (such as smart TVs), wearable devices, vehicle-mounted terminals, and other intelligent terminals with data processing functions. Each terminal and the node device can interact through wireless communication or wired communication methods.

[0088] In practice, it is found that when the blockchain node (i.e., the node device) is invaded, it is easy to cause the transaction data to be stolen or tampered with, resulting in relatively low security of the transaction data. If the transaction data is a transfer transaction of digital assets, if the transaction data is tampered with, it will cause asset losses to users. Based on this, this application provides a blockchain data processing method, which can avoid the transaction data from being tampered with and improve the security of the transaction data. Specifically, as Figure 2 shown, the Figure 2 can be a schematic diagram of the interaction scenario between the node device and the terminal in the blockchain data processing system. Figure 2 The terminal 20a in Figure 1 can refer to any one of the terminals in the Figure 2 The node device 21a in Figure 1 can refer to any node device in the blockchain network in the Figure 2 The electronic invoice is used as an example for illustration. The blockchain network can refer to a decentralized network built by an electronic invoice reimbursement institution. Each node device in the blockchain network is used to reimburse electronic invoices. Different node devices can be used to reimburse electronic invoices in different regions, or different node devices can be used to reimburse electronic invoices corresponding to different items.

[0089] In the specific implementation process, the terminal 20a can respond to the startup operation for the blockchain application and display the page 24a in the blockchain application. The page 24a can be a page for selecting the transaction data to be uploaded to the chain, such as Figure 2As shown in the figure, the page 24a includes the electronic invoice 25a to be uploaded to the blockchain and the option to upload to the blockchain. In response to the trigger operation for the option to upload to the blockchain, the terminal 20a takes the electronic invoice 25a as transaction data, and can select, according to the location information of the terminal 20a, the node device with the shortest distance from the terminal 20a in the blockchain network as the node device associated with the terminal 20a. Alternatively, the terminal 20a can select, according to the item indicated by the electronic invoice 25a, the node device for the electronic invoice for reimbursing the above item in the blockchain network as the node device associated with the terminal 20a. Figure 2 Taking the association between the node device 21a and the terminal 20a as an example for illustration.

[0090] Furthermore, the terminal 20a can use the hardware public key of the node device 21a to encrypt the electronic invoice 25a to obtain the encrypted electronic invoice (i.e., the first ciphertext data), generate an upload request carrying the encrypted electronic invoice, and send the upload request to the node device 21a. The node device 21a can use the hardware private key of the node device 21a to decrypt the encrypted electronic invoice in the first secure hardware area through the first secure hardware client to obtain the electronic invoice 25a (i.e., the plaintext data). The node device 21a can effectively verify the electronic invoice 25a in the first secure hardware area through the first secure hardware client to obtain the validity verification result, that is, verify whether the electronic invoice 25a is authentic, complete, etc. When the validity verification result indicates that the electronic invoice 25a is not valid, the node device 21a refuses to upload the electronic invoice 25a to the blockchain. When the validity verification result indicates that the electronic invoice 25a is valid, the node device 21a can use the hardware public key 22a of the node device 21a to encrypt the electronic invoice 25a in the first secure hardware area to obtain the encrypted electronic invoice, and store the encrypted electronic invoice in the blockchain 26a.

[0091] Optionally, before storing the electronic invoice 25a on the blockchain 26a, the node device 21a can perform reimbursement processing on the electronic invoice 25a in the first secure hardware area through the first secure hardware client to obtain the reimbursement result. The node device 21a can use the hardware public key 22a of the node device 21a to encrypt the reimbursement result in the first secure hardware area to obtain the encrypted reimbursement result, and store the encrypted reimbursement result and the encrypted electronic invoice in the blockchain 26a.

[0092] In summary, by transmitting the electronic invoice in an encrypted manner, decrypting the encrypted electronic invoice in the secure hardware area, and performing verification, reimbursement, etc. on the electronic invoice in the secure hardware area, it is possible to prevent the electronic invoice from being stolen by illegal users and improve the processing security of the electronic invoice.

[0093] Further, please refer to Figure 3 which is a schematic flowchart of a blockchain data processing method provided by an embodiment of the present application. As Figure 3 shown, this method is executed by a target node device in a Figure 1 blockchain network, and the target node device may be a node device in the blockchain network. Among them, this method may include the following steps:

[0094] S101. Receive a blockchain request for uploading transaction data to a blockchain in a blockchain network; the blockchain request carries first ciphertext data of the transaction data; the first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of the target node device, the target node device is the node device in the blockchain network that receives the blockchain request, and the first hardware public key is generated by a first secure hardware client in the target node device.

[0095] In the present application, when there is transaction data to be uploaded in a terminal, the first hardware public key of the target node device may be used to encrypt the transaction data to obtain first ciphertext data of the transaction data, generate a blockchain request carrying the first ciphertext data, and send the blockchain request to the target node device. The target node device may receive the blockchain request. By transmitting the ciphertext data of the transaction data to the target node device, it is possible to prevent the transaction data from being maliciously stolen during the transmission process and improve the transmission security of the transaction data.

[0096] It should be noted that the target node device may refer to the node device in the blockchain network that is closest to the first terminal; or, the target node device may refer to the node device associated with the transaction data. For example, if the transaction data refers to the transaction data of a certain institution, then the target node device may refer to the node device in the blockchain network that belongs to the institution; different node devices in the blockchain network belong to different institutions. Or, the target node device may be selected by the terminal based on the data processing performance of the node devices in the blockchain network, and the data processing performance may be determined by the usage rates of content resources, CPU resources, interface resources, etc. Or, the target node device may be selected by the terminal according to the working states of the node devices in the blockchain network. For example, the target node device may be a node device in the blockchain network whose working state is in an idle state, and the working state may be determined according to the task volume corresponding to the tasks to be executed by the node device.

[0097] S102. Through the first secure hardware client, in a first secure hardware area associated with the first secure hardware client, use the first hardware private key of the target node device to decrypt the first ciphertext data to obtain the plaintext data of the transaction data.

[0098] In this application, the target node device can use the first hardware private key of the target node device to decrypt the first ciphertext data in the first secure hardware area associated with the first secure hardware client, so as to obtain the plaintext data of the transaction data. By implementing the decryption process of the ciphertext data of the transaction data in the first secure hardware area, it is possible to prevent the non-secure hardware area and illegal users in the target node device from obtaining the plaintext data of the transaction data, thereby improving the security of the transaction data.

[0099] S103. Through the above-mentioned first secure hardware client, in the above-mentioned first secure hardware area, perform validity verification on the plaintext data of the above-mentioned transaction data to obtain a validity verification result.

[0100] In this application, the target node device can use the first secure hardware client to perform validity verification on the plaintext data of the transaction data in the first secure hardware area to obtain a validity verification result. The validity verification result is used to reflect the validity of the transaction data, or the validity verification result reflects that the transaction data is not valid. The validity of the transaction data can refer to the integrity, authenticity, etc. of the transaction data, and the invalidity of the transaction data can refer to the lack of integrity, authenticity, etc. of the transaction data. By performing validity verification on the plaintext data of the transaction data in the first secure hardware area, it is possible to prevent the non-secure hardware area and illegal users of the node device from obtaining the plaintext data of the transaction data, thereby improving the security of the transaction data.

[0101] In one embodiment, the plaintext data of the transaction data can be verified for validity by a single target node device in the blockchain network. Specifically, the target node device can use the first secure hardware client to perform validity verification on the plaintext data of the transaction data in the first secure hardware area to obtain the first validity verification result of the transaction data, and determine the first validity verification result as the verification result of the transaction data, which can improve the verification efficiency of the transaction data.

[0102] In one embodiment, the plaintext data of the transaction data can be verified for validity by multiple node devices in the blockchain network. Specifically, the target node device can use the first secure hardware client to perform validity verification on the plaintext data of the transaction data in the first secure hardware area to obtain the first validity verification result of the transaction data, receive the second validity verification result, and determine the validity verification result of the transaction data according to the first verification result and the second verification result. The second validity verification result can be obtained by performing validity verification on the plaintext data of the transaction data by node devices other than the target node device in the blockchain network. By performing validity verification on the plaintext data of the transaction data by multiple node devices in the decentralized blockchain network, the verification accuracy of the transaction data can be improved.

[0103] In one embodiment, the plaintext data of the transaction data can be verified for validity by a sub-node device in a sub-blockchain network. The sub-blockchain network is a decentralized network composed of multiple sub-node devices. Each sub-node device may include a third secure hardware client, and the third secure hardware client is associated with a third secure hardware area in the sub-node device. Each sub-node device includes a hardware public key and a hardware private key. Specifically, the target node device can encrypt the transaction data using the hardware public key corresponding to the sub-node device to obtain the fourth ciphertext data of the transaction data, and send the fourth ciphertext data of the transaction data to the corresponding sub-node device. The sub-node device decrypts the fourth ciphertext data using the private key of the sub-node device in the secure hardware area associated with the third secure hardware client through the third secure hardware client to obtain the plaintext data of the transaction data, verifies the validity of the plaintext data of the transaction data to obtain a third validity verification result, and sends the third validity verification result to the target node device. The target node device can determine the third validity as the validity verification result of the transaction data, or the target node device can determine the validity verification result of the transaction data according to the third validity verification result and the first validity verification result, or the target node device can determine the validity verification result of the transaction data according to the third validity verification result and the second validity verification result, or the target node device can determine the validity verification result of the transaction data according to the third validity verification result, the first validity verification result, and the second validity verification result. By verifying the validity of the plaintext data of the transaction data through the sub-node devices in the decentralized sub-blockchain network, the verification accuracy of the transaction data is improved.

[0104] S104. When the above validity verification result indicates that the plaintext data of the above transaction data is valid, encrypt the plaintext data of the above transaction data using the above first hardware public key in the above first secure hardware area through the first secure hardware client to obtain the first ciphertext data of the above transaction data, and store the first ciphertext data on the above blockchain.

[0105] In this application, when the validity verification result indicates that the transaction data is valid, the target node device can store the first ciphertext data on the blockchain. By storing the ciphertext data of the transaction data on the blockchain, it is possible to prevent the non-secure hardware area of the node device and illegal users from obtaining the plaintext data of the transaction data, thereby improving the security of the transaction data.

[0106] Optionally, the target node device can also process the plaintext data of the transaction data in the first hardware security area through the first hardware client to obtain a processing result, encrypt the processing result using the first hardware public key to obtain an encrypted processing result, and upload the encrypted processing result to the blockchain. Here, the transaction data is transfer transaction data regarding digital assets, and processing the plaintext data of the transaction data can refer to performing a transfer operation; when the transaction data is an electronic invoice, processing the plaintext data of the transaction data can refer to performing a reimbursement operation on the electronic invoice.

[0107] It should be noted that the security hardware clients in each node device of the blockchain network can refer to the same security hardware client or different security hardware clients; the ciphertext data of the transaction data can refer to the data obtained by encrypting the transaction data; the plaintext data of the transaction data can refer to the data obtained by decrypting the ciphertext data of the transaction data, and the plaintext data can refer to the transaction data itself.

[0108] In this application, each node device in the blockchain network is installed with a security hardware client. The security hardware client is associated with the security hardware area of the node device. The security hardware client can be used to generate a hardware key pair for each node device. The hardware key pair includes a hardware private key and a hardware public key, and the hardware private key is stored in the security hardware area. Through the hardware public key, encrypted transmission of transaction data can be achieved, which can prevent the transaction data from being stolen by illegal users or non-security hardware areas in the node device during the transmission process, improving the transmission security of the transaction data. At the same time, through the security hardware client, the ciphertext data (i.e., the first ciphertext data) of the transaction data is decrypted using the hardware private key in the security hardware area, and the validity of the transaction data is verified in the security hardware area. When it is determined that the transaction data is valid, the ciphertext data of the transaction data is stored on the blockchain. The decryption process and validity verification process of the transaction data are both implemented in the security hardware area. At the same time, the ciphertext data of the transaction data is uploaded to the blockchain. Even if the target node device is illegally invaded by an attacker, the attacker cannot obtain the plaintext data of the transaction data, which can improve the security of the transaction data.

[0109] Further, please refer to Figure 4 which is a schematic flowchart of a blockchain data processing method provided by an embodiment of this application. As Figure 4 shown, this method is executed by the node device in the Figure 1 blockchain network, and this method can also be executed by the sub-node device in the Figure 1 sub-blockchain network, or this method can also be executed by an off-chain terminal. In this application, the devices used to execute this method are collectively referred to as computer devices. Among them, this method can include the following steps:

[0110] S201. Receive a blockchain uploading request for uploading transaction data to a blockchain in a blockchain network; the blockchain uploading request carries first ciphertext data of the transaction data; the first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of a target node device, where the target node device is a node device in the blockchain network that receives the blockchain uploading request, and the first hardware public key is generated by a first secure hardware client in the target node device.

[0111] S202. Through the first secure hardware client, in a first secure hardware area associated with the first secure hardware client, use the first hardware private key of the target node device to decrypt the first ciphertext data to obtain plaintext data of the transaction data.

[0112] S203. Through the first secure hardware client, in the first secure hardware area, perform validity verification on the plaintext data of the transaction data to obtain a first validity verification result.

[0113] In this application, the target node device can, through the first secure hardware client, in the first secure hardware area, perform validity verification on the plaintext data of the transaction data to obtain a first validity verification result. By performing validity verification on the plaintext data of the transaction data in the first secure hardware area, it is possible to prevent the plaintext data of the transaction data from being obtained by non-secure hardware areas and illegal users, thereby improving the security of the plaintext data of the transaction data.

[0114] In one embodiment, the blockchain uploading request further carries device attribute information of a first terminal that sends the blockchain uploading request, and a transaction signature of the transaction data; the step of, through the first secure hardware client, in the first secure hardware area, performing validity verification on the plaintext data of the transaction data to obtain a first validity verification result includes: reading a permission database from the blockchain; the permission database includes device attribute information corresponding to a first terminal having the permission to request blockchain uploading for the transaction data; through the first secure hardware client, in the first secure hardware area, verify the permission of the first terminal to request blockchain uploading for the transaction data according to the device attribute information in the permission database and the device attribute information carried in the blockchain uploading request to obtain a permission verification result. Verify the transaction signature of the transaction data according to the public key of the first terminal and the plaintext data of the transaction data to obtain a signature verification result; determine the first validity verification result of the plaintext data of the transaction data according to the permission verification result and the signature verification result.

[0115] It should be noted that the on-chain request may also carry the device attribute information of the first terminal and the transaction signature of the transaction data. The device attribute information may include the IP address of the first terminal, the terminal name, the institution to which the first terminal belongs, the user information of the user logged in to the first terminal, etc. The transaction signature can be obtained through the following steps: The first terminal performs a hash operation on the transaction data to obtain the first digest information of the transaction data, and encrypts the first digest information with the private key of the first terminal to obtain the transaction signature.

[0116] Specifically, after receiving the on-chain request, the target node device can read the permission database from the blockchain. The permission database is used to reflect which terminals have the permission to request to chain the transaction data. The permission to request to chain can refer to the permission to request the node device in the blockchain network to chain the transaction data to the blockchain. The target node device can compare the device attribute information in the permission database with the device attribute information carried in the on-chain request. When there is device attribute information in the permission database that matches the device attribute information carried in the on-chain request, it is determined that the first terminal has the permission to request to chain the transaction data, and a permission verification result is generated to indicate that the first terminal has the permission to request to chain the transaction data. When there is no device attribute information in the permission database that matches the device attribute information carried in the on-chain request, it is determined that the first terminal does not have the permission to request to chain the transaction data, and a permission verification result is generated to indicate that the first terminal does not have the permission to request to chain the transaction data.

[0117] Further, the target node device can perform a hashing operation on the plaintext data of the transaction data within the first secure hardware area through the first secure hardware client to obtain a second digest information, and decrypt the transaction signature using the public key of the first terminal to obtain a third digest information. When the second digest information is the same as the third digest information, it indicates that no information loss, tampering, etc. occurred during the transmission of the first ciphertext data of the transaction data (i.e., the plaintext data of the transaction data is complete and authentic), and that the on-chain request was sent by the first terminal; it is determined that the transaction signature verification is passed, and a signature verification result indicating that the transaction signature verification is passed is generated; when the second digest information is different from the third digest information, it is determined that the transaction signature verification fails, and a signature verification result indicating that the transaction signature verification fails is generated. Then, the target node device can determine the first validity verification result of the plaintext data of the transaction data according to the signature verification result and the permission verification result. For example, when the signature verification result indicates that the transaction signature verification is passed and the permission verification result indicates that the first terminal has the permission to request on-chain for the transaction data, it is determined that the plaintext data of the transaction data is valid, and a first validity verification result indicating that the plaintext data of the transaction data is valid is generated. When the signature verification result indicates that the transaction signature verification fails, or the permission verification result indicates that the first terminal does not have the permission to request on-chain for the transaction data, it is determined that the plaintext data of the transaction data is not valid, and a first validity verification result indicating that the plaintext data of the transaction data is not valid is generated.

[0118] In one embodiment, the implementation process of the remaining node devices for validating the plaintext data of the transaction data can refer to the implementation process of the target node device for validating the validity of the plaintext data of the transaction data. For the repeated parts, they will not be elaborated again.

[0119] S204. Through the above-mentioned first secure hardware client, within the above-mentioned first secure hardware area, use the second hardware public key of the remaining node device to encrypt the plaintext data of the above-mentioned transaction data to obtain the second ciphertext data of the above-mentioned transaction data, and send the above-mentioned second ciphertext data to the above-mentioned remaining node device; the above-mentioned remaining node device is a device other than the above-mentioned target node device in the above-mentioned blockchain network; the above-mentioned remaining node device is used to decrypt the above-mentioned second ciphertext data through the second secure hardware client within the second secure hardware area using the second hardware private key of the above-mentioned remaining node device to obtain the plaintext data of the above-mentioned transaction data, and perform a validity verification on the plaintext data of the above-mentioned transaction data to obtain a second validity verification result.

[0120] In this application, the target node device can use the second hardware public key of the \(i\)th remaining node device in the first secure hardware area through the first secure hardware client to encrypt the plaintext data of the transaction data, obtaining the second ciphertext data of the transaction data; \(i\) can be a positive integer less than or equal to \(P\), where \(P\) is the number of remaining node devices in the blockchain network, and \(P\) is an integer greater than 1. By analogy, repeat the above steps until the second ciphertext data corresponding to \(P\) remaining node devices are obtained respectively, and send the second ciphertext data corresponding to \(P\) remaining node devices to the corresponding remaining node devices respectively. For example, send the second ciphertext data corresponding to the \(i\)th remaining node device to the \(i\)th remaining node device. After receiving the second ciphertext data, the \(i\)th remaining node device decrypts the second ciphertext data using the hardware private key corresponding to the \(i\)th remaining node device in the second secure hardware area associated with the second secure hardware client, obtaining the plaintext data of the transaction data, and performs a legality verification on the plaintext data of the transaction data, obtaining the second validity verification result corresponding to the \(i\)th remaining node device. By analogy, each remaining node device repeats the above steps until the second validity verification results are obtained for all \(P\) remaining node devices. The second validity verification result is used to indicate that the plaintext data of the transaction data is valid, or the second validity verification result is used to indicate that the plaintext data of the transaction data is invalid.

[0121] In one embodiment, step S204 may include: obtaining \(N\) hardware sub-public keys derived from the second hardware public keys of the above remaining node devices; dividing the plaintext data of the transaction data in the first secure hardware area through the first secure hardware client, obtaining \(N\) plaintext data segments of the transaction data. Using the \(N\) hardware sub-public keys to encrypt the \(N\) plaintext data segments of the transaction data, obtaining \(N\) ciphertext data segments of the transaction data; one ciphertext data segment is obtained by encrypting one plaintext data segment with one hardware sub-public key; the second ciphertext data includes the \(N\) ciphertext data segments. Batch sending the \(N\) ciphertext data segments to the remaining node devices; the remaining node devices are further configured to decrypt the \(N\) ciphertext data segments using the second hardware private keys of the remaining node devices in the second secure hardware area through the second secure hardware client, obtaining the \(N\) plaintext data segments, and merging the \(N\) plaintext data segments to obtain the plaintext data of the transaction data.

[0122] Specifically, the target node device can obtain N hardware sub-public keys derived from the second hardware public keys of the above remaining node devices, divide the plaintext data of the transaction data to obtain N plaintext data segments of the transaction data. The amount of information contained in the civilized data segments is much smaller than that contained in the plaintext data of the transaction data. The amount of information contained in the N plaintext data segments can be the same or different. Further, using the N hardware sub-public keys, encrypt the N plaintext data segments of the transaction data to obtain N ciphertext data segments of the transaction data. One ciphertext data segment is obtained by encrypting one plaintext data segment with one hardware sub-public key; and in the sorting order of the N plaintext data segments in the plaintext data, batch send the N ciphertext data segments to the remaining node devices, that is, send the N ciphertext data segments to the remaining node devices in batches. It can be seen that by dividing the plaintext data into finer-grained plaintext data segments and encrypting the plaintext data segments with different hardware sub-public keys, the transmission reliability and transmission efficiency of the ciphertext data of the transaction data are improved; by transmitting the ciphertext data segments in batches, it is possible to avoid network congestion caused by excessive information volume in a single transmission.

[0123] For example, Figure 5 As shown, the target node device can obtain the hardware sub-public key 52a, hardware sub-public key 53a, and hardware sub-public key 54a derived from the hardware public key 51a of the remaining node device 55a until obtaining the hardware sub-public key corresponding to each plaintext data segment; divide the plaintext data of the transaction data to obtain plaintext data segment 1, plaintext data segment 2, plaintext data segment 3, ……; the target node device can use the hardware sub-public key 52a to encrypt the plaintext data segment 1 in the first secure hardware area through the first secure hardware client to obtain the ciphertext data segment 1; use the hardware sub-public key 53a to encrypt the plaintext data segment 2 to obtain the ciphertext data segment 2; use the hardware sub-public key 54a to encrypt the plaintext data segment 3 to obtain the ciphertext data segment 3 until obtaining the ciphertext data segment corresponding to each plaintext data segment. The target node device can send the ciphertext data segment 1 to the remaining node device 55a at time t1, send the ciphertext data segment 2 to the remaining node device 55a at time t2, and send the ciphertext data segment 3 to the remaining node device 55a at time t3 until all the ciphertext data segments are sent to the remaining node device, improving the transmission efficiency and transmission reliability of the ciphertext data.

[0124] In one embodiment, the target node device may send N ciphertext data segments in batches and the numbers of each ciphertext data segment to the remaining node devices. The number of each ciphertext data may be determined according to the position of the corresponding plaintext data segment of the ciphertext data segment in the plaintext data. When receiving a retransmission instruction message regarding the k-th ciphertext data segment, indicating that the k-th ciphertext data segment transmission fails, the target node device may re-send the k-th ciphertext data segment to the remaining node devices, where k is a positive integer less than or equal to N. That is, when an exception occurs in a certain ciphertext data segment, it is not necessary to re-send the entire ciphertext data, improving the transmission efficiency of the ciphertext data and reducing the transmission cost of the ciphertext data.

[0125] In one embodiment, the implementation process of deriving N hardware sub-public keys according to the second hardware public key of the remaining node devices includes: the remaining node devices may perform a hash operation with the second hardware public key, the node chain code of the remaining node devices, and j as parameters to obtain a first hash sequence, where j is a positive integer less than or equal to N, and the node chain code of the remaining node devices may be generated according to a random number. The first hash sequence is divided into two hash sub-sequences, namely a left hash sub-sequence and a right hash sub-sequence. Concatenating the left hash sub-sequence to the left of the right hash sub-sequence may obtain the first hash sequence. The lengths of the left hash sub-sequence and the right hash sub-sequence may be the same or different. Performing an operation (such as summing, subtracting, etc.) on the left hash sub-sequence and the second hardware public key to obtain the j-th hardware sub-public key. By analogy, repeating the above steps, N hardware sub-public keys can be obtained.

[0126] In one embodiment, the above-mentioned remaining node devices are further configured to, through the above-mentioned second secure hardware client, in the above-mentioned second secure hardware area, use the second hardware private key of the above-mentioned remaining node devices to decrypt the above-mentioned N ciphertext data segments to obtain the above-mentioned N plaintext data segments, and merge the above-mentioned N plaintext data segments to obtain the plaintext data of the above-mentioned transaction data, including: the remaining node devices may generate hardware sub-private keys corresponding to the N hardware sub-public keys respectively. Specifically, an operation (such as summing, subtracting, etc.) may be performed on the above-mentioned left hash sub-sequence and the second hardware private key to obtain the hardware sub-private key corresponding to the j-th hardware sub-public key. By analogy, repeating the above steps, hardware sub-private keys corresponding to the N hardware sub-public keys can be obtained respectively.

[0127] Further, decrypt the ciphertext data segment corresponding to the j-th hardware sub-public key according to the hardware sub-private key corresponding to the j-th hardware sub-public key to obtain the plaintext data segment corresponding to the j-th hardware public key; the ciphertext data segment corresponding to the j-th hardware sub-public key may refer to the one obtained by encrypting the plaintext data segment with the j-th hardware public key. By analogy, repeating the above steps, plaintext data segments corresponding to the N hardware sub-public keys can be obtained respectively.

[0128] S205. Receive the second validity verification result returned by the remaining node devices, and determine the validity verification result of the plaintext data of the transaction data according to the first validity verification result and the above-mentioned second validity verification result.

[0129] In this application, the target node device can receive the second validity verification result returned by the remaining node devices, and determine the validity verification result of the plaintext data of the transaction data according to the first validity verification result and the second validity verification result. By performing the validity verification on the plaintext data of the transaction data through multiple node devices in the decentralized blockchain network, the verification accuracy of the transaction data is improved.

[0130] For example, as Figure 6 shown, the node device 61a is the target node device, and the remaining node devices include the node device 62a, the node device 63a, and the node device 64a. The node device 61a can use the hardware public key 65a in the first secure hardware area through the first secure hardware client in the node device 61a to encrypt the plaintext data of the transaction data to obtain the second ciphertext data 1, and send the second ciphertext data 1 to the node device 62a; the hardware public key 65a belongs to the node device 62a. The node device 62a can use the hardware private key of the node device 62a through the second secure hardware client in the second node device 62a to decrypt the second ciphertext data 1 in the second secure hardware area to obtain the plaintext data of the transaction data, perform the validity verification on the plaintext data of the transaction data, obtain the second validity verification result 1 of the transaction data, and return the second validity verification result 1 to the node device 61a. By analogy, repeat the above steps until the node device 61a obtains the second validity verification results respectively corresponding to each remaining node device. The node device 61a can perform the validity verification on the plaintext data of the transaction data through the first secure hardware client in the first secure hardware area to obtain the first validity verification result. The node device 61a can count the number of valid devices corresponding to the node devices that determine the plaintext data of the transaction data to be valid in the blockchain network according to the first validity verification result and the second validity verification result. For example, if the number of valid devices is 3 and the total number of node devices corresponding in the blockchain network is 4. Determine the ratio between the number of valid devices and the total number of devices to obtain 0.75, that is, most of the node devices in the blockchain network determine that the transaction data has a valid value. The node device 61a can generate a validity verification result for indicating that the plaintext data of the transaction data has a valid value.

[0131] In one embodiment, step S205 may include: according to the first validity verification result and the second validity verification result, counting the number of valid devices in the blockchain network that determine the plaintext data of the transaction data to be valid; counting the number of participating devices corresponding to the node devices participating in the legality verification of the plaintext data of the transaction data, and the total number of device corresponding to the node devices in the blockchain network. According to the number of participating devices, the number of valid devices, and the total number of devices, determine the validity verification result of the plaintext data of the transaction data.

[0132] Specifically, the target node device may, according to the first validity verification result and the second validity verification result, count the number of devices corresponding to the node devices in the blockchain network that determine the plaintext data of the transaction data to be valid as the number of valid devices; count the number of devices corresponding to the node devices participating in the verification of the plaintext data of the transaction data as the number of participating devices. The node devices participating in the verification of the plaintext data of the transaction data may include the target node device and the node devices that send the second validity verification result to the target node device. Further, count the total number of devices corresponding to the node devices in the blockchain network. When the number of participating devices is less than or equal to the device number threshold, or when the quantity ratio is less than or equal to the ratio threshold, it is determined that the plaintext data of the transaction data is not valid, and a validity verification result for indicating that the plaintext data of the transaction data is not valid is generated. When the number of participating devices is greater than the device number threshold, the number ratio can be obtained by dividing the number of valid devices by the total number of devices. When the number ratio is greater than the ratio threshold, it is determined that the plaintext data of the transaction data is valid, and a validity verification result for indicating that the plaintext data of the transaction data is valid is generated. By performing validity verification on the plaintext data of the transaction data through multiple node devices in the blockchain network, the verification accuracy of the transaction data is improved.

[0133] S206. When the validity verification result indicates that the plaintext data of the transaction data is valid, through the first secure hardware client, in the first secure hardware area, encrypt the plaintext data of the transaction data using the first hardware public key to obtain the first ciphertext data of the transaction data, and store the first ciphertext data on the blockchain.

[0134] In one embodiment, the above-mentioned chain-up request carries the transaction attribute information of the transaction data. Taking the transaction data with digital assets as an example, the transaction attribute information may include the category of digital assets, the first account address, the second account address, etc. The first account address may be the address for transferring digital assets, and the second account address may be the address for transferring out digital assets, etc. When the transaction data is an electronic invoice, the transaction attribute information may include the institution that issues the electronic invoice, the institution that requests the issuance of the electronic invoice, etc. Storing the first ciphertext data on the blockchain includes: determining, according to the transaction attribute information carried in the above-mentioned chain-up request, a bookkeeping node device for chaining up the transaction data from the node devices of the above-mentioned blockchain network; when the above-mentioned target node device is the bookkeeping node device, storing the first ciphertext data on the blockchain.

[0135] Specifically, the target node device may determine, according to the transaction attribute information carried in the chain-up request, a node device for chaining up the transaction data from the node devices of the blockchain network, denoted as the bookkeeping node device; when the target node device is not the bookkeeping node device, in the first secure hardware area through the first secure hardware client, encrypt the plaintext data of the transaction data using the hardware public key of the bookkeeping node device to obtain the fifth ciphertext data of the transaction data, and send the fifth ciphertext data to the bookkeeping node device. The bookkeeping node device may decrypt the fifth ciphertext data using the hardware private key of the bookkeeping node device in the secure hardware area of the bookkeeping node device through the secure hardware client in the bookkeeping node device to obtain the plaintext data of the transaction data, encrypt the plaintext data of the transaction data using the hardware public key of the bookkeeping node device to obtain the sixth ciphertext data, and store the sixth ciphertext data on the blockchain. When the target node device is the bookkeeping node device, the first ciphertext data may be stored on the blockchain. By storing the ciphertext data of the transaction data on the blockchain, the plaintext data of the transaction data can be prevented from being stolen by illegal users, improving the security of the transaction data.

[0136] In one embodiment, determining, according to the transaction attribute information carried in the above-mentioned chain-up request, a bookkeeping node device for chaining up the transaction data from the node devices of the above-mentioned blockchain network includes: determining the institution to which the transaction data belongs according to the transaction attribute information carried in the above-mentioned chain-up request; selecting a node device associated with the above-mentioned institution from the node devices of the above-mentioned blockchain network as a candidate node device; determining, according to the occupancy rate of the device resources of the above-mentioned candidate node device, a bookkeeping node device for chaining up the transaction data from the above-mentioned candidate node devices.

[0137] Specifically, when the transaction data is the transaction data of digital assets, the target node device may determine the institution to which the transaction data belongs according to the institution to which the first account address belongs or the institution to which the second account address belongs; when the transaction data is an electronic invoice, the target node device may determine the institution that issues the electronic invoice or the institution that requests the issuance of the electronic invoice as the institution to which the transaction data belongs. Further, select a node device associated with the institution from the blockchain network as the candidate node device, and determine the accounting node device for uploading the transaction data from the candidate node devices according to the occupancy rate of the device resources of the candidate node devices.

[0138] In one embodiment, determining the accounting node device for uploading the transaction data from the candidate node devices according to the occupancy rate of the device resources of the candidate node devices includes: obtaining the occupancy rates and weights corresponding to M types of device resources of the candidate node devices respectively; M is an integer greater than 1; performing a weighted summation process on the occupancy rates corresponding to the M types of device resources of the candidate node devices according to the weights corresponding to the M types of device resources respectively to obtain the total occupancy rate of the M types of device resources of the candidate node devices; determining the candidate node device with the minimum total occupancy rate as the accounting node device for uploading the transaction data.

[0139] Specifically, the target node device may obtain the occupancy rates and weights corresponding to M types of device resources of the candidate node devices respectively; the M types of device resources may include memory resources, CPU resources, interface resources, etc.; the weights corresponding to the device resources may be pre-set, or the weights corresponding to the device resources may be determined according to the influence degree of the device resources on the uploading operation of the transaction data. Further, the target node device may perform a weighted summation process on the occupancy rates corresponding to the M types of device resources of the candidate node devices respectively to obtain the total occupancy rate of the M types of device resources of the candidate node devices, and determine the candidate node device with the minimum total occupancy rate as the accounting node device for uploading the transaction data, which is beneficial to improving the uploading efficiency of the transaction data.

[0140] In one embodiment, receive a request from a second terminal for obtaining the transaction data; according to the obtaining request, read the first ciphertext data of the transaction data from the blockchain; in the first secure hardware area through the first secure hardware client, decrypt the first ciphertext data by using the first hardware private key of the target node device to obtain the plaintext data of the transaction data; in the first secure hardware area through the first secure hardware client, encrypt the plaintext data of the transaction data by using the public key of the second terminal to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

[0141] Specifically, the target node device can receive a request from the second terminal to obtain transaction data. The request can carry transaction attribute information of the transaction data. Based on the transaction attribute information carried in the request, the first ciphertext data of the transaction data is read from the blockchain. Through the first secure hardware client, in the first secure hardware area, the first private key of the target node device is used to decrypt the first ciphertext data to obtain the plaintext data of the transaction data. Then, through the first secure hardware client, in the first secure hardware area, the public key of the second terminal is used to encrypt the plaintext data of the transaction data to obtain the third ciphertext data of the transaction data, and the third ciphertext data is sent to the second terminal. By transmitting the ciphertext data of the transaction data to the second terminal, the security of the transaction data can be improved, and the plaintext data of the transaction data can be prevented from being illegally stolen.

[0142] It should be noted that after the target node device obtains the plaintext data of the transaction data, it can process the plaintext data of the transaction data to obtain a processing result. Through the first secure hardware client, in the first secure hardware area, the public key of the second terminal is used to encrypt the processing result to obtain the encrypted processing result, and the encrypted processing result is returned to the second terminal. For example, when it is the transaction bill of the transaction data, other business scenarios such as calculating the total annual expenditure of the user can be calculated according to the transaction bill.

[0143] In one embodiment, the request carries the device attribute information of the second terminal and the transaction attribute information of the transaction data; according to the request, reading the first ciphertext data of the transaction data from the blockchain includes: verifying the access permission of the second terminal for the transaction data according to the device attribute information of the second terminal; when the second terminal has the access permission for the transaction data, reading the first ciphertext data of the transaction data from the blockchain according to the transaction attribute information.

[0144] The target node device can obtain a device database from the blockchain. The device database includes the device attribute information of the terminals that have the access permission for the transaction data. The device attribute information in the device database is compared with the device attribute information carried in the request. When there is no device attribute information in the device database that matches the device attribute information carried in the request, it is determined that the second terminal does not have the access permission for the transaction data, and the second terminal is refused to return the transaction data. When there is device attribute information in the device database that matches the device attribute information carried in the request, it is determined that the second terminal has the access permission for the transaction data, and the first ciphertext data of the transaction data is read from the blockchain according to the transaction attribute information. By verifying the access permission of the second terminal, the security of obtaining the transaction data is improved.

[0145] In one embodiment, the image file of the first secure hardware client is synchronized to the management node device in the blockchain network; when the target node device is in an abnormal state and a recovery signature request is received, the management node device runs the image file of the first secure hardware client to recover the first hardware private key; the recovery signature request is used to indicate that a specified number of node devices in the blockchain network need to recover the first hardware private key. The management node device is further configured to decrypt the first ciphertext data to obtain the plaintext data of the transaction data by using the recovered first hardware private key in the second secure hardware area through the second secure hardware client; encrypt the plaintext data of the transaction data by using the public key of the second terminal in the second secure hardware area through the second secure hardware client to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

[0146] Specifically, the target node device can copy the execution file of the first secure hardware client to obtain the image file of the first secure hardware client; the image file can be used to recover the operations performed by the first secure hardware client, such as recovering the first hardware private key and the first hardware public key. Further, the image file of the first secure hardware client is synchronized to the management node device in the blockchain network. When it is detected that the target node device is in an abnormal state, the management node device can broadcast a recovery request for recovering the first hardware private key to the node devices in the blockchain network. After each node device receives the recovery request, it can detect the target node device. When it is detected that the target node device is in an abnormal state, it can sign the recovery request to obtain a recovery signature request. When the number of node devices corresponding to the recovery signature requests sent in the blockchain network is greater than or equal to the specified number, the image file of the first secure hardware client can be run to recover the first hardware private key. The management node device is further configured to decrypt the first ciphertext data to obtain the plaintext data of the transaction data by using the recovered first hardware private key in the second secure hardware area through the second secure hardware client; encrypt the plaintext data of the transaction data by using the public key of the second terminal in the second secure hardware area through the second secure hardware client to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

[0147] Further, the management node device can use the hardware public key of the management node device to encrypt the plaintext data of the transaction data in the second secure hardware area through the second secure hardware client, obtain the seventh ciphertext data of the transaction data, and store the seventh ciphertext data on the blockchain, avoiding the problem that the target node device has an abnormality and the transaction data cannot be read.

[0148] It should be noted that the abnormal state can refer to network failure, insufficient storage space, hardware failure, etc. The management node device can refer to the node device in the blockchain network. The management node device can be elected by each node device in the blockchain network, and the management node device is also updated every once in a while.

[0149] In this application, each node device in the blockchain network is installed with a secure hardware client. The secure hardware client is associated with the secure hardware area of the node device. The secure hardware client can be used to generate the hardware key pair of each node device. The hardware key pair includes a hardware private key and a hardware public key. The hardware private key is stored in the secure hardware area. Through the hardware public key, the encrypted transmission of transaction data can be realized, which can avoid the transaction data being stolen by illegal users or the non-secure hardware area in the node device during the transmission process, and improve the transmission security of the transaction data. At the same time, through the secure hardware client, the ciphertext data (i.e., the first ciphertext data) of the transaction data is decrypted using the hardware private key in the secure hardware area, and the validity of the transaction data is verified in the secure hardware area. When it is determined that the transaction data is valid, the ciphertext data of the transaction data is stored on the blockchain. The decryption process and the validity verification process of the transaction data are both implemented in the secure hardware area. At the same time, the ciphertext data of the transaction data is uploaded to the blockchain. Even if the target node device is illegally invaded by an attacker, the attacker cannot obtain the plaintext data of the transaction data, which can improve the security of the transaction data.

[0150] Please refer to Figure 7 , which is a schematic structural diagram of a blockchain data processing device provided by an embodiment of the present application. The above blockchain-based data processing device can be a computer program (including program code) running in a network device. For example, the blockchain-based data processing device is an application software; the device can be used to execute the corresponding steps in the method provided by the embodiment of the present application. As Figure 7 shown, the blockchain data processing device can include:

[0151] A receiving module 711, configured to receive a blockchain-upload request for uploading transaction data to a blockchain in a blockchain network; the blockchain-upload request carries first ciphertext data of the transaction data; the first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of a target node device, where the target node device is a node device in the blockchain network that receives the blockchain-upload request, and the first hardware public key is generated by a first secure hardware client in the target node device;

[0152] A decryption module 712, configured to decrypt the first ciphertext data with the first hardware private key of the target node device in a first secure hardware area associated with the first secure hardware client through the first secure hardware client to obtain plaintext data of the transaction data;

[0153] A verification module 713, configured to perform validity verification on the plaintext data of the transaction data in the first secure hardware area through the first secure hardware client to obtain a validity verification result;

[0154] A blockchain-upload module 714, configured to, when the validity verification result indicates that the plaintext data of the transaction data is valid, encrypt the plaintext data of the transaction data with the first hardware public key in the first secure hardware area through the first secure hardware client to obtain the first ciphertext data of the transaction data, and store the first ciphertext data on the blockchain.

[0155] Optionally, the verification module 713 may include a verification unit 71a, an encryption unit 72a, and a first determination unit 73a;

[0156] The verification unit 71a is configured to perform validity verification on the plaintext data of the transaction data in the first secure hardware area through the first secure hardware client to obtain a first validity verification result;

[0157] The encryption unit 72a is configured to encrypt the plaintext data of the transaction data with a second hardware public key of the remaining node devices in the first secure hardware area through the first secure hardware client to obtain second ciphertext data of the transaction data, and send the second ciphertext data to the remaining node devices; the remaining node devices are devices in the blockchain network other than the target node device; the remaining node devices are configured to decrypt the second ciphertext data with the second hardware private key of the remaining node devices in a second secure hardware area through a second secure hardware client to obtain the plaintext data of the transaction data, and perform validity verification on the plaintext data of the transaction data to obtain a second validity verification result;

[0158] The first determination unit 73a is configured to receive the second validity verification result returned by the remaining node devices, and determine the validity verification result of the plaintext data of the transaction data according to the first validity verification result and the second validity verification result.

[0159] Optionally, the on-chain request further carries device attribute information of the first terminal that sends the on-chain request, and a transaction signature of the transaction data;

[0160] Optionally, the verification unit 71a is specifically configured to:

[0161] Read a permission database from the blockchain; the permission database includes device attribute information corresponding to permission terminals having the permission to request on-chain for transaction data;

[0162] Through the first secure hardware client, in the first secure hardware area, verify the on-chain request permission of the first terminal for the transaction data according to the device attribute information in the permission database and the device attribute information carried in the on-chain request, to obtain a permission verification result;

[0163] Verify the transaction signature of the transaction data according to the public key of the first terminal and the plaintext data of the transaction data, to obtain a signature verification result;

[0164] Determine the first validity verification result of the plaintext data of the transaction data according to the permission verification result and the signature verification result.

[0165] Optionally, the first determination unit 73a is specifically configured to

[0166] According to the first validity verification result and the second validity verification result, count the number of valid devices in the blockchain network that determine the plaintext data of the transaction data to be valid;

[0167] Count the number of participating devices corresponding to the node devices participating in the legality verification of the plaintext data of the transaction data in the blockchain network, and the total number of device corresponding to the node devices in the blockchain network;

[0168] Determine the validity verification result of the plaintext data of the transaction data according to the number of participating devices, the number of valid devices, and the total number of devices.

[0169] Optionally, the encryption unit 72a is specifically configured to:

[0170] Obtain N hardware sub-public keys derived from the second hardware public key of the remaining node devices;

[0171] Through the above-mentioned first secure hardware client, in the above-mentioned first secure hardware area, the plaintext data of the above-mentioned transaction data is divided to obtain N plaintext data segments of the above-mentioned transaction data;

[0172] Using the above-mentioned N hardware sub-public keys, the N plaintext data segments of the above-mentioned transaction data are encrypted to obtain N ciphertext data segments of the above-mentioned transaction data; one ciphertext data segment is obtained by encrypting one plaintext data segment with one hardware sub-public key; the above-mentioned second ciphertext data includes the above-mentioned N ciphertext data segments;

[0173] Batch send the above-mentioned N ciphertext data segments to the above-mentioned remaining node devices; the above-mentioned remaining node devices are also used to decrypt the above-mentioned N ciphertext data segments through the above-mentioned second secure hardware client in the above-mentioned second secure hardware area using the second hardware private key of the above-mentioned remaining node devices to obtain the above-mentioned N plaintext data segments, and merge the above-mentioned N plaintext data segments to obtain the plaintext data of the above-mentioned transaction data.

[0174] Optionally, the above-mentioned on-chain request also carries the transaction attribute information of the above-mentioned transaction data; the on-chain module 714 may include a second determination unit 74b and an on-chain unit 75b;

[0175] The second determination unit 74b is configured to determine, according to the transaction attribute information carried in the above-mentioned on-chain request, a bookkeeping node device for on-chain of the above-mentioned transaction data from the node devices of the above-mentioned blockchain network;

[0176] The on-chain unit 75b is configured to store the above-mentioned first ciphertext data on the above-mentioned blockchain when the above-mentioned target node device is the above-mentioned bookkeeping node device.

[0177] Optionally, the second determination unit 74b is specifically configured to:

[0178] Determine the institution to which the above-mentioned transaction data belongs according to the transaction attribute information carried in the above-mentioned on-chain request;

[0179] Select a node device associated with the above-mentioned institution from the node devices of the above-mentioned blockchain network as a candidate node device;

[0180] Determine a bookkeeping node device for on-chain of the above-mentioned transaction data from the above-mentioned candidate node devices according to the occupancy rate of the device resources of the above-mentioned candidate node devices.

[0181] Optionally, the second determination unit 74b is specifically configured to:

[0182] Obtain the occupancy rates and weights corresponding to M types of device resources of the above-mentioned candidate node devices; M is an integer greater than 1;

[0183] According to the weights corresponding to the above-mentioned M types of device resources, perform a weighted summation process on the occupancy rates corresponding to the M types of device resources of the above-mentioned candidate node devices to obtain the total occupancy rate of the M types of device resources of the above-mentioned candidate node devices;

[0184] Determine the candidate node device with the minimum total occupancy rate as the accounting node device for uploading the above-mentioned transaction data to the blockchain.

[0185] Optionally, the device may further include a reading module 715 and an encryption module 716;

[0186] The receiving module 711 is further configured to receive a request from the second terminal for obtaining the above-mentioned transaction data;

[0187] The reading module 715 is configured to read the first ciphertext data of the above-mentioned transaction data from the above-mentioned blockchain according to the above-mentioned obtaining request;

[0188] The decryption module 712 is further configured to decrypt the first ciphertext data by using the first hardware private key of the above-mentioned target node device in the above-mentioned first secure hardware area through the above-mentioned first secure hardware client to obtain the plaintext data of the above-mentioned transaction data;

[0189] The encryption module 716 is configured to encrypt the plaintext data of the above-mentioned transaction data by using the public key of the above-mentioned second terminal in the above-mentioned first secure hardware area through the above-mentioned first secure hardware client to obtain the third ciphertext data of the above-mentioned transaction data, and send the third ciphertext data to the above-mentioned second terminal.

[0190] Optionally, the above-mentioned obtaining request carries the device attribute information of the above-mentioned second terminal and the transaction attribute information of the above-mentioned transaction data;

[0191] Specifically, the reading module 715 is configured to verify the obtaining permission of the above-mentioned second terminal for the above-mentioned transaction data according to the device attribute information of the above-mentioned second terminal; when the above-mentioned second terminal has the obtaining permission for the above-mentioned transaction data, read the first ciphertext data of the above-mentioned transaction data from the above-mentioned blockchain according to the above-mentioned transaction attribute information.

[0192] Optionally, the device may further include a synchronization module 717;

[0193] A synchronization module 717 is configured to synchronize the mirror file of the first secure hardware client to a management node device in the blockchain network; the management node device is configured to run the mirror file of the first secure hardware client to recover the first hardware private key when the target node device is in an abnormal state and receives a recovery signature request; the recovery signature request is used to indicate that a specified number of node devices in the blockchain network need to recover the first hardware private key.

[0194] The management node device is further configured to, through the second secure hardware client, in the second secure hardware area, use the recovered first hardware private key to decrypt the first ciphertext data to obtain the plaintext data of the transaction data; through the second secure hardware client, in the second secure hardware area, use the public key of the second terminal to encrypt the plaintext data of the transaction data to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

[0195] In this application, each node device in the blockchain network is installed with a secure hardware client. The secure hardware client is associated with the secure hardware area of the node device. The secure hardware client can be used to generate a hardware key pair for each node device. The hardware key pair includes a hardware private key and a hardware public key, and the hardware private key is stored in the secure hardware area. Through the hardware public key, encrypted transmission of transaction data can be realized, which can prevent the transaction data from being stolen by illegal users or in the non-secure hardware area of the node device during the transmission process, and improve the transmission security of the transaction data. At the same time, through the secure hardware client, in the secure hardware area, the hardware private key is used to decrypt the ciphertext data of the transaction data (i.e., the first ciphertext data), and the validity of the transaction data is verified in the secure hardware area. When it is determined that the transaction data is valid, the ciphertext data of the transaction data is stored on the blockchain. The decryption process and the validity verification process of the transaction data are both implemented in the secure hardware area. At the same time, the ciphertext data of the transaction data is uploaded to the blockchain. Even if the target node device is illegally invaded by an attacker, the attacker cannot obtain the plaintext data of the transaction data, which can improve the security of the transaction data.

[0196] Please refer to Figure 8 which is a schematic structural diagram of a computer device provided by an embodiment of this application. As Figure 8As shown in the figure, the above computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004, and a memory 1005. In addition, the above computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile Memory), such as at least one disk memory. Optionally, the memory 1005 may further be at least one storage device far from the foregoing processor 1001. As Figure 8 shown, the memory 1005, as a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a computer program.

[0197] In Figure 8 the computer device 1000 shown in the figure, the network interface 1004 can provide network communication functions; while the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0198] Receiving a blockchain request to upload transaction data to a blockchain in a blockchain network; the blockchain request carries first ciphertext data of the transaction data; the first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of a target node device, and the target node device is a node device in the blockchain network that receives the blockchain request, and the first hardware public key is generated by a first secure hardware client in the target node device;

[0199] Through the first secure hardware client, in a first secure hardware area associated with the first secure hardware client, using the first hardware private key of the target node device, decrypt the first ciphertext data to obtain the plaintext data of the transaction data;

[0200] Through the first secure hardware client, in the first secure hardware area, perform validity verification on the plaintext data of the transaction data to obtain a validity verification result;

[0201] When the above validity verification result indicates that the plaintext data of the above transaction data is valid, through the above first secure hardware client, in the above first secure hardware area, encrypt the plaintext data of the above transaction data using the above first hardware public key to obtain the first ciphertext data of the above transaction data, and store the above first ciphertext data on the above blockchain.

[0202] Optionally, the processor 1001 may be used to call a computer program stored in the memory 1005 to execute:

[0203] Through the above first secure hardware client, in the above first secure hardware area, perform a validity verification on the plaintext data of the above transaction data to obtain a first validity verification result;

[0204] Through the above first secure hardware client, in the above first secure hardware area, encrypt the plaintext data of the above transaction data using the second hardware public key of the remaining node devices to obtain the second ciphertext data of the above transaction data, and send the above second ciphertext data to the above remaining node devices; the above remaining node devices are devices other than the above target node device in the above blockchain network; the above remaining node devices are used to decrypt the above second ciphertext data using the second hardware private key of the above remaining node devices through a second secure hardware client in a second secure hardware area to obtain the plaintext data of the above transaction data, and perform a validity verification on the plaintext data of the above transaction data to obtain a second validity verification result;

[0205] Receive the second validity verification result returned by the above remaining node devices, and determine the validity verification result of the plaintext data of the above transaction data according to the above first validity verification result and the above second validity verification result.

[0206] Optionally, the processor 1001 may be used to call a computer program stored in the memory 1005 to execute:

[0207] The above through the above first secure hardware client, in the above first secure hardware area, perform a validity verification on the plaintext data of the above transaction data to obtain a first validity verification result, including:

[0208] Read the permission database from the blockchain; the above permission database includes device attribute information corresponding to permission terminals with the permission to request to chain transaction data;

[0209] Through the above first secure hardware client, in the above first secure hardware area, verify the permission of the above first terminal to request to chain transaction data according to the device attribute information in the above permission database and the device attribute information carried in the above chain request to obtain a permission verification result;

[0210] Verify the transaction signature of the above transaction data based on the public key of the first terminal and the plaintext data of the above transaction data to obtain a signature verification result;

[0211] Determine the first validity verification result of the plaintext data of the above transaction data according to the above permission verification result and the above signature verification result.

[0212] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0213] Count the number of valid devices in the above blockchain network that determine that the plaintext data of the above transaction data is valid according to the above first validity verification result and the above second validity verification result;

[0214] Count the number of participating device corresponding to the node devices participating in the legality verification of the plaintext data of the above transaction data in the above blockchain network, and the total number of device corresponding to the node devices in the above blockchain network;

[0215] Determine the validity verification result of the plaintext data of the above transaction data according to the above number of participating device, the above number of valid devices, and the above total number of device.

[0216] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0217] Obtain N hardware sub-public keys derived from the second hardware public key of the above remaining node devices;

[0218] Divide the plaintext data of the above transaction data in the above first secure hardware area through the above first secure hardware client to obtain N plaintext data segments of the above transaction data;

[0219] Encrypt the N plaintext data segments of the above transaction data by using the above N hardware sub-public keys to obtain N ciphertext data segments of the above transaction data; a ciphertext data segment is obtained by encrypting a plaintext data segment with a hardware sub-public key; the above second ciphertext data includes the above N ciphertext data segments;

[0220] Batch send the above N ciphertext data segments to the above remaining node devices; the above remaining node devices are further used to decrypt the above N ciphertext data segments by using the second hardware private key of the above remaining node devices in the above second secure hardware area through the above second secure hardware client to obtain the above N plaintext data segments, and merge the above N plaintext data segments to obtain the plaintext data of the above transaction data.

[0221] Optionally, the above-mentioned on-chain request also carries the transaction attribute information of the above-mentioned transaction data; the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0222] Determine the accounting node device for uploading the above-mentioned transaction data to the blockchain from the node devices of the above-mentioned blockchain network according to the transaction attribute information carried in the above-mentioned on-chain request;

[0223] When the above-mentioned target node device is the above-mentioned accounting node device, store the above-mentioned first ciphertext data on the above-mentioned blockchain.

[0224] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0225] Determine the institution to which the above-mentioned transaction data belongs according to the transaction attribute information carried in the above-mentioned on-chain request;

[0226] Select the node device associated with the above-mentioned institution from the node devices of the above-mentioned blockchain network as the candidate node device;

[0227] Determine the accounting node device for uploading the above-mentioned transaction data to the blockchain from the above-mentioned candidate node devices according to the occupancy rate of the device resources of the above-mentioned candidate node devices.

[0228] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0229] Obtain the occupancy rate and weight corresponding to each of the M device resources of the above-mentioned candidate node device; M is an integer greater than 1;

[0230] Perform a weighted summation process on the occupancy rates corresponding to the M device resources of the above-mentioned candidate node device according to the weights corresponding to the M device resources, to obtain the total occupancy rate of the M device resources of the above-mentioned candidate node device;

[0231] Determine the candidate node device with the minimum total occupancy rate as the accounting node device for uploading the above-mentioned transaction data to the blockchain.

[0232] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0233] Receive the acquisition request of the second terminal regarding the above-mentioned transaction data;

[0234] Read the first ciphertext data of the above-mentioned transaction data from the above-mentioned blockchain according to the above-mentioned acquisition request;

[0235] Through the above-mentioned first secure hardware client, in the above-mentioned first secure hardware area, the first hardware private key of the above-mentioned target node device is used to decrypt the above-mentioned first ciphertext data to obtain the plaintext data of the above-mentioned transaction data;

[0236] Through the above-mentioned first secure hardware client, in the above-mentioned first secure hardware area, the public key of the above-mentioned second terminal is used to encrypt the plaintext data of the above-mentioned transaction data to obtain the third ciphertext data of the above-mentioned transaction data, and the above-mentioned third ciphertext data is sent to the above-mentioned second terminal.

[0237] Optionally, the above-mentioned acquisition request carries the device attribute information of the above-mentioned second terminal and the transaction attribute information of the above-mentioned transaction data;

[0238] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0239] Verify the acquisition permission of the above-mentioned second terminal for the above-mentioned transaction data according to the device attribute information of the above-mentioned second terminal;

[0240] When the above-mentioned second terminal has the acquisition permission for the above-mentioned transaction data, read the first ciphertext data of the above-mentioned transaction data from the above-mentioned blockchain according to the above-mentioned transaction attribute information.

[0241] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to execute:

[0242] Synchronize the image file of the above-mentioned first secure hardware client to the management node device in the above-mentioned blockchain network; the management node device is used to run the image file of the above-mentioned first secure hardware client to recover the above-mentioned first hardware private key when the above-mentioned target node device is in an abnormal state and receives a recovery signature request; the above-mentioned recovery signature request is used to reflect that a specified number of node devices in the above-mentioned blockchain network indicate that the above-mentioned first hardware private key needs to be recovered;

[0243] The above-mentioned management node device is further used to, through the above-mentioned second secure hardware client, in the above-mentioned second secure hardware area, use the recovered first hardware private key to decrypt the above-mentioned first ciphertext data to obtain the plaintext data of the above-mentioned transaction data; through the above-mentioned second secure hardware client, in the above-mentioned second secure hardware area, use the public key of the above-mentioned second terminal to encrypt the plaintext data of the above-mentioned transaction data to obtain the third ciphertext data of the above-mentioned transaction data, and send the above-mentioned third ciphertext data to the above-mentioned second terminal.

[0244] In this application, each node device in the blockchain network is installed with a secure hardware client. The secure hardware client is associated with the secure hardware area of the node device. The secure hardware client can be used to generate a hardware key pair for each node device. The hardware key pair includes a hardware private key and a hardware public key, and the hardware private key is stored in the secure hardware area. Through the hardware public key, encrypted transmission of transaction data can be achieved, which can prevent the transaction data from being stolen by unauthorized users or the non-secure hardware area of the node device during the transmission process, and improve the transmission security of the transaction data. At the same time, through the secure hardware client, the ciphertext data of the transaction data (i.e., the first ciphertext data) is decrypted using the hardware private key in the secure hardware area, and the validity of the transaction data is verified in the secure hardware area. When it is determined that the transaction data is valid, the ciphertext data of the transaction data is stored on the blockchain. The decryption process and the validity verification process of the transaction data are both implemented in the secure hardware area. At the same time, the ciphertext data of the transaction data is uploaded to the blockchain. Even if the target node device is illegally invaded by an attacker, the attacker cannot obtain the plaintext data of the transaction data, which can improve the security of the transaction data.

[0245] It should be noted that in the embodiments of this application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.

[0246] In addition, it should be pointed out here that: the embodiments of this application also provide a computer-readable storage medium, and the computer-readable storage medium stores the computer program executed by the aforementioned blockchain data processing device. The computer program includes program instructions. When the aforementioned processor executes the program instructions, it can execute the description of the aforementioned blockchain data processing method in the corresponding previous embodiments. Therefore, it will not be elaborated here. In addition, the description of the beneficial effects of using the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application.

[0247] As an example, the aforementioned program instructions can be deployed to be executed on a computer device, or be deployed to be executed on at least two computer devices at one location. Or, they can be executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. The at least two computer devices distributed at at least two locations and interconnected through a communication network can form a blockchain network.

[0248] The above computer-readable storage medium may be the blockchain data processing device provided in any of the foregoing embodiments or the middle storage unit of the above computer device, such as the hard disk or the middle memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the computer device. Further, the computer-readable storage medium may also include both the middle storage unit and the external storage device of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0249] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish the content in different media, rather than to describe a specific order. In addition, the term "comprising" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally further includes steps or modules that are not listed, or optionally further includes other step units inherent to these processes, methods, devices, products, or equipment.

[0250] When collecting and processing relevant data in this application book (such as the initial behavior characteristics corresponding to the user's transaction behavior, and the user's object characteristics, etc.) during actual application, it should be strictly in accordance with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and within the scope authorized by laws and regulations and the personal information subject, carry out subsequent data use and processing behaviors.

[0251] The embodiments of the present application also provide a computer program product, including a computer program. When the above computer program is executed by a processor, it implements the descriptions of the above blockchain data processing method and decoding method in the corresponding foregoing embodiments. Therefore, details will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated either. For the technical details not disclosed in the embodiments of the computer program product involved in the present application, please refer to the description of the method embodiments of the present application.

[0252] Those of ordinary skill in the art will realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of the examples have been generally described in terms of function in the above description. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of this application.

[0253] The methods and related devices provided by the embodiments of this application are described with reference to the method flowcharts and / or structural schematic diagrams provided by the embodiments of this application. Specifically, each process and / or block of the method flowchart and / or structural schematic diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network-connected devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable network-connected devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable network-connected devices to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be loaded onto a computer or other programmable network-connected devices, such that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or structural schematic one block or multiple blocks.

[0254] The above-disclosed are only the preferred embodiments of this application. Of course, the scope of rights of this application cannot be limited thereby. Therefore, equivalent changes made according to the claims of this application still fall within the scope covered by this application.

Claims

1. A blockchain data processing method, characterized in that, Including: Receiving a blockchain uploading request for uploading transaction data to a blockchain in a blockchain network; the blockchain uploading request carries first ciphertext data of the transaction data; The first ciphertext data is obtained by encrypting the transaction data with a first hardware public key of a target node device, where the target node device is a node device in the blockchain network that receives the blockchain uploading request, and the first hardware public key is generated by a first secure hardware client in the target node device; Through the first secure hardware client, in a first secure hardware area associated with the first secure hardware client, decrypting the first ciphertext data with a first hardware private key of the target node device to obtain plaintext data of the transaction data; Through the first secure hardware client, validating the plaintext data of the transaction data in the first secure hardware area to obtain a validity verification result; When the validity verification result indicates that the plaintext data of the transaction data is valid, through the first secure hardware client, in the first secure hardware area, encrypting the plaintext data of the transaction data with the first hardware public key to obtain the first ciphertext data of the transaction data, and storing the first ciphertext data on the blockchain; 2. The method according to claim 1, wherein The validating, through the first secure hardware client, the plaintext data of the transaction data in the first secure hardware area to obtain a validity verification result includes: Validating, through the first secure hardware client, the plaintext data of the transaction data in the first secure hardware area to obtain a first validity verification result; Through the first secure hardware client, in the first secure hardware area, encrypting the plaintext data of the transaction data with second hardware public keys of remaining node devices to obtain second ciphertext data of the transaction data, and sending the second ciphertext data to the remaining node devices; the remaining node devices are devices in the blockchain network other than the target node device; the remaining node devices are used to decrypt the second ciphertext data with second hardware private keys of the remaining node devices in a second secure hardware area through a second secure hardware client to obtain the plaintext data of the transaction data, and validate the plaintext data of the transaction data to obtain second validity verification results; Receiving the second validity verification results returned by the remaining node devices, and determining the validity verification result of the plaintext data of the transaction data according to the first validity verification result and the second validity verification results; 3. The method according to claim 2, wherein The blockchain uploading request further carries device attribute information of a first terminal that sends the blockchain uploading request, and a transaction signature of the transaction data; The validating, through the first secure hardware client, the plaintext data of the transaction data in the first secure hardware area to obtain a first validity verification result includes: Read the permission database from the blockchain; the permission database includes device attribute information corresponding to permission terminals with the permission to request the transaction data to be uploaded to the blockchain; Through the first secure hardware client, in the first secure hardware area, verify the permission of the first terminal to request the transaction data to be uploaded to the blockchain according to the device attribute information in the permission database and the device attribute information carried in the upload request, and obtain a permission verification result; Verify the transaction signature of the transaction data according to the public key of the first terminal and the plaintext data of the transaction data, and obtain a signature verification result; Determine the first validity verification result of the plaintext data of the transaction data according to the permission verification result and the signature verification result.

4. The method according to claim 2, wherein The determining the validity verification result of the plaintext data of the transaction data according to the first validity verification result and the second validity verification result includes: According to the first validity verification result and the second validity verification result, count the number of valid devices in the blockchain network that determine the plaintext data of the transaction data to be valid; Count the number of participating devices corresponding to the node devices participating in the legality verification of the plaintext data of the transaction data in the blockchain network, and the total number of device corresponding to the node devices in the blockchain network; Determine the validity verification result of the plaintext data of the transaction data according to the number of participating devices, the number of valid devices, and the total number of devices.

5. The method according to claim 2, characterized in that, The encrypting the plaintext data of the transaction data by using the second hardware public key of the remaining node devices through the first secure hardware client in the first secure hardware area to obtain the second ciphertext data of the transaction data, and sending the second ciphertext data to the remaining node devices includes: Obtain N hardware sub-public keys derived from the second hardware public key of the remaining node devices; Through the first secure hardware client, in the first secure hardware area, divide the plaintext data of the transaction data to obtain N plaintext data segments of the transaction data; Encrypt the N plaintext data segments of the transaction data by using the N hardware sub-public keys to obtain N ciphertext data segments of the transaction data; one ciphertext data segment is obtained by encrypting one plaintext data segment with one hardware sub-public key; the second ciphertext data includes the N ciphertext data segments; Batch send the N ciphertext data segments to the remaining node devices; the remaining node devices are further configured to decrypt the N ciphertext data segments by using the second hardware private key of the remaining node devices through the second secure hardware client in the second secure hardware area to obtain the N plaintext data segments, and merge the N plaintext data segments to obtain the plaintext data of the transaction data.

6. The method according to claim 1, characterized in that, The upload request further carries the transaction attribute information of the transaction data; the storing the first ciphertext data to the blockchain includes: Determine an accounting node device for uploading the transaction data from the node devices of the blockchain network according to the transaction attribute information carried in the uploading request; When the target node device is the accounting node device, store the first ciphertext data on the blockchain.

7. The method according to claim 6, wherein The determining an accounting node device for uploading the transaction data from the node devices of the blockchain network according to the transaction attribute information carried in the uploading request includes: Determine the institution to which the transaction data belongs according to the transaction attribute information carried in the uploading request; Select, from the node devices of the blockchain network, the node devices associated with the institution as candidate node devices; Determine an accounting node device for uploading the transaction data from the candidate node devices according to the occupancy rate of the device resources of the candidate node devices.

8. The method according to claim 7, wherein The determining an accounting node device for uploading the transaction data from the candidate node devices according to the occupancy rate of the device resources of the candidate node devices includes: Obtain the occupancy rates and weights respectively corresponding to M types of device resources of the candidate node devices; M is an integer greater than 1; Perform a weighted summation process on the occupancy rates respectively corresponding to the M types of device resources of the candidate node devices according to the weights respectively corresponding to the M types of device resources to obtain the total occupancy rate of the M types of device resources of the candidate node devices; Determine the candidate node device with the minimum total occupancy rate as the accounting node device for uploading the transaction data.

9. The method according to claim 1, characterized in that, The method further includes: Receive a request from a second terminal for obtaining the transaction data; Read the first ciphertext data of the transaction data from the blockchain according to the obtaining request; In the first secure hardware area through the first secure hardware client, decrypt the first ciphertext data by using the first hardware private key of the target node device to obtain the plaintext data of the transaction data; In the first secure hardware area through the first secure hardware client, encrypt the plaintext data of the transaction data by using the public key of the second terminal to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

10. The method according to claim 9, wherein The obtaining request carries the device attribute information of the second terminal and the transaction attribute information of the transaction data; The reading the first ciphertext data of the transaction data from the blockchain according to the obtaining request includes: Verify the obtaining permission of the second terminal for the transaction data according to the device attribute information of the second terminal; When the second terminal has the obtaining permission for the transaction data, read the first ciphertext data of the transaction data from the blockchain according to the transaction attribute information.

11. The method according to claim 9, wherein The method further includes: Synchronize the image file of the first secure hardware client to the management node device in the blockchain network; the management node device is configured to run the image file of the first secure hardware client and recover the first hardware private key when the target node device is in an abnormal state and a recovery signature request is received; the recovery signature request is used to indicate that a specified number of node devices in the blockchain network require the recovery of the first hardware private key. The management node device is further configured to, through the second secure hardware client, in the second secure hardware area, use the recovered first hardware private key to decrypt the first ciphertext data to obtain the plaintext data of the transaction data; through the second secure hardware client, in the second secure hardware area, use the public key of the second terminal to encrypt the plaintext data of the transaction data to obtain the third ciphertext data of the transaction data, and send the third ciphertext data to the second terminal.

12. A blockchain data processing device, characterized in that, Comprising: A receiving module, configured to receive a chain-up request for uploading transaction data to a blockchain in a blockchain network; the chain-up request carries the first ciphertext data of the transaction data. The first ciphertext data is obtained by encrypting the transaction data with the first hardware public key of the target node device, the target node device is the node device in the blockchain network that receives the chain-up request, and the first hardware public key is generated by the first secure hardware client in the target node device. A decryption module, configured to, through the first secure hardware client, in the first secure hardware area associated with the first secure hardware client, use the first hardware private key of the target node device to decrypt the first ciphertext data to obtain the plaintext data of the transaction data. A verification module, configured to, through the first secure hardware client, in the first secure hardware area, perform validity verification on the plaintext data of the transaction data to obtain a validity verification result. A chain-up module, configured to, when the validity verification result indicates that the plaintext data of the transaction data is valid, through the first secure hardware client, in the first secure hardware area, use the first hardware public key to encrypt the plaintext data of the transaction data to obtain the first ciphertext data of the transaction data, and store the first ciphertext data on the blockchain.

13. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 11.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 11.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 11.