WO2022205962A1 - 一种基于中继设备网络跨链读取数据的方法和装置 - Google Patents

一种基于中继设备网络跨链读取数据的方法和装置 Download PDF

Info

Publication number
WO2022205962A1
WO2022205962A1 PCT/CN2021/133089 CN2021133089W WO2022205962A1 WO 2022205962 A1 WO2022205962 A1 WO 2022205962A1 CN 2021133089 W CN2021133089 W CN 2021133089W WO 2022205962 A1 WO2022205962 A1 WO 2022205962A1
Authority
WO
WIPO (PCT)
Prior art keywords
relay device
data
blockchain
relay
read request
Prior art date
Application number
PCT/CN2021/133089
Other languages
English (en)
French (fr)
Inventor
邱鸿霖
余逸荣
Original Assignee
蚂蚁区块链科技(上海)有限公司
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蚂蚁区块链科技(上海)有限公司, 支付宝(杭州)信息技术有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2022205962A1 publication Critical patent/WO2022205962A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the embodiments of this specification relate to the field of blockchain technology, and more particularly, to a method and apparatus for reading data across chains based on a relay device network.
  • Blockchain technology also known as distributed ledger technology, is a decentralized distributed database technology characterized by decentralization, openness, transparency, immutability, and trustworthiness. Each data of the blockchain will be broadcast to the blockchain nodes of the entire network, and each full node has a full amount of consistent data.
  • many different types of chains have emerged, which are applied in the fields of finance, health care, supply chain, asset management and traceability.
  • most on-chain applications encrypted currencies or smart contracts
  • How to make different types of chains cooperate to realize the circulation of value has become the direction of exploration.
  • a request for cross-chain reading of data in a second blockchain is issued in the first blockchain, and a relay device off-chain obtains the request from the first blockchain, Accordingly, the second blockchain reads the corresponding data and provides the data to the first blockchain.
  • the blockchains connected to the same relay device can read each other's data, and the computing power of the relay device is limited, so the number of connected blockchains is also limited.
  • one aspect of this specification provides a method for reading data across a chain based on a relay device network, where the relay device network includes a first relay device and a second relay device, and the first relay device network includes a first relay device and a second relay device.
  • the relay device is connected to the first blockchain and stores a first look-up table.
  • the first look-up table records the blockchains connected to each of a predetermined number of relay devices.
  • Blockchain connection the method is performed by the first relay device, including: obtaining a read request for the first data in the second blockchain from the first blockchain; determining whether the local connecting with the second blockchain; in the case of determining that the local is not connected to the second blockchain, sending the read request to the predetermined number of relays based on the first lookup table at least one relay device in the device for sending the read request to the second relay device; receiving the first data from one relay device in the predetermined number of relay devices; The first data is provided to the first blockchain.
  • the second relay device is included in the predetermined number of relay devices, wherein the read request is sent to the predetermined number of relay devices based on the first lookup table At least one relay in the device includes, based on the first lookup table, sending the read request to the second relay.
  • the second relay device is not included in the predetermined number of relay devices, wherein the read request is sent to the predetermined number of relay devices based on the first lookup table At least one of the relay devices includes, based on the first look-up table, sending the read request to a third relay device of the predetermined number of relay devices for use in sending the read request to a third one of the predetermined number of relay devices.
  • the fetch request is sent to the second relay device.
  • the method further comprises, in the event that it is determined to be locally connected to the second blockchain, reading the first data from the second blockchain.
  • receiving the first data from a relay device of the predetermined number of relay devices includes receiving the first data and a certificate thereof from a relay device of the predetermined number of relay devices data
  • providing the first data to the first blockchain includes providing the first data and its certification data to the first blockchain.
  • the first data is any of the following data in the second blockchain: block header data, transaction data, receipt data, and account status data.
  • Another aspect of the present specification provides a method for reading data across a chain based on a network of relay devices, where the network of relay devices includes a first relay device and a second relay device, the first relay device is connected to the second relay device.
  • a blockchain connection the second relay device is connected to the second blockchain, and stores a second look-up table, the second look-up table records the respective connected blockchains of a predetermined number of relay devices , the method is performed by the second relay device, comprising: receiving a read request for the first data in the second blockchain from the relay device network, wherein the read request is performed by The first relay device obtains from the first blockchain; reads the first data from the second blockchain based on the read request; A piece of data is sent to at least one relay device among the predetermined number of relay devices for sending the first data to the first relay device.
  • Another aspect of the present specification provides an apparatus for reading data across a chain based on a network of relay devices, where the network of relay devices includes a first relay device and a second relay device, and the first relay device is connected to a second relay device.
  • a blockchain is connected and stores a first look-up table, the first look-up table records the respective connected blockchains of a predetermined number of relay devices, and the second relay device is connected to the second blockchain , the apparatus is deployed on the first relay device, and includes: an acquisition unit configured to acquire a read request for the first data in the second blockchain from the first blockchain; determine The unit is configured to determine whether the local is connected to the second blockchain; the sending unit is configured to, in the case of determining that the local is not connected to the second blockchain, based on the first lookup table, send The read request is sent to at least one relay device in the predetermined number of relay devices, so as to be used for sending the read request to the second relay device; the receiving unit is configured to: One relay device in the predetermined number of relay devices receives the
  • the predetermined number of relay devices includes the second relay device, wherein the sending unit is further configured to send the read request based on the first lookup table to the second relay device.
  • the second relay device is not included in the predetermined number of relay devices, wherein the sending unit is further configured to, based on the first lookup table, send the read request and sent to a third relay device among the predetermined number of relay devices for sending the read request to the second relay device.
  • the apparatus further includes a reading unit configured to read the first blockchain from the second blockchain if it is determined to be locally connected to the second blockchain data.
  • the receiving unit is further configured to receive the first data and its certification data from one relay device in the predetermined number of relay devices, and the providing unit is further configured to: The first data and its certification data are provided to the first blockchain.
  • Another aspect of the present specification provides an apparatus for reading data across a chain based on a network of relay devices, where the network of relay devices includes a first relay device and a second relay device, and the first relay device is connected to a second relay device.
  • a blockchain connection the second relay device is connected to the second blockchain, and stores a second look-up table, the second look-up table records the respective connected blockchains of a predetermined number of relay devices , the apparatus is deployed on the second relay device, and includes: a receiving unit configured to receive a read request for the first data in the second blockchain from the relay device network, wherein, The read request is obtained from the first blockchain by the first relay device; a reading unit is configured to read the first blockchain from the second blockchain based on the read request data; a sending unit configured to send the first data to at least one relay device in the predetermined number of relay devices based on the second lookup table, so as to send the first data to the first relay device.
  • the reading unit is further configured to read the first data and its certification data from the second blockchain based on the read request
  • the sending unit is further configured to: The first data and its certification data are sent to at least one relay device of the predetermined number of relay devices based on the second lookup table.
  • Another aspect of the present specification provides a computer-readable storage medium on which a computer program or instruction is stored, and when the computer program or instruction is executed in a computer, causes the computer to execute any one of the above methods.
  • Another aspect of the present specification provides a computing device, including a memory and a processor, where a computer program or instruction is stored in the memory, and the processor implements any one of the above methods when executing the computer program or instruction.
  • a relay device network supporting routing can be implemented under the chain of the blockchain, and a cross-chain network topology can be formed based on the relay device network.
  • a cross-chain network topology can be formed based on the relay device network.
  • FIG. 1 shows a schematic diagram of a cross-chain system according to an embodiment of the present specification
  • FIG. 2 schematically shows a sequence diagram of a method for reading data across chains according to an embodiment of the present specification
  • FIG. 3 shows an apparatus 300 for reading data across chains based on a relay device network according to an embodiment of the present specification
  • FIG. 4 shows an apparatus 400 for reading data across chains based on a relay device network according to an embodiment of the present specification.
  • FIG. 1 shows a schematic diagram of a cross-chain system according to an embodiment of the present specification.
  • the cross-chain system includes a first blockchain 11 , a relay device network 12 and a second blockchain 13 .
  • the relay device network 12 includes a plurality of relay devices with a predetermined connection relationship, and FIG. 1 only schematically shows the first relay device 121 and the second relay device 122 , wherein the clouds shown in dotted lines represent , the first relay device 121 and the second relay device 122 may be directly connected, or may be connected through other relay devices.
  • Each relay device in the relay device network 12 is connected to at least one blockchain, and each relay device stores a look-up table that records the correspondence of a predetermined number of relay devices to the blockchain to which it is connected. Therefore, through the plurality of relay devices in the relay device network 12, the relay device network can be connected with more blockchains.
  • 1 schematically shows that the first blockchain 11 is connected to the first relay device 121 , and the second blockchain 13 is connected to the second relay device 122
  • a first contract and a request issuing contract are deployed in the first blockchain 11 .
  • the first contract is, for example, used to calculate the account balance of account A in the second blockchain.
  • the transfer transaction is recorded in the second blockchain 13, for example, by receipt n.
  • the request issuing contract is called in the first contract to issue a read request for reading the receipt n in the second blockchain 13 .
  • a receipt m is stored in the first blockchain 11, and the receipt m includes the read request.
  • the first relay device 121 After depositing the receipt m in the first blockchain 11, the first relay device 121 can obtain the receipt m from the first blockchain 11, thereby obtaining the read request. Based on the content in the read request, the first relay device 121 can determine that the read request is used to request to read the receipt n in the second blockchain 13, and the first relay device 121 determines whether it is related to the second blockchain. 13 is connected, if connected with the second blockchain 13, the first relay device 121 can directly read the receipt n from the second blockchain 13 (this situation is not shown in FIG. 1 ). If the first relay device 121 determines that it is not connected to the second blockchain 13, it can determine the routing path to the second blockchain 13 by reading the lookup table as shown in FIG. 1, so that the first intermediate The relay device 121 may send the read request to the relay device network 12 to be finally sent to the second relay device 122 .
  • the second relay device 122 After receiving the read request, the second relay device 122 reads the receipt n and its Simple Payment Verification (Spv) proof data from the second blockchain 13, and sends the receipt n and its Spv proof data back to the first Relay device 121 . Afterwards, the first relay device 121 may transmit the receipt n and its Spv proof data back to the requesting contract by sending a transaction (not shown) to the first blockchain 11, wherein in the transaction, the receipt n and Its Spv proof data is the calling request to issue the contract with incoming parameters. After receiving the receipt n and its Spv proof data, the request issuing contract verifies the receipt n through the Spv proof data. After the verification is passed, the first contract is called with the receipt n as the incoming parameter, thereby providing the receipt n to the first contract. contract.
  • Spv Simple Payment Verification
  • the relay device is not limited to the form shown in FIG. 1
  • the first contract is not limited to the above-mentioned contract, and so on.
  • FIG. 2 schematically shows a sequence diagram of a method for reading data across chains according to an embodiment of the present specification.
  • the first blockchain 11 and the second blockchain 13 may be any blockchain, such as a Bitcoin chain, an Ethereum chain, a Hyperledger Fabric blockchain, and the like.
  • Different blockchains have different on-chain data proof methods.
  • the Fabric chain uses the endorsement node signature method
  • the Ethereum chain uses the Spv proof method. The following description will be made by taking the first blockchain 11 as an example of the Ethereum chain.
  • step S202 the first relay device 121 obtains a read request from the first blockchain 11 .
  • the first contract in the first blockchain 11 provides the read request as an incoming parameter to the request-issuing contract by invoking the request-issuing contract, so that by executing the request-issuing contract, the first blockchain A receipt m is stored in 11, the read request is included in the receipt m, eg, the read request is included in a data field in a log of a predetermined name of the receipt m.
  • the data structure of the read request can be preset, and the data structure includes, for example, a blockchain identifier of the request data, a receipt identifier, and the like.
  • the read request wishes to read the receipt n in the second blockchain 13, so, in the content of the read request, the predetermined data structure may include: the chain identifier of the second blockchain 13, and
  • the identifier of the receipt n for example, the identifier of the receipt n includes the identifier of the block where the receipt n is located (for example, the block number, or the hash value of the block header, etc.), the number of the receipt n in the block, and so on.
  • the read request is not limited to a request to read a receipt in the second blockchain 13, but can read arbitrary data in the second blockchain 13, including, for example, provable (ie, consensus) data , such as block headers, transaction data, account status data, etc.
  • provable data such as block headers, transaction data, account status data, etc.
  • the commonality of these provable data is that they are all stored in the second blockchain after the consensus of multiple nodes in the second blockchain 13, and, based on the data structure of blocks, these can be verified through the Spv verification method.
  • the data is indeed the data in the second blockchain.
  • a field corresponding to the data type may be included to indicate the data type of the data of the read request, such as block header type, transaction data type, receipt data type. and many more.
  • the first relay device 121 can monitor the receipt corresponding to the request to issue the contract, and whenever it is determined that the receipt generated by executing the request to issue the contract is stored in the first block chain 11, the first block The receipt is read in the chain 11, and the data read request in the receipt is correspondingly read from a log with a predetermined name in the receipt.
  • the first blockchain 11 can actively push information, and each time it is determined that the first blockchain 11 stores a receipt generated by executing the contract issued by the request, the receipt is actively pushed to the first relay device 121.
  • step S204 the first relay device 121 determines whether the local is connected to the second blockchain 13.
  • the first relay device 121 After the first relay device 121 obtains the receipt m from the first blockchain 11, it can read the read request therein. Based on the content of the blockchain identification field of the request data in the read request, the read request can be determined. The fetch request is used to request to read data in the second blockchain 13 .
  • Blockchain ID connection address Blockchain ID1 IP address 1, port/IP address 2, port/... Blockchain ID2 IP address 3, port/IP address 4, port/... ... ...
  • the blockchain ID on the left is the identifier of each blockchain connected to the first relay device 121
  • the connection address on the right is the connection address of at least one node in the corresponding blockchain .
  • the first relay device 121 can determine whether the block chain identifier (block chain ID) of the second block chain 13 is recorded in the table 1 by querying the table 1. Any one of the connection addresses corresponding to the blockchain 13 is connected to a node corresponding to the connection address in the second blockchain 13 for reading data in the second blockchain 13 . If the block chain ID of the second block chain 13 is not recorded in Table 1, it means that the first relay device 121 is not directly connected to the second block chain 13, so it is necessary to pass the off-chain relay device's Transit to establish a connection with the second blockchain.
  • block chain ID block chain ID
  • step S206 in the case where the first relay device 121 determines that the local is not connected to the second blockchain 13, the first relay device 121 directly or indirectly sends the read request to the second blockchain based on the local lookup table Following device 122.
  • the number of relay devices and blockchains is small, so that the correspondence between all relay devices and their respective connected blockchains can be recorded in a look-up table.
  • the same look-up table can be stored in each relay device in the relay device network.
  • Table 2 schematically shows a look-up table according to this embodiment.
  • the first relay device 121 can determine that the second blockchain 13 is connected to the second relay device 122 .
  • the first relay device 121 may also record the connection address of each relay device in Table 2, or the first relay device 121 may record the connection address of each relay device in another table, so that the first relay device 121
  • the connection address of the second relay device 122 can be obtained locally, and the second relay device 122 can be connected to send the read request to the second relay device 122.
  • Relay device 122 .
  • the number of blockchains is large, and the number of relay devices in the relay device network is also large, in which case each relay device is not necessarily related to other relay devices in the relay device network.
  • Each relay device is connected.
  • the first relay device 121 is not directly connected to the second relay device 122. Therefore, the first relay device 121 and the second relay device 122 need to be relayed by other relay devices.
  • indirect connection That is to say, each relay device is only connected to a predetermined number of relay devices in the relay device network, and the look-up table stored in each relay device only records the relay device connected to the relay device and the blockchain. Therefore, the lookup tables of each relay device are different tables.
  • Table 3 schematically shows the first middle A lookup table in device 121 is followed.
  • Table 4 schematically shows a lookup table in the relay device ID3 according to this embodiment.
  • the first relay device 121 can send the read request to at least one relay device connected to it based on a predetermined routing algorithm, so as to pass the other relays in the relay device network.
  • the relay of the device finally sends the read request to the second relay device 122 .
  • the first relay device 121 can calculate a routing path based on the DHT algorithm so that the read request is sent to the second relay device 122 with the least number of relays.
  • step S208 the second relay device 122 reads the receipt n and its proof from the second blockchain 13.
  • a client of the second blockchain 13 is installed in the second relay device 122, the client is provided with the above-mentioned data table, and the interface of the client directly displays the information of the connectable blockchain.
  • option which includes the identifier of the second blockchain 13, so that the business personnel corresponding to the second relay device 122 can directly click on the identifier of the second blockchain 13 to connect to the second blockchain through the client Chain 13.
  • a button or input box for reading data will be displayed on the interface of the client, and the business personnel can read the second blockchain by clicking or inputting in the client 13 for the corresponding data.
  • the Spv proof data is the data used to verify the data.
  • the Spv proof data of receipt n includes: the block header hash value of block 1, the receipt tree root hash value included in block 1 Hash value, hash value of each other node in the tree path from receipt m to the root node in the receipt tree.
  • the second relay device 122 reads the receipt n and its certification data is only an example description of the embodiment of the present specification, and is not used to limit the scope of the embodiment of the present specification.
  • the second relay device 122 may only read receipt n for transmission back to the first blockchain 11.
  • the second relay device 122 may only read the data requested to be read without reading its certification data.
  • the first relay device 121 is directly connected with the second relay device 122, so that the second relay device 122 can directly send the receipt n and its Spv proof data to the first relay device 122.
  • Relay device 121 When sending, the second relay device 122 marks the sent data as request data corresponding to the read request, so as to facilitate subsequent processing by the first relay device 121 .
  • the first relay device 121 sends the read request to the second relay device 122 through the relay of other relay devices. During the sending process of each relay device, an additional read request may be added.
  • On the transmission path from the first relay device 121 to the second relay device 122 for example, its transmission path is the first relay device 121 ⁇ the relay device ID3 ⁇ the second relay device 122, so that the second relay device 122 The relay device 122 may transmit the read data back to the first relay device 121 based on the transmission path.
  • the read request includes the chain identifier (ie, the first blockchain 11 ) of the blockchain requesting to be issued, and the second relay device 122 can determine, based on its local lookup table, to place the receipt n and its The Spv proof data is provided to the routing path of the first blockchain, so that the receipt n and its Spv proof data are sent back to the first relay device 121 through the routing path.
  • the chain identifier ie, the first blockchain 11
  • the second relay device 122 can determine, based on its local lookup table, to place the receipt n and its The Spv proof data is provided to the routing path of the first blockchain, so that the receipt n and its Spv proof data are sent back to the first relay device 121 through the routing path.
  • the second relay device 122 only reads the receipt n, and only sends the receipt n directly or indirectly to the first relay device 121 .
  • step S212 the first relay device 121 provides the receipt n and its Spv proof data to the first blockchain 11.
  • the first relay device 121 provides the first blockchain 11 with a transaction by sending a transaction to the first blockchain 11 after receiving the receipt n and its Spv proof data from the relay device network. Receipt n and its Spv proof data. In this transaction, the contract is invoked with receipt n and its Spv proof data as incoming parameters. Specifically, when the receipt n and its Spv proof data are passed in, it is also indicated that it corresponds to the read request.
  • the request-issuing contract when executed in the first blockchain 11, after the receipt n is verified by using the Spv proof data, the request-issuing contract calls back the first contract based on the correspondence between the pre-recorded read request and the first contract , so that the receipt n is provided to the first contract, that is, the reading process of cross-chain data is completed.
  • the process of verifying receipt n by the Spv proof data may specifically include the following steps: calculating the hash value of the obtained receipt n; calculating the block based on the hash values of other nodes in the tree path included in the Spv proof data The root hash of the receipt tree in 1; compare the calculated root hash with the root hash of the receipt tree of block 1 included in the Spv proof data to determine whether receipt m is the receipt in block 1 m; and, based on the Spv proof data including the block header hash value of block 1 and the relevant information of the genesis block of the second blockchain 13 preset in the request issuing contract (for example, the genesis block hash value) value) to determine whether block 1 is a block in the second block chain 13, so that the authenticity of receipt n can be verified.
  • the first relay device 121 only receives the data 2 from the network of relay devices, the first relay device 121 only provides the receipt n to the first blockchain 11 .
  • FIG. 3 shows an apparatus 300 for reading data across chains based on a relay device network according to an embodiment of the present specification.
  • the relay device network includes a first relay device and a second relay device.
  • the first relay device is connected to the first blockchain and stores a first look-up table.
  • the first look-up table records the blockchains connected to each of a predetermined number of relay devices, and the second relay device is connected to the first look-up table.
  • the device is deployed on the first relay device, and includes: an acquisition unit 31, configured to acquire, from the first blockchain, the first data in the second blockchain
  • the determining unit 32 is configured to determine whether the local is connected to the second blockchain
  • the sending unit 33 is configured to, in the case of determining that the local is not connected to the second blockchain, based on the first lookup table, for sending the read request to at least one relay device in the predetermined number of relay devices, so as to send the read request to the second relay device
  • the receiving unit 34 is configured to receive first data from one relay device in the predetermined number of relay devices
  • the providing unit 35 is configured to provide the first data to the first blockchain.
  • the predetermined number of relay devices includes the second relay device, wherein the sending unit 33 is further configured to, based on the first lookup table, send the read request sent to the second relay device.
  • the apparatus further includes a reading unit 36 configured to, in the case of determining that the local connection with the second blockchain is determined, read the first blockchain from the second blockchain a data.
  • the receiving unit 34 is further configured to receive the first data and its certification data from one relay device in the predetermined number of relay devices, and the providing unit 35 is further configured to: The first data and its certification data are provided to the first blockchain.
  • FIG. 4 shows an apparatus for reading data across chains based on a relay device network according to an embodiment of the present specification.
  • the relay device network includes a first relay device and a second relay device.
  • the first relay device network includes a first relay device and a second relay device.
  • the relay device is connected to the first blockchain, the second relay device is connected to the second blockchain, and stores a second look-up table, and the second look-up table records that a predetermined number of relay devices are connected to each other.
  • the apparatus is deployed on the second relay device, and includes: a receiving unit 41, configured to receive, from the relay device network, a read of the first data in the second blockchain read request, wherein the read request is obtained from the first blockchain by the first relay device; the reading unit 42 is configured to, based on the read request, obtain from the second blockchain reading the first data; the sending unit 43 is configured to send the first data to the relay device network based on the second lookup table, so as to send the first data and its certification data sent to the first relay device.
  • a receiving unit 41 configured to receive, from the relay device network, a read of the first data in the second blockchain read request, wherein the read request is obtained from the first blockchain by the first relay device
  • the reading unit 42 is configured to, based on the read request, obtain from the second blockchain reading the first data
  • the sending unit 43 is configured to send the first data to the relay device network based on the second lookup table, so as to send the first data and its certification data sent to the first relay device.
  • the reading unit 42 is further configured to read the first data and its certification data from the second blockchain based on the read request
  • the sending unit 43 is further configured to to send the first data and its certification data to at least one relay device in the predetermined number of relay devices based on the second lookup table.
  • Another aspect of the present specification provides a computer-readable storage medium on which a computer program or instruction is stored, and when the computer program or instruction is executed in a computer, causes the computer to execute any one of the above methods.
  • Another aspect of the present specification provides a computing device, including a memory and a processor, where a computer program or instruction is stored in the memory, and the processor implements any one of the above methods when executing the computer program or instruction.
  • a software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.
  • RAM random access memory
  • ROM read only memory
  • electrically programmable ROM electrically erasable programmable ROM
  • registers hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本说明书实施例提供了一种基于中继设备网络跨链读取数据的方法和装置,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接、并存储有第一查找表,所述第二中继设备与第二区块链连接,所述方法由所述第一中继设备执行,包括:从所述第一区块链获取对所述第二区块链中的第一数据的读取请求;确定本地是否与所述第二区块链连接;在确定本地不与所述第二区块链连接的情况中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述读取请求发送给所述第二中继设备;从所述预定数目个中继设备中的一个中继设备接收第一数据;将所述第一数据提供给所述第一区块链。

Description

一种基于中继设备网络跨链读取数据的方法和装置 技术领域
本说明书实施例涉及区块链技术领域,更具体地,涉及一种基于中继设备网络跨链读取数据的方法和装置。
背景技术
区块链技术也被称之为分布式账本技术,是一种去中心化的分布式数据库技术,其特点是去中心化、公开透明、不可篡改、可信任。区块链的每笔数据,都会广播到全网的区块链节点,每个全节点都有全量的、一致的数据。随着区块链技术的火热,出现了许多不同类型的链,应用在金融、健康医疗、供应链、资产管理和溯源等领域。然而大部分链上应用(加密货币或者智能合约)都无法跨越当前链的边界,不能与其他链协同合作实现价值的流通,从而限制了区块链的发挥空间。如何能让不同类型的链协同合作实现价值的流通成了探索的方向。
在现有的一种跨链技术中,在第一区块链中发出跨链读取第二区块链中的数据的请求,链下的中继设备从第一区块链获取该请求,从而第二区块链读取相应的数据,并将数据提供给第一区块链。在该技术中,只有连接在同一个中继设备的区块链之间才可以相互读取对方的数据,而中继设备的计算能力有限,因此,其连接的区块链数目也是有限的。
因此,需要一种更有效的跨链读取数据的方案。
发明内容
本说明书实施例旨在提供一种更有效的跨链读取数据的方案,以解决现有技术中的不足。
为实现上述目的,本说明书一个方面提供一种基于中继设备网络跨链读取数据的方法,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接、并存储有第一查找表,所述第一查找表中记录了预定数目个中继设备各自连接的区块链,所述第二中继设备与第二区块链连接,所述方法由所述第一中继设备执行,包括:从所述第一区块链获取对所述第二区块链中的第一数据的读取请求;确定本 地是否与所述第二区块链连接;在确定本地不与所述第二区块链连接的情况中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述读取请求发送给所述第二中继设备;从所述预定数目个中继设备中的一个中继设备接收第一数据;将所述第一数据提供给所述第一区块链。
在一种实施方式中,所述预定数目个中继设备中包括所述第二中继设备,其中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备包括,基于所述第一查找表,将所述读取请求发送给所述第二中继设备。
在一种实施方式中,所述预定数目个中继设备中不包括所述第二中继设备,其中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备包括,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的第三中继设备,以用于将所述读取请求发送给所述第二中继设备。
在一种实施方式中,所述方法还包括,在确定本地与所述第二区块链连接的情况中,从所述第二区块链读取所述第一数据。
在一种实施方式中,从所述预定数目个中继设备中的一个中继设备接收第一数据包括,从所述预定数目个中继设备中的一个中继设备接收第一数据及其证明数据,将所述第一数据提供给所述第一区块链包括,将所述第一数据及其证明数据提供给所述第一区块链。
在一种实施方式中,所述第一数据为所述第二区块链中的以下任一种数据:区块头数据、交易数据、收据数据、账户状态数据。
本说明书另一方面提供一种基于中继设备网络跨链读取数据的方法,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接,所述第二中继设备与第二区块链连接、并存储有第二查找表,所述第二查找表中记录了预定数目个中继设备各自连接的区块链,所述方法由所述第二中继设备执行,包括:从所述中继设备网络接收对所述第二区块链中的第一数据的读取请求,其中,所述读取请求由所述第一中继设备从所述第一区块链获取;基于所述读取请求从所述第二区块链读取所述第一数据;基于所述第二查找表将所述第一数据发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述第一数据发送给所述第一中继设备。
在一种实施方式中,基于所述读取请求从所述第二区块链读取所述第一数据包括,基于所述读取请求从所述第二区块链读取所述第一数据及其证明数据,基于所述第二查 找表将所述第一数据发送给所述预定数目个中继设备中的至少一个中继设备包括,基于所述第二查找表将所述第一数据及其证明数据发送给所述预定数目个中继设备中的至少一个中继设备。
本说明书另一方面提供一种基于中继设备网络跨链读取数据的装置,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接、并存储有第一查找表,所述第一查找表中记录了预定数目个中继设备各自连接的区块链,所述第二中继设备与第二区块链连接,所述装置部署于所述第一中继设备,包括:获取单元,配置为,从所述第一区块链获取对所述第二区块链中的第一数据的读取请求;确定单元,配置为,确定本地是否与所述第二区块链连接;发送单元,配置为,在确定本地不与所述第二区块链连接的情况中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述读取请求发送给所述第二中继设备;接收单元,配置为,从所述预定数目个中继设备中的一个中继设备接收第一数据;提供单元,配置为,将所述第一数据提供给所述第一区块链。
在一种实施方式中,所述预定数目个中继设备中包括所述第二中继设备,其中,所述发送单元还配置为,基于所述第一查找表,将所述读取请求发送给所述第二中继设备。
在一种实施方式中,所述预定数目个中继设备中不包括所述第二中继设备,其中,所述发送单元还配置为,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的第三中继设备,以用于将所述读取请求发送给所述第二中继设备。
在一种实施方式中,所述装置还包括,读取单元,配置为,在确定本地与所述第二区块链连接的情况中,从所述第二区块链读取所述第一数据。
在一种实施方式中,所述接收单元还配置为,从所述预定数目个中继设备中的一个中继设备接收第一数据及其证明数据,所述提供单元还配置为,将所述第一数据及其证明数据提供给所述第一区块链。
本说明书另一方面提供一种基于中继设备网络跨链读取数据的装置,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接,所述第二中继设备与第二区块链连接、并存储有第二查找表,所述第二查找表中记录了预定数目个中继设备各自连接的区块链,所述装置部署于所述第二中继设备,包括:接收单元,配置为,从所述中继设备网络接收对所述第二区块链中的第一数据的读取请求,其中,所述读取请求由所述第一中继设备从所述第一区块链获取;读取单元,配置为,基 于所述读取请求从所述第二区块链读取所述第一数据;发送单元,配置为,基于所述第二查找表将所述第一数据发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述第一数据发送给所述第一中继设备。
在一种实施方式中,所述读取单元还配置为,基于所述读取请求从所述第二区块链读取所述第一数据及其证明数据,所述发送单元还配置为,基于所述第二查找表将所述第一数据及其证明数据发送给所述预定数目个中继设备中的至少一个中继设备。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序或指令,所述处理器在执行所述计算机程序或指令时,实现上述任一项方法。
通过根据本说明书实施例的跨链读取数据的方案,可在区块链的链下实现支持路由的中继设备网络,可基于该中继设备网络形成跨链网络拓扑,该跨链网络拓扑支持大规模跨链网络连接,从而区块链通过接入中继设备即可在跨链网络拓扑中寻址区块链账本信息。
附图说明
通过结合附图描述本说明书实施例,可以使得本说明书实施例更加清楚:
图1示出根据本说明书实施例的跨链系统的示意图;
图2示意示出根据本说明书实施例的跨链读取数据的方法时序图;
图3示出根据本说明书实施例的一种基于中继设备网络跨链读取数据的装置300;
图4示出根据本说明书实施例的一种基于中继设备网络跨链读取数据的装置400。
具体实施方式
下面将结合附图描述本说明书实施例。
图1示出根据本说明书实施例的跨链系统的示意图。如图1所示,所述跨链系统包括第一区块链11、中继设备网络12和第二区块链13。其中,所述中继设备网络12中包括多个具有预定连接关系的中继设备,图1仅示意示出第一中继设备121和第二中继设备122,其中以虚线示出的云朵表示,第一中继设备121与第二中继设备122有可能 直接连接,或者有可能通过其它中继设备连接。中继设备网络12中的每个中继设备与至少一个区块链连接,每个中继设备中存储有查找表,该查找表记录了预定数目个中继设备与其连接的区块链的对应关系,从而通过中继设备网络12中的多个中继设备,中继设备网络可与更多个区块链连接。图1中示意示出了,第一区块链11与第一中继设备121连接,第二区块链13与第二中继设备122连接。
其中,第一区块链11中部署有第一合约和请求发出合约。第一合约例如为用于计算第二区块链中的账户A的账户余额,在执行第一合约时,需要读取第二区块链中账户A与其它账户之间的转账交易过程,以用于计算账户A的余额,在第二区块链13中例如通过收据n对该转账交易进行了记录。为此,第一合约中调用请求发出合约,以发出读取第二区块链13中的收据n的读取请求。当在第一区块链11中执行该请求发出合约时,在第一区块链11中存入收据m,收据m中包括所述读取请求。
当在第一区块链11中存入收据m之后,第一中继设备121可从第一区块链11中获取所述收据m,从而可获取所述读取请求。第一中继设备121基于读取请求中的内容可确定该读取请求用于请求读取第二区块链13中的收据n,第一中继设备121确定其是否与第二区块链13连接,如果与第二区块链13连接,则第一中继设备121可直接从第二区块链13读取收据n(该情况在图1中未示出)。如果第一中继设备121确定其不与第二区块链13连接,则可如图1中所示,通过读取查找表,确定到第二区块链13的路由路径,从而第一中继设备121可将读取请求发送到中继设备网络12中,以最后发送给第二中继设备122。
第二中继设备122在接收到读取请求之后,从第二区块链13读取收据n及其简单支付验证(Spv)证明数据,并将收据n及其Spv证明数据发回给第一中继设备121。之后,第一中继设备121可通过向第一区块链11发送交易(未示出)而将收据n及其Spv证明数据回传给请求发出合约,其中,在该交易中以收据n及其Spv证明数据为传入参数调用请求发出合约。请求发出合约在收到收据n及其Spv证明数据之后,通过Spv证明数据对收据n进行验证,在验证通过之后,以收据n作为传入参数调用第一合约,从而将收据n提供给第一合约。
可以理解,上述参考图1的描述只是示意性的,而不是用于限制本说明书实施例。例如,所述中继设备不限于为图1中所示的形式,所述第一合约不限于为上述合约,等等。
下面将具体描述上述跨链读取数据的过程。
图2示意示出根据本说明书实施例的跨链读取数据的方法时序图。
在本说明书实施例中,第一区块链11和第二区块链13可以为任意区块链,如比特币链、以太坊链、Hyperledger Fabric区块链等等。不同的区块链具有不同的链上数据证明方式,例如,Fabric链使用背书节点签名的方式,以太坊链使用Spv证明的方式。下文中将以第一区块链11为以太坊链为例进行描述。
参考图2,首先,在步骤S202,第一中继设备121从第一区块链11获取读取请求。
如上文所述,第一区块链11中的第一合约通过调用请求发出合约而将读取请求作为传入参数提供给请求发出合约,从而通过执行请求发出合约,可在第一区块链11中存入收据m,该收据m中包括所述读取请求,例如,在收据m的预定名称的日志中的数据字段中包括该读取请求。可预先设定读取请求的数据结构,在该数据结构中例如包括请求数据的区块链标识、收据标识等。例如,该读取请求希望读取第二区块链13中的收据n,从而,在该读取请求的内容中,可在预定数据结构中包括:第二区块链13的链标识、以及收据n的标识,该收据n的标识例如包括收据n所在的区块标识(例如区块号、或区块头哈希值等)、以及收据n在区块中的编号等等。在一种实施方式中,收据n的标识不限于包括上述内容,只要可以唯一确定收据n即可,例如,在如上文所述收据n为账户A与其它账户之间的转账交易的收据的情况中,收据n的标识可以为账户A以及交易发送时间,从而基于该标识内容可唯一确定收据n。可以理解,请求发出合约不限于通过收据m的形式向第一区块链11中存入读取请求,而也可以通过其它数据,如交易数据。另外,读取请求不限于请求读取第二区块链13中的收据,而是可以读取第二区块链13中的任意数据,该任意数据例如包括可证明(即经共识的)数据,如区块头、交易数据、账户状态数据等等。这些可证明数据的共性为,其都在第二区块链13中经过多个节点的共识之后存入第二区块链中,并且,基于区块的数据结构,可通过Spv验证方式验证这些数据确实是第二区块链中的数据。相对应地,在读取请求的数据结构中,可包括与数据类型对应的字段,以指示读取请求的数据的数据类型,所述数据类型例如为区块头类型、交易数据类型、收据数据类型等等。
从而,第一中继设备121可对与请求发出合约对应的收据进行监听,每当确定第一区块链11中存入了执行请求发出合约所产生的收据时,即可从第一区块链11中读取该收据,并相应地从该收据中的具有预定名称的日志中读取该收据中的数据读取请求。或者,第一区块链11中可主动进行信息推送,每次在确定第一区块链11中存入了执行请求发出合约所产生的收据时,将该收据主动推送给第一中继设备121。可以理解,在本 说明书实施例中,不限于通过调用请求发出合约的方式来发出跨链读取请求,而是可通过执行任何交易来跨链读取数据,只要通过执行该交易可以将读取请求存入第一区块链11中且可辨识其中包括跨链读取请求即可。
在步骤S204,第一中继设备121确定本地是否与第二区块链13连接。
第一中继设备121在从第一区块链11获取收据m之后,即可读取其中的读取请求,基于该读取请求中的请求数据的区块链标识字段内容,可确定该读取请求用于请求读取第二区块链13中的数据。
如前文所述,第一中继设备121与预定数目的区块链连接,第一中继设备121在本地记录有如表1所示的数据表,该数据表中记录了与其连接的区块链的连接地址。
区块链ID 连接地址
区块链ID1 IP地址1,端口/IP地址2,端口/…
区块链ID2 IP地址3,端口/IP地址4,端口/…
表1
其中,在表1中,左侧的区块链ID即为第一中继设备121连接的各个区块链的标识,右侧的连接地址为相应的区块链中的至少一个节点的连接地址。
第一中继设备121通过查询表1,可确定表1中是否记录了第二区块链13的区块链标识(区块链ID),如果记录了,则可基于表1中与第二区块链13对应的连接地址中的任一连接地址连接第二区块链13中的与该连接地址对应的节点,以用于读取第二区块链13中的数据。如果表1中未记录第二区块链13的区块链ID,则说明第一中继设备121不与第二区块链13直接连接,从而需要如下文所述通过链下中继设备的中转来与第二区块链建立连接。
在步骤S206,在第一中继设备121确定本地不与第二区块链13连接的情况中,第一中继设备121基于本地的查找表将读取请求直接或间接地发送给第二中继设备122。
在一种实施方式中,中继设备和区块链的数目较少,从而可在一个查找表中记录全部中继设备与其各自连接的区块链的对应关系。从而,中继设备网络中的各个中继设备中可存储同样的查找表。表2示意示出了根据该实施方式的查找表。
Figure PCTCN2021133089-appb-000001
表2
假设第二区块链13的区块链标识为表2中的区块链ID2,第一中继设备121在查找表2之后,可确定第二区块链13与第二中继设备122连接。第一中继设备121可在表2中还记录各个中继设备的连接地址,或者第一中继设备121可在另外的表格中记录各个中继设备的连接地址,从而,第一中继设备121在确定第二区块链13与第二中继设备122连接之后,可从本地获取第二中继设备122的连接地址,连接第二中继设备122,从而将读取请求发送给第二中继设备122。
在一种实施方式中,区块链的数目较多,中继设备网络中的中继设备的数目也较多,在该情况中,每个中继设备不一定与中继设备网络中的其它各个中继设备连接,例如,第一中继设备121不与第二中继设备122直接连接,从而,需要通过其它中继设备的中转来使得第一中继设备121与第二中继设备122间接连接。也就是说,各个中继设备仅与中继设备网络中的预定数目的中继设备连接,各个中继设备中存储的查找表中仅记录了该中继设备连接的中继设备与区块链的连接关系,因此,各个中继设备的查找表是不同的表。假设第一中继设备121与中继设备ID3和中继设备ID4连接,中继设备ID3与第二中继设备122和中继设备ID5连接,表3示意示出根据该实施方式的第一中继设备121中的查找表。表4示意示出根据该实施方式的中继设备ID3中的查找表。
Figure PCTCN2021133089-appb-000002
表3
Figure PCTCN2021133089-appb-000003
表4
第一中继设备121在读取本地的查找表(表3)之后,可基于预定路由算法将读取请求发送给其连接的至少一个中继设备,从而通过中继设备网络中的其它中继设备的中转最终将读取请求发送到第二中继设备122。
例如,表3和表4可以为分布式散列表(DHT表),在该情况中,表3和表4中的中继设备ID与区块链ID可以是同构的,例如各个中继设备ID为通过对各个中继设备编号取哈希值而获取的不同的第一数值,所述多个第一数值构成多个均匀的取值范围,各个区块链ID为通过对区块链域名取哈希值获取的不同第二数值,所述多个第二数值分布在所述多个取值范围中,并基于其所分布的取值范围确定该区块链ID对应的区块 链与哪个中继设备连接。例如,第二中继设备122的中继设备ID为中继设备ID2,则将分布于以中继设备ID2为中心的预定范围中的区块链ID对应的区块链确定为与第二中继设备122连接。从而,第一中继设备121可基于DHT算法计算路由路径,使得以最少的中转次数将读取请求发送到第二中继设备122。
例如,参考表3和表4,可确定路由路径中继设备ID3→中继设备ID2是最优的路径,从而,第一中继设备121基于本地存储的中继设备ID3的连接地址将读取请求发送给中继设备ID3。中继设备ID3在接收到读取请求之后,确定该读取请求用于请求第二区块链13中的数据,从而,中继设备ID3通过查找其本地的查找表(表4)确定其连接的第二中继设备122与第二区块链13连接,从而,中继设备ID3将读取请求直接发送给第二中继设备122。
在步骤S208,第二中继设备122从第二区块链13读取收据n及其证明。
如上文所述,读取请求具有预定数据结构,其中包括请求读取的区块链标识和数据标识,例如,其中包括第二区块链13中的收据n的标识,该收据n的标识例如包括:区块号(例如区块1)、收据编号(例如收据n)。从而,第二中继设备122在接收到读取请求之后,基于读取请求的内容确定其需要连接第二区块链13。第二中继设备122中也具有与表1类似的数据表,第二中继设备122基于本地的数据表获取第二区块链13的连接地址连接到第二区块链13,并从第二区块链13读取相应的数据。具体是,在第二中继设备122中例如安装了第二区块链13的客户端,该客户端中设置有上述数据表,并且在客户端的界面中直接显示了可连接的区块链的选项,该选项中包括第二区块链13的标识,从而,与第二中继设备122对应的业务人员直接点击第二区块链13的标识,即可通过客户端连接到第二区块链13。在连接到第二区块链13之后,客户端的界面中将显示用于读取数据的按钮或输入框,业务人员通过在客户端中进行点击或输入,从而可读取到第二区块链13中的相应数据。例如,通过在客户端中选择区块1中的收据n,从而可读取到收据n,通过点击客户端中的与收据n对应的Spv证明数据按钮,从而可读取到收据n的Spv证明数据。在以太坊链中,Spv证明数据为用于对数据进行Spv验证的数据,例如,收据n的Spv证明数据包括:区块1的区块头哈希值、区块1中包括的收据树根哈希值、收据树中从收据m到根节点的树路径中其它各个节点的哈希值。
可以理解,这里,第二中继设备122读取收据n及其证明数据仅仅为本说明书实施例的一种示例描述,而不是用于限制本说明书实施例的范围。例如,在第一区块链11不需要证明数据的情况中,第二中继设备122可以仅读取收据n,以用于传回给第一区 块链11。再例如,在第一区块链11请求读取的数据不是可证明数据的情况中,第二中继设备122可以仅读取请求读取的数据,而不需要读取其证明数据。
在步骤S210,第二中继设备122将收据n及其Spv证明数据直接或间接地发送给第一中继设备121。
在一种实施方式中,如上文所述,第一中继设备121与第二中继设备122直接连接,从而,第二中继设备122可直接将收据n及其Spv证明数据发送给第一中继设备121。在发送时,第二中继设备122对发送的数据标注其为与所述读取请求对应的请求数据,从而便于第一中继设备121的后续处理。
在一种实施方式中,第一中继设备121通过其它中继设备的中转而将读取请求发送给第二中继设备122,在各个中继设备发送的过程中,可对读取请求附加上其从第一中继设备121到第二中继设备122的发送路径,例如,其发送路径为第一中继设备121→中继设备ID3→第二中继设备122,从而,第二中继设备122可基于该发送路径将读取的数据发送回第一中继设备121。
在一种实施方式中,在读取请求中包括请求发出区块链的链标识(即第一区块链11),第二中继设备122可基于其本地的查找表确定将收据n及其Spv证明数据提供给第一区块链的路由路径,从而通过该路由路径将收据n及其Spv证明数据发送回第一中继设备121。
可以理解,在第一区块链11不需要收据n的证明数据的情况中,第二中继设备122仅读取收据n,并仅将收据n直接或间接地发送给第一中继设备121。
在步骤S212,第一中继设备121将收据n及其Spv证明数据提供给第一区块链11。
如上文所述,参考图1,第一中继设备121在从中继设备网络接收到收据n及其Spv证明数据之后,通过向第一区块链11发送交易而向第一区块链11提供收据n及其Spv证明数据,在该交易中,以收据n及其Spv证明数据作为传入参数调用请求发出合约。具体是,在传入收据n及其Spv证明数据时,还标明,其与所述读取请求相对应。从而,当在第一区块链11中执行请求发出合约时,在使用Spv证明数据对收据n验证通过之后,请求发出合约基于预先记录的读取请求与第一合约的对应关系回调第一合约,从而将收据n提供给第一合约,即完成了跨链数据的读取过程。
其中,通过Spv证明数据对收据n进行验证的过程具体可包括如下步骤:计算获取的收据n的哈希值;基于Spv证明数据中包括的树路径中其它各节点的哈希值,计算区 块1中收据树的根哈希值;将计算的根哈希值与Spv证明数据中包括的区块1的收据树的根哈希值进行比较,以确定收据m是否为区块1中的收据m;以及,基于Spv证明数据中包括区块1的区块头哈希值、以及请求发出合约中预先设置的第二区块链13的创世区块的相关信息(例如创世区块哈希值),确定区块1是否为第二区块链13中的区块,从而可验证收据n的真实可信性。
可以理解,在第一中继设备121仅从中继设备网络中接收到数据2的情况中,第一中继设备121仅将收据n提供给第一区块链11。
图3示出根据本说明书实施例的一种基于中继设备网络跨链读取数据的装置300,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接、并存储有第一查找表,所述第一查找表中记录了预定数目个中继设备各自连接的区块链,所述第二中继设备与第二区块链连接,所述装置部署于所述第一中继设备,包括:获取单元31,配置为,从所述第一区块链获取对所述第二区块链中的第一数据的读取请求;确定单元32,配置为,确定本地是否与所述第二区块链连接;发送单元33,配置为,在确定本地不与所述第二区块链连接的情况中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述读取请求发送给所述第二中继设备;接收单元34,配置为,从所述预定数目个中继设备中的一个中继设备接收第一数据;提供单元35,配置为,将所述第一数据提供给所述第一区块链。
在一种实施方式中,所述预定数目个中继设备中包括所述第二中继设备,其中,所述发送单元33还配置为,基于所述第一查找表,将所述读取请求发送给所述第二中继设备。
在一种实施方式中,所述预定数目个中继设备中不包括所述第二中继设备,其中,所述发送单元33还配置为,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的第三中继设备,以用于将所述读取请求发送给所述第二中继设备。
在一种实施方式中,所述装置还包括,读取单元36,配置为,在确定本地与所述第二区块链连接的情况中,从所述第二区块链读取所述第一数据。
在一种实施方式中,所述接收单元34还配置为,从所述预定数目个中继设备中的一个中继设备接收第一数据及其证明数据,所述提供单元35还配置为,将所述第一数据及其证明数据提供给所述第一区块链。
图4示出根据本说明书实施例的一种基于中继设备网络跨链读取数据的装置,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接,所述第二中继设备与第二区块链连接、并存储有第二查找表,所述第二查找表中记录了预定数目个中继设备各自连接的区块链,所述装置部署于所述第二中继设备,包括:接收单元41,配置为,从所述中继设备网络接收对所述第二区块链中的第一数据的读取请求,其中,所述读取请求由所述第一中继设备从所述第一区块链获取;读取单元42,配置为,基于所述读取请求从所述第二区块链读取所述第一数据;发送单元43,配置为,基于所述第二查找表将所述第一数据发送给所述中继设备网络,以用于将所述第一数据及其证明数据发送给所述第一中继设备。
在一种实施方式中,所述读取单元42还配置为,基于所述读取请求从所述第二区块链读取所述第一数据及其证明数据,所述发送单元43还配置为,基于所述第二查找表将所述第一数据及其证明数据发送给所述预定数目个中继设备中的至少一个中继设备。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序或指令,所述处理器在执行所述计算机程序或指令时,实现上述任一项方法。
通过根据本说明书实施例的跨链读取数据的方案,可在区块链的链下实现支持路由的中继设备网络,可基于该中继设备网络形成跨链网络拓扑,该跨链网络拓扑支持大规模跨链网络连接,从而区块链通过接入中继设备即可在跨链网络拓扑中寻址区块链账本信息。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本领域普通技术人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (16)

  1. 一种基于中继设备网络跨链读取数据的方法,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接、并存储有第一查找表,所述第一查找表中记录了预定数目个中继设备各自连接的区块链,所述第二中继设备与第二区块链连接,所述方法由所述第一中继设备执行,包括:
    从所述第一区块链获取对所述第二区块链中的第一数据的读取请求;
    确定本地是否与所述第二区块链连接;
    在确定本地不与所述第二区块链连接的情况中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述读取请求发送给所述第二中继设备;
    从所述预定数目个中继设备中的一个中继设备接收第一数据;
    将所述第一数据提供给所述第一区块链。
  2. 根据权利要求1所述的方法,其中,所述预定数目个中继设备中包括所述第二中继设备,其中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备包括,基于所述第一查找表,将所述读取请求发送给所述第二中继设备。
  3. 根据权利要求1所述的方法,其中,所述预定数目个中继设备中不包括所述第二中继设备,其中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备包括,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的第三中继设备,以用于将所述读取请求发送给所述第二中继设备。
  4. 根据权利要求1所述的方法,其中,从所述预定数目个中继设备中的一个中继设备接收第一数据包括,从所述预定数目个中继设备中的一个中继设备接收第一数据及其证明数据,将所述第一数据提供给所述第一区块链包括,将所述第一数据及其证明数据提供给所述第一区块链。
  5. 根据权利要求4所述的方法,所述第一数据为所述第二区块链中的以下任一种数据:区块头数据、交易数据、收据数据、账户状态数据。
  6. 一种基于中继设备网络跨链读取数据的方法,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接,所述第二中继设备与第二区块链连接、并存储有第二查找表,所述第二查找表中记录了预定数目个中继设备各自连接的区块链,所述方法由所述第二中继设备执行,包括:
    从所述中继设备网络接收对所述第二区块链中的第一数据的读取请求,其中,所述 读取请求由所述第一中继设备从所述第一区块链获取;
    基于所述读取请求从所述第二区块链读取所述第一数据;
    基于所述第二查找表将所述第一数据发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述第一数据发送给所述第一中继设备。
  7. 根据权利要求6所述的方法,其中,基于所述读取请求从所述第二区块链读取所述第一数据包括,基于所述读取请求从所述第二区块链读取所述第一数据及其证明数据,基于所述第二查找表将所述第一数据发送给所述预定数目个中继设备中的至少一个中继设备包括,基于所述第二查找表将所述第一数据及其证明数据发送给所述预定数目个中继设备中的至少一个中继设备。
  8. 一种基于中继设备网络跨链读取数据的装置,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接、并存储有第一查找表,所述第一查找表中记录了预定数目个中继设备各自连接的区块链,所述第二中继设备与第二区块链连接,所述装置部署于所述第一中继设备,包括:
    获取单元,配置为,从所述第一区块链获取对所述第二区块链中的第一数据的读取请求;
    确定单元,配置为,确定本地是否与所述第二区块链连接;
    发送单元,配置为,在确定本地不与所述第二区块链连接的情况中,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述读取请求发送给所述第二中继设备;
    接收单元,配置为,从所述预定数目个中继设备中的一个中继设备接收第一数据;
    提供单元,配置为,将所述第一数据提供给所述第一区块链。
  9. 根据权利要求8所述的装置,其中,所述预定数目个中继设备中包括所述第二中继设备,其中,所述发送单元还配置为,基于所述第一查找表,将所述读取请求发送给所述第二中继设备。
  10. 根据权利要求8所述的装置,其中,所述预定数目个中继设备中不包括所述第二中继设备,其中,所述发送单元还配置为,基于所述第一查找表,将所述读取请求发送给所述预定数目个中继设备中的第三中继设备,以用于将所述读取请求发送给所述第二中继设备。
  11. 根据权利要求8所述的装置,其中,所述接收单元还配置为,从所述预定数目个中继设备中的一个中继设备接收第一数据及其证明数据,所述提供单元还配置为,将所述第一数据及其证明数据提供给所述第一区块链。
  12. 根据权利要求11所述的装置,所述第一数据为所述第二区块链中的以下任一种数据:区块头数据、交易数据、收据数据、账户状态数据。
  13. 一种基于中继设备网络跨链读取数据的装置,所述中继设备网络中包括第一中继设备和第二中继设备,所述第一中继设备与第一区块链连接,所述第二中继设备与第二区块链连接、并存储有第二查找表,所述第二查找表中记录了预定数目个中继设备各自连接的区块链,所述装置部署于所述第二中继设备,包括:
    接收单元,配置为,从所述中继设备网络接收对所述第二区块链中的第一数据的读取请求,其中,所述读取请求由所述第一中继设备从所述第一区块链获取;
    读取单元,配置为,基于所述读取请求从所述第二区块链读取所述第一数据;
    发送单元,配置为,基于所述第二查找表将所述第一数据发送给所述预定数目个中继设备中的至少一个中继设备,以用于将所述第一数据发送给所述第一中继设备。
  14. 根据权利要求13所述的装置,其中,所述读取单元还配置为,基于所述读取请求从所述第二区块链读取所述第一数据及其证明数据,所述发送单元还配置为,基于所述第二查找表将所述第一数据及其证明数据发送给所述预定数目个中继设备中的至少一个中继设备。
  15. 一种计算机可读存储介质,其上存储有计算机程序或指令,当所述计算机程序或指令在计算机中执行时,令计算机执行权利要求1-7中任一项的所述的方法。
  16. 一种计算设备,包括存储器和处理器,所述存储器中存储有计算机程序或指令,所述处理器在执行所述计算机程序或指令时,实现权利要求1-7中任一项所述的方法。
PCT/CN2021/133089 2021-03-30 2021-11-25 一种基于中继设备网络跨链读取数据的方法和装置 WO2022205962A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110339758.8 2021-03-30
CN202110339758.8A CN112804357B (zh) 2021-03-30 2021-03-30 一种基于中继设备网络跨链读取数据的方法和装置

Publications (1)

Publication Number Publication Date
WO2022205962A1 true WO2022205962A1 (zh) 2022-10-06

Family

ID=75815979

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/133089 WO2022205962A1 (zh) 2021-03-30 2021-11-25 一种基于中继设备网络跨链读取数据的方法和装置

Country Status (2)

Country Link
CN (2) CN113676553A (zh)
WO (1) WO2022205962A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113676553A (zh) * 2021-03-30 2021-11-19 支付宝(杭州)信息技术有限公司 一种基于中继设备网络跨链读取数据的方法和装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110035045A (zh) * 2018-11-16 2019-07-19 阿里巴巴集团控股有限公司 跨链数据的可信管理方法及装置、电子设备
WO2019211225A1 (en) * 2018-05-01 2019-11-07 International Business Machines Corporation Blockchain implementing cross-chain transactions
CN110443704A (zh) * 2019-06-28 2019-11-12 阿里巴巴集团控股有限公司 一种跨链发送资源的方法和装置
CN110751475A (zh) * 2019-10-24 2020-02-04 杭州趣链科技有限公司 一种区块链交易的跨链方法及系统、设备和存储介质
CN112446785A (zh) * 2020-11-06 2021-03-05 杭州趣链科技有限公司 跨链交易方法、系统、装置、设备和存储介质
CN112445841A (zh) * 2020-11-17 2021-03-05 杭州趣链科技有限公司 账户查询方法、装置、系统、服务器及介质
CN112804357A (zh) * 2021-03-30 2021-05-14 支付宝(杭州)信息技术有限公司 一种基于中继设备网络跨链读取数据的方法和装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008686B (zh) * 2018-11-16 2020-12-04 创新先进技术有限公司 跨区块链的数据处理方法、装置、客户端、区块链系统
CN110311790B (zh) * 2019-06-28 2020-07-28 阿里巴巴集团控股有限公司 一种跨链发送可认证消息的方法和装置
CN111416808B (zh) * 2020-03-13 2021-04-13 财付通支付科技有限公司 跨区块链的数据互存方法、装置、设备及存储介质
CN112929285B (zh) * 2020-08-28 2022-05-31 支付宝(杭州)信息技术有限公司 区块链网络的通信优化系统
CN111769957B (zh) * 2020-09-02 2020-12-15 百度在线网络技术(北京)有限公司 区块链跨链查询方法、装置、设备和存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019211225A1 (en) * 2018-05-01 2019-11-07 International Business Machines Corporation Blockchain implementing cross-chain transactions
CN110035045A (zh) * 2018-11-16 2019-07-19 阿里巴巴集团控股有限公司 跨链数据的可信管理方法及装置、电子设备
CN110443704A (zh) * 2019-06-28 2019-11-12 阿里巴巴集团控股有限公司 一种跨链发送资源的方法和装置
CN110751475A (zh) * 2019-10-24 2020-02-04 杭州趣链科技有限公司 一种区块链交易的跨链方法及系统、设备和存储介质
CN112446785A (zh) * 2020-11-06 2021-03-05 杭州趣链科技有限公司 跨链交易方法、系统、装置、设备和存储介质
CN112445841A (zh) * 2020-11-17 2021-03-05 杭州趣链科技有限公司 账户查询方法、装置、系统、服务器及介质
CN112804357A (zh) * 2021-03-30 2021-05-14 支付宝(杭州)信息技术有限公司 一种基于中继设备网络跨链读取数据的方法和装置

Also Published As

Publication number Publication date
CN113676553A (zh) 2021-11-19
CN112804357B (zh) 2021-08-06
CN112804357A (zh) 2021-05-14

Similar Documents

Publication Publication Date Title
US11687916B2 (en) Decisional architectures in blockchain environments
JP7461695B2 (ja) ブロックチェーン・ネットワークからのデータの抽出
TWI724389B (zh) 徵信評估方法及裝置、電子設備
CN113972986B (zh) 基于区块链的工业互联网标识信息解析方法以及相关装置
EP3751815B1 (en) Multi-source deterministic oracle management
TW202002569A (zh) 基於區塊鏈的資料驗證方法及裝置、電子設備
TW202101439A (zh) 跨鏈發送可認證訊息的方法和裝置
WO2022205958A1 (zh) 一种基于中继设备网络跨链中转数据的方法和装置
CN110311781A (zh) 提供微服务信息
WO2022205966A1 (zh) 一种跨链访问控制方法和装置
JP2023532959A (ja) 許可制ブロックチェーンのためのプライバシー保護アーキテクチャ
TW202101350A (zh) 基於處理模組跨鏈發送可認證訊息的方法和裝置
US20200111040A1 (en) Organization management support system, organization management support method, and organization management support apparatus
US20220158840A1 (en) Methods and systems for exchanging confidential information via a blockchain
WO2022205962A1 (zh) 一种基于中继设备网络跨链读取数据的方法和装置
US11418342B2 (en) System and methods for data exchange using a distributed ledger
CN112866421A (zh) 基于分布式缓存以及nsq的智能合约运行方法及装置
CN112035542A (zh) 信息查询方法、装置、电子设备及可读存储介质
CN115619395A (zh) 基于区块链的数据处理方法及相关设备
KR20200078069A (ko) 블록체인 네트워크와 금융 시스템의 연동을 위한 검증 장치 및 방법
WO2022205957A1 (zh) 一种基于中继设备跨链中转消息的方法和装置
CN115708119A (zh) 跨链交易系统、方法、设备及存储介质
CN111818107B (zh) 网络请求的响应方法、装置、设备及可读存储介质
Härer Scalable model-based decentralized applications in the cloud using certificates and blockchains
CN113689601B (zh) 基于区块链的通行验证方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21934598

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21934598

Country of ref document: EP

Kind code of ref document: A1