Data processing method and device based on block chain, equipment and storage medium
By using cross-chain communication protocol in the blockchain network, the problem of transaction data storage pressure and data effectiveness in the blockchain network is solved, and the method of safe reading of off-chain data is realized, reducing storage costs and pressure, ensuring that Data validity and security.
Patent Information
- Application Number
- CN202310647015.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2024-12-03
AI Technical Summary
The transaction data stored in the blockchain network increases over time, resulting in increased storage pressure, and it is difficult to ensure the effectiveness of the data by storing transaction data in off-chain devices.
By introducing a cross-chain communication protocol into the blockchain network, the node device sends the original read request to the terminal device, generates an off-chain read request based on the transaction attribute information and device attribute information, and calls the off-chain read interface from the target network device. Read transaction data packets and verify data validity through data verification functions to ensure data security and effectiveness.
It realizes the secure reading of off-chain data on the blockchain network, reduces the data storage pressure of the blockchain network, reduces the data storage cost, and improves the scope of application, ensuring the effectiveness and security of transaction data. sex.
Smart Images

Figure CN119066713A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to fields such as blockchain, and in particular to a data processing method, device, equipment and storage medium based on blockchain. Background Art
[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains multiple transaction data, which are used to verify the validity of its transaction data (anti-counterfeiting) and generate the next block. As time goes by, the transaction data stored on the blockchain increases, which brings greater storage pressure to the blockchain. Based on this, more and more users store part of their transaction data in the off-chain devices of the blockchain. In practice, it is found that it is difficult to ensure the validity of transaction data when storing transaction data in off-chain devices. Summary of the invention
[0003] The embodiments of the present application provide a blockchain-based data processing method, apparatus, device, and storage medium, which can ensure the validity of transaction data.
[0004] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, including:
[0005] Sending an original read request for target transaction data to a node device in the blockchain network; the original read request carries transaction attribute information of the target transaction;
[0006] Receive a first off-chain read request sent by the node device calling the off-chain read interface in the cross-chain communication protocol; the first off-chain read request is generated according to the transaction attribute information and the device attribute information of the target network device, the device attribute information is obtained by the node device from the cross-chain communication protocol when determining that the target transaction data belongs to the off-chain data of the blockchain network, and the target network device is a device for reading the off-chain data of the blockchain network;
[0007] According to the first off-chain read request, a transaction data packet including the target transaction data is read from the target network device; the transaction data packet is read by the target network device from an external device associated with the blockchain network;
[0008] Forwarding the transaction data packet to the node device, the node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0009] The target transaction data is received when the verification result indicates that the target transaction data is valid.
[0010] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, including:
[0011] Receiving an original read request for target transaction data sent by a terminal device; the original read request carries transaction attribute information of the target transaction;
[0012] If the target transaction data belongs to off-chain data of the blockchain network, query the device attribute information of the target network device for reading the off-chain data of the blockchain network from the cross-chain communication protocol of the blockchain network;
[0013] Generate a first off-chain read request according to the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device, wherein the terminal device is used to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, wherein the transaction data packet is read by the target network device from an external device associated with a node device in the blockchain network;
[0014] Receiving the transaction data packet sent by the terminal device, and verifying the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0015] If the verification result indicates that the target transaction data is valid, the target transaction data in the transaction data packet is returned to the terminal device.
[0016] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, including:
[0017] A sending module, used to send an original read request about target transaction data to a node device in a blockchain network; the original read request carries transaction attribute information of the target transaction;
[0018] A first receiving module is used to receive a first off-chain read request sent by the node device calling the off-chain read interface in the cross-chain communication protocol; the first off-chain read request is generated according to the transaction attribute information and the device attribute information of the target network device, the device attribute information is obtained by the node device from the cross-chain communication protocol when determining that the target transaction data belongs to the off-chain data of the blockchain network, and the target network device is a device for reading the off-chain data of the blockchain network;
[0019] A reading module, configured to read a transaction data packet including the target transaction data from the target network device according to the first off-chain reading request; the transaction data packet is read by the target network device from an external device associated with the blockchain network;
[0020] A forwarding module, used to forward the transaction data packet to the node device, and the node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0021] The second receiving module is configured to receive the target transaction data returned by the node device when the verification result indicates that the target transaction data is valid.
[0022] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, including:
[0023] A first receiving module, configured to receive an original read request for target transaction data sent by a terminal device; the original read request carries transaction attribute information of the target transaction;
[0024] A query module, used for querying from the cross-chain communication protocol of the blockchain network if the target transaction data belongs to off-chain data of the blockchain network, and for reading device attribute information of the target network device of the off-chain data of the blockchain network;
[0025] A generation module, configured to generate a first off-chain read request according to the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device, wherein the terminal device is configured to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, wherein the transaction data packet is read by the target network device from an external device associated with a node device in the blockchain network;
[0026] A second receiving module is used to receive the transaction data packet sent by the terminal device, and verify the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0027] The sending module is configured to return the target transaction data in the transaction data packet to the terminal device if the verification result indicates that the target transaction data is valid.
[0028] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0029] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0030] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0031] In the present application, the node devices in the blockchain network pre-generate a set of universal cross-chain communication protocols, which are used to indicate how to securely read off-chain data through the blockchain network. For example, the cross-chain communication protocol includes an off-chain read interface for issuing off-chain read requests, and a data verification function for verifying off-chain data, etc. Through the cross-chain communication protocol, secure reading of off-chain data can be achieved to ensure the security of the read transaction data, and to achieve interoperability between on-chain and off-chain.
[0032] Specifically, when the terminal device needs to read the target transaction data, the terminal device can send an original read request about the target transaction data to the node device in the blockchain network. The original read request carries the transaction attribute information of the target transaction data. After receiving the original read request, the node device can determine whether the target transaction data belongs to the off-chain data of the blockchain network. If it is determined that the target transaction data belongs to the off-chain data of the blockchain network, the device attribute information of the target network device used to read the off-chain data of the blockchain network can be queried from the above cross-chain communication protocol. Further, the node device calls the above off-chain read interface according to the first off-chain read request of the device attribute information and the transaction attribute information, and sends the first off-chain read request to the terminal device. The first off-chain read request is used to instruct the target network device to return the target transaction data to the terminal device. After receiving the first off-chain read request, the terminal device reads the transaction data packet including the target transaction data from the target network device and forwards the transaction data packet to the node device. The node device calls the data verification function to verify the validity of the target transaction data. When the target transaction data is valid, the target transaction data is returned to the terminal device, so that the off-chain data can be safely read on the chain, and the validity of the off-chain data (i.e., transaction data) can be ensured. At the same time, by reading off-chain data through a set of universal cross-chain communication protocols, there is no need to store data for verification separately on the chain for each transaction data, nor is there a need for the terminal device to perceive the interaction details of storing transaction data in an external device, and no additional credit assumptions are required, which improves the scope of application of this application and can realize universal reading of off-chain data. In addition, the target transaction data is read by the target network device from an external device associated with the blockchain network, that is, by storing the target transaction data off the chain of the blockchain network, the data storage pressure of the blockchain network can be reduced, and the data storage cost can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 This is a schematic diagram of the architecture of a blockchain-based data processing system provided by this application;
[0035] Figure 2 It is a schematic diagram of the structure of a blockchain provided by this application;
[0036] Figure 3This is a schematic diagram of a scenario of interaction between a terminal device, a target network device, and a node device in a blockchain network provided by the present application;
[0037] Figure 4 This is a flowchart of a blockchain-based data processing method provided by this application;
[0038] Figure 5 This is a schematic diagram of a scenario for generating a second off-chain read request based on a URL template provided by this application;
[0039] Figure 6 This is a flowchart of a blockchain-based data processing method provided by this application;
[0040] Figure 7 This is a schematic diagram of a scenario for querying the balance of a user corresponding to a terminal device provided by the present application;
[0041] Figure 8 It is a structural schematic diagram of a blockchain-based data processing device provided in an embodiment of the present application;
[0042] Fig. 9 It is a structural schematic diagram of a blockchain-based data processing device provided in an embodiment of the present application;
[0043] Fig.10 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] First, we introduce the blockchain data processing system used in this solution. Figure 1 , Figure 1 A schematic diagram of the structure of a blockchain data processing system provided by an embodiment of the present invention. The blockchain data processing system includes a blockchain network, a terminal device 105, a network device 106, and an external device 107.
[0046] The terminal device 105 may include a data processing application, which is used to write transaction data into the blockchain network or read transaction data, such as the data processing application may be a blockchain application. The terminal device 105 has a communication connection with the network device 106 and each node device in the blockchain network, so that the terminal device 105 can exchange information with the network device 106 and each node device in the blockchain network.
[0047] Among them, the external device 107 may refer to a device for storing off-chain data of the blockchain network, and the external device 107 may be a node device in another blockchain network, or the external device 107 may refer to a database device, and the database device may be a node device in a non-blockchain network, such as a database device may refer to a device specifically used to store transaction data.
[0048] The network device 106 refers to a device for reading off-chain data from the external device 107. The network device 106 is equivalent to an entry for reading off-chain data from the external device 107. The network device 106 may specifically refer to a gateway device. The network device 106 has a network connection with the external device 107 and each node device in the blockchain network, so that the network device 107 can exchange information with the external device 107 and the node devices in the blockchain network.
[0049] The blockchain network is an end-to-end decentralized network composed of multiple node devices. The node devices in the blockchain network can be called background processing devices of the data processing application in the terminal device 105. The number of node devices in the blockchain network can be deployed according to actual needs. This application does not limit the number of node devices. Figure 1 The blockchain network includes four node devices as an example for explanation, and the four node devices are node device 101, node device 102, node device 103 and node device 104.
[0050] It is understandable that each node device can receive the transaction data to be recorded when performing normal work, and maintain the blockchain based on the received transaction data to be recorded. In order to ensure the information exchange within the blockchain network, there can be a network connection 10 between each node device in the blockchain network, and data can be transmitted between the node devices through the above network connection 10. For example, when any node device in the blockchain network receives the transaction data to be recorded, the other node devices in the blockchain network will verify the transaction data to be recorded according to the consensus algorithm, and after the verification is successful (that is, after reaching a consensus), the transaction data to be recorded is stored as data in the blockchain, so that the data stored on all node devices in the blockchain network are consistent.
[0051] It is understandable that data or blocks can be transmitted between node devices through the network connection 10. The network connection between the above node devices can be based on node identification. For each node device in the blockchain network, it has a node identification corresponding to it, and each of the above node devices can store the node identifications of other node devices connected to itself, so that the acquired data or generated blocks can be broadcast to other node devices according to the node identifications of other node devices. For example, node device 101 can maintain a node identification list, which stores the node names and node identifications of other node devices, as shown in Table 1:
[0052] Table 1
[0053] Node Name Node ID Node device 101 117.xxx.xxx.174 Node device 102 117.xxx.xxx.145 … … Node device 111 117.xxx.xxx.183 Node device 112 117.xxx.xxx.125 Node device 113 119..xxx.xxx.234 … …
[0054] Among them, the node identifier can be the Internet Protocol (IP) address for interconnecting networks or any other information that can be used to identify the node device in the blockchain network. Table 1 only uses the IP address as an example for explanation.
[0055] Assuming that the node identifier of node device 101 is 117.xxx.xxx.174, node device 101 can send a data synchronization request to node device 102 through 117.xxx.xxx.174, and node device 102 can know that the data synchronization request is sent by node device 101 through node identifier 117.xxx.xxx.174; similarly, node device 102 can send transaction data A to node device 101 through node identifier 117.xxx.xxx.145, and node device 101 can know that transaction data A is sent by node device 101 through node identifier 117.xxx.xxx.145, and the same is true for data transmission between other node devices, so they will not be elaborated one by one.
[0056] It is understandable that the above-mentioned network connection does not limit the connection method, and can be directly or indirectly connected through wired communication, directly or indirectly connected through wireless communication, or through other connection methods, which are not limited in this application.
[0057] See also Figure 2The blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the input information characteristic value, version number, timestamp and difficulty value, and the block body stores the input information; the next block of the genesis block takes the genesis block as the parent block, and the next block also includes a block header and a block body. The block header stores the input information characteristic value of the current block, the block header characteristic value, version number, timestamp and difficulty value of the parent block, and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0058] It is understandable that in order to reduce the storage pressure of the blockchain network, some transaction data is stored off-chain in the blockchain network, that is, the data stored off-chain in the blockchain network can be called off-chain data. In order for the node devices in the blockchain network to store transaction data off-chain in an orderly manner, and for the terminal devices to be able to safely read the off-chain data in the blockchain network, the node devices in the blockchain network can pre-generate a cross-chain communication protocol, which is used to instruct the reading of off-chain data in the blockchain network through the chain. Specifically, the cross-chain communication protocol includes the following contents:
[0059] ① Off-chain read interface for node devices to send off-chain read requests to terminal devices. ② Device attribute information and request generation templates of network devices associated with the blockchain network. Network devices may refer to the entry for reading off-chain data from external devices. The number of network devices may be one or more. The request generation template of the network device refers to the request generation template adapted to the network device. The request generation template is used to generate off-chain read requests adapted to the network device. The off-chain read request adapted to the network device refers to the off-chain read request that the network device can successfully parse. The request generation template includes the device attribute information of the corresponding network device. The device attribute information may include the IP address (URL address) of the network device, the device name, etc. ③ Data verification function used to verify off-chain data. The data verification function is used to indicate how to verify the validity of off-chain data.
[0060] Optionally, the cross-chain communication protocol can be stored in the form of a smart contract on a blockchain in the blockchain network. The cross-chain communication protocol has a unique protocol identifier in the blockchain network, which can also be called a protocol address (or contract address). A smart contract can refer to a protocol defined in a digital form, which needs to be run in a trusted environment. The trusted environment can refer to a blockchain platform, which can be deployed on each node device in the blockchain network, that is, the blockchain is established on the blockchain platform, and the blockchain platform can be a back-end processing application for the data processing application in the above-mentioned terminal device 105. The blockchain platform can be used to manage (such as permission management) and maintain (such as updating and repairing) the data processing application in the terminal device 105.
[0061] Among them, node device 101, node device 102, node device 103 and node device 104 can all be independent physical servers, or they can be server clusters or distributed systems composed of at least two physical servers, or they can also be cloud servers that provide 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 basic cloud computing services such as big data and artificial intelligence platforms. Terminal device 105 can specifically refer to a vehicle-mounted terminal, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a screen speaker, a smart watch, etc., but is not limited to this. The terminal device and the server can be directly or indirectly connected via wired or wireless communication. At the same time, the number of terminal devices and servers can be one or at least two, and this application does not limit this. Network device 106 and external device 107 can both be servers or terminal devices.
[0062] In this application, the device attribute information of the network device may include at least one of the IP address (or URL address) and device name of the network device; the transaction attribute information of the target transaction data may include the data volume of the target transaction data, the object identifier of the object (such as a user or organization) to which the target transaction data belongs, the purpose of the target transaction data, etc. The object identifier may include the public key or account number (such as a payment account number) of the object in the blockchain network. Figure 1 The blockchain data processing system shown can implement the blockchain-based data processing method of the present application, see Figure 3 As shown, Figure 3 The terminal device 20a in the embodiment may refer to Figure 1 The terminal device 105 in the embodiment has transaction data 25b to be stored, that is, the transaction data 25b can be referred to as target transaction data. Figure 3 The node device 21a in may refer to Figure 1 Any node device in the blockchain network in the block chain, the blockchain network to which the node device 21a belongs can be called blockchain network a. The blockchain 26b of the blockchain network a stores a cross-chain communication protocol 27b. Figure 3 The node device 22a in may refer to Figure 1 The external device 107 in the blockchain network b is taken as an example to illustrate that the external device is any node device in the blockchain network b. The blockchain 28b is stored in each node device in the blockchain network b. Figure 3 The network device 23a in the embodiment may refer to Figure 1 The network device 106 in FIG. Figure 3 As shown, the data processing method of the blockchain may include the following steps S30 to S36:
[0063] S30, the terminal device 20a sends an original read request for transaction data 31c to the node device 21a. The terminal device 20a can display the data reading interface 30c of the data processing application, and the data reading interface 30c can include the transaction data 31c to be downloaded in the blockchain network a and the download control 32c. The transaction data 31c can refer to on-chain data or off-chain data. The on-chain data of the blockchain network a refers to the transaction data stored in the blockchain 26b of the blockchain network a, and the off-chain data of the blockchain network a refers to the transaction data stored in the external device by the node device in the blockchain network a. The external device can refer to the node device in the blockchain network b associated with the blockchain network a, or the external device can refer to the database device associated with the blockchain network a. In response to the trigger operation of the download control 32c in the data reading interface 30c, the terminal device 20 generates an original read request for the transaction data 31c and sends the original read request to the server 21a. Since the terminal device 20a does not perceive whether the transaction data 31c belongs to the on-chain data, the original read request may refer to the on-chain read request for the transaction data 31c, that is, the original read request is used to instruct the node device 21a to return the transaction data 31c, and the original read request carries the transaction attribute information of the transaction data 31c; the transaction attribute information of the transaction data 31c may include the data volume of the transaction data 31c, the object identifier of the object (such as a user or an institution) to which the transaction data 31c belongs, the purpose of the transaction data 31c, etc.
[0064] S31, node device 21a determines whether transaction data 31c belongs to on-chain data according to cross-chain communication protocol 27b. If transaction data 31c belongs to on-chain data, step S32 is executed; if transaction data 31c does not belong to on-chain data, that is, transaction data 31c belongs to off-chain data, step S33 is executed. Specifically, node device 21a can determine whether transaction data 31c belongs to on-chain data according to the off-chain storage rules in cross-chain communication protocol 27b. In one embodiment, when the off-chain data storage rules indicate that transaction data with a data volume greater than the data volume threshold is stored off-chain, node device 21a can obtain the data volume of transaction data 31c from the transaction attribute information of transaction data 31c. When the data volume of transaction data 31c is less than or equal to the data volume threshold, it is determined that transaction data 31c belongs to on-chain data; when the data volume of transaction data 31c is greater than the data volume threshold, it is determined that transaction data 31c belongs to off-chain data. In one embodiment, when the off-chain data storage rule indicates that transaction data with a real-time level less than the real-time level threshold is stored off-chain, the node device 21a can obtain the purpose of the transaction data 31c from the transaction attribute information of the transaction data 31c, and determine the real-time level of the transaction data 31c according to the purpose of the transaction data 31c. If the real-time level of the transaction data 31c is greater than or equal to the real-time level threshold, it is determined that the transaction data 31c belongs to the on-chain data; if the real-time level of the transaction data 31c is less than the real-time level threshold, it is determined that the transaction data 31c belongs to the off-chain data. In one embodiment, when the off-chain data storage rule indicates that transaction data with a security level less than the security level threshold is stored off-chain, the node device 21a can obtain the object identifier corresponding to the transaction data 31c from the transaction attribute information of the transaction data 31c, and determine the security level of the transaction data 31c according to the object to which the transaction data 31c belongs. If the security level of transaction data 31c is greater than or equal to the security level threshold, it is determined that the transaction data 31c belongs to on-chain data; if the security level of transaction data 31c is less than the security level threshold, it is determined that the transaction data 31c belongs to off-chain data. In particular, other node devices in blockchain network a can also determine that the transaction data 31c belongs to off-chain data in the above manner. If the majority (such as 51%) of the node devices in the blockchain network determine that the transaction data 31c belongs to on-chain data, step S32 is executed; if the majority (such as 51%) of the node devices in the blockchain network determine that the transaction data 31c belongs to off-chain data, step S33 is executed.
[0065] S32. If the transaction data 31c is on-chain data, the node device 21a reads the transaction data 31c from the blockchain 26b and returns the transaction data 31c to the terminal device 20a.
[0066] S33. If the transaction data 31c belongs to off-chain data, the node device 21a can call the off-chain reading interface in the cross-chain communication protocol and return an off-chain reading request to the terminal device 20a. The off-chain reading request can be generated based on the device attribute information of the network device 23a and the transaction attribute information of the transaction data 31c.
[0067] S34, terminal device 20a can read the transaction data packet from network device 23a according to the off-chain read request; specifically, network device 23a can query the storage information associated with the transaction attribute information according to the transaction attribute information in the off-chain read request, and read the transaction data packet from blockchain 28b according to the storage information, and the transaction data packet includes transaction data 31c and signature information of the institution to which network device 23a belongs. The signature information is used to verify whether the transaction data packet is sent by network device 23a, and to verify whether the transaction data 31c in the transaction data packet is tampered with. The signature information of the institution to which network device 23a belongs is obtained by network device 23a using the private key of its institution to sign the transaction data 31c. The transaction data 31c is read by network device 23a from blockchain 28b in node device 22a. In particular, the signature information of the organization to which the network device 23a belongs can be obtained by signing the transaction data 31c using the private key of the organization to which the node device 21a belongs during the process of storing the transaction data 31c. The node device 22a stores the transaction data packet including the transaction data 31c, and the network device 23a reads the transaction data packet from the node device 22a and returns it to the terminal device 20a.
[0068] S35. The terminal device 20a forwards the transaction data packet to the node device 21a.
[0069] S36. When confirming that the transaction data 31c is valid, the node device 21a returns the transaction data 31c to the terminal device 20a. After receiving the transaction data packet, the node device 21a can call the data verification function in the cross-chain communication protocol to verify the validity of the transaction data 31c in the transaction data packet, such as performing a hash operation on the transaction data 31c to obtain the hash value of the transaction data 31c, and using the public key of the institution to which the network device belongs to verify the signature information of the institution to which the network device belongs to obtain the signature verification data. If the signature verification data matches the hash value of the transaction data 31c, it is determined that the transaction data 31c has been verified. Further, when it is determined that the transaction data 31c is valid, the transaction data 31c is sent to the terminal device 20a.
[0070] In summary, based on the above steps S20~S25, cross-chain storage of transaction data can be achieved, avoiding storing all transaction data in the same blockchain network, reducing the data storage pressure of the blockchain network, and at the same time, the terminal device does not need to perceive the interaction details of storing transaction data in the node device off-chain, that is, there is no need to improve the data processing application in the terminal device to adapt to the off-chain data storage, reducing development costs. Based on the above steps S30~S36, a set of universal cross-chain communication protocols is used to safely read off-chain data. There is no need to store data for verification separately on the chain for each transaction data, and no additional credit assumptions are required. The scope of application of this application is improved, and universal reading of off-chain data can be achieved. At the same time, the cross-chain communication protocol enables a node device in a blockchain network to read data from another blockchain network, and interoperability between different blockchain networks is achieved, that is, message communication between different blockchain networks is achieved.
[0071] For further information, see Figure 4 , is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 4 As shown, this method can be Figure 1 The data processing method based on blockchain may include the following steps S101 to S105:
[0072] S101. Send an original read request for target transaction data to a node device in the blockchain network; the original read request carries transaction attribute information of the target transaction.
[0073] In this application, the transaction data to be read by the terminal device is called the target transaction data, which belongs to the on-chain data or off-chain data of the blockchain network. The off-chain data of the blockchain network may refer to the transaction data stored by the node device in the blockchain network to the external device; the on-chain data of the blockchain network may refer to the transaction data stored by the node device in the blockchain network to the blockchain in the blockchain network. The terminal device can generate an original read request for the target transaction data and send the original read request to any node device in the blockchain network. Since the terminal device does not perceive whether the node device stores the target transaction data on the chain or off the chain, that is, the terminal device defaults to storing the target transaction data on the chain of the blockchain network, the original read request may refer to the on-chain read request for the target transaction data. The original read request may carry the transaction attribute information of the target transaction data, and the transaction attribute information of the target transaction data may include the data volume of the target transaction data, the object identifier of the object (such as a user or an institution) to which the target transaction data belongs, the purpose of the target transaction data, etc. The object identifier may include the public key or account number (such as a payment account) of the object in the blockchain network.
[0074] S102. Receive a first off-chain read request sent by the above-mentioned node device calling the off-chain read interface in the cross-chain communication protocol; the above-mentioned first off-chain read request is generated according to the above-mentioned transaction attribute information and the device attribute information of the target network device, and the above-mentioned device attribute information is obtained by querying from the above-mentioned cross-chain communication protocol when the above-mentioned node device determines that the above-mentioned target transaction data belongs to the off-chain data of the above-mentioned blockchain network. The target network device is a device for reading the off-chain data of the above-mentioned blockchain network.
[0075] In this application, after the node device receives the above original read request, it can determine whether the target transaction data belongs to off-chain data based on the cross-chain communication protocol. For the specific judgment process, please refer to Figure 3 Step S31 in the above description will not be repeated. When the node device determines that the target transaction data belongs to off-chain data, it can query the device attribute information of the target network device used to read the off-chain data of the blockchain network based on the cross-chain communication protocol, generate a first on-chain read request according to the device attribute information and transaction attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first on-chain read request to the terminal device.
[0076] It should be noted that the target network device may refer to an entry for reading off-chain data of a blockchain network, and the number of target network devices may be one or more. The first off-chain read request may include additional data, an initial verification function and a request generation template in a cross-chain communication protocol, and a protocol identifier of a cross-chain communication protocol. The additional data and the initial verification function are used to verify the transaction data packet returned by the network device. The additional data may include at least one of the public key of the institution to which the network device belongs, the standard data volume of the target transaction data, and the standard data format. The standard data volume refers to the data volume of the target transaction data when it has not been tampered with, and the standard data format may refer to the data format of the target transaction data when it has not been tampered with. The request generation template is used to indicate how to generate an off-chain read request adapted to the target network device, and the request generation template may include device attribute information of the target network device, such as the IP address of the target network device.
[0077] Optionally, the original read request may also carry a protocol identifier of a cross-chain communication protocol associated with the terminal device and the node device. The protocol identifier in the original read request is obtained by the terminal device and is used to indicate the cross-chain communication protocol that the terminal device expects to trigger; the first off-chain read request carries a protocol identifier. After receiving the first off-chain read request, the terminal device may compare the protocol identifier of the protocol in the first off-chain read request with the protocol identifier in the original read request. If the similarity between the protocol identifier of the protocol in the first off-chain read request and the protocol identifier in the original read request is greater than the similarity threshold, it is determined that the first off-chain read request is triggered by the cross-chain communication protocol indicated in the original read request, and the terminal device may execute step S103; if the similarity between the protocol identifier of the protocol in the first off-chain read request and the protocol identifier in the original read request is less than or equal to the similarity threshold, it is determined that the first off-chain read request is not triggered by the cross-chain communication indicated by the original read request, and the first off-chain read request may be triggered by the cross-chain communication protocol, and the terminal device may end this process; this can avoid returning erroneous data to the terminal device.
[0078] S103. According to the first off-chain read request, a transaction data packet including the target transaction data is read from the target network device; the transaction data packet is read by the target network device from an external device associated with the blockchain network.
[0079] In the present application, after receiving the first off-chain read request, the terminal device can read a transaction data packet including the target transaction data from the target network device according to the off-chain read request. The transaction data packet can also include the signature information of the organization to which the target network device belongs. The transaction data packet can be read by the network device from an external device associated with the blockchain network. The external device can refer to any node device in an associated blockchain network that has an associated relationship with the blockchain network, or the external device can refer to a database device associated with the blockchain network. In other words, the target transaction data can be stored on a blockchain in another blockchain network, so that interoperability between different blockchain networks can be achieved.
[0080] It should be noted that the target network device is usually maintained by the organization to which the blockchain network belongs. Therefore, the node device in the blockchain network stores the public key and private key of the organization to which the target network device belongs. Furthermore, the signature information of the organization to which the target network device belongs can be obtained by the node device in the blockchain network using the private key of the organization to which the network device belongs to sign the target transaction data in the process of storing the target transaction data, that is, the transaction data packet including the target transaction data and the signature information of the organization to which the target network device belongs is stored in the external device. Alternatively, the signature information of the organization to which the target network device belongs can be obtained by the target network device using the private key of the organization to which the network device belongs to sign the target transaction data after reading the target transaction data from the external device, that is, the target transaction data is stored in the external device.
[0081] Optionally, the above-mentioned reading of the transaction data packet including the above-mentioned target transaction data from the above-mentioned target network device according to the above-mentioned first off-chain read request includes: the terminal device can generate a second off-chain read request adapted to the target network device according to the first off-chain read request, and the second off-chain read request adapted to the target network device refers to an off-chain read request that the target network device can parse successfully. The request format of the second off-chain read request is the request format indicated by the request generation template, and the request format includes any one of Hypertext Transfer Protocol (HTTP), Hypertext Transfer Protocol Secure (HTTPS), etc. The second off-chain read request can be used to instruct the target network device to read the target transaction data from the external device. The second off-chain read request includes one or more of callback data, protocol identifier, and device attribute information of the target network device. The callback data is used to instruct the target network device to read the target transaction data from the external device based on the reading method corresponding to the target transaction data. The callback data is obtained by encoding the transaction attribute information and the method identifier of the reading method. The reading method may refer to a function for reading off-chain data, such as the target transaction data is the balance of a user's payment account, and the reading method for reading the balance may be balanceOf. Further, the terminal device may send the second off-chain read request to the target network device, and the target network device is used to generate a request response message according to the second off-chain read request. The terminal device may receive the above-mentioned request response message returned by the target network device, such as judging whether the request response message is a successful response message according to the status value of the request response message, such as when the status value is 200, determining that the request response message is a successful response message. Alternatively, query whether a transaction data packet is included from the request response message, and if a transaction data packet is included, determining that the request response message is a successful response message, and obtaining the transaction data packet of the target transaction data from the request response message. The terminal device reads the transaction data packet including the target transaction data from the target network device through the first off-chain read request, which can realize the interconnection and intercommunication between the terminal device and the target network device, and improve the reading efficiency of the transaction data packet.
[0082] It is understandable that the request response message may include a successful response message or a failed response message. The successful response message is used to indicate that the target network device has successfully read a transaction data packet including the target transaction data from an external device, that is, the successful response message includes the transaction data packet. The failed response message is used to indicate that the target network device has read a transaction data packet including the target transaction data from an external device, and the response identification message may include a status value. Taking the request format indicated by the request generation template as HTTPS as an example, the status value belongs to [400, 499], indicating that the second chain read request is invalid. If the status value is 404, it means that the target network device does not support the protocol identifier of the second device attribute information (such as the protocol identifier is incorrect). The status value is 400, indicating that the data format of the callback data is invalid, that is, the target network device cannot parse the callback data. The status value belongs to [500, 599], indicating that an abnormality has occurred in the target network device. If the status value is 500, it means that an error has occurred inside the target network device.
[0083] Optionally, the first off-chain read request includes the protocol identifier of the cross-chain communication protocol, the request generation template in the cross-chain communication protocol and callback data, and the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain the read method associated with the cross-chain communication protocol from the local storage, and the read method indicates the off-chain read function, and the read method is stored locally in the target network device. The callback data is used to instruct the target network device to call the read method to read the target transaction data from the external device. Optionally, taking the request format indicated by the request generation template as HTTPS as an example, the above-mentioned generation of the second off-chain read request adapted to the target network device according to the first off-chain read request includes: if the request generation template includes a data field and a sender field, the sender field is replaced by the protocol identifier, and the data field is replaced by the callback data to obtain a request for obtaining the target transaction data; the acquisition request can also be called a GET request, and the request format of the GET request is in json format. Further, the acquisition request is determined as a second off-chain read request adapted to the target network device. By generating a request template in the cross-chain communication protocol, a second off-chain read request that is compatible with the target network device is generated. This can increase the target network device's parsing success rate for the second off-chain read request and improve the efficiency of reading transaction data. The terminal device does not need to parse (such as decode) the data in the first off-chain read request, which can improve the efficiency of reading off-chain data.
[0084] It should be noted that the target network device may include multiple cross-chain communication protocols, and different cross-chain communication protocols have different functions. Different cross-chain communication protocols can be associated with different blockchain networks. A cross-chain communication protocol is associated with one or more methods, and different methods are used to implement different functions. For example, the cross-chain communication protocol may include a data update method and the above-mentioned reading method. The above-mentioned data update method is used to update off-chain data, and the above-mentioned reading method is used to read off-chain data of the blockchain network.
[0085] For example, Figure 5 As shown, the request generation template can also be called a Uniform Resource Locator (URL) template. When the request generation template is: `https: / / example.com / gateway / {sender} / {data}.json`, it indicates that the request generation template includes a data field, namely {data}, https: / / example.com / gateway / represents the IP address of the target network device, {sender} represents the sender field, which is used to carry the protocol identifier of the cross-chain communication protocol, and {data} is used to carry callback data. The second off-chain read request generated based on the first off-chain read request is: https: / / example.com / gateway / 0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8 / 0xd5fa2b00.json; wherein https: / / example.com / gateway represents the IP address of the target network device, 0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8 represents the protocol identifier of the cross-chain communication protocol, and 0xd5fa2b00 represents callback data, which is obtained by encoding the reading method for reading the target transaction data and the parameters required to read the target transaction data (such as the account number of the object to which the target transaction data belongs).
[0086] Optionally, the first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a read method associated with the cross-chain communication protocol; and the callback data is used to instruct the target network device to call the read method to read the target transaction data from the external device.
[0087] Optionally, taking the request format indicated by the request generation template as HTTPS as an example, the above-mentioned second off-chain read request adapted to the above-mentioned target network device is generated according to the above-mentioned first off-chain read request, including: if the above-mentioned request generation template includes no data field, the terminal device can generate a processing request, and use the processing request as the second off-chain read request. The processing request can be called a POST request, and the content type Content-Type of the request header of the processing request should be application / json. The request body is in json format, and the request body includes {sender} and data field data, both of which are string types and are hexadecimal encoded with a prefix of 0x. Specifically, if the above-mentioned request generation template includes a sender field, and the above-mentioned request generation template includes no data field, the above-mentioned sender field is replaced by a protocol identifier to obtain a request header; the data field and the sender field are added to the request generation template, and the callback data is used as the field value of the above-mentioned data field. The above protocol identifier is used as the field value of the added sender field, and is added to the above request generation template to obtain the request body; based on the request header and the request body, a processing request for the target transaction data is generated, and the processing request is determined as a second off-chain read request adapted to the target network device. By using the request generation template in the cross-chain communication protocol, a second off-chain read request adapted to the target network device is generated, which can improve the target network device's parsing success rate for the second off-chain read request and improve the efficiency of reading transaction data.
[0088] For example, Figure 5As shown, when the request generation template is: `https: / / example.com / gateway / {sender}.json` (i.e., URL template), it indicates that the request generation template does not include the data field, i.e., {data}. The second off-chain read request generated based on the first off-chain read request is shown in Table 2 below. In Table 2, {"data":"0xd5fa2b00","sender":"0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8"} represents the request header, "0xd5fa2b00" represents callback data, and "0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8" represents the protocol identifier. In Table 2, https: / / example.com / gateway / 0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8.json indicates the request body, https: / / example.com / gateway / indicates the IP address of the target network device, and 0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8 indicates the callback data.
[0089] Table 2
[0090]
[0091] Optionally, the first off-chain read request carries request generation templates corresponding to N candidate network devices, and the N candidate network devices correspond to device attribute information respectively, and are arranged in the device list of the first off-chain read request in the order of the credibility of the corresponding target network device from high to low, and N is an integer greater than 1. The credibility of the candidate network device can be determined based on one or more of the transaction data reading efficiency, network stability, and security of the candidate network device. The terminal device can determine the candidate network device i, which is the candidate network device i at the front of the arrangement sequence number of the device attribute information corresponding to the device list, as the target network device for reading the off-chain data of the blockchain network. When there are multiple optional candidate network devices, the terminal device can give priority to the candidate network device with high credibility as the target network device for reading the target transaction data, which can improve the success rate of reading the target transaction data, as well as improve the reading efficiency and security of the target transaction data.
[0092] Optionally, if the request response message belongs to a response failure message, and the status value carried by the request response message is within the first threshold range, the first threshold range indicates that the target network device fails to parse the data in the second off-chain read request, that is, the second off-chain read request is not compatible with the target network device. At this time, if the target network device is reselected and retried, data parsing failure will still occur. Therefore, the terminal device can suspend sending the second off-chain read request to the remaining network devices, that is, no need to retry again, and suspend obtaining the target transaction data. The remaining network device is the network device other than the candidate network device i among the N candidate network devices. If the request response message belongs to a response failure message, and the status value carried by the request response message is within the second threshold range, the second threshold range indicates that the target network device is abnormal, then the terminal device can re-determine the target network device for reading the off-chain data of the above-mentioned blockchain network from the remaining network devices according to the arrangement sequence number of the remaining network devices, and re-send the second off-chain read request to the above-mentioned target network device, that is, select a different candidate network device for retrying. By adaptively selecting whether to retry through the status value, the target transaction data can be obtained, which can avoid the waste of resources caused by invalid retries and improve the success rate of reading the target transaction data through effective retries.
[0093] It should be noted that the first threshold range and the second threshold range can be pre-set, such as data in the cross-chain communication protocol, the first threshold range can refer to [400, 499], and the second threshold range can refer to [500, 599].
[0094] It should be noted that, in the case where the target network device responds successfully, the message format of the request response message returned by the target network device when the second chain read request is the above-mentioned GET request is the same as the message format of the request response message returned when the second chain read request is the above-mentioned POST request. For example, when the target network device responds successfully, the Content-Type (content type) of the response header in the returned request response message should be application / json, the response body is in json format, and the response body contains a data field data of character type string as the response result (i.e., transaction data packet), and the response result is obtained by hexadecimal encoding, using 0x as the prefix. For example, the request response message can be shown in Table 3, 200 in Table 3 represents the status value, reflecting that the request response message belongs to a successful response message, UTF-8 (8 bits, Universal Character Set / Unicode Transformation Format) is a variable-length character encoding for Unicode, reflecting that the character encoding of the message header of the request response message is UTF-8, and "0xdeadbeefdecafbad" represents the transaction data packet, that is, the target transaction data is encoded based on UTF-8.
[0095] Table 3
[0096]
[0097] It should be noted that, in the case where the target network device fails to respond, the message format of the request response message returned by the target network device when the second chain read request is the above-mentioned GET request is the same as the message format of the request response message returned when the second chain read request is the above-mentioned POST request. The response header of the request response message includes a status value, the content type (message format) is application / json, the response body should be in json format, and the response body should contain a message field message of string type. The value of the message field is a readable error message, which is used to reflect the reason for the response failure. For example, the request response message can be as shown in Table 4, where 404 in Table 4 represents the status value, reflecting that the request response message belongs to a response failure message, and "Gateway address not supported." indicates the reason for the failure of the target network device to respond, that is, the target network device does not support the cross-chain communication protocol indicated by the protocol identifier.
[0098] Table 4
[0099]
[0100] Optionally, the terminal device can count the number of times the second off-chain request is sent. If the number of times is greater than the number threshold, and the request response message returned by the target network device is a response failure message, the step of re-determining the target network device for reading the off-chain data of the blockchain network from the remaining network devices according to the arrangement sequence of the remaining network devices is suspended. The number threshold here can be pre-set in the cross-chain communication protocol, such as 4 times, so as to avoid unlimited retries and network congestion problems.
[0101] S104. Forward the transaction data packet to the node device. The node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result.
[0102] In the present application, after the terminal device obtains the transaction data packet, it can forward the transaction data packet to the node device, and the node device can be used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result. The data verification function can be obtained by the terminal device adding the public key of the institution to which the target network device belongs and the transaction data packet to the initial verification function, or the data verification function is read by the node device from the node device in the blockchain network. The data verification function is used to indicate how to verify the validity of the target transaction data in the transaction data packet, such as by verifying the signature information of the institution to which the target network device belongs to verify the validity of the target transaction data, or by verifying the data format or data volume of the target transaction data, etc., to verify the validity of the target transaction data.
[0103] Optionally, the first off-chain read request carries the initial verification function in the cross-chain communication protocol and additional data for verifying the target transaction data, such as the additional data may refer to one or more of the public key of the organization to which the target network device belongs, the standard data format of the target transaction data, the data volume, etc.; the above forwarding of the transaction data packet to the above node device includes: the terminal device may add the transaction data packet and the public key to the initial verification function to obtain a data verification function associated with the cross-chain communication protocol, and the initial verification function includes data verification rules for indicating how to verify the off-chain data. Then, the terminal device may send the data verification function to the node device; the node device is also used to verify the validity of the target transaction data contained in the transaction data packet in the data verification function based on the data verification rules and the additional data in the data transaction function to obtain a verification result. After the terminal device receives the first off-chain read request, the terminal device only needs to add the additional data in the first off-chain read request to the initial verification function without reservation and without modification, that is, the terminal device is opaque to the additional data, that is, the terminal device does not need to perceive the verification details of the target transaction data by the node device; in other words, there is no need to modify the data processing application in the terminal device to adapt to the off-chain data verification process, thereby reducing development costs.
[0104] S105: Receive the target transaction data returned by the node device when the verification result indicates that the target transaction data is valid.
[0105] In this application, when the verification result indicates that the target transaction data is valid, the node device can send the target transaction data to the terminal device; when the verification result indicates that the target transaction data is not valid, the node device can return a read failure message to the terminal device, and the read failure message is used to indicate that the target transaction data is not valid. By returning the target transaction data to the terminal device only when the target transaction data is verified to be valid, it is possible to avoid sending invalid transaction data to the terminal device, avoid wasting resources, and improve the off-chain reading security of transaction data.
[0106] In the present application, the node devices in the blockchain network pre-generate a set of universal cross-chain communication protocols, which are used to indicate how to securely read off-chain data through the blockchain network. For example, the cross-chain communication protocol includes an off-chain read interface for issuing off-chain read requests, and a data verification function for verifying off-chain data, etc. Through the cross-chain communication protocol, secure reading of off-chain data can be achieved to ensure the security of the read transaction data, and to achieve interoperability between on-chain and off-chain.
[0107] Specifically, when the terminal device needs to read the target transaction data, the terminal device can send an original read request about the target transaction data to the node device in the blockchain network. The original read request carries the transaction attribute information of the target transaction data. After receiving the original read request, the node device can determine whether the target transaction data belongs to the off-chain data of the blockchain network. If it is determined that the target transaction data belongs to the off-chain data of the blockchain network, the device attribute information of the target network device used to read the off-chain data of the blockchain network can be queried from the above cross-chain communication protocol. Further, the node device calls the above off-chain read interface according to the first off-chain read request of the device attribute information and the transaction attribute information, and sends the first off-chain read request to the terminal device. The first off-chain read request is used to instruct the target network device to return the target transaction data to the terminal device. After receiving the first off-chain read request, the terminal device reads the transaction data packet including the target transaction data from the target network device and forwards the transaction data packet to the node device. The node device calls the data verification function to verify the validity of the target transaction data. When the target transaction data is valid, the target transaction data is returned to the terminal device, so that the off-chain data can be safely read on the chain, and the validity of the off-chain data (i.e., transaction data) can be ensured. At the same time, by reading off-chain data through a set of universal cross-chain communication protocols, there is no need to store data for verification separately on the chain for each transaction data, nor is there a need for the terminal device to perceive the interaction details of storing transaction data in an external device, and no additional credit assumptions are required, which improves the scope of application of this application and can realize universal reading of off-chain data. In addition, the target transaction data is read by the target network device from an external device associated with the blockchain network, that is, by storing the target transaction data off the chain of the blockchain network, the data storage pressure of the blockchain network can be reduced, and the data storage cost can be reduced.
[0108] For further information, see Figure 6 , is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 6 As shown, this method can be Figure 1 The data processing method based on blockchain may include the following steps S201 to S205:
[0109] S201. Receive an original read request for target transaction data sent by a terminal device; the original read request carries transaction attribute information of the target transaction.
[0110] In this application, the node device can accept the original read request about the target transaction data generated by the terminal device. The original read request carries the transaction data attribute information of the target transaction data. After receiving the original read request, the node device can call the cross-chain communication protocol in the blockchain network to verify whether the target transaction data belongs to the off-chain data of the blockchain network. When the target transaction data belongs to the off-chain data of the blockchain network, execute step S202; when the target transaction data belongs to the on-chain data of the blockchain network, the node device can read the target transaction data from the blockchain in the blockchain network, return the target transaction data to the terminal device, and end this process. Among them, the implementation process of verifying whether the target transaction belongs to the on-chain data in the blockchain network can refer to Figure 3 Step S31 in .
[0111] S202. If the target transaction data belongs to off-chain data of the blockchain network, query the cross-chain communication protocol of the blockchain network to obtain device attribute information of the target network device for reading the off-chain data of the blockchain network.
[0112] In the present application, the second device attribute information of the target network device used to read the off-chain data of the blockchain network is recorded in the cross-chain communication protocol. Therefore, if the target transaction data belongs to the off-chain data of the blockchain network, the device attribute information of the target network device used to read the off-chain data of the blockchain network can be queried from the cross-chain communication protocol in the blockchain network.
[0113] Optionally, when there are multiple network devices for reading off-chain data, the node device may query the cross-chain communication protocol of the blockchain network for device attribute information corresponding to N candidate network devices for reading off-chain data of the above blockchain network; the N candidate network devices include the target network device, and N is an integer greater than 1. The candidate network device refers to a network device for reading off-chain data in the blockchain network, and the N candidate network devices may be distributed in different regions, and the N candidate network devices may belong to the same organization, or to different organizations.
[0114] S203. Generate a first off-chain read request based on the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device. The terminal device is used to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request. The transaction data packet is read by the target network device from an external device associated with the node device in the blockchain network.
[0115] In the present application, the node device can generate a first off-chain read request based on the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device. After receiving the first off-chain read request, the terminal device can read a transaction data packet including the target transaction data from the target network device according to the off-chain read request. The transaction data packet can also include the signature information of the organization to which the target network device belongs. The transaction data packet can be read by the network device from an external device associated with the blockchain network.
[0116] Optionally, when there are multiple network devices for reading off-chain data, the node device can generate a first off-chain read request based on the transaction attribute information and the device attribute information corresponding to the N candidate network devices. By sending the device attribute information corresponding to the N candidate network devices to the terminal device, it is beneficial for the terminal device to autonomously select a suitable network device to read the target transaction data, thereby improving the success rate of reading the target transaction data.
[0117] Optionally, the above-mentioned generation of the first off-chain read request based on the transaction attribute information and the device attribute information corresponding to the N candidate network devices includes: the node device can obtain the credibility corresponding to the N candidate network devices from the device attribute information of the N candidate network devices, and sort the device attribute information corresponding to the N candidate network devices in descending order of the credibility corresponding to the N candidate network devices. Add the device attribute information corresponding to the sorted N candidate network devices to the device list; generate the first off-chain read request based on the device list and the transaction attribute information. By sorting the device attribute information corresponding to the N candidate network devices, it is beneficial for the terminal device to give priority to network devices with high credibility to read the target transaction data, improve the success rate of reading the target transaction data, and improve the reading efficiency of the target transaction data.
[0118] Optionally, generating a first off-chain read request according to the device list and the transaction attribute information includes: obtaining a read method associated with the cross-chain communication protocol from the blockchain of the blockchain network according to the protocol identifier of the cross-chain communication protocol in the transaction attribute information; generating callback data instructing the target network device to read the target transaction data from the external device according to the read method and the transaction attribute information, that is, encoding the identifier corresponding to the read method and the transaction attribute information to obtain the callback data. Generate a first off-chain read request according to the device list, protocol identifier and callback data. This is conducive to improving the success rate of reading the target transaction data.
[0119] It should be noted that the first off-chain read request may refer to an error response message returned by the node device to the terminal device for the original read request. The contents of the error response message are shown in Table 5 below. The errorOffchainLookup in Table 5 represents an error response message, which can also be referred to as an error query method. The error response message includes the following contents: 1. The sender field: represents the protocol identifier of the cross-chain communication protocol that triggers the sending of the error response message; 2. URLs: can also be referred to as a device list, which includes a request generation template for N candidate network devices for reading off-chain data of the blockchain network, also referred to as a URL template. The URL template may include two replacement parameters, {sender} and {data}. After the terminal device receives the error response message, {sender} in the URL template is replaced with the value of the sender parameter (protocol identifier), encoded in hexadecimal format with a lowercase 0x prefix; {data} is replaced with the value of the callData parameter (i.e., call data), using a hexadecimal format with a 0x prefix. The replaced URL template is referred to as the second off-chain read request. In particular, the URL template may also contain only {sender}, excluding {data}. 3. callData (callback data): used to reflect the reading method of reading the target transaction data and the parameters required to read the target transaction data. This value can be opaque to the terminal device (i.e., the terminal device does not need to understand the meaning of the value). The node device and the target network device can standardize it as needed, as long as both parties can encode and decode the value in the correct way. 4. callbackFunction: specifies the callback method, which can also be called the initial verification function. 5. extraData: is the additional data required by the initial verification function, which is retained by the terminal device and provided to the initial verification function without modification. This value is opaque to the client. The initial verification function is used to decode and verify the data returned by the target network device (i.e., the target transaction data in the transaction data packet). The initial verification function has parameters (bytes response, bytes extraData), response response field, and extraData is an additional data field. When the terminal device receives a successful response message, the transaction data packet in the successful response message can be used as the field value of the response field, and the additional data in the first chain read request can be used as the field value of the extraData.
[0120] Table 5
[0121]
[0122] S204. Receive the transaction data packet sent by the terminal device, and verify the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result.
[0123] In the present application, after the terminal device obtains the transaction data packet, it can forward the transaction data packet to the node device, and the node device can be used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result. The data verification function can be obtained by the terminal device adding the public key of the institution to which the target network device belongs and the transaction data packet to the initial verification function, or the data verification function is read by the node device from the node device in the blockchain network. The data verification function is used to indicate how to verify the validity of the target transaction data in the transaction data packet, such as by verifying the signature information of the institution to which the target network device belongs to verify the validity of the target transaction data, or by verifying the data format or data volume of the target transaction data to verify the validity of the target transaction data. The verification result is used to indicate that the target transaction data is valid or not valid. The validity of the target transaction data means that the target transaction data has not been tampered with and the target transaction data is returned by a legitimate target network device. At least one of the following: the target transaction data is not valid means that the target transaction data has been tampered with and the target transaction data is not returned by a legitimate target network device. The target transaction data is verified through the data verification function associated with the cross-chain communication protocol, which helps to ensure the security of reading off-chain data.
[0124] Optionally, the first off-chain read request carries the initial verification function in the cross-chain communication protocol and additional data for verifying the target transaction data; step S204 includes: the node device can receive the data verification function sent by the terminal device, and the data verification function is obtained by the terminal device adding the transaction data packet and the additional data to the initial verification function, and the target transaction data in the data verification function can be verified according to the additional data and data verification rules in the data verification function to obtain a verification result.
[0125] Optionally, the transaction data packet also includes the signature information of the organization to which the target network device belongs; the data transaction function includes a data verification rule, and a public key of the organization to which the target network device belongs, that is, the additional data includes the public key of the organization to which the target network device belongs, and the data verification rule is used to indicate the verification of the above-mentioned signature information; the above-mentioned data verification function associated with the above-mentioned cross-chain communication protocol verifies the validity of the above-mentioned target transaction data in the above-mentioned transaction data packet, and obtains the verification result, including: the node device can perform a hash operation on the target transaction data in the transaction data packet to obtain the hash value of the target transaction data. Then, according to the public key of the organization to which the target network device belongs, the signature information is verified to obtain the verification data, that is, according to the public key of the organization to which the target network device belongs, the signature information is decrypted to obtain the verification data. If the similarity between the hash value of the target transaction data and the verification data is less than or equal to the similarity threshold, it is determined that the hash value of the target transaction data does not match the above-mentioned verification data, that is, the target transaction data is not returned by the target network device, or the target transaction data is tampered with, then a verification result indicating that the above-mentioned target transaction data is not valid is generated. If the similarity between the hash value of the target transaction data and the signature verification data is greater than the similarity threshold, it is determined that the hash value of the target transaction data matches the above-mentioned signature verification data, that is, the target transaction data is returned by the target network device and the target transaction data has not been tampered with, then a verification result indicating that the above-mentioned target transaction data is valid is generated.
[0126] Optionally, the data transaction function includes data validation rules and a standard data format of the target transaction data, that is, the additional data includes a standard data format of the target transaction data, and the data validation rules are used to indicate verification of the data format of the target transaction data; the above-mentioned data verification function associated with the above-mentioned cross-chain communication protocol verifies the validity of the above-mentioned target transaction data in the above-mentioned transaction data packet, and obtains a verification result, including: if the data format of the target transaction data in the transaction data packet is not in the standard data format, indicating that the returned target transaction data has been tampered with or the target transaction data has been read incorrectly, then a verification result indicating that the target transaction data is not valid is generated; if the data format of the target transaction data in the transaction data packet is in the standard data format, indicating that the returned target transaction data has not been tampered with, and the target transaction data has been read correctly, then a verification result indicating that the target transaction data is valid is generated.
[0127] Optionally, the data transaction function includes a data validation rule and a standard data volume of the target transaction data, that is, the standard data volume of the target transaction data is included in the additional data, and the data validation rule is used to indicate the verification of the data volume of the target transaction data; the above-mentioned data validation function associated with the above-mentioned cross-chain communication protocol verifies the validity of the above-mentioned target transaction data in the above-mentioned transaction data packet, and obtains a verification result, including: if the difference between the data volume of the target transaction data in the transaction data packet and the standard data volume is greater than the difference threshold, indicating that the returned target transaction data has been tampered with (or part of the data is missing) or the target transaction data is read incorrectly, then a verification result indicating that the target transaction data is not valid is generated; if the difference between the data volume of the target transaction data in the transaction data packet and the standard data volume is less than or equal to the difference threshold, indicating that the returned target transaction data has not been tampered with, and the target transaction data is read correctly, then a verification result indicating that the target transaction data is valid is generated.
[0128] S205. If the verification result indicates that the target transaction data is valid, the target transaction data in the transaction data packet is returned to the terminal device.
[0129] In the present application, if the above verification result indicates that the above target transaction data is valid, the node device can return the above target transaction data in the above transaction data packet to the above terminal device, so as to avoid sending invalid transaction data to the terminal device, avoid wasting resources, and improve the off-chain reading security of the transaction data.
[0130] It should be noted that the above-mentioned blockchain networks and associated blockchain networks may refer to blockchain networks that meet the access conditions of the cross-chain communication protocol. The access conditions may include that the blockchain network has the legitimacy (such as the node devices in the blockchain network belong to legal individuals or legal institutions), the stability of the blockchain network (such as network stability, storage stability) is greater than the stability threshold, the security level of the blockchain network is greater than the security level threshold, etc.
[0131] For example, as shown in Table 6, the terminal device needs to query the balance of the addr address as an example, that is, the target transaction data that needs to be read is the balance of the addr address. The cross-chain communication protocol in this application is a smart contract for querying the balance of the account address. The smart contract can be expressed as: function balanceOf(address addr)public viewreturns(uint balance). The smart contract is used to instruct the node device to return the balance of the addr address when verifying the validity of the queried balance based on the data verification function. The data verification function can be expressed as: functionbalanceOfWithProof(bytes calldata response,bytes calldata extraData)publicview returns(uint balance), which can also be called a balance verification function.
[0132] Table 6
[0133]
[0134] For details, please visit Figure 7As shown, the process of querying the user's balance through the above-mentioned smart contract includes the following steps S70 to S74: S70, the terminal device sends an original read request to the node device; when the user (Xiao Li) corresponding to the terminal device needs to query the balance, that is, the balance can be called the target transaction data, the terminal device can display a balance query page 70a on the data processing application (such as a payment application), and the balance query page 70a includes the user information (such as name, nickname, account address) of the user corresponding to the terminal device and the query control 71b. The terminal device responds to the trigger operation for the query control 71b, generates a query request about the user's balance, and uses the query request as an original read request, and sends the original read request to the node device. The original query request carries the account address of the user corresponding to the terminal device, which can be called the addr address. S71, the node device sends a first chain read request to the terminal device; after receiving the original read request, the node device can call function balanceOf(address addr) public view returns(uint balance) to verify whether the balance is stored under the blockchain. If it is determined that the balance is stored under the blockchain, that is, the balance belongs to the off-chain data of the blockchain network, the node device can return a first off-chain read request to the terminal device. The first off-chain read request is shown in Table 6. The first off-chain read request carries a protocol identifier (field value of the sender field), a URL template, callback data (callDate), an initial verification function, and additional data. The initial verification function is the field value of the callback function field callbackFunction. The initial verification function is a function for verifying the validity of the balance, which can also be called balanceOfWithProof. The additional data includes the addr address of the user corresponding to the terminal device. S72. The terminal device adds the protocol identifier and callback data to the URL template to obtain a second off-chain read request, and sends the second off-chain read request to the target network device. After the terminal device receives the first off-chain read request, it can select a candidate network device in urls as the target network device, replace the sender field in the URL template corresponding to the target network device with the protocol identifier, and replace the data field in the URL template corresponding to the target network device with callData to obtain a second off-chain read request, and send the second off-chain read request to the target network device.
[0135] Further, S73, the target network device returns a transaction data packet (balance with signature information) to the terminal device. After the target network device receives the second off-chain read request, the balance with signature information of the addr address (also referred to as a transaction data packet) is returned to the terminal device. S74, the terminal device can add the transaction data packet and additional data to the initial verification function, obtain the data verification function, and send the data verification function to the node device. The terminal device can add the signed balance and the extraData to the initial verification function to obtain the balance verification function (i.e., the data verification function), send the balance verification function to the node device, and the node device executes the balance verification function to decode and verify the signed balance and extraData. When the verification passes, the balance is returned to the terminal device. The terminal device can display the balance returned by the node device in the query result interface 72a, such as the balance is 123.
[0136] It should be noted that the balance with signature information here may refer to the signature of the organization to which the target network device belongs. The node device may query the public key of the organization to which the target network device belongs from the blockchain according to the addr address, and verify the signature according to the public key. If the signature verification passes, it is determined that the balance verification passes. Alternatively, the signature information may refer to the signature of the user corresponding to the terminal device, and the addr address may refer to the public key of the user. The signature is verified according to the public key of the user. If the signature verification passes, it is determined that the balance verification passes. For the specific verification process, please refer to the above step S204.
[0137] In the present application, the node devices in the blockchain network pre-generate a set of universal cross-chain communication protocols, which are used to indicate how to securely read off-chain data through the blockchain network. For example, the cross-chain communication protocol includes an off-chain read interface for issuing off-chain read requests, and a data verification function for verifying off-chain data, etc. Through the cross-chain communication protocol, secure reading of off-chain data can be achieved to ensure the security of the read transaction data, and to achieve interoperability between on-chain and off-chain.
[0138] Specifically, when the terminal device needs to read the target transaction data, the terminal device can send an original read request about the target transaction data to the node device in the blockchain network. The original read request carries the transaction attribute information of the target transaction data. After receiving the original read request, the node device can determine whether the target transaction data belongs to the off-chain data of the blockchain network. If it is determined that the target transaction data belongs to the off-chain data of the blockchain network, the device attribute information of the target network device used to read the off-chain data of the blockchain network can be queried from the above cross-chain communication protocol. Further, the node device calls the above off-chain read interface according to the first off-chain read request of the device attribute information and the transaction attribute information, and sends the first off-chain read request to the terminal device. The first off-chain read request is used to instruct the target network device to return the target transaction data to the terminal device. After receiving the first off-chain read request, the terminal device reads the transaction data packet including the target transaction data from the target network device and forwards the transaction data packet to the node device. The node device calls the data verification function to verify the validity of the target transaction data. When the target transaction data is valid, the target transaction data is returned to the terminal device, so that the off-chain data can be safely read on the chain, and the validity of the off-chain data (i.e., transaction data) can be ensured. At the same time, by reading off-chain data through a set of universal cross-chain communication protocols, there is no need to store data for verification separately on the chain for each transaction data, nor is there a need for the terminal device to perceive the interaction details of storing transaction data in an external device, and no additional credit assumptions are required, which improves the scope of application of this application and can realize universal reading of off-chain data. In addition, the target transaction data is read by the target network device from an external device associated with the blockchain network, that is, by storing the target transaction data off the chain of the blockchain network, the data storage pressure of the blockchain network can be reduced, and the data storage cost can be reduced.
[0139] See also Figure 8 , is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The above-mentioned blockchain-based data processing device can be a computer program (including program code) running in a terminal device, for example, the blockchain-based data processing device is an application software; the device can be used to execute the corresponding steps of the method provided in an embodiment of the present application. Figure 8 As shown, the blockchain-based data processing device may include:
[0140] The sending module 810 is used to send an original read request about the target transaction data to the node device in the blockchain network; the original read request carries the transaction attribute information of the target transaction;
[0141] The first receiving module 811 is used to receive a first off-chain read request sent by the node device calling the off-chain read interface in the cross-chain communication protocol; the first off-chain read request is generated according to the transaction attribute information and the device attribute information of the target network device, the device attribute information is obtained by the node device from the cross-chain communication protocol when determining that the target transaction data belongs to the off-chain data of the blockchain network, and the target network device is a device for reading the off-chain data of the blockchain network;
[0142] The reading module 812 is used to read the transaction data packet including the target transaction data from the target network device according to the first off-chain reading request; the transaction data packet is read by the target network device from an external device associated with the blockchain network;
[0143] The forwarding module 813 is used to forward the transaction data packet to the node device, and the node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0144] The second receiving module 814 is configured to receive the target transaction data returned by the node device when the verification result indicates that the target transaction data is valid.
[0145] Optionally, the reading module 812 may include a generating unit 81a, a first sending unit 82a and a receiving unit 83a;
[0146] A generating unit 81a, configured to generate a second off-link read request adapted to the target network device according to the first off-link read request;
[0147] The first sending unit 82a is used to send the second off-link read request to the target network device; the target network device is used to generate a request response message according to the second off-link read request;
[0148] The receiving unit 83a is configured to receive the request response message returned by the target network device, and if the request response message is a successful response message, obtain a transaction data packet including the target transaction data from the request response message.
[0149] Optionally, the first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a read method associated with the cross-chain communication protocol; and the callback data is used to instruct the target network device to call the read method to read the target transaction data from the external device.
[0150] Optionally, the generating unit 81a generates a second off-link read request adapted to the target network device according to the first off-link read request, including:
[0151] If the request generation template includes a data field and a sender field, the sender field is replaced by the protocol identifier, and the data field is replaced by the callback data to obtain an acquisition request for the target transaction data;
[0152] The above-mentioned acquisition request is determined as a second off-chain read request adapted to the above-mentioned target network device.
[0153] Optionally, the first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a read method associated with the cross-chain communication protocol; and the callback data is used to instruct the target network device to call the read method to read the target transaction data from the external device.
[0154] The generating unit 81a generates a second off-link read request adapted to the target network device according to the first off-link read request, including:
[0155] If the request generation template includes a sender field, the sender field is replaced by the protocol identifier to obtain a request header;
[0156] Adding a data field and the sender field to the request generation template, using the callback data as the field value of the data field, using the protocol identifier as the field value of the added sender field, and adding them to the request generation template to obtain a request body;
[0157] A processing request for the target transaction data is generated according to the request header and the request body, and the processing request is determined as a second off-chain read request adapted to the target network device.
[0158] Optionally, the first off-chain read request includes request generation templates corresponding to N candidate network devices, respectively, and the N candidate network devices respectively correspond to the request generation templates, and are arranged in the device list of the first off-chain read request in descending order of the credibility of the corresponding candidate network devices, where N is an integer greater than 1;
[0159] The generation unit 81a arranges the sequence number of the request generation template device attribute information corresponding to the first off-chain read request, and places the candidate network device i at the front; and determines the candidate network device i as the target network device for reading the off-chain data of the blockchain network.
[0160] Optionally, the sending module 810 is also used to suspend sending the second off-chain read request to the remaining network devices if the above-mentioned request response message belongs to a response failure message and the status value carried by the above-mentioned request response message is within the first threshold range; the above-mentioned remaining network devices are network devices other than the above-mentioned candidate network device i among the above-mentioned N candidate network devices; if the above-mentioned request response message belongs to a response failure message and the status value carried by the above-mentioned request response message is within the second threshold range, then according to the arrangement sequence number of the above-mentioned remaining network devices, the target network device for reading the off-chain data of the above-mentioned blockchain network is re-determined from the above-mentioned remaining network devices, and the second off-chain read request is re-sent to the above-mentioned target network device.
[0161] Optionally, the sending module 810 is further used to count the number of times the second off-chain request is sent;
[0162] If the above-mentioned sending times is greater than the times threshold, and the request response message returned by the above-mentioned target network device is a response failure message, then the step of re-determining the target network device for reading the off-chain data of the above-mentioned blockchain network from the above-mentioned remaining network devices according to the arrangement sequence of the above-mentioned remaining network devices is suspended.
[0163] Optionally, the first off-chain read request includes the initial verification function in the cross-chain communication protocol and additional data for verifying the target transaction data; the sending module 810 may include an adding unit 84b and a second sending unit 85b;
[0164] An adding unit 84b is used to add the transaction data packet and the additional data to the initial verification function to obtain a data verification function associated with the cross-chain communication protocol;
[0165] The second sending unit 85b is used to send the above-mentioned data verification function to the above-mentioned node device; the above-mentioned node device is also used to verify the validity of the above-mentioned target transaction data contained in the above-mentioned transaction data packet in the above-mentioned data verification function based on the data verification rules in the above-mentioned data transaction function and the above-mentioned additional data to obtain a verification result.
[0166] In the present application, the node devices in the blockchain network pre-generate a set of universal cross-chain communication protocols, which are used to indicate how to securely read off-chain data through the blockchain network. For example, the cross-chain communication protocol includes an off-chain read interface for issuing off-chain read requests, and a data verification function for verifying off-chain data, etc. Through the cross-chain communication protocol, secure reading of off-chain data can be achieved to ensure the security of the read transaction data, and to achieve interoperability between on-chain and off-chain.
[0167] See also Fig. 9 , is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The above-mentioned 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 of the method provided in an embodiment of the present application. Fig. 9 As shown, the blockchain-based data processing device may include:
[0168] The first receiving module 910 is used to receive an original read request for target transaction data sent by a terminal device; the original read request carries transaction attribute information of the target transaction;
[0169] A query module 911 is used for querying, from the cross-chain communication protocol of the blockchain network, device attribute information of the target network device for reading the off-chain data of the blockchain network if the target transaction data belongs to the off-chain data of the blockchain network;
[0170] A generating module 912 is used to generate a first off-chain read request according to the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device, and the terminal device is used to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, and the transaction data packet is read by the target network device from an external device associated with the node device in the blockchain network;
[0171] The second receiving module 913 is used to receive the transaction data packet sent by the terminal device, and verify the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0172] The sending module 914 is configured to return the target transaction data in the transaction data packet to the terminal device if the verification result indicates that the target transaction data is valid.
[0173] Optionally, the transaction data packet further includes signature information of the organization to which the target network device belongs; the data transaction function includes a data verification rule and a public key of the organization to which the target network device belongs, and the data verification rule is used to instruct verification of the signature information;
[0174] The second receiving module 913 may include an operation unit 91a, a processing unit 92a and a first generating unit 93a;
[0175] The computing unit 91a is used to perform a hash operation on the target transaction data in the transaction data packet to obtain a hash value of the target transaction data;
[0176] The processing unit 92a is used to perform signature verification processing on the signature information according to the public key of the organization to which the target network device belongs, and obtain signature verification data;
[0177] The first generating unit 93a is configured to generate a verification result indicating that the target transaction data is valid if the hash value of the target transaction data matches the signature verification data.
[0178] Optionally, the query module 911 queries the cross-chain communication protocol of the blockchain network to read the device attribute information of the target network device of the off-chain data of the blockchain network, including:
[0179] Querying, from the cross-chain communication protocol of the blockchain network, device attribute information corresponding to N candidate network devices for reading off-chain data of the blockchain network; the N candidate network devices include the target network device, and N is an integer greater than 1;
[0180] The generation module 912 generates a first off-chain read request carrying the transaction attribute information and the device attribute information, including:
[0181] A first off-chain read request is generated according to the transaction attribute information and the device attribute information corresponding to the N candidate network devices.
[0182] The generation module 912 may include an acquisition unit 94b, a sorting unit 95b, and a second generation unit 96b;
[0183] An acquiring unit 94b is used to acquire the credibility corresponding to each of the N candidate network devices from the device attribute information of the N candidate network devices;
[0184] A sorting unit 95b is used to sort the request generation templates corresponding to the N candidate network devices in descending order of the credibility corresponding to the N candidate network devices;
[0185] The second generating unit 96b is used to generate device attribute information requests corresponding to the sorted N candidate network devices respectively, and add them to the device list; and generate a first off-chain read request according to the device list and the transaction attribute information.
[0186] Optionally, the second generating unit 96b generates a first off-chain read request according to the device list and the transaction attribute information, including:
[0187] According to the protocol identifier of the cross-chain communication protocol in the transaction attribute information, obtaining a method identifier of a reading method associated with the cross-chain communication protocol from the blockchain of the blockchain network;
[0188] generating callback data instructing the target network device to read the target transaction data from the external device according to the method identifier and the transaction attribute information;
[0189] Generate a first off-chain read request according to the device list, the protocol identifier and the callback data.
[0190] In the present application, the node devices in the blockchain network pre-generate a set of universal cross-chain communication protocols, which are used to indicate how to securely read off-chain data through the blockchain network. For example, the cross-chain communication protocol includes an off-chain read interface for issuing off-chain read requests, and a data verification function for verifying off-chain data, etc. Through the cross-chain communication protocol, secure reading of off-chain data can be achieved to ensure the security of the read transaction data, and to achieve interoperability between on-chain and off-chain.
[0191] See also Fig.10 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.10As shown, the above-mentioned computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also 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, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also 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 it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device away from the aforementioned processor 1001. As Fig.10 As 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 device control application program.
[0192] exist Fig.10 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0193] Sending an original read request for target transaction data to a node device in the blockchain network; the original read request carries transaction attribute information of the target transaction;
[0194] Receive a first off-chain read request sent by the node device calling the off-chain read interface in the cross-chain communication protocol; the first off-chain read request is generated according to the transaction attribute information and the device attribute information of the target network device, the device attribute information is obtained by the node device from the cross-chain communication protocol when determining that the target transaction data belongs to the off-chain data of the blockchain network, and the target network device is a device for reading the off-chain data of the blockchain network;
[0195] According to the first off-chain read request, a transaction data packet including the target transaction data is read from the target network device; the transaction data packet is read by the target network device from an external device associated with the blockchain network;
[0196] Forwarding the transaction data packet to the node device, the node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0197] The target transaction data is received when the verification result indicates that the target transaction data is valid.
[0198] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, including:
[0199] Generate a second off-link read request adapted to the target network device according to the first off-link read request;
[0200] Sending the second off-chain read request to the target network device; the target network device is used to generate a request response message according to the second off-chain read request;
[0201] The request response message returned by the target network device is received, and if the request response message is a successful response message, a transaction data packet including the target transaction data is obtained from the request response message.
[0202] Optionally, the first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a read method associated with the cross-chain communication protocol; and the callback data is used to instruct the target network device to call the read method to read the target transaction data from the external device.
[0203] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to generate a second off-link read request adapted to the target network device according to the first off-link read request, including:
[0204] If the request generation template includes a data field and a sender field, the sender field is replaced by the protocol identifier, and the data field is replaced by the callback data to obtain an acquisition request for the target transaction data;
[0205] The acquisition request is determined as a second off-link read request adapted to the target network device.
[0206] Optionally, the first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a read method associated with the cross-chain communication protocol; and the callback data is used to instruct the target network device to call the read method to read the target transaction data from the external device.
[0207] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to generate a second off-link read request adapted to the target network device according to the first off-link read request, including:
[0208] If the request generation template includes a sender field, the sender field is replaced by the protocol identifier to obtain a request header;
[0209] Adding a data field and the sender field to the request generation template, using the callback data as the field value of the data field, using the protocol identifier as the field value of the added sender field, and adding them to the request generation template to obtain a request body;
[0210] A processing request for the target transaction data is generated according to the request header and the request body, and the processing request is determined as a second off-chain read request adapted to the target network device.
[0211] Optionally, the first off-chain read request includes request generation templates corresponding to N candidate network devices, and the N candidate network devices correspond to request generation templates, which are arranged in the first off-chain read request in order of the credibility of the corresponding candidate network devices from high to low, where N is an integer greater than 1.
[0212] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to implement:
[0213] The candidate network device i at the front is the arrangement number of the request generation template device attribute information corresponding to the first off-chain read request;
[0214] The candidate network device i is determined as a target network device for reading off-chain data of the blockchain network.
[0215] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to implement:
[0216] If the request response message is a response failure message, and the status value carried by the request response message is within the first threshold range, suspending sending the second off-chain read request to the remaining network devices; the remaining network devices are network devices other than the candidate network device i among the N candidate network devices;
[0217] If the request response message is a response failure message and the status value carried by the request response message is within the second threshold range, then according to the arrangement sequence of the remaining network devices, the target network device for reading the off-chain data of the blockchain network is re-determined from the remaining network devices, and a second off-chain read request is re-sent to the target network device.
[0218] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to implement:
[0219] Counting the number of times the second off-chain request is sent;
[0220] If the number of transmissions is greater than the number threshold, and the request response message returned by the target network device is a response failure message, then the step of re-determining the target network device for reading the off-chain data of the blockchain network from the remaining network devices according to the arrangement sequence of the remaining network devices is suspended.
[0221] Optionally, the first off-chain read request includes an initial verification function in the cross-chain communication protocol and additional data for verifying the target transaction data; Optionally, the processor 1001 calls a device control application stored in the memory 1005 to forward the transaction data packet to the node device, including:
[0222] Add the transaction data packet and the additional data to the initial verification function to obtain a data verification function associated with the cross-chain communication protocol;
[0223] The data verification function is sent to the node device; the node device is also used to execute the data verification function, verify the validity of the target transaction data contained in the transaction data packet in the data verification function, and obtain a verification result.
[0224] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to implement:
[0225] Receiving an original read request for target transaction data sent by a terminal device; the original read request carries transaction attribute information of the target transaction;
[0226] If the target transaction data belongs to off-chain data of the blockchain network, query the device attribute information of the target network device for reading the off-chain data of the blockchain network from the cross-chain communication protocol of the blockchain network;
[0227] Generate a first off-chain read request according to the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device, wherein the terminal device is used to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, wherein the transaction data packet is read by the target network device from an external device associated with a node device in the blockchain network;
[0228] Receiving the transaction data packet sent by the terminal device, and verifying the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result;
[0229] If the verification result indicates that the target transaction data is valid, the target transaction data in the transaction data packet is returned to the terminal device.
[0230] Optionally, the transaction data packet further includes signature information of the organization to which the target network device belongs; the data transaction function includes a data verification rule and a public key of the organization to which the target network device belongs, and the data verification rule is used to instruct verification of the signature information;
[0231] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to verify the validity of the target transaction data in the transaction data packet according to a data verification function associated with the cross-chain communication protocol, and obtains a verification result, including:
[0232] Performing a hash operation on the target transaction data in the transaction data packet to obtain a hash value of the target transaction data;
[0233] Performing signature verification on the signature information according to the public key of the organization to which the target network device belongs to obtain signature verification data;
[0234] If the hash value of the target transaction data matches the signature verification data, a verification result indicating that the target transaction data is valid is generated.
[0235] Optionally, the processor 1001 calls the device control application stored in the memory 1005 to query the device attribute information of the target network device for reading the off-chain data of the blockchain network from the cross-chain communication protocol of the blockchain network, including:
[0236] Querying, from the cross-chain communication protocol of the blockchain network, device attribute information corresponding to N candidate network devices respectively for reading off-chain data of the blockchain network; the N candidate network devices include the target network device, and N is an integer greater than 1;
[0237] The generating a first off-chain read request according to the transaction attribute information and the device attribute information includes:
[0238] A first off-chain read request is generated according to the transaction attribute information and the device attribute information corresponding to the N candidate network devices.
[0239] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to generate a first off-chain read request according to the transaction attribute information and the device attribute information corresponding to the N candidate network devices, including:
[0240] Obtaining, from the device attribute information of the N candidate network devices, the credibility corresponding to each of the N candidate network devices;
[0241] Sorting the request generation templates corresponding to the N candidate network devices respectively in descending order of the credibility respectively corresponding to the N candidate network devices;
[0242] Generate device attribute information requests corresponding to the sorted N candidate network devices respectively, and add them to the device list;
[0243] Generate a first off-chain read request based on the device list and the transaction attribute information.
[0244] Optionally, the processor 1001 calls a device control application stored in the memory 1005 to generate a first off-chain read request according to the device list and the transaction attribute information, including:
[0245] According to the protocol identifier of the cross-chain communication protocol in the transaction attribute information, obtaining a method identifier of a reading method associated with the cross-chain communication protocol from the blockchain of the blockchain network;
[0246] generating callback data instructing the target network device to read the target transaction data from the external device according to the method identifier and the transaction attribute information;
[0247] Generate a first off-chain read request according to the device list, the protocol identifier and the callback data.
[0248] In the present application, the node devices in the blockchain network pre-generate a set of universal cross-chain communication protocols, which are used to indicate how to securely read off-chain data through the blockchain network. For example, the cross-chain communication protocol includes an off-chain read interface for issuing off-chain read requests, and a data verification function for verifying off-chain data, etc. Through the cross-chain communication protocol, secure reading of off-chain data can be achieved to ensure the security of the read transaction data, and to achieve interoperability between on-chain and off-chain.
[0249] It should be noted that the data collection and processing in the application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in the examples, and the informed consent or separate consent of the subject of personal information should be obtained, and the subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the subject of personal information. For example, before obtaining or using the transaction attribute information of the target transaction data and the device attribute information of the equipment (such as terminal equipment, node equipment, network equipment), the separate authorization of the user to whom the target transaction data belongs and the user to whom the equipment belongs is required.
[0250] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the description of the data processing method based on blockchain in the above corresponding embodiment, and can also execute the description of the data processing device based on blockchain in the above corresponding embodiment, which will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated.
[0251] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the above-mentioned computer-readable storage medium stores a computer program executed by the aforementioned blockchain-based data processing device, and the above-mentioned computer program includes program instructions. When the above-mentioned processor executes the above-mentioned program instructions, it can execute the description of the above-mentioned blockchain-based data processing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0252] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. At least two computer devices distributed at at least two locations and interconnected through a communication network may constitute a blockchain network.
[0253] The computer-readable storage medium may be a data processing device based on blockchain provided by any of the aforementioned embodiments or a central storage unit of the computer device, such as a hard disk or a central storage of a 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 memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both a central storage unit of the computer device and an external storage 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.
[0254] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. 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 may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.
[0255] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the description of the above-mentioned blockchain-based data processing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in this application, please refer to the description of the method embodiment of this application.
[0256] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0257] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate instructions for implementing the process in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable network connected device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0258] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method based on blockchain, characterized in that: include: Sending an original read request for target transaction data to a node device in the blockchain network; The original read request carries the transaction attribute information of the target transaction; Receive a first off-chain read request sent by the node device calling the off-chain read interface in the cross-chain communication protocol; the first off-chain read request is generated according to the transaction attribute information and the device attribute information of the target network device, the device attribute information is obtained by the node device from the cross-chain communication protocol when determining that the target transaction data belongs to the off-chain data of the blockchain network, and the target network device is a device for reading the off-chain data of the blockchain network; According to the first off-chain read request, a transaction data packet including the target transaction data is read from the target network device; the transaction data packet is read by the target network device from an external device associated with the blockchain network; Forwarding the transaction data packet to the node device, the node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result; The target transaction data is received when the verification result indicates that the target transaction data is valid.
2. The method according to claim 1, characterized in that The step of reading a transaction data packet including the target transaction data from the target network device according to the first off-chain read request comprises: Generate a second off-link read request adapted to the target network device according to the first off-link read request; Sending the second off-chain read request to the target network device; the target network device is used to generate a request response message according to the second off-chain read request; The request response message returned by the target network device is received, and if the request response message is a successful response message, a transaction data packet including the target transaction data is obtained from the request response message.
3. The method according to claim 2, characterized in that The first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a reading method associated with the cross-chain communication protocol; The callback data is used to instruct the target network device to call the reading method to read the target transaction data from the external device; The step of generating, according to the first off-link read request, a second off-link read request adapted to the target network device comprises: If the request generation template includes a data field and a sender field, the sender field is replaced by the protocol identifier, and the data field is replaced by the callback data to obtain an acquisition request for the target transaction data; The acquisition request is determined as a second off-link read request adapted to the target network device.
4. The method according to claim 2, characterized in that The first off-chain read request includes a protocol identifier of the cross-chain communication protocol, a request generation template in the cross-chain communication protocol, and callback data, wherein the request generation template is adapted to the target network device; the protocol identifier is used to instruct the target network device to obtain a reading method associated with the cross-chain communication protocol; The callback data is used to instruct the target network device to call the reading method to read the target transaction data from the external device; The step of generating, according to the first off-link read request, a second off-link read request adapted to the target network device comprises: If the request generation template includes a sender field, the sender field is replaced by the protocol identifier to obtain a request header; Adding a data field and the sender field to the request generation template, using the callback data as the field value of the data field, using the protocol identifier as the field value of the added sender field, and adding them to the request generation template to obtain a request body; A processing request for the target transaction data is generated according to the request header and the request body, and the processing request is determined as a second off-chain read request adapted to the target network device.
5. The method according to claim 2, characterized in that The first off-chain read request includes request generation templates corresponding to N candidate network devices, respectively, and the N candidate network devices respectively correspond to the request generation templates, and are arranged in the first off-chain read request in descending order of the credibility of the corresponding candidate network devices, where N is an integer greater than 1; the method further includes: The candidate network device i at the front is the arrangement number of the request generation template device attribute information corresponding to the first off-chain read request; The candidate network device i is determined as a target network device for reading off-chain data of the blockchain network.
6. The method according to claim 5, characterized in that The method further comprises: If the request response message is a response failure message, and the status value carried by the request response message is within the first threshold range, suspending sending the second off-chain read request to the remaining network devices; the remaining network devices are network devices other than the candidate network device i among the N candidate network devices; If the request response message is a response failure message and the status value carried by the request response message is within the second threshold range, then according to the arrangement sequence of the remaining network devices, the target network device for reading the off-chain data of the blockchain network is re-determined from the remaining network devices, and a second off-chain read request is re-sent to the target network device.
7. The method according to claim 6, characterized in that The method further comprises: Counting the number of times the second off-chain request is sent; If the number of transmissions is greater than the number threshold, and the request response message returned by the target network device is a response failure message, then the step of re-determining the target network device for reading the off-chain data of the blockchain network from the remaining network devices according to the arrangement sequence of the remaining network devices is suspended.
8. The method according to claim 1, characterized in that The first off-chain read request includes an initial verification function in the cross-chain communication protocol and additional data for verifying the target transaction data; forwarding the transaction data packet to the node device includes: Add the transaction data packet and the additional data to the initial verification function to obtain a data verification function associated with the cross-chain communication protocol; The data verification function is sent to the node device; the node device is also used to execute the data verification function, verify the validity of the target transaction data contained in the transaction data packet in the data verification function, and obtain a verification result.
9. A data processing method based on blockchain, characterized in that: include: Receiving an original read request for target transaction data sent by a terminal device; The original read request carries the transaction attribute information of the target transaction; If the target transaction data belongs to off-chain data of the blockchain network, query the device attribute information of the target network device for reading the off-chain data of the blockchain network from the cross-chain communication protocol of the blockchain network; Generate a first off-chain read request according to the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device, wherein the terminal device is used to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, wherein the transaction data packet is read by the target network device from an external device associated with a node device in the blockchain network; Receiving the transaction data packet sent by the terminal device, and verifying the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result; If the verification result indicates that the target transaction data is valid, the target transaction data in the transaction data packet is returned to the terminal device.
10. The method according to claim 9, characterized in that The transaction data packet also includes signature information of the organization to which the target network device belongs; the data transaction function includes a data verification rule and a public key of the organization to which the target network device belongs, and the data verification rule is used to instruct verification of the signature information; The verifying the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result includes: Performing a hash operation on the target transaction data in the transaction data packet to obtain a hash value of the target transaction data; Performing signature verification on the signature information according to the public key of the organization to which the target network device belongs to obtain signature verification data; If the hash value of the target transaction data matches the signature verification data, a verification result indicating that the target transaction data is valid is generated.
11. The method according to claim 9, characterized in that The querying, from the cross-chain communication protocol of the blockchain network, of the device attribute information of the target network device for reading the off-chain data of the blockchain network includes: Querying, from the cross-chain communication protocol of the blockchain network, device attribute information corresponding to N candidate network devices respectively for reading off-chain data of the blockchain network; the N candidate network devices include the target network device, and N is an integer greater than 1; The generating a first off-chain read request according to the transaction attribute information and the device attribute information includes: A first off-chain read request is generated according to the transaction attribute information and the device attribute information corresponding to the N candidate network devices.
12. The method according to claim 11, characterized in that The generating a first off-chain read request according to the transaction attribute information and the device attribute information respectively corresponding to the N candidate network devices includes: Obtaining, from the device attribute information of the N candidate network devices, the credibility corresponding to each of the N candidate network devices; Sorting the request generation templates corresponding to the N candidate network devices respectively in descending order of the credibility respectively corresponding to the N candidate network devices; Generate device attribute information requests corresponding to the sorted N candidate network devices respectively, and add them to the device list; Generate a first off-chain read request based on the device list and the transaction attribute information.
13. The method according to claim 12, characterized in that The generating a first off-chain read request according to the device list and the transaction attribute information includes: According to the protocol identifier of the cross-chain communication protocol in the transaction attribute information, obtaining a method identifier of a reading method associated with the cross-chain communication protocol from the blockchain of the blockchain network; generating callback data instructing the target network device to read the target transaction data from the external device according to the method identifier and the transaction attribute information; Generate a first off-chain read request according to the device list, the protocol identifier and the callback data.
14. A data processing device based on blockchain, characterized in that: include: A sending module, used to send an original read request about target transaction data to a node device in the blockchain network; The original read request carries the transaction attribute information of the target transaction; A first receiving module is used to receive a first off-chain read request sent by the node device calling the off-chain read interface in the cross-chain communication protocol; the first off-chain read request is generated according to the transaction attribute information and the device attribute information of the target network device, the device attribute information is obtained by the node device from the cross-chain communication protocol when determining that the target transaction data belongs to the off-chain data of the blockchain network, and the target network device is a device for reading the off-chain data of the blockchain network; A reading module, configured to read a transaction data packet including the target transaction data from the target network device according to the first off-chain reading request; The transaction data packet is read by the target network device from an external device associated with the blockchain network; A forwarding module, used to forward the transaction data packet to the node device, and the node device is used to verify the validity of the target transaction data in the transaction data packet based on the data verification function associated with the cross-chain communication protocol to obtain a verification result; The second receiving module is configured to receive the target transaction data returned by the node device when the verification result indicates that the target transaction data is valid.
15. A data processing device based on blockchain, characterized in that: include: A first receiving module, configured to receive an original read request for target transaction data sent by a terminal device; The original read request carries the transaction attribute information of the target transaction; A query module, used for querying from the cross-chain communication protocol of the blockchain network if the target transaction data belongs to off-chain data of the blockchain network, and for reading device attribute information of the target network device of the off-chain data of the blockchain network; A generation module, configured to generate a first off-chain read request according to the transaction attribute information and the device attribute information, call the off-chain read interface in the cross-chain communication protocol, and send the first off-chain read request to the terminal device, wherein the terminal device is configured to read a transaction data packet including the target transaction data from the target network device according to the first off-chain read request, wherein the transaction data packet is read by the target network device from an external device associated with a node device in the blockchain network; A second receiving module is used to receive the transaction data packet sent by the terminal device, and verify the validity of the target transaction data in the transaction data packet according to the data verification function associated with the cross-chain communication protocol to obtain a verification result; The sending module is configured to return the target transaction data in the transaction data packet to the terminal device if the verification result indicates that the target transaction data is valid.
16. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.
17. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
18. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
