Data transmission method, node device and data transmission system
The node devices of the relay chain send cross-chain requests and point-to-point network address routing tables, which solves the problem of off-chain data transmission between blockchains, realizes data transmission on-chain and off-chain data transmission, and meets the data interaction needs of various application scenarios.
Patent Information
- Application Number
- CN202210990408.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-18
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-08-18
AI Technical Summary
The existing technology cannot realize off-chain data transmission between blockchains. Cross-chain communication is mainly aimed at the on-chain data storage and asset interoperability, and cannot meet the data interaction needs of multiple application scenarios.
The node device of the relay chain sends cross-chain requests, carries the contract address of the data to be transmitted in the target blockchain node device, and uses the point-to-point network address routing table to realize data transmission, supporting data transmission on and off-chain.
It realizes off-chain data transmission between blockchains, improves the flexibility and security of data transmission, and meets the data interaction needs of various application scenarios.
Smart Images

Figure CN115460223B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular relates to a data transmission method, node device and data transmission system. Background Art
[0002] To accommodate diverse application scenarios, data exchange between blockchains is necessary. However, blockchains established in various fields are independent and closed, making direct data exchange difficult. Consequently, cross-chain blockchain technology has emerged to enable communication between blockchains. Cross-chain refers to the ability to achieve trusted interoperability between different blockchains.
[0003] In existing technologies, the functions implemented by cross-chain communication are generally aimed at the storage of on-chain data, asset interoperability, etc., and cannot realize off-chain data transmission. Summary of the Invention
[0004] The embodiments of the present application provide a data transmission method, a node device, and a data transmission system, which can solve the problem that the existing technology cannot achieve off-chain data transmission.
[0005] In a first aspect, an embodiment of the present application provides a data transmission method, applied to a first node device of a first blockchain, the method comprising:
[0006] Sending a first cross-chain request to a second node device of the relay chain, where the first cross-chain request carries a first contract address for storing a first data digest of the data to be transmitted in a third node device of the second blockchain;
[0007] Receiving a peer-to-peer network address routing table returned by the second node device of the relay chain based on the first cross-chain request;
[0008] After receiving the data transmission request sent by the third node device of the second blockchain, the data to be transmitted is sent to the third node device of the second blockchain according to the point-to-point network address routing table, and the first data summary is sent to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0009] Optionally, sending the first cross-chain request to the second node device of the relay chain includes:
[0010] generating a first data summary according to the data to be transmitted;
[0011] Sending a first cross-chain request to the second node device of the relay chain; wherein the first cross-chain request also carries first cross-chain verification information, and the first cross-chain request is used to instruct the second node device of the relay chain to send the first data summary to the smart contract corresponding to the first contract address after verifying the cross-chain verification information.
[0012] Optionally, after receiving the data transmission request sent by the third node device of the second blockchain, sending the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table, and sending the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain, includes:
[0013] If the amount of the data to be transmitted is greater than a set threshold, the data to be transmitted is divided into a plurality of data packets, each of which carries its own number;
[0014] Sending the plurality of data packets sequentially to the third node device of the second blockchain according to their respective numbers through the point-to-point network address routing table;
[0015] In the process of sending the multiple data packets in sequence according to their respective numbers to the third node device of the second blockchain, if communication between the first node device of the first blockchain and the third node device of the second blockchain is interrupted, then the maximum number of the data packets currently sent to the third node device of the second blockchain is recorded;
[0016] When the first node device of the first blockchain and the third node device of the second blockchain resume communication, the data packets with numbers greater than the maximum number are sent to the third node device of the second blockchain in sequence.
[0017] Optionally, the method further includes:
[0018] Sending a second cross-chain request to the second node device of the relay chain, where the second cross-chain request carries a keyword corresponding to the data to be obtained and a second contract address of a second data digest of the data to be obtained in the third node device of the second blockchain;
[0019] receiving a transaction receipt returned by the second node device of the relay chain based on the second cross-chain request; wherein the transaction receipt is generated by the second node device of the relay chain after sending the second cross-chain request to the third node device of the second blockchain, and the third node device of the second blockchain detects whether the data to be obtained exists according to the keyword, and is sent by the third node device of the second blockchain to the second node device of the relay chain; the transaction receipt carries a receipt type and a second data digest corresponding to the data to be obtained;
[0020] When the receipt type is a specified type, sending a data acquisition request to a third node device of the second blockchain through the peer-to-peer network address routing table;
[0021] Receive the data to be obtained sent by the third node device of the second blockchain through the point-to-point network address routing table; wherein, the data to be obtained is obtained by the third node device of the second blockchain according to a preset acquisition method.
[0022] In a second aspect, an embodiment of the present application provides a data transmission method, applied to a second node device in a relay chain, the method comprising:
[0023] Receiving a first cross-chain request sent by a first node device of a first blockchain, where the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of a second blockchain;
[0024] Based on the first cross-chain request, the peer-to-peer network address routing table is sent to the first node device of the first blockchain to instruct the first node device of the first blockchain to send the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table after receiving the data transmission request sent by the third node device of the second blockchain, and to send the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0025] In a third aspect, an embodiment of the present application provides a data transmission method, which is applied to a third node device of a second blockchain, the method comprising:
[0026] Receiving a first cross-chain request sent by a second node device of the relay chain; the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of the second blockchain;
[0027] Sending a data transmission request to a first node device of a first blockchain, instructing the first node device of the first blockchain to send the data to be transmitted and the first data digest to a third node device of the second blockchain according to a peer-to-peer network address routing table after receiving the data transmission request; wherein the peer-to-peer network address routing table is sent by the second node device of the relay chain to the first node device of the first blockchain after receiving the first cross-chain request sent by the first node device of the first blockchain;
[0028] The received first data digest is stored in a smart contract corresponding to the first contract address.
[0029] In a fourth aspect, an embodiment of the present application provides a first node device of a first blockchain, including:
[0030] A first cross-chain request sending unit, configured to send a first cross-chain request to a second node device of the relay chain, wherein the first cross-chain request carries a first contract address for storing a first data digest of the data to be transmitted in a third node device of the second blockchain;
[0031] A first receiving unit is configured to receive a peer-to-peer network address routing table returned by the second node device of the relay chain based on the first cross-chain request;
[0032] A first data sending unit is configured to, after receiving a data transmission request sent by a third node device of the second blockchain, send the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table, and send the first data summary to a smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0033] In a fifth aspect, an embodiment of the present application provides a second node device of a relay chain, including:
[0034] A receiving unit, configured to receive a first cross-chain request sent by a first node device of a first blockchain, wherein the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of a second blockchain;
[0035] A sending unit is configured to send a peer-to-peer network address routing table to a first node device of the first blockchain based on the first cross-chain request, so as to instruct the first node device of the first blockchain to send the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table after receiving the data transmission request sent by the third node device of the second blockchain, and to send the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0036] In a sixth aspect, an embodiment of the present application provides a third node device of a second blockchain, including:
[0037] A receiving unit, configured to receive a first cross-chain request sent by a second node device of the relay chain; the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of the second blockchain;
[0038] a sending unit, configured to send a data transmission request to a first node device of a first blockchain, to instruct the first node device of the first blockchain to send the data to be transmitted and the first data digest to a third node device of the second blockchain according to a peer-to-peer network address routing table after receiving the data transmission request; wherein the peer-to-peer network address routing table is sent by the second node device of the relay chain to the first node device of the first blockchain after receiving the first cross-chain request sent by the first node device of the first blockchain;
[0039] A writing unit is configured to store the received first data summary in a smart contract corresponding to the first contract address.
[0040] In the seventh aspect, an embodiment of the present application provides a node device, which includes: a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, it implements the steps of the data transmission method as described in any one of the first aspect, or the steps of the data transmission method as described in any one of the second aspect, or the steps of the data transmission method as described in any one of the third aspect.
[0041] In an eighth aspect, an embodiment of the present application provides a data transmission system, comprising: a first blockchain composed of at least one node device, a relay chain composed of at least one node device, and a second blockchain composed of at least one node device, wherein the node device of the first blockchain is used to execute the method described in the first aspect above, the node device of the relay chain is used to execute the method described in the second aspect above, and the node device of the second blockchain is used to execute the method described in the third aspect above.
[0042] In the ninth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the data transmission method as described in any one of the first aspect, second aspect or third aspect above.
[0043] In the tenth aspect, an embodiment of the present application provides a computer program product, which, when running on a data transmission system, enables the data transmission system to execute the data transmission method described in any one of the first, second or third aspects above.
[0044] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0045] An embodiment of the present application provides a data transmission method, in which a first node device of a first blockchain can send a first cross-chain request to a second node device of a relay chain, where the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of the second blockchain; after receiving the above-mentioned first cross-chain request, the second node device of the relay chain can send a point-to-point network address routing table to the first node device of the first blockchain based on the first cross-chain request. Thereafter, after receiving the data transmission request sent by the third node device of the second blockchain, the first node device of the first blockchain can send the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table, and send the first data digest to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain; wherein the data transmission request can be sent by the third node device of the second blockchain to the first node device of the first blockchain after receiving the first cross-chain request sent by the second node device of the relay chain; finally, the third node device of the second blockchain can receive the data to be transmitted and the first data digest sent by the first node device of the first blockchain, and store the first data digest in the smart contract corresponding to the first contract address. In the above-mentioned data transmission method, the first node device of the first blockchain can send the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table sent by the second node device of the relay chain, and send the first data summary of the data to be transmitted to the smart contract corresponding to the first contract address in the third node device of the second blockchain, that is, the first data summary of the data to be transmitted is transmitted on the chain, and at the same time, the data to be transmitted is transmitted off-chain, thereby realizing the on-chain and off-chain data transmission function. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. 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 any creative work.
[0047] Figure 1 This is a structural diagram of a data transmission system provided in an embodiment of the present application;
[0048] Figure 2 This is a flowchart of an implementation of a data transmission method provided in one embodiment of the present application;
[0049] Figure 3 is a flowchart of an implementation of a data transmission method provided in another embodiment of the present application;
[0050] Figure 4 is a flowchart of an implementation of a data transmission method provided in yet another embodiment of the present application;
[0051] Figure 5 This is a schematic diagram of the structure of a first node device of a first blockchain provided by an embodiment of the present application;
[0052] Figure 6 This is a schematic structural diagram of a first node device of a first blockchain provided by another embodiment of the present application;
[0053] Figure 7 This is a schematic diagram of the structure of a second node device in a relay chain provided by an embodiment of the present application;
[0054] Figure 8 is a schematic structural diagram of a second node device of a relay chain provided in another embodiment of the present application;
[0055] Figure 9 This is a schematic diagram of the structure of the third node device of the second blockchain provided in one embodiment of the present application;
[0056] Figure 10 This is a schematic structural diagram of a third node device of a second blockchain provided in another embodiment of the present application. DETAILED DESCRIPTION
[0057] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0058] See also Figure 1 , Figure 1 This is a schematic diagram of the structure of a data transmission system provided by an embodiment of the present application. Figure 1As shown, the data transmission system provided in the embodiment of the present application includes a first node device 100 of a first blockchain, a second node device 200 of a relay chain, and a third node device 300 of a second blockchain. The first node device 100 of the first blockchain is wirelessly connected to the second node device 200 of the relay chain and the third node device 300 of the second blockchain, respectively. The second node device 200 of the relay chain is wirelessly connected to the third node device 300 of the second blockchain. The first node device 100 of the first blockchain and the third node device 300 of the second blockchain can be any node device of any chain in the blockchain network.
[0059] The relay chain, also known as the relayer, is a third-party public chain in the blockchain network that can be used to connect to other chains in the blockchain network through the cross-chain messaging protocol.
[0060] In actual applications, a channel is added between any two chains in the blockchain network, and a specific data structure is created in the channel, so that the two chains can interact with each other through the data structure in the channel. This added channel is called a relay chain.
[0061] It should be noted that each node device of different blockchains can realize cross-chain transactions (such as data transmission and data acquisition mentioned in all embodiments of this application) through its corresponding cross-chain gateway. Therefore, in one embodiment of this application, please continue to refer to Figure 1 The data transmission system may further include: a first cross-chain gateway 400 corresponding to the first node device 100 of the first blockchain and a second cross-chain gateway 500 corresponding to the third node device 300 of the second blockchain.
[0062] In practical applications, a cross-chain gateway is an important component for connecting to specific blockchain types and forwarding cross-chain messages. It mainly provides core functions such as cross-chain transaction monitoring, cross-chain transaction execution, and cross-chain transaction routing.
[0063] See also Figure 2 , Figure 2 This is a flow chart of a data transmission method provided in an embodiment of the present application. Figure 2 As shown, when the first node device of the first blockchain actively transmits data to the third node device of the second blockchain, a data transmission method provided in an embodiment of the present application may specifically include the following steps, which are detailed as follows:
[0064] In S101, a first node device of a first blockchain sends a first cross-chain request to a second node device of a second node device of a relay chain.
[0065] In an embodiment of the present application, when a first node device of a first blockchain needs to actively transmit data to a third node device of a second blockchain, the first node device of the first blockchain may determine the data to be transmitted. The data to be transmitted may be any set of data stored in the first node device of the first blockchain (or a database in the first node device).
[0066] After the first node device of the first blockchain determines the data to be transmitted, since the data to be transmitted is transmitted to the third node device of the second blockchain, it is necessary to determine in which contract address in the third node device of the second blockchain the first data summary of the data to be transmitted needs to be stored in the smart contract, that is, to determine the first contract address in the third node device of the second blockchain for storing the first data summary of the data to be transmitted.
[0067] Based on this, the first cross-chain request carries the first contract address of the third node device of the second blockchain for storing the first data summary of the data to be transmitted.
[0068] In one implementation of the embodiment of the present application, the first node device of the first blockchain can send the first cross-chain request to the second node device of the relay chain through the first cross-chain gateway corresponding thereto.
[0069] In S102, the second node device of the relay chain receives the first cross-chain request.
[0070] In S103, the second node device of the relay chain sends the peer-to-peer network address routing table to the first node device of the first blockchain based on the first cross-chain request.
[0071] In practical applications, since each blockchain node device needs to register with the second node device of the relay chain when it needs to use the second node device of the relay chain for cross-chain transactions, each blockchain node device can register its corresponding peer-to-peer network identity (P2P-ID) with the second node device of the relay chain. Therefore, the second node device of the relay chain pre-stores a peer-to-peer network address routing table. This peer-to-peer network address routing table is used to store the peer-to-peer network identity corresponding to each blockchain node device.
[0072] It should be noted that the second node device of the relay chain can send the above-mentioned point-to-point network address routing table to the first node device of the first blockchain through the first cross-chain gateway corresponding to the first node device of the first blockchain.
[0073] In S104, the second node device of the relay chain sends the first cross-chain request to the third node device of the second blockchain.
[0074] In an embodiment of the present application, the second node device of the relay chain can send the first cross-chain request to the third node device of the second blockchain through the second cross-chain gateway corresponding to the third node device of the second blockchain.
[0075] In one embodiment of the present application, the second node device of the relay chain can also send the point-to-point network address routing table to the third node device of the second blockchain through the second cross-chain gateway corresponding to the third node device of the second blockchain.
[0076] In S105, the third node device of the second blockchain receives the first cross-chain request.
[0077] In S106, the third node device of the second blockchain sends a data transmission request to the first node device of the first blockchain.
[0078] In an embodiment of the present application, after the third node device of the second blockchain receives the first cross-chain request, when the third node device of the second blockchain agrees to receive the data to be transmitted sent by the first node device of the first blockchain, the third node device of the second blockchain can send the data transmission request to the second cross-chain network corresponding to the first node device of the first blockchain through its corresponding second cross-chain gateway, so as to achieve the purpose of the third node device of the second blockchain sending the data transmission request to the first node device of the first blockchain.
[0079] In one embodiment of the present application, in combination with S104, the third node device of the second blockchain can receive the point-to-point network address routing table sent by the second node device of the relay chain, and send the data transmission request to the first node device of the first blockchain according to the point-to-point network address routing table.
[0080] In S107, the first node device of the first blockchain receives the data transmission request.
[0081] In S108, the first node device of the first blockchain receives the peer-to-peer network address routing table, and sends the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table, and sends the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0082] In an embodiment of the present application, after receiving a data transmission request sent by a third node device of the second blockchain, the first node device of the first blockchain can send the data to be transmitted through the first cross-chain gateway corresponding to the first node device of the first blockchain to the second cross-chain gateway corresponding to the third node device of the second blockchain according to the point-to-point network address routing table sent by the second node device of the relay chain, and send the first data summary of the data to be transmitted to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0083] In one embodiment of the present application, when the amount of data to be transmitted is too large, the transmission time will also be extended. When the transmission time is too long, communication between the first node device of the first blockchain and the third node device of the second blockchain is likely to be interrupted. Based on this, the first node device of the first blockchain can specifically send the data to be transmitted through the following steps, which are detailed as follows:
[0084] If the amount of the data to be transmitted is greater than a set threshold, the data to be transmitted is divided into a plurality of data packets, each of which carries its own number;
[0085] Sending the plurality of data packets sequentially to the third node device of the second blockchain according to their respective numbers through the point-to-point network address routing table;
[0086] In the process of sending the multiple data packets in sequence according to their respective numbers to the third node device of the second blockchain, if communication between the first node device of the first blockchain and the third node device of the second blockchain is interrupted, then the maximum number of the data packets currently sent to the third node device of the second blockchain is recorded;
[0087] When the first node device of the first node device of the first blockchain and the third node device of the second blockchain resume communication, the data packets with numbers greater than the maximum number are sent to the third node device of the second blockchain in sequence.
[0088] In this embodiment, when transmitting data to be transmitted, the first node device of the first blockchain may compare the amount of the data to be transmitted with a set threshold. The set threshold can be set according to actual needs and is not limited here.
[0089] When the first node device of the first blockchain detects that the amount of data to be transmitted exceeds a set threshold, the first node device may divide the data to be transmitted into multiple data packets, wherein each data packet carries a respective number, for example, the numbers 1, 2, 3, etc.
[0090] Specifically, the first node device of the first blockchain can first determine the number of data packets that need to be divided, and evenly distribute the data to be transmitted to each data packet according to the number.
[0091] After receiving multiple data packets, the first node device of the first blockchain can send the multiple data packets in sequence according to their respective numbers to the third node device of the second blockchain through the point-to-point network address routing table.
[0092] It should be noted that sending the data packets to the third node devices of the second blockchain in sequence according to their respective numbers can be: sending the data packets to the third node devices of the second blockchain in sequence according to the numbers from small to large.
[0093] In this embodiment, when the first node device of the first blockchain sends the above-mentioned multiple data packets to the third node device of the second blockchain in sequence according to their respective numbers, it is necessary to detect the communication quality between the first node device of the first blockchain and the third node device of the second blockchain in real time.
[0094] When the first node device of the first blockchain detects that communication between itself and the third node device of the second blockchain is interrupted, it needs to record the maximum number of data packets currently sent to the third node device of the second blockchain.
[0095] When the first node device of the first blockchain detects that communication between itself and the third node device of the second blockchain is restored, it does not need to resend the data to be transmitted to the third node device of the second blockchain from the beginning. Instead, it can send data packets with numbers greater than the above-mentioned maximum number to the third node device of the second blockchain in sequence, thereby improving data transmission efficiency.
[0096] In S109, the third node device of the second blockchain receives the data to be transmitted and the first data summary.
[0097] In this embodiment, after the third node device of the second blockchain obtains the data to be transmitted, the third node device of the second blockchain may store the data to be transmitted (e.g., in its own database) or process the data according to preset requirements, which are not limited here. The preset requirements can be set according to actual needs and are not limited here.
[0098] In S1010, the third node device of the second blockchain stores the first data summary in the smart contract corresponding to the first contract address.
[0099] In an embodiment of the present application, the third node device of the second blockchain can receive the first data summary of the data to be transmitted sent by the first node device of the first blockchain, and store the first data summary of the data to be transmitted in the smart contract corresponding to the first contract address.
[0100] As can be seen from the above, an embodiment of the present application provides a data transmission method, in which the first node device of the first blockchain can send a first cross-chain request to the second node device of the relay chain, and the first cross-chain request carries the first contract address of the third node device of the second blockchain for storing the first data digest of the data to be transmitted; after receiving the above-mentioned first cross-chain request, the second node device of the relay chain can send the point-to-point network address routing table to the first node device of the first blockchain based on the first cross-chain request. Thereafter, the first node device of the first blockchain can, after receiving the data transmission request sent by the third node device of the second blockchain, send the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table, and send the first data digest to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain; wherein the data transmission request can be sent by the third node device of the second blockchain to the first node device of the first blockchain after receiving the first cross-chain request sent by the second node device of the relay chain; finally, the third node device of the second blockchain can receive the data to be transmitted and the first data digest sent by the first node device of the first blockchain, and store the first data digest in the smart contract corresponding to the first contract address. In the above-mentioned data transmission method, the first node device of the first blockchain can send the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table sent by the second node device of the relay chain, and send the first data summary of the data to be transmitted to the smart contract corresponding to the first contract address in the third node device of the second blockchain, that is, the first data summary of the data to be transmitted is transmitted on the chain, and at the same time, the data to be transmitted is transmitted off-chain, thereby realizing the on-chain and off-chain data transmission function.
[0101] See also Figure 3 , Figure 3 This is a flowchart of a data transmission method provided by another embodiment of the present application. Figure 2 In a corresponding embodiment, a data transmission method in this embodiment may include S201 to S209 for the security and authenticity of cross-chain transactions, as detailed below:
[0102] In S201, a first node device of a first blockchain generates a first data summary based on the data to be transmitted.
[0103] In this embodiment, when a first node device of a first blockchain needs to actively transmit data to a third node device of a second blockchain, the first node device of the first blockchain may determine the data to be transmitted. The data to be transmitted may be any set of data stored in the first node device of the first blockchain (or a database in the first node device).
[0104] After the first node device of the first blockchain determines the data to be transmitted, since the data to be transmitted is transmitted to the third node device of the second blockchain, it is necessary to determine in which contract address in the third node device of the second blockchain the first data summary of the data to be transmitted needs to be stored in the smart contract, that is, to determine the first contract address in the third node device of the second blockchain for storing the first data summary of the data to be transmitted.
[0105] Based on this, after determining the data to be transmitted, the first node device of the first blockchain can also generate a first data digest based on the data to be transmitted. Specifically, the first node device of the first blockchain can calculate the first data digest of the data to be transmitted based on a data digest algorithm.
[0106] In practical applications, a data digest algorithm is used to convert a byte string of arbitrary length into a fixed-length hexadecimal digit string. This algorithm can be Message Digest Algorithm (MD5) or Secure Hash Algorithm (SHA1), depending on actual needs. This is not a limitation at this time.
[0107] In S202, the first node device of the first blockchain sends a first cross-chain request to the second node device of the second node device of the relay chain.
[0108] In this embodiment, the first node device of the first blockchain can send the first cross-chain request to the second node device of the relay chain through its corresponding first cross-chain gateway.
[0109] It should be noted that since each blockchain node device needs to use the relay chain's second node device to conduct cross-chain transactions, the node device of that blockchain needs to register with the relay chain's second node device. At the same time, the node device of that blockchain also needs to register the verification rules for this cross-chain transaction. The verification rules can be a piece of code.
[0110] Based on this, the first node device of the first blockchain can send a first cross-chain request carrying the first contract address, the first data digest, and the first cross-chain verification information to the second node device of the relay chain. The first cross-chain verification information (i.e., proof information) refers to information used to verify the first cross-chain request according to the above verification rules.
[0111] In S203, the second node device of the relay chain receives the first cross-chain request.
[0112] In S204, the second node device of the relay chain sends the peer-to-peer network address routing table to the first node device of the first blockchain based on the first cross-chain request.
[0113] In this embodiment, S204 and Figure 2 S103 in the corresponding embodiment is the same. Please refer to the relevant description in S103 for details, which will not be repeated here.
[0114] In S205, the second node device of the relay chain verifies the validity and existence of the first cross-chain request according to the first cross-chain verification information.
[0115] In this embodiment, after receiving the first cross-chain request sent by the first node device of the first blockchain, the second node device of the relay chain can extract the first cross-chain verification information in the first cross-chain request.
[0116] After obtaining the first cross-chain verification information, the second node device of the relay chain can input the first cross-chain verification information into a preset verification engine for execution to verify the validity and existence of the first cross-chain request. The preset verification engine can be a WASM virtual machine.
[0117] In one embodiment of the present application, when the second node device of the relay chain detects that the validity and existence verification of the first cross-chain request have passed, the second node device of the relay chain can execute steps S206 and S209, the first node device of the first blockchain can execute steps S2011 to S2012, and the third node device of the second blockchain can execute steps S207 to S208, S2010 and S2013 to S2014.
[0118] In another embodiment of the present application, upon detecting that the validity and / or existence verification of the first cross-chain request fails, the second node device of the relay chain may stop the cross-chain transaction and send a first prompt message to the first node device of the first blockchain. The first prompt message is used to describe that the validity and / or existence verification of the first cross-chain request of the first node device of the first blockchain fails.
[0119] In S206, if the second node device of the relay chain detects that the validity and existence verification of the first cross-chain request have passed, the first cross-chain request is sent to the third node device of the second blockchain.
[0120] In this embodiment, when the second node device of the relay chain detects that the validity and existence verification of the first cross-chain request have passed, it can extract the first data summary and the first contract address in the first cross-chain request, and send the first data summary and the first contract address to the third node device of the second blockchain through the cross-chain gateway corresponding to the third node device of the second blockchain.
[0121] In one embodiment of the present application, the second node device of the relay chain may also send the peer-to-peer network address routing table to the third node device of the second blockchain.
[0122] In S207, the third node device of the second blockchain receives the first cross-chain request sent by the second node device of the relay chain.
[0123] In S208, the third node device of the second blockchain sends the first data digest to the second node device of the relay chain.
[0124] In this embodiment, after receiving the first cross-chain request, the third node device of the second blockchain can extract the first data digest carried in the first cross-chain request.
[0125] When the third node device of the second blockchain agrees to receive the data to be transmitted sent by the first node device of the first blockchain, the third node device of the second blockchain can send the above-mentioned first data summary to the second node device of the relay chain.
[0126] In one implementation of this embodiment, the third node device of the second blockchain can send the first data summary to the second node device of the relay chain through its corresponding second cross-chain gateway.
[0127] It should be noted that, after extracting the first data summary, the third node device of the second blockchain can also store the first data summary in the smart contract corresponding to the first contract address.
[0128] In S209, the second node device of the relay chain receives the first data summary sent by the third node device of the second blockchain.
[0129] In this embodiment, after receiving the first data summary sent by the third node device of the second blockchain, the second node device of the relay chain can store the first data summary.
[0130] In S2010, the third node device of the second blockchain sends a data transmission request to the first node device of the first blockchain.
[0131] In this embodiment, in combination with S206, the third node device of the second blockchain can receive the point-to-point network address routing table sent by the second node device of the relay chain, and send the data transmission request to the first node device of the first blockchain according to the point-to-point network address routing table.
[0132] It should be noted that the third node device of the second blockchain can send the data transmission request to the second cross-chain network corresponding to the first node device of the first blockchain through its corresponding second cross-chain gateway, so as to achieve the purpose of the third node device of the second blockchain sending the data transmission request to the first node device of the first blockchain.
[0133] In S2011, the first node device of the first blockchain receives the data transmission request.
[0134] In S2012, the first node device of the first blockchain receives the peer-to-peer network address routing table, and sends the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table, and sends the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0135] In S2013, the third node device of the second blockchain receives the data to be transmitted.
[0136] In S2014, the third node device of the second blockchain writes the data to be transmitted into the smart contract corresponding to the contract address.
[0137] S2011 to S2014 in this embodiment and Figure 2 S107 to S1010 in the corresponding embodiments are the same. Please refer to the relevant descriptions in S107 to S1010 for details, which will not be repeated here.
[0138] As can be seen from the above, in the data transmission method provided by this embodiment, the first cross-chain request sent by the first node device of the first blockchain to the second node device of the relay chain also carries the first cross-chain verification information of the data to be transmitted, so that the relay can verify the validity and existence of the first cross-chain request through the first cross-chain verification information, thereby ensuring the security of this cross-chain transaction; only when the validity and existence of the first cross-chain request are verified, the above-mentioned first data digest will be sent to the third node device of the second blockchain. When the third node device of the second blockchain determines that it needs to receive the data to be transmitted from the first node device of the first blockchain, it can send a data transmission request to the first node device of the first blockchain. After receiving the data transmission request, the first node device of the first blockchain can send the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table, and send the first data digest of the data to be transmitted to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain. The data transmission method provided by this embodiment ensures the security of the cross-chain transaction here through the first cross-chain verification information.
[0139] See also Figure 4 , Figure 4 This is a flowchart of a data transmission method provided by another embodiment of the present application. Figure 2 In a corresponding embodiment, when a first node device of a first blockchain needs to obtain data of a third node device of a second blockchain, a data transmission method in this embodiment may specifically include S301 to S309, as detailed below:
[0140] In S301, a second cross-chain request is sent to a second node device of the relay chain.
[0141] In this embodiment, when the first node device of the first blockchain needs to actively obtain certain data from the third node device of the second blockchain, the third node device of the second blockchain needs to determine the keyword corresponding to the data to be obtained, and the smart contract corresponding to which contract address in the third node device of the second blockchain the second data summary of the data to be obtained is stored, that is, determine the second contract address in the third node device of the second blockchain where the second data summary of the data to be obtained is located.
[0142] Based on this, the first node device of the first blockchain can send a second cross-chain request to the second node device of the relay chain, carrying the second data summary of the data to be obtained, the second contract address in the third node device of the second blockchain, and the keyword corresponding to the data to be obtained.
[0143] It should be noted that the first node device of the first blockchain can send the above-mentioned second cross-chain request to the second node device of the relay chain through its corresponding first cross-chain gateway.
[0144] In one embodiment of the present application, when a node device on each blockchain needs to use a second node device on the relay chain to conduct a cross-chain transaction, the node device on that blockchain needs to register with the second node device on the relay chain. Furthermore, the node device on that blockchain also needs to register the verification rules for this cross-chain transaction. These verification rules can be a piece of code.
[0145] Based on this, the first node device of the first blockchain can send a second cross-chain request to the second node device of the relay chain, carrying the second contract address, the keyword corresponding to the data to be obtained, and the second cross-chain verification information. The second cross-chain verification information (i.e., proof information) refers to information used to verify the second cross-chain request according to the above verification rules.
[0146] In S302, the second node device of the relay chain receives the second cross-chain request.
[0147] In S303, the second node device of the relay chain sends the peer-to-peer network address routing table to the first node device of the first blockchain and the third node device of the second blockchain.
[0148] In practical applications, since each blockchain node device needs to register with the second node device of the relay chain when it needs to use the second node device of the relay chain for cross-chain transactions, each blockchain node device can register its corresponding peer-to-peer network identity (P2P-ID) with the second node device of the relay chain. Therefore, the second node device of the relay chain pre-stores a peer-to-peer network address routing table. This peer-to-peer network address routing table is used to store the peer-to-peer network identity corresponding to each blockchain node device.
[0149] It should be noted that the second node device of the relay chain can send the above-mentioned point-to-point network address routing table to the first node device of the first blockchain through the first cross-chain gateway corresponding to the first node device of the first blockchain.
[0150] In another embodiment of the present application, in combination with S301, when the second cross-chain request also carries second cross-chain verification information, the second node device of the relay chain may specifically perform the following steps:
[0151] The validity and existence of the second cross-chain request are verified according to the second cross-chain verification information.
[0152] In this embodiment, after receiving the second cross-chain request sent by the first node device of the first blockchain, the second node device of the relay chain can extract the second cross-chain verification information in the second cross-chain request.
[0153] After obtaining the second cross-chain verification information, the second node device of the relay chain can input the second cross-chain verification information into a preset verification engine for execution to verify the validity and existence of the second cross-chain request. The preset verification engine can be a WASM virtual machine.
[0154] In one embodiment of the present application, when the second node device of the relay chain detects that the validity and existence verification of the second cross-chain request has passed, the second node device of the relay chain can execute steps S305, S3010~S3011 and S3013, the first node device of the first blockchain can execute steps S3012~S3013 and S3016, and the third node device of the second blockchain can execute steps S306~S309 and S3014~S3015.
[0155] In another embodiment of the present application, when the second node device of the relay chain detects that the validity and / or existence verification of the second cross-chain request fails, it may stop the cross-chain transaction and send a second prompt message to the third node device of the second blockchain. The second prompt message is used to describe that the validity and / or existence verification of the second cross-chain request of the first node device of the first blockchain fails.
[0156] In this embodiment, the second node device of the relay chain can send the point-to-point network address routing table to the first node device of the first blockchain through the first cross-chain gateway corresponding to the first node device of the first blockchain, and send it to the third node device of the second blockchain through the second cross-chain gateway corresponding to the third node device of the second blockchain.
[0157] In S304, the first node device of the first blockchain receives the peer-to-peer network address routing table.
[0158] In S305, the second node device of the relay chain sends the second cross-chain request to the third node device of the second blockchain.
[0159] In this embodiment, the second node device of the relay chain can send the second cross-chain request to the third node device of the second blockchain through the second cross-chain gateway corresponding to the third node device of the second blockchain.
[0160] In one embodiment of the present application, in combination with S301, when the second cross-chain request also carries second cross-chain verification information, the second node device of the relay chain can extract the second contract address and the keyword corresponding to the data to be obtained in the second cross-chain request, and send the second contract address and the keyword corresponding to the data to be obtained to the third node device of the second blockchain.
[0161] In S306, the third node device of the second blockchain receives the second cross-chain request sent by the second node device of the relay chain.
[0162] In this embodiment, after receiving the second cross-chain request sent by the second node device of the relay chain, the third node device of the second blockchain can extract the keyword corresponding to the data to be obtained from the second cross-chain request, and detect whether the data to be obtained exists in the third node device of the second blockchain based on the keyword.
[0163] It should be noted that the third node device of the second blockchain pre-stores the correspondence between different preset keywords and different preset data. Therefore, after obtaining the keyword of the data to be obtained, the third node device of the second blockchain can compare the keyword with the pre-stored preset keywords one by one to determine whether there is a keyword corresponding to the data to be obtained among the multiple preset keywords.
[0164] After determining that a keyword corresponding to the data to be acquired exists among multiple preset keywords, the third node device of the second blockchain can further determine whether the data to be acquired exists in the third node device of the second blockchain based on the correspondence between different preset keywords and different preset data.
[0165] In S307, if the third node device of the second blockchain detects the existence of the data to be obtained based on the keyword, it determines that the receipt type of the transaction receipt is a specified type, and obtains the data to be obtained.
[0166] In actual applications, the third node device of the second blockchain can generate a transaction receipt after detecting whether the data to be obtained exists based on the keyword corresponding to the data to be obtained, and determine the receipt type of the transaction receipt based on whether the data to be obtained exists.
[0167] In this embodiment, the transaction receipt types include, but are not limited to, a first type and a second type. The first type may be "success," which indicates that the cross-chain transaction (i.e., data acquisition) was successful, meaning the data to be acquired exists on the third node device of the second blockchain. The second type may be "failure," which indicates that the cross-chain transaction (i.e., data acquisition) failed, meaning the data to be acquired does not exist on the third node device of the second blockchain.
[0168] It should be noted that, in this embodiment, the third node device of the second blockchain can determine the first type as the designated type.
[0169] When the third node device of the second blockchain detects the existence of the data to be obtained based on the keyword, it can determine that the receipt type of the transaction receipt is a specified type and obtain the data to be obtained.
[0170] It should be noted that the third node device of the second blockchain can obtain the data to be obtained according to a preset acquisition method. The preset acquisition method can be set according to actual needs and is not limited here. For example, the preset acquisition method can be obtained from a database or through a uniform resource locator (URL).
[0171] In S308, the third node device of the second blockchain generates a second data digest according to the data to be obtained, and generates the transaction receipt according to the second data digest and the receipt type of the transaction receipt.
[0172] In this embodiment, after obtaining the data to be obtained, the third node device of the second blockchain can also generate a second data digest based on the data to be obtained. Specifically, the third node device of the second blockchain can calculate the second data digest of the data to be obtained based on a data digest algorithm.
[0173] In this embodiment, after obtaining the second data summary, the third node device of the second blockchain can generate a transaction receipt based on the second data summary and the receipt type.
[0174] In one embodiment of the present application, after obtaining the data to be obtained, the third node device of the second blockchain can also generate a transaction receipt according to a preset acquisition method of the data to be obtained, the second data summary, and the receipt type.
[0175] It should be noted that when the receipt type of the transaction receipt is the second type, it means that there is no data to be obtained in the third node device of the second blockchain. Therefore, at this time, the third node device of the second blockchain can only generate a transaction receipt based on the receipt type.
[0176] In S309, the third node device of the second blockchain sends the transaction receipt to the second node device of the relay chain.
[0177] In one implementation of this embodiment, the third node device of the second blockchain can send the transaction receipt to the second node device of the relay chain through its corresponding second cross-chain gateway.
[0178] In S3010, the second node device of the relay chain receives the transaction receipt sent by the third node device of the second blockchain.
[0179] In S3011, the second node device of the relay chain sends the transaction receipt to the first node device of the first blockchain.
[0180] In one implementation of this embodiment, the second node device of the relay chain can send the transaction receipt to the first node device of the first blockchain through the first cross-chain gateway corresponding to the first node device of the first blockchain.
[0181] In S3012, the first node device of the first blockchain receives the transaction receipt sent by the second node device of the relay chain.
[0182] In this embodiment, after receiving the transaction receipt sent by the second node device of the relay chain, the first node device of the first blockchain can extract the second data summary and receipt type in the transaction receipt.
[0183] In S3013, when the first node device of the first blockchain detects that the receipt of the transaction receipt is of the specified type, it sends the second data summary to the second node device of the relay chain, and sends a data acquisition request to the third node device of the second blockchain through the peer-to-peer network address routing table.
[0184] In this embodiment, when the first node device of the first blockchain detects that the receipt type of the transaction receipt is a specified type, it indicates that there is data to be obtained in the third node device of the second blockchain, and the third node device of the second blockchain agrees to send the data to be obtained to the first node device of the first blockchain. Therefore, the first node device of the first blockchain can send the second data summary to the second node device of the relay chain, and send a data acquisition request to the third node device of the second blockchain through the point-to-point network address routing table.
[0185] In one implementation of this embodiment, the first node device of the first blockchain can send the second data summary to the second node device of the relay chain through its corresponding first cross-chain gateway.
[0186] The first node device of the first blockchain can send the data acquisition request to the second cross-chain gateway of the third node device of the second blockchain through its corresponding first cross-chain network, so as to achieve the purpose of sending the data acquisition request to the second cross-chain gateway.
[0187] In combination with S308, the transaction receipt also carries a method for obtaining the data to be obtained. At this time, the first node device of the first blockchain can store the second data summary and the preset acquisition method in the smart contract corresponding to a contract address in the first node device of the first blockchain.
[0188] In S3013, the second node device of the relay chain receives and stores the second data summary sent by the first node device of the first blockchain.
[0189] In S3014, the third node device of the second blockchain receives the data acquisition request sent by the first node device of the first blockchain.
[0190] In S3015, the third node device of the second blockchain obtains the data to be obtained according to a preset acquisition method, and sends the data to be obtained to the first node device of the first blockchain.
[0191] In this embodiment, after receiving the data acquisition request sent by the first node device of the first blockchain, the third node device of the second blockchain can send the data to be acquired to the first cross-chain gateway corresponding to the first node device of the first blockchain through the second cross-chain gateway corresponding to the third node device of the second blockchain according to the point-to-point network address routing table sent by the second node device of the relay chain.
[0192] In one embodiment of the present application, when the amount of data to be acquired is too large, the transmission time will also be prolonged. When the transmission time is too long, communication between the first node device of the first blockchain and the third node device of the second blockchain is likely to be interrupted. Based on this, the third node device of the second blockchain can specifically send the data to be acquired through the following steps, which are detailed as follows:
[0193] If the amount of the data to be acquired is greater than a set threshold, the data to be acquired is divided into a plurality of data packets, each of which carries its own number;
[0194] Sending the plurality of data packets sequentially to the first node device of the first blockchain according to their respective numbers through the point-to-point network address routing table;
[0195] In the process of sending the multiple data packets in sequence according to their respective numbers to the first node device of the first blockchain, if communication between the first node device of the first blockchain and the third node device of the second blockchain is interrupted, then the maximum number of the data packets currently sent to the first node device of the first blockchain is recorded;
[0196] When the first node device of the first blockchain and the third node device of the second blockchain resume communication, the data packets with numbers greater than the maximum number are sent to the first node device of the first blockchain in sequence.
[0197] In this embodiment, when transmitting the data to be acquired, the third node device of the second blockchain may compare the amount of the data to be acquired with a set threshold. The set threshold can be set according to actual needs and is not limited here.
[0198] When the third node device of the second blockchain detects that the amount of data to be acquired exceeds a set threshold, the data to be acquired may be divided into multiple data packets, wherein each data packet carries a respective number, for example, the numbers 1, 2, 3, etc.
[0199] Specifically, the third node device of the second blockchain can first determine the number of data packets that need to be divided, and evenly distribute the data to be obtained to each data packet according to the number.
[0200] After receiving the multiple data packets, the third node device of the second blockchain can send the multiple data packets to the first node device of the first blockchain in sequence according to their respective numbers through the point-to-point network address routing table.
[0201] It should be noted that sending the data packets to the first node device of the first blockchain in sequence according to their respective numbers may be: sending the data packets to the first node device of the first blockchain in sequence according to the numbers from small to large.
[0202] In this embodiment, when the third node device of the second blockchain sends the above-mentioned multiple data packets to the first node device of the first blockchain in sequence according to their respective numbers, it is necessary to detect the communication quality between the first node device of the first blockchain and the third node device of the second blockchain in real time.
[0203] When the third node device of the second blockchain detects that communication between itself and the first node device of the first blockchain is interrupted, it needs to record the maximum number of data packets currently sent to the first node device of the first blockchain.
[0204] When the third node device of the second blockchain detects that communication between itself and the first node device of the first blockchain is restored, it does not need to resend the data to be acquired to the first node device of the first blockchain from the beginning. Instead, it can send data packets with numbers greater than the above-mentioned maximum number to the first node device of the first blockchain in sequence, thereby improving data transmission efficiency.
[0205] In S3016, the first node device of the first blockchain receives the data to be obtained sent by the third node device of the second blockchain.
[0206] In this embodiment, the first node device of the first blockchain can receive the data to be obtained sent by the third node device of the second blockchain, and store the second data summary of the data to be obtained in the first node device of the first blockchain in the smart contract corresponding to a certain contract address.
[0207] From the above, it can be seen that in this embodiment, a data transmission method is provided, in which the second node device of the relay chain stores the second data summary of the data to be obtained, so that the integrity and authenticity of the data to be obtained transmitted off-chain can be verified, thereby ensuring the integrity and authenticity of the data to be obtained, and thus improving the success rate of this cross-chain transaction.
[0208] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0209] See also Figure 5 , Figure 5 A schematic diagram of the structure of a first node device of a first blockchain provided by an embodiment of the present application is shown. Figure 5 As shown, the first node device 10 of the first blockchain provided in this embodiment may include: a first cross-chain request sending unit 11, a first receiving unit 12 and a first data sending unit 13. Among them:
[0210] The first cross-chain request sending unit 11 is used to send a first cross-chain request to the second node device of the relay chain, where the first cross-chain request carries a first contract address for storing a first data digest of the data to be transmitted in the third node device of the second blockchain.
[0211] The first receiving unit 12 is used to receive the point-to-point network address routing table returned by the second node device of the relay chain based on the first cross-chain request.
[0212] The first data sending unit 13 is used to send the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table after receiving the data transmission request sent by the third node device of the second blockchain, and send the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0213] In one embodiment of the present application, the first cross-chain request sending unit 11 specifically includes: a generating unit and a first cross-chain request sending sub-unit.
[0214] The generating unit is configured to generate a first data digest according to the data to be transmitted.
[0215] The first cross-chain request sending subunit is used to send a first cross-chain request to the second node device of the relay chain; wherein, the first cross-chain request also carries first cross-chain verification information, and the first cross-chain request is used to instruct the second node device of the relay chain to send the first data summary to the smart contract corresponding to the first contract address after verifying the cross-chain verification information.
[0216] In one embodiment of the present application, the first data sending unit 13 specifically includes: a dividing unit, a first data packet sending unit, a recording unit, and a second data packet sending unit.
[0217] The dividing unit is configured to divide the data to be transmitted into a plurality of data packets if the amount of the data to be transmitted is greater than a set threshold, and each of the data packets carries its own number.
[0218] The first data packet sending unit is used to send the multiple data packets in sequence according to their respective numbers to the third node device of the second blockchain through the point-to-point network address routing table.
[0219] The recording unit is used to record the maximum number of the data packets currently sent to the third node device of the second blockchain if communication between the first node device of the first blockchain and the third node device of the second blockchain is interrupted during the process of sending the multiple data packets in sequence according to their respective numbers.
[0220] The second data packet sending unit is used to send the data packets with numbers greater than the maximum number to the third node device of the second blockchain in sequence when the first node device of the first blockchain and the third node device of the second blockchain resume communication.
[0221] In one embodiment of the present application, the first node device 100 of the first blockchain further includes: a second cross-chain request sending unit, a second receiving unit, a summary sending unit, and a third receiving unit.
[0222] The second cross-chain request sending unit is used to send a second cross-chain request to the second node device of the relay chain, where the second cross-chain request carries a keyword corresponding to the data to be obtained and a second contract address of the second data digest of the data to be obtained in the third node device of the second blockchain.
[0223] The second receiving unit is used to receive a transaction receipt returned by the second node device of the relay chain based on the second cross-chain request; wherein, after the second node device of the relay chain sends the second cross-chain request to the third node device of the second blockchain, the transaction receipt is generated by the third node device of the second blockchain after detecting whether the data to be obtained exists according to the keyword, and is sent by the third node device of the second blockchain to the second node device of the relay chain; the transaction receipt carries a receipt type and a second data digest corresponding to the data to be obtained.
[0224] The summary sending unit is used to send a data acquisition request to the third node device of the second blockchain through the point-to-point network address routing table when the receipt type is a specified type.
[0225] The third receiving unit is used to receive the data to be obtained sent by the third node device of the second blockchain through the point-to-point network address routing table; wherein, the data to be obtained is obtained by the third node device of the second blockchain according to a preset acquisition method.
[0226] Figure 6 This is a schematic diagram of the structure of the first node device of the first blockchain provided in another embodiment of the present application. Figure 6 As shown, the first node device 2 of the first blockchain of this embodiment includes: at least one processor 20 ( Figure 6 Only one is shown in the figure) a processor, a memory 21, and a computer program 22 stored in the memory 21 and executable on the at least one processor 20, wherein the processor 20 implements the steps of any of the above-mentioned data transmission method embodiments when executing the computer program 22.
[0227] The first node device of the first blockchain may include, but is not limited to, a processor 20 and a memory 21. Those skilled in the art will understand that Figure 6 This is only an example of the first node device 2 of the first blockchain and does not constitute a limitation on the first node device 2 of the first blockchain.
[0228] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0229] In some embodiments, the memory 21 may be an internal storage unit of the first node device 2 of the first blockchain, such as the memory of the first node device 2 of the first blockchain. In other embodiments, the memory 21 may also be an external storage device of the first node device 2 of the first blockchain, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the first node device 2 of the first blockchain.
[0230] See also Figure 7 , Figure 7 FIG. 1 shows a schematic diagram of a second node device in a relay chain according to an embodiment of the present application. Figure 7 As shown, the second node device 30 of the relay chain provided in this embodiment may include: a receiving unit 31 and a sending unit 32.
[0231] The receiving unit 31 is used to receive a first cross-chain request sent by a first node device of the first blockchain, where the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of the second blockchain.
[0232] The sending unit 32 is used to send the peer-to-peer network address routing table to the first node device of the first blockchain based on the first cross-chain request, so as to instruct the first node device of the first blockchain to send the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table after receiving the data transmission request sent by the third node device of the second blockchain, and send the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
[0233] Figure 8 This is a structural diagram of the second node device of the relay chain provided in another embodiment of the present application. Figure 8 As shown, the second node device 4 of the relay chain of this embodiment includes: at least one processor 40 ( Figure 8 Only one is shown in the figure) a processor, a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 implements the steps of any of the above-mentioned data transmission method embodiments when executing the computer program 42.
[0234] The second node device of the relay chain may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that Figure 8 This is merely an example of the second node device 4 of the relay chain and does not constitute a limitation on the second node device 4 of the relay chain.
[0235] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0236] In some embodiments, the memory 41 may be an internal storage unit of the second node device 4 of the relay chain, such as a memory of the second node device 4 of the relay chain. In other embodiments, the memory 41 may also be an external storage device of the second node device 4 of the relay chain, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the second node device 4 of the relay chain.
[0237] See also Figure 9 , Figure 9 A schematic diagram of the structure of a third node device of a second blockchain provided in an embodiment of the present application is shown. Figure 9 As shown, the third node device 50 of the second blockchain provided in this embodiment may include: a receiving unit 51, a sending unit 52 and a writing unit 53. Among them:
[0238] The receiving unit 51 is used to receive a first cross-chain request sent by a second node device of the relay chain; the first cross-chain request carries a first contract address for storing a first data digest of the data to be transmitted in a third node device of the second blockchain.
[0239] The sending unit 52 is used to send a data transmission request to the first node device of the first blockchain, so as to instruct the first node device of the first blockchain to send the data to be transmitted and the first data summary to the third node device of the second blockchain according to the point-to-point network address routing table after receiving the data transmission request; wherein, the point-to-point network address routing table is sent to the first node device of the first blockchain by the second node device of the relay chain after receiving the first cross-chain request sent by the first node device of the first blockchain.
[0240] The writing unit 53 is used to store the received first data summary in the smart contract corresponding to the first contract address.
[0241] Figure 10 This is a schematic diagram of the structure of the third node device of the second blockchain provided in another embodiment of the present application. Figure 10As shown, the third node device 6 of the second blockchain of this embodiment includes: at least one processor 60 ( Figure 10 Only one is shown in the figure) a processor, a memory 61, and a computer program 62 stored in the memory 21 and executable on the at least one processor 60, wherein the processor 60 implements the steps of any of the above-mentioned data transmission method embodiments when executing the computer program 62.
[0242] The third node device of the second blockchain may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will understand that Figure 10 This is merely an example of the third node device 6 of the second blockchain and does not constitute a limitation on the third node device 6 of the second blockchain.
[0243] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0244] In some embodiments, the memory 61 may be an internal storage unit of the third node device 6 of the second blockchain, such as the memory of the third node device 6 of the second blockchain. In other embodiments, the memory 61 may also be an external storage device of the third node device 6 of the second blockchain, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the third node device 6 of the second blockchain.
[0245] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0246] An embodiment of the present application provides a computer program product. When the computer program product runs on a data transmission system, the data transmission system can implement the steps in the above-mentioned various method embodiments when the computer program product is executed.
[0247] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A data transmission method, applied to a first node device of a first blockchain, characterized in that: The method comprises: Performing a registration operation in a second node device of the relay chain; the registration operation includes registering a peer-to-peer network identity corresponding to the first node device of the first blockchain to the second node device of the relay chain; Sending a first cross-chain request to the second node device of the relay chain, where the first cross-chain request carries a first contract address for storing a first data digest of the data to be transmitted in a third node device of the second blockchain; Receiving a peer-to-peer network address routing table returned by the second node device of the relay chain based on the first cross-chain request; After receiving the data transmission request sent by the third node device of the second blockchain, the data to be transmitted is sent to the third node device of the second blockchain according to the point-to-point network address routing table, and the first data summary is sent to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
2. The data transmission method according to claim 1, wherein: The sending a first cross-chain request to the second node device of the relay chain includes: generating a first data summary according to the data to be transmitted; Sending a first cross-chain request to the second node device of the relay chain; wherein the first cross-chain request also carries first cross-chain verification information, and the first cross-chain request is used to instruct the second node device of the relay chain to send the first data summary to the smart contract corresponding to the first contract address after verifying the cross-chain verification information.
3. The data transmission method according to claim 1, wherein: After receiving the data transmission request sent by the third node device of the second blockchain, sending the data to be transmitted to the third node device of the second blockchain according to the point-to-point network address routing table includes: If the amount of the data to be transmitted is greater than a set threshold, the data to be transmitted is divided into a plurality of data packets, each of which carries its own number; Sending the plurality of data packets sequentially to the third node device of the second blockchain according to their respective numbers through the point-to-point network address routing table; In the process of sending the multiple data packets in sequence according to their respective numbers to the third node device of the second blockchain, if communication between the first node device of the first blockchain and the third node device of the second blockchain is interrupted, then the maximum number of the data packets currently sent to the third node device of the second blockchain is recorded; When the first node device of the first blockchain and the third node device of the second blockchain resume communication, the data packets with numbers greater than the maximum number are sent to the third node device of the second blockchain in sequence.
4. The data transmission method according to claim 1, wherein: Also includes: Sending a second cross-chain request to the second node device of the relay chain, where the second cross-chain request carries a keyword corresponding to the data to be obtained and a second contract address of a second data digest of the data to be obtained in the third node device of the second blockchain; receiving a transaction receipt returned by the second node device of the relay chain based on the second cross-chain request; wherein the transaction receipt is generated by the second node device of the relay chain after sending the second cross-chain request to the third node device of the second blockchain, and the third node device of the second blockchain detects whether the data to be obtained exists according to the keyword, and is sent by the third node device of the second blockchain to the second node device of the relay chain; the transaction receipt carries a receipt type and a second data digest corresponding to the data to be obtained; When the receipt type is a specified type, sending a data acquisition request to a third node device of the second blockchain through the peer-to-peer network address routing table; Receive the data to be obtained sent by the third node device of the second blockchain through the point-to-point network address routing table; wherein, the data to be obtained is obtained by the third node device of the second blockchain according to a preset acquisition method.
5. A data transmission method, applied to a second node device in a relay chain, characterized in that: The method comprises: Performing a registration operation corresponding to a first node device of a first blockchain; the registration operation comprising registering a peer-to-peer network identity corresponding to the first node device of the first blockchain; Receiving a first cross-chain request sent by a first node device of the first blockchain, where the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of the second blockchain; Based on the first cross-chain request, the peer-to-peer network address routing table is sent to the first node device of the first blockchain to instruct the first node device of the first blockchain to send the data to be transmitted to the third node device of the second blockchain according to the peer-to-peer network address routing table after receiving the data transmission request sent by the third node device of the second blockchain, and to send the first data summary to the smart contract corresponding to the first contract address deployed in the third node device of the second blockchain.
6. The data transmission method according to claim 5, wherein: Also includes: Receiving a second cross-chain request sent by the first node device of the first blockchain; The second cross-chain request carries a keyword corresponding to the data to be obtained and a second contract address of a second data digest of the data to be obtained in a third node device of the second blockchain; Sending the peer-to-peer network address routing table to a first node device of the first blockchain and a third node device of the second blockchain based on the second cross-chain request, and sending the second cross-chain request to the third node device of the second blockchain; receiving a transaction receipt sent by a third node device of the second blockchain; the transaction receipt is returned to the second node device of the relay chain by the third node device of the second blockchain after detecting the existence of the data to be acquired based on the keyword; the transaction receipt carries a receipt type and a second data digest corresponding to the data to be acquired; Send the transaction receipt to the first node device of the first blockchain.
7. A data transmission method, applied to a third node device of a second blockchain, characterized in that: The method comprises: Performing a registration operation in a second node device of the relay chain; the registration operation includes registering a peer-to-peer network identity corresponding to a third node device of the second blockchain to the second node device of the relay chain; Receiving a first cross-chain request sent by a second node device of the relay chain; the first cross-chain request carries a first contract address for storing a first data digest of data to be transmitted in a third node device of the second blockchain; Sending a data transmission request to a first node device of a first blockchain, instructing the first node device of the first blockchain to send the data to be transmitted and the first data digest to a third node device of the second blockchain according to a peer-to-peer network address routing table after receiving the data transmission request; wherein the peer-to-peer network address routing table is sent by the second node device of the relay chain to the first node device of the first blockchain after receiving the first cross-chain request sent by the first node device of the first blockchain; The received first data digest is stored in a smart contract corresponding to the first contract address.
8. The data transmission method according to claim 7, wherein: Also includes: Receiving a second cross-chain request sent by a second node device of the relay chain; the second cross-chain request carries a keyword corresponding to the data to be obtained and a second contract address of a second data digest of the data to be obtained in a third node device of the second blockchain; If the existence of the data to be obtained is detected based on the keyword, determining that the receipt type of the transaction receipt is a specified type, and obtaining the data to be obtained; generating a second data digest according to the data to be acquired, generating the transaction receipt according to the second data digest and the receipt type of the transaction receipt, and sending the transaction receipt to the second node device of the relay chain; receiving, through a peer-to-peer network address routing table, a data acquisition request sent by a first node device of the first blockchain; The data to be obtained is sent to the first node device of the first blockchain according to the peer-to-peer network address routing table.
9. A node device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it implements the data transmission method according to any one of claims 1 to 4, or the data transmission method according to claims 5-6, or the data transmission method according to claims 7-8.
10. A data transmission system, characterized in that: comprising a first blockchain consisting of at least one node device, a relay chain consisting of at least one node device, and a second blockchain consisting of at least one node device; The node device of the first blockchain is used to execute the data transmission method according to any one of claims 1 to 4; The node device of the relay chain is used to perform the data transmission method according to any one of claims 5-6; The node device of the second blockchain is used to execute the data transmission method according to any one of claims 7 to 8.
Citation Information
Patent Citations
Cross-chain method and intermediate system for on-chain and off-chain combined file block chain
CN114172730A