WO2020224235A1 - Cross-chain transaction method and apparatus, device, and storage medium - Google Patents

Cross-chain transaction method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2020224235A1
WO2020224235A1 PCT/CN2019/120569 CN2019120569W WO2020224235A1 WO 2020224235 A1 WO2020224235 A1 WO 2020224235A1 CN 2019120569 W CN2019120569 W CN 2019120569W WO 2020224235 A1 WO2020224235 A1 WO 2020224235A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
node
associated data
lock
data corresponding
Prior art date
Application number
PCT/CN2019/120569
Other languages
French (fr)
Chinese (zh)
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 WO2020224235A1 publication Critical patent/WO2020224235A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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

  • This application relates to the field of blockchain technology, in particular to methods, devices, equipment and storage media for cross-chain transactions.
  • Blockchain is a distributed ledger, and its essence is also a distributed database.
  • a blockchain is an independent ledger, and two different chains are two different independent ledger.
  • Cross-chain technology is a technology for collaborative operation of transactions between multiple distributed ledgers in the blockchain.
  • institutional nodes will carry out security protection in many aspects to ensure the security of cross-chain transactions.
  • the inventor realizes that in a cross-chain transaction, data may be used by multiple chains at the same time. For example, the data is modified by other users during the transaction, resulting in inconsistencies before and after the transaction, and the transaction fails. In view of this, providing a safe and effective transaction method in cross-chain transactions has become a problem to be solved.
  • the purpose of this application is to provide a method, device, equipment and storage medium for cross-chain transactions, aiming to realize safe and effective cross-chain transactions.
  • the first aspect of this application provides a cross-chain transaction method, including: S1, when a cross-chain transaction is performed between each node of a multi-chain, the receiving client sends the transaction information of this transaction and the client The terminal locks the corresponding related data lock request based on the transaction information, and locks the related data corresponding to this transaction on the node based on the lock request; S2, executes the smart contract based on the transaction information and the related data, and completes this time After the transaction, the transaction completion message is pushed to the client; S3, when the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, Based on the unlock request, the associated data corresponding to the transaction on the current node is unlocked.
  • the second aspect of this application provides a cross-chain transaction device, including: a locking module, used for cross-chain transactions between nodes in a multi-chain, the receiving client sends the transaction information of this transaction and the client is based on The transaction information locks the corresponding associated data request, and locks the associated data corresponding to the transaction on the node based on the lock request; the push module is used to execute the smart contract based on the transaction information and the associated data, and complete the transaction After the transaction, the completion message of this transaction is pushed to the client; the unlocking module is used to receive the completion message of each node of the multi-chain and send the unlock request to each node of the multi-chain. The unlocking request unlocks the associated data corresponding to the transaction on the current node based on the unlocking request.
  • a locking module used for cross-chain transactions between nodes in a multi-chain, the receiving client sends the transaction information of this transaction and the client is based on The transaction information locks the corresponding associated data request, and locks the associated data corresponding to the transaction on
  • a third aspect of the present application provides a cross-chain transaction device, including: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected by wires; the at least one The processor invokes the instructions in the memory, so that the cross-chain transaction device executes the method described in the first aspect.
  • the fourth aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and when the computer instructions run on a computer, the computer executes the above-mentioned first aspect method.
  • the node when a cross-chain transaction is performed between each node of the multi-chain, the node locks the associated data corresponding to the transaction on the node when receiving the transaction, and pushes the completion message of the transaction to The client, after receiving the completion message of each node of the multi-chain, the client sends an unlock request to each node to unlock the associated data corresponding to the transaction on the node.
  • This application locks the data during cross-chain transactions And unlock the data after the transaction is completed, which can realize safe and effective cross-chain transactions.
  • FIG. 1 is a schematic diagram of an optional application environment of each embodiment of this application.
  • FIG. 2 is a schematic diagram of the hardware architecture of an embodiment of the cross-chain transaction device of this application.
  • FIG. 3 is a program module diagram of an embodiment of the processing system in FIG. 2;
  • FIG. 4 is a schematic flowchart of an embodiment of a method for applying a cross-chain transaction.
  • the embodiments of the present application provide a method, device, equipment and storage medium for cross-chain transactions, aiming to realize safe and effective cross-chain transactions.
  • FIG. 1 is a schematic diagram of the application environment of the preferred embodiment of the present application.
  • the multiple chains include blockchain 1, blockchain 2, and blockchain 3.
  • the client sends transactions to multiple blockchains to perform cross-chain transactions among the nodes of the multiple chains.
  • the cross-chain transaction device is the device where the node executing the transaction in the blockchain is located.
  • a cross-chain transaction device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • the cross-chain transaction device can be a computer, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing, where cloud computing is one of distributed computing.
  • a super virtual computer composed of a group of loosely coupled computer sets.
  • the cross-chain transaction device 1 may include, but is not limited to, those that can communicate with each other through a system bus.
  • the memory 11, the processor 12, and the network interface 13, and the memory 11 stores a processing system 10 that can run on the processor 12.
  • Figure 2 only shows the device 1 for cross-chain transactions with components 11-13, but it should be understood that it is not required to implement all of the illustrated components, and more or less may be implemented instead. Components.
  • the memory 11 includes a memory and at least one type of readable storage medium.
  • the memory provides a cache for the operation of the device 1 for cross-chain transactions;
  • the readable storage medium can be, for example, flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access Non-volatile storage media such as memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, and optical disks.
  • the readable storage medium may be an internal storage unit of the device 1 for cross-chain transactions, such as the hard disk of the device 1 for cross-chain transactions; in other embodiments, the non-volatile storage medium may also be It is the external storage device of the device 1 for cross-chain transactions, such as plug-in hard disks, Smart Media Card (SMC), Secure Digital (SD) cards, flash memory cards equipped on the device 1 for cross-chain transactions (Flash Card) etc.
  • the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed in the cross-chain transaction device 1, for example, to store the program code of the processing system 10 in an embodiment of the present application.
  • the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 12 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run data stored in the memory 11 Program code or processing data, such as running the processing system 10, etc.
  • CPU Central Processing Unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run data stored in the memory 11 Program code or processing data, such as running the processing system 10, etc.
  • the network interface 13 may include a standard wireless network interface and a wired network interface.
  • the network interface 13 is generally used to establish a communication connection between the cross-chain transaction device 1 and other electronic devices.
  • the processing system 10 is stored in the memory 11, and includes at least one computer-readable instruction stored in the memory 11, and the at least one computer-readable instruction can be executed by the processor 12 to implement the method of each embodiment of the present application; And, the at least one computer-readable instruction can be divided into different logic modules according to the different functions implemented by its parts.
  • the above-mentioned processing system 10 implements the following steps when being executed by the processor 12:
  • the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node is The related data corresponding to the transaction is locked;
  • the client When the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and performs the associated data corresponding to this transaction on the node based on the unlock request. Unlock.
  • FIG. 3 it is a program module diagram of the processing system 10 in FIG.
  • the processing system 10 is divided into multiple modules, and the multiple modules are stored in the memory 12 and executed by the processor 13 to complete the application.
  • the module referred to in this application refers to a series of computer program instruction segments that can complete specific functions.
  • the processing system 10 can be divided into: a locking module 101, a pushing module 102, and an unlocking module 103.
  • the locking module 101 is used to receive the transaction information of this transaction sent by the client and the lock request of the client based on the transaction information for the corresponding associated data when performing cross-chain transactions between the various nodes of the multi-chain.
  • the lock request locks the associated data corresponding to this transaction on the node;
  • related data is data that must be used in transactions, and different transactions have different related data.
  • institution A and institution B belong to different blockchains.
  • the transaction information of cross-chain transactions is: transfer 1 million from institution A to institution B, and the corresponding associated data is institution A’s account information on the blockchain, Account information of institution B on the blockchain. If the data on each chain is successfully locked, the transaction can be executed. The purpose of locking the associated data is to prevent other users from modifying the data, causing the transaction to fail.
  • the push module 102 is configured to execute a smart contract based on the transaction information and associated data, and push the completion message of the transaction to the client after the transaction is completed;
  • the completion message of this transaction is actively pushed to the client terminal, so that the upper-level client terminal can learn the transaction result in time without constantly polling the node for the transaction result.
  • the unlocking module 103 is used for receiving the unlocking request after the client receives the completion message of each node of the multi-chain and sending an unlocking request to each node of the multi-chain respectively, and based on the unlocking request, the current node The associated data corresponding to this transaction is unlocked.
  • the client When the client receives the completion message of each node of the multi-chain, it analyzes whether it has received the completion message of all the nodes that execute the transaction to determine whether the transaction is successful, and if it is, it can send an unlock request to the multi-chain To unlock the associated data corresponding to this transaction on this node. In other embodiments, the node can unlock the associated data by itself after the transaction is completed.
  • FIG. 4 is a schematic flowchart of an embodiment of a method for cross-chain transaction of this application.
  • the processor 13 of the device 1 for cross-chain transaction executes the processing system 10 stored in the memory 12, the following steps of the method are implemented:
  • Step S1 when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node The related data corresponding to the previous transaction is locked;
  • the client sends the transaction information of this transaction to each node of the multi-chain for cross-chain transactions, and at the same time, the client sends a lock request of the transaction information to the corresponding associated data to each node of the multi-chain.
  • Related data is the data that must be used in the transaction. Different transactions have different related data. For example, A and B belong to different blockchains.
  • the transaction information of a cross-chain transaction is: transfer 1 million from A to B Institution
  • the corresponding associated data is the account information of institution A on the blockchain and the account information of institution B on the blockchain.
  • the cross-chain transaction fails and the transaction needs to be re-initiated. If the data on each chain is successfully locked, the transaction can be executed.
  • the purpose of locking the associated data is to prevent other users from modifying the data, causing the transaction to fail.
  • Step S2 execute a smart contract based on the transaction information and associated data, and push the completion message of the transaction to the client after the transaction is completed;
  • each node of the multi-chain executes smart contracts based on the transaction information and associated data, executes the transaction submission after the transaction is completed, and writes the transaction information on the blockchain ledger.
  • the transaction is completed
  • the message is actively pushed to the client, so that the upper-level client can learn the transaction result in time without constantly polling the node for the transaction result.
  • the client can obtain the transaction completion message through long polling, that is, after the client sends the transaction information of this transaction to the node, the connection is idle and waits, and the node immediately returns the completion message when the transaction is completed.
  • Message to the client This operation takes into account: when the push completion message is unstable and the transaction is lost, the transaction falls into an unknown state. Therefore, the message delivery mechanism can be used at the same time, that is, the client performs long polling while the node is pushing. .
  • Step S3 After the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and based on the unlock request, the transaction corresponding to this node is Link data to unlock.
  • the client When the client receives the completion message of each node of the multi-chain, it analyzes whether it has received the completion message of all the nodes that execute the transaction to determine whether the transaction is successful, and if it is, it can send an unlock request to the multi-chain To unlock the associated data corresponding to this transaction on this node. In other embodiments, the node can unlock the associated data by itself after the transaction is completed.
  • the step of locking the associated data corresponding to this transaction on the node based on the locking request specifically includes: locking the smart contract on a predetermined smart contract based on the locking request Write the associated data corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
  • the step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request specifically includes: writing the associated data corresponding to the transaction on the node on the predetermined unlock smart contract based on the unlock request, and execute The unlocking smart contract unlocks the associated data corresponding to this transaction on the node.
  • the related data lock can be realized by a lock smart contract.
  • the transaction is: the user needs to modify data A, then the locked related data can be LOCK-A.
  • the lock smart contract is used to write LOCK-A on the blockchain successfully , It means that data A is locked successfully.
  • the associated data unlocking can be realized by unlocking the smart contract.
  • the unlocking associated data can be LOCK-A.
  • the unlocking smart contract is used to write LOCK-A on the blockchain successfully, Indicates that data A is successfully unlocked.
  • the step of locking the associated data corresponding to this transaction on the current node based on the lock request includes: writing on a predetermined lock smart contract based on the lock request Enter the associated data and the first identity information corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
  • the step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request further includes: writing the associated data and the second transaction corresponding to the transaction on the node on the predetermined unlocking smart contract based on the unlock request. 2.
  • Identity information execute the unlocking smart contract, and when the second identity information is the same as the first identity information, the associated data corresponding to the transaction on the current node is unlocked.
  • the second identity information and the first identity information can be the digital certificate of the user (organization), the associated data and the digital certificate of the institution are written on the locked smart contract, and the associated data and the digital certificate of the institution are written on the unlocked smart contract.
  • unlocking if only two digital certificates are consistent, the identity verification is passed, and the unlocking operation can be performed.
  • the step of locking the associated data corresponding to this transaction on the current node based on the lock request includes: writing on a predetermined lock smart contract based on the lock request Enter the associated data and lock duration corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
  • the cross-chain transaction method further includes: when the unlock request is not received after pushing the completion message of the transaction to the client, if the time difference between the current moment and the moment when the associated data is locked is greater than or equal to the lock duration, the current The associated data corresponding to this transaction on the node is unlocked.
  • the associated data and the lock duration can be written on the locked smart contract.
  • the analysis is performed on the relationship between the current time and the time when the associated data is locked and the lock duration. The data will be unlocked when it is greater than or equal to the lock duration.
  • the step of locking the associated data corresponding to this transaction on the current node based on the lock request includes: writing on a predetermined lock smart contract based on the lock request Enter the associated data and the number of blocks corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
  • the cross-chain transaction method further includes: when the unlock request is not received after pushing the completion message of the transaction to the client, if the difference between the current block number and the block number at the moment when the associated data is locked is greater than or equal to When the number of blocks is reached, the associated data corresponding to the transaction on this node will be unlocked.
  • This embodiment considers that the node time on the blockchain is often not uniform (each node runs on a separate server, and the time of each server is not completely the same, there may be a difference of several seconds or minutes), so it can Use the number of blocks to replace the lock duration mentioned above. For example, if the number of blocks is 10, the valid duration of the locked data is 10 blocks. Assuming that the current block number is 100, other users will The data cannot be unlocked unless the user actively releases it. After the block number reaches 110, it will be automatically unlocked.
  • the node locks the associated data corresponding to the transaction on the node when the transaction is received, and the transaction is completed after the transaction is completed.
  • the completion message of the transaction is pushed to the client.
  • the client After the client receives the completion message of each node of the multi-chain, it sends an unlock request to each node to unlock the associated data corresponding to the transaction on the node. Locking the data during cross-chain transactions and unlocking the data after the transaction is completed can realize safe and effective cross-chain transactions.
  • the present application also provides a cross-chain transaction device, including: a memory and at least one processor, the memory stores instructions, the memory and the at least one processor are interconnected by wires; the at least one processor calls The instructions in the memory enable the cross-chain transaction device to execute the steps in the above-mentioned cross-chain transaction method.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on the computer, the computer executes the following steps:
  • the receiving client when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node The related data corresponding to this transaction is locked;
  • S2 execute the smart contract based on the transaction information and related data, and push the completion message of the transaction to the client after the transaction is completed;
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.

Abstract

The present application relates to blockchain technology, and discloses a cross-chain transaction method and apparatus, a device, and a storage medium. The method comprises: when a cross-chain transaction is performed between various nodes of multiple chains, receiving transaction information of the current transaction sent by a client and a locking request of the client for corresponding associated data based on the transaction information, and locking, on the basis of the locking request, the corresponding associated data of the current transaction on the current node; executing a smart contract on the basis of the transaction information and the associated data, and after completion of the current transaction, pushing a completion message of the current transaction to the client; and after the client has respectively received the completion messages of the various nodes of the multiple chains and has respectively sent an unlocking request to the various nodes of the multiple chains, receiving the unlocking request, and unlocking, on the basis of the unlocking request, the corresponding associated data of the current transaction on the current node. The present application achieves safe and effective cross-chain transaction.

Description

跨链交易的方法、装置、设备及存储介质Method, device, equipment and storage medium for cross-chain transaction
本申请要求于2019年5月6日提交中国专利局、申请号为201910370448.5、发明名称为“跨链交易的装置、方法及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 6, 2019, with the application number 201910370448.5, and the invention title "apparatus, method and storage medium for cross-chain transactions", the entire content of which is incorporated by reference Applying.
技术领域Technical field
本申请涉及区块链技术领域,尤其涉及跨链交易的方法、装置、设备及存储介质。This application relates to the field of blockchain technology, in particular to methods, devices, equipment and storage media for cross-chain transactions.
背景技术Background technique
区块链是一个分布式账本,它的本质也是一个分布式的数据库。一条区块链就是一个独立的账本,两条不同的链,就是两个不同的独立的账本。跨链技术是区块链多个分布式账本之间进行事务协同操作的技术。对于跨链的交易,一般而言,为了安全考虑,机构节点会在多方面进行安全防护,以保证跨链的交易的安全性。然而,发明人意识到在跨链交易中,数据可能会被多个链同时使用,例如,交易过程中数据被其他用户进行修改,导致交易前后的不一致性,使得交易失败。有鉴于此,在跨链交易中提供一种安全有效的交易方法成为有待解决的问题。Blockchain is a distributed ledger, and its essence is also a distributed database. A blockchain is an independent ledger, and two different chains are two different independent ledger. Cross-chain technology is a technology for collaborative operation of transactions between multiple distributed ledgers in the blockchain. For cross-chain transactions, generally speaking, for security considerations, institutional nodes will carry out security protection in many aspects to ensure the security of cross-chain transactions. However, the inventor realizes that in a cross-chain transaction, data may be used by multiple chains at the same time. For example, the data is modified by other users during the transaction, resulting in inconsistencies before and after the transaction, and the transaction fails. In view of this, providing a safe and effective transaction method in cross-chain transactions has become a problem to be solved.
发明内容Summary of the invention
本申请的目的在于提供一种跨链交易的方法、装置、设备及存储介质,旨在实现安全有效的跨链交易。The purpose of this application is to provide a method, device, equipment and storage medium for cross-chain transactions, aiming to realize safe and effective cross-chain transactions.
为实现上述目的,本申请第一方面提供了一种跨链交易的方法,包括:S1,在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;S2,基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;S3,当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。In order to achieve the above objective, the first aspect of this application provides a cross-chain transaction method, including: S1, when a cross-chain transaction is performed between each node of a multi-chain, the receiving client sends the transaction information of this transaction and the client The terminal locks the corresponding related data lock request based on the transaction information, and locks the related data corresponding to this transaction on the node based on the lock request; S2, executes the smart contract based on the transaction information and the related data, and completes this time After the transaction, the transaction completion message is pushed to the client; S3, when the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, Based on the unlock request, the associated data corresponding to the transaction on the current node is unlocked.
本申请第二方面提供了一种跨链交易的装置,包括:锁定模块,用于在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;推送模块,用于基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;解锁模块,用于当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。The second aspect of this application provides a cross-chain transaction device, including: a locking module, used for cross-chain transactions between nodes in a multi-chain, the receiving client sends the transaction information of this transaction and the client is based on The transaction information locks the corresponding associated data request, and locks the associated data corresponding to the transaction on the node based on the lock request; the push module is used to execute the smart contract based on the transaction information and the associated data, and complete the transaction After the transaction, the completion message of this transaction is pushed to the client; the unlocking module is used to receive the completion message of each node of the multi-chain and send the unlock request to each node of the multi-chain. The unlocking request unlocks the associated data corresponding to the transaction on the current node based on the unlocking request.
本申请第三方面提供了一种跨链交易的设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互联;所述至少一个处理器调用所述存储器中的所述指令,以使得所述跨链交易的设备执行上述第一方面所述的方法。A third aspect of the present application provides a cross-chain transaction device, including: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected by wires; the at least one The processor invokes the instructions in the memory, so that the cross-chain transaction device executes the method described in the first aspect.
本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行上述第一方面所述的方法。The fourth aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and when the computer instructions run on a computer, the computer executes the above-mentioned first aspect method.
本申请在多链的各个节点间进行跨链交易时,节点在接收到交易时将本节点上本次交易对应的关联数据进行锁定,在完成本次交易后将本次交易的完成消息推送给客户端,客户端分别接收到该多链的各个节点的完成消息后,向各个节点发送解锁请求,以将节点上本次交易对应的关联数据进行解锁,本申请在进行跨链交易时锁定数据并在交易完成后解锁数据,能够实现安全有效的跨链交易。In this application, when a cross-chain transaction is performed between each node of the multi-chain, the node locks the associated data corresponding to the transaction on the node when receiving the transaction, and pushes the completion message of the transaction to The client, after receiving the completion message of each node of the multi-chain, the client sends an unlock request to each node to unlock the associated data corresponding to the transaction on the node. This application locks the data during cross-chain transactions And unlock the data after the transaction is completed, which can realize safe and effective cross-chain transactions.
附图说明Description of the drawings
图1为本申请各个实施例一可选的应用环境示意图;FIG. 1 is a schematic diagram of an optional application environment of each embodiment of this application;
图2为本申请跨链交易的装置一实施例的硬件架构的示意图;FIG. 2 is a schematic diagram of the hardware architecture of an embodiment of the cross-chain transaction device of this application;
图3为图2中处理系统一实施例的程序模块图;FIG. 3 is a program module diagram of an embodiment of the processing system in FIG. 2;
图4为本申请跨链交易的方法一实施例的流程示意图。FIG. 4 is a schematic flowchart of an embodiment of a method for applying a cross-chain transaction.
具体实施方式Detailed ways
本申请实施例提供了一种跨链交易的方法、装置、设备及存储介质,旨在实现安全有效的跨链交易。The embodiments of the present application provide a method, device, equipment and storage medium for cross-chain transactions, aiming to realize safe and effective cross-chain transactions.
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例进行描述。In order to enable those skilled in the art to better understand the solutions of the present application, the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, without having to use To describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than the content illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device including a series of steps or units is not necessarily limited to those clearly listed Steps or units, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or equipment.
为便于理解,下面对本申请实施例的具体流程进行描述,参阅图1所示,是本申请的较佳实施例的应用环境示意图。在该实施例中,多链包括区块链1、区块链2及区块链3,客户端将交易发送给多个区块链,以在多链的各个节点间进行跨链交易。跨链交易的装置为区块链中执行交易的节点所在的设备。For ease of understanding, the following describes the specific process of the embodiment of the present application. Refer to FIG. 1, which is a schematic diagram of the application environment of the preferred embodiment of the present application. In this embodiment, the multiple chains include blockchain 1, blockchain 2, and blockchain 3. The client sends transactions to multiple blockchains to perform cross-chain transactions among the nodes of the multiple chains. The cross-chain transaction device is the device where the node executing the transaction in the blockchain is located.
跨链交易的装置是一种能够按照事先设定或者存储的指令,自动进行数值 计算和/或信息处理的设备。所述跨链交易的装置可以是计算机、也可以是单个网络服务器、多个网络服务器组成的服务器组或者基于云计算的由大量主机或者网络服务器构成的云,其中云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。A cross-chain transaction device is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions. The cross-chain transaction device can be a computer, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing, where cloud computing is one of distributed computing. A super virtual computer composed of a group of loosely coupled computer sets.
参照图2所示,为本申请跨链交易的装置一实施例的硬件架构的示意图,在本实施例中,跨链交易的装置1可包括,但不仅限于,可通过系统总线相互通信连接的存储器11、处理器12、网络接口13,存储器11存储有可在处理器12上运行的处理系统10。需要指出的是,图2仅示出了具有组件11-13的跨链交易的装置1,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。2 shows a schematic diagram of the hardware architecture of an embodiment of the cross-chain transaction device of this application. In this embodiment, the cross-chain transaction device 1 may include, but is not limited to, those that can communicate with each other through a system bus. The memory 11, the processor 12, and the network interface 13, and the memory 11 stores a processing system 10 that can run on the processor 12. It should be pointed out that Figure 2 only shows the device 1 for cross-chain transactions with components 11-13, but it should be understood that it is not required to implement all of the illustrated components, and more or less may be implemented instead. Components.
其中,存储器11包括内存及至少一种类型的可读存储介质。内存为跨链交易的装置1的运行提供缓存;可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等的非易失性存储介质。在一些实施例中,可读存储介质可以是跨链交易的装置1的内部存储单元,例如该跨链交易的装置1的硬盘;在另一些实施例中,该非易失性存储介质也可以是跨链交易的装置1的外部存储设备,例如跨链交易的装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。本实施例中,存储器11的可读存储介质通常用于存储安装于跨链交易的装置1的操作系统和各类应用软件,例如存储本申请一实施例中的处理系统10的程序代码等。此外,存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。Among them, the memory 11 includes a memory and at least one type of readable storage medium. The memory provides a cache for the operation of the device 1 for cross-chain transactions; the readable storage medium can be, for example, flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access Non-volatile storage media such as memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, and optical disks. In some embodiments, the readable storage medium may be an internal storage unit of the device 1 for cross-chain transactions, such as the hard disk of the device 1 for cross-chain transactions; in other embodiments, the non-volatile storage medium may also be It is the external storage device of the device 1 for cross-chain transactions, such as plug-in hard disks, Smart Media Card (SMC), Secure Digital (SD) cards, flash memory cards equipped on the device 1 for cross-chain transactions (Flash Card) etc. In this embodiment, the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed in the cross-chain transaction device 1, for example, to store the program code of the processing system 10 in an embodiment of the present application. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
所述处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片,用于运行所述存储器11中存储的程序代码或者处理数据,例如运行处理系统10等。The processor 12 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run data stored in the memory 11 Program code or processing data, such as running the processing system 10, etc.
所述网络接口13可包括标准的无线网络接口、有线网络接口,该网络接口13通常用于在所述跨链交易的装置1与其他电子设备之间建立通信连接。The network interface 13 may include a standard wireless network interface and a wired network interface. The network interface 13 is generally used to establish a communication connection between the cross-chain transaction device 1 and other electronic devices.
所述处理系统10存储在存储器11中,包括至少一个存储在存储器11中的计算机可读指令,该至少一个计算机可读指令可被处理器器12执行,以实现本申请各实施例的方法;以及,该至少一个计算机可读指令依据其各部分所实现的功能不同,可被划为不同的逻辑模块。The processing system 10 is stored in the memory 11, and includes at least one computer-readable instruction stored in the memory 11, and the at least one computer-readable instruction can be executed by the processor 12 to implement the method of each embodiment of the present application; And, the at least one computer-readable instruction can be divided into different logic modules according to the different functions implemented by its parts.
在一实施例中,上述处理系统10被所述处理器12执行时实现如下步骤:In an embodiment, the above-mentioned processing system 10 implements the following steps when being executed by the processor 12:
在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;When a cross-chain transaction is performed between various nodes of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node is The related data corresponding to the transaction is locked;
基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交 易的完成消息推送给客户端;Execute the smart contract based on the transaction information and related data, and push the completion message of the transaction to the client after completing the transaction;
当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。When the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and performs the associated data corresponding to this transaction on the node based on the unlock request. Unlock.
具体原理请参照下述图3关于处理系统10的程序模块图及图4关于该方法的流程图的介绍。For specific principles, please refer to the following description of the program module diagram of the processing system 10 in FIG. 3 and the flowchart of the method in FIG. 4.
参照图3所示,为图2中处理系统10的程序模块图。所述处理系统10被分割为多个模块,该多个模块被存储于存储器12中,并由处理器13执行,以完成本申请。本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段。Referring to FIG. 3, it is a program module diagram of the processing system 10 in FIG. The processing system 10 is divided into multiple modules, and the multiple modules are stored in the memory 12 and executed by the processor 13 to complete the application. The module referred to in this application refers to a series of computer program instruction segments that can complete specific functions.
所述处理系统10可以被分割为:锁定模块101、推送模块102及解锁模块103。The processing system 10 can be divided into: a locking module 101, a pushing module 102, and an unlocking module 103.
所述锁定模块101,用于在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;The locking module 101 is used to receive the transaction information of this transaction sent by the client and the lock request of the client based on the transaction information for the corresponding associated data when performing cross-chain transactions between the various nodes of the multi-chain. The lock request locks the associated data corresponding to this transaction on the node;
其中,关联数据为交易中必须使用到的数据,不同的交易的关联数据不同。例如,A机构与B机构属于不同的区块链,跨链交易的交易信息例如为:从A机构转账100万至B机构,则对应的关联数据为A机构在区块链上的账户信息、B机构在区块链上的账户信息。如果各个链上的数据锁定成功,则可以执行交易。关联数据的锁定的目的是防止其他用户修改该数据,使得交易失败。Among them, related data is data that must be used in transactions, and different transactions have different related data. For example, institution A and institution B belong to different blockchains. For example, the transaction information of cross-chain transactions is: transfer 1 million from institution A to institution B, and the corresponding associated data is institution A’s account information on the blockchain, Account information of institution B on the blockchain. If the data on each chain is successfully locked, the transaction can be executed. The purpose of locking the associated data is to prevent other users from modifying the data, causing the transaction to fail.
所述推送模块102,用于基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;The push module 102 is configured to execute a smart contract based on the transaction information and associated data, and push the completion message of the transaction to the client after the transaction is completed;
其中,在交易完成后,将本次交易的完成消息主动推送给客户端,使得上层的客户端能够及时获知交易结果,不需要不断向节点轮询交易结果。Among them, after the transaction is completed, the completion message of this transaction is actively pushed to the client terminal, so that the upper-level client terminal can learn the transaction result in time without constantly polling the node for the transaction result.
所述解锁模块103,用于当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。The unlocking module 103 is used for receiving the unlocking request after the client receives the completion message of each node of the multi-chain and sending an unlocking request to each node of the multi-chain respectively, and based on the unlocking request, the current node The associated data corresponding to this transaction is unlocked.
当客户端接收到该多链的各个节点的完成消息后,分析是否接收到所有执行交易的节点的完成消息,以确定本次交易是否成功,如果是,则可以发送发送解锁请求给该多链的各个节点,以将本节点上本次交易对应的关联数据进行解锁。在其他实施例中,节点在交易完成后,可以自行对关联数据进行解锁。When the client receives the completion message of each node of the multi-chain, it analyzes whether it has received the completion message of all the nodes that execute the transaction to determine whether the transaction is successful, and if it is, it can send an unlock request to the multi-chain To unlock the associated data corresponding to this transaction on this node. In other embodiments, the node can unlock the associated data by itself after the transaction is completed.
如图4所示,图4为本申请跨链交易的方法一实施例的流程示意图,跨链交易的装置1的处理器13执行存储器12中存储的处理系统10时实现该方法的如下步骤:As shown in FIG. 4, FIG. 4 is a schematic flowchart of an embodiment of a method for cross-chain transaction of this application. When the processor 13 of the device 1 for cross-chain transaction executes the processing system 10 stored in the memory 12, the following steps of the method are implemented:
步骤S1,在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;Step S1, when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node The related data corresponding to the previous transaction is locked;
其中,由客户端将本次交易的交易信息发送给多链的各个节点进行跨链交易,同时客户端发送该交易信息对相应的关联数据的锁定请求给多链的各个节点。关联数据为交易中必须使用到的数据,不同的交易的关联数据不同,例如,A机构与B机构属于不同的区块链,跨链交易的交易信息例如为:从A机构转账100万至B机构,则对应的关联数据为A机构在区块链上的账户信息、B机构在区块链上的账户信息。Among them, the client sends the transaction information of this transaction to each node of the multi-chain for cross-chain transactions, and at the same time, the client sends a lock request of the transaction information to the corresponding associated data to each node of the multi-chain. Related data is the data that must be used in the transaction. Different transactions have different related data. For example, A and B belong to different blockchains. For example, the transaction information of a cross-chain transaction is: transfer 1 million from A to B Institution, the corresponding associated data is the account information of institution A on the blockchain and the account information of institution B on the blockchain.
其中,如果有区块链中的关联数据没有锁定成功,则本次跨链交易失败,需要重新发起交易。如果各个链上的数据锁定成功,则可以执行交易。关联数据的锁定的目的是防止其他用户修改该数据,使得交易失败。Among them, if the associated data in the blockchain is not locked successfully, the cross-chain transaction fails and the transaction needs to be re-initiated. If the data on each chain is successfully locked, the transaction can be executed. The purpose of locking the associated data is to prevent other users from modifying the data, causing the transaction to fail.
步骤S2,基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;Step S2, execute a smart contract based on the transaction information and associated data, and push the completion message of the transaction to the client after the transaction is completed;
其中,多链的各个节点基于该交易信息及关联数据执行智能合约,在交易完成后执行提交交易并在区块链账本上写入交易信息,同时,在交易完成后,将本次交易的完成消息主动推送给客户端,使得上层的客户端能够及时获知交易结果,不需要不断向节点轮询交易结果。Among them, each node of the multi-chain executes smart contracts based on the transaction information and associated data, executes the transaction submission after the transaction is completed, and writes the transaction information on the blockchain ledger. At the same time, after the transaction is completed, the transaction is completed The message is actively pushed to the client, so that the upper-level client can learn the transaction result in time without constantly polling the node for the transaction result.
进一步地,客户端可以通过长轮询的方式获取交易完成消息,即客户端在发送本次交易的交易信息给节点之后,连接空闲并等待,节点在交易完成后生成完成消息时,立刻返回完成消息给客户端。该操作是考虑到:当推送完成消息不稳定出现交易丢失的情况时,交易就陷入了不可知状态,因此,可同时使用消息确保送达机制,即在节点推送的同时客户端进行长轮询。Further, the client can obtain the transaction completion message through long polling, that is, after the client sends the transaction information of this transaction to the node, the connection is idle and waits, and the node immediately returns the completion message when the transaction is completed. Message to the client. This operation takes into account: when the push completion message is unstable and the transaction is lost, the transaction falls into an unknown state. Therefore, the message delivery mechanism can be used at the same time, that is, the client performs long polling while the node is pushing. .
步骤S3,当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。Step S3: After the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and based on the unlock request, the transaction corresponding to this node is Link data to unlock.
当客户端接收到该多链的各个节点的完成消息后,分析是否接收到所有执行交易的节点的完成消息,以确定本次交易是否成功,如果是,则可以发送发送解锁请求给该多链的各个节点,以将本节点上本次交易对应的关联数据进行解锁。在其他实施例中,节点在交易完成后,可以自行对关联数据进行解锁。When the client receives the completion message of each node of the multi-chain, it analyzes whether it has received the completion message of all the nodes that execute the transaction to determine whether the transaction is successful, and if it is, it can send an unlock request to the multi-chain To unlock the associated data corresponding to this transaction on this node. In other embodiments, the node can unlock the associated data by itself after the transaction is completed.
在一实施例中,在上述实施例的基础上,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,具体包括:基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;In one embodiment, on the basis of the above-mentioned embodiment, the step of locking the associated data corresponding to this transaction on the node based on the locking request specifically includes: locking the smart contract on a predetermined smart contract based on the locking request Write the associated data corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,具体包括:基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据,执行该解锁智能合约以将本节点上本次交易对应的关联数据进行解锁。The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request specifically includes: writing the associated data corresponding to the transaction on the node on the predetermined unlock smart contract based on the unlock request, and execute The unlocking smart contract unlocks the associated data corresponding to this transaction on the node.
其中,关联数据锁定可以用锁定智能合约来实现,例如,交易为:用户需要修改数据A,那么锁定关联数据可以为LOCK-A,当用锁定智能合约在区块链 上写入LOCK-A成功时,表示数据A锁定成功。Among them, the related data lock can be realized by a lock smart contract. For example, the transaction is: the user needs to modify data A, then the locked related data can be LOCK-A. When the lock smart contract is used to write LOCK-A on the blockchain successfully , It means that data A is locked successfully.
其中,关联数据解锁可以用解锁智能合约来实现,例如,在需要解锁数据A时,那么解锁关联数据可以为LOCK-A,当用解锁智能合约在区块链上写入LOCK-A成功时,表示数据A解锁成功。Among them, the associated data unlocking can be realized by unlocking the smart contract. For example, when data A needs to be unlocked, then the unlocking associated data can be LOCK-A. When the unlocking smart contract is used to write LOCK-A on the blockchain successfully, Indicates that data A is successfully unlocked.
在一实施例中,在上述实施例的基础上,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,包括:基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及第一身份信息,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;In one embodiment, on the basis of the foregoing embodiment, the step of locking the associated data corresponding to this transaction on the current node based on the lock request includes: writing on a predetermined lock smart contract based on the lock request Enter the associated data and the first identity information corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,进一步包括:基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据及第二身份信息,执行该解锁智能合约,当所述第二身份信息与所述第一身份信息相同时,将本节点上本次交易对应的关联数据进行解锁。The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request further includes: writing the associated data and the second transaction corresponding to the transaction on the node on the predetermined unlocking smart contract based on the unlock request. 2. Identity information, execute the unlocking smart contract, and when the second identity information is the same as the first identity information, the associated data corresponding to the transaction on the current node is unlocked.
其中,第二身份信息与第一身份信息可以是用户(机构)的数字证书,在锁定智能合约上写入关联数据及机构的数字证书,在解锁智能合约上写入关联数据及机构的数字证书,在解锁时,只有两个数字证书一致则身份校验通过,可以执行解锁操作。在锁定智能合约及解锁智能合约中分别写入身份信息,目的是为了防止其他用户恶意解锁数据(即在已经有用户锁定数据的情况下,强行解锁来使用该数据)而中断交易,进一步提高跨链交易的安全性。Among them, the second identity information and the first identity information can be the digital certificate of the user (organization), the associated data and the digital certificate of the institution are written on the locked smart contract, and the associated data and the digital certificate of the institution are written on the unlocked smart contract. When unlocking, if only two digital certificates are consistent, the identity verification is passed, and the unlocking operation can be performed. Write the identity information in the lock smart contract and unlock the smart contract separately. The purpose is to prevent other users from maliciously unlocking the data (that is, when there is already a user locked data, forcibly unlocking to use the data) and interrupting the transaction, further improving the cross-border Security of chain transactions.
在一实施例中,在上述实施例的基础上,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,包括:基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及锁定时长,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;In one embodiment, on the basis of the foregoing embodiment, the step of locking the associated data corresponding to this transaction on the current node based on the lock request includes: writing on a predetermined lock smart contract based on the lock request Enter the associated data and lock duration corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
该跨链交易的方法,还包括:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前时刻与锁定关联数据的时刻的时间差大于等于该锁定时长时,将本节点上本次交易对应的关联数据进行解锁。The cross-chain transaction method further includes: when the unlock request is not received after pushing the completion message of the transaction to the client, if the time difference between the current moment and the moment when the associated data is locked is greater than or equal to the lock duration, the current The associated data corresponding to this transaction on the node is unlocked.
其中,为了防止某个用户长时间锁定数据或者完成跨链交易之后长时间不解锁数据(例如,客户端程序出现异常宕机无法继续执行正常逻辑进行解锁),使得锁定数据不能被其他用户所使用,本实施例可以在锁定智能合约上写入关联数据及锁定时长,当然,在交易完成的情况下,才执行分析当前时刻与锁定关联数据的时刻的时间差与该锁定时长的大小关系,在时间差大于等于该锁定时长时将数据进行解锁。Among them, in order to prevent a user from locking the data for a long time or not unlocking the data for a long time after completing a cross-chain transaction (for example, the client program has an abnormal downtime and cannot continue to execute normal logic to unlock), so that the locked data cannot be used by other users In this embodiment, the associated data and the lock duration can be written on the locked smart contract. Of course, only when the transaction is completed, the analysis is performed on the relationship between the current time and the time when the associated data is locked and the lock duration. The data will be unlocked when it is greater than or equal to the lock duration.
在一实施例中,在上述实施例的基础上,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,包括:基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及区块数量,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;In one embodiment, on the basis of the foregoing embodiment, the step of locking the associated data corresponding to this transaction on the current node based on the lock request includes: writing on a predetermined lock smart contract based on the lock request Enter the associated data and the number of blocks corresponding to this transaction on this node, and execute the lock smart contract to lock the associated data corresponding to this transaction on this node;
该跨链交易的方法,还包括:当将本次交易的完成消息推送给客户端后未 接收到解锁请求时,若当前区块号与锁定关联数据的时刻的区块号的差值大于等于该区块数量时,将本节点上本次交易对应的关联数据进行解锁。The cross-chain transaction method further includes: when the unlock request is not received after pushing the completion message of the transaction to the client, if the difference between the current block number and the block number at the moment when the associated data is locked is greater than or equal to When the number of blocks is reached, the associated data corresponding to the transaction on this node will be unlocked.
本实施例考虑到区块链上的节点时间往往无法统一一致(每个节点运行在单独的服务器上,每个服务器的时间不是完全一致的,可能有几秒、几分钟的差异),因此可以使用区块数量来代替上述的锁定时长,例如,区块数量为10,则锁定数据的有效时长为10个区块,假设当前区块号是100,那么在区块号到达110之前,其他用户无法解锁该数据,除非用户主动释放,区块号进行到110之后,自动解锁。This embodiment considers that the node time on the blockchain is often not uniform (each node runs on a separate server, and the time of each server is not completely the same, there may be a difference of several seconds or minutes), so it can Use the number of blocks to replace the lock duration mentioned above. For example, if the number of blocks is 10, the valid duration of the locked data is 10 blocks. Assuming that the current block number is 100, other users will The data cannot be unlocked unless the user actively releases it. After the block number reaches 110, it will be automatically unlocked.
与现有技术相比,本申请在多链的各个节点间进行跨链交易时,节点在接收到交易时将本节点上本次交易对应的关联数据进行锁定,在完成本次交易后将本次交易的完成消息推送给客户端,客户端分别接收到该多链的各个节点的完成消息后,向各个节点发送解锁请求,以将节点上本次交易对应的关联数据进行解锁,本申请在进行跨链交易时锁定数据并在交易完成后解锁数据,能够实现安全有效的跨链交易。Compared with the prior art, in this application, when a cross-chain transaction is performed between each node in a multi-chain, the node locks the associated data corresponding to the transaction on the node when the transaction is received, and the transaction is completed after the transaction is completed. The completion message of the transaction is pushed to the client. After the client receives the completion message of each node of the multi-chain, it sends an unlock request to each node to unlock the associated data corresponding to the transaction on the node. Locking the data during cross-chain transactions and unlocking the data after the transaction is completed can realize safe and effective cross-chain transactions.
本申请还提供一种跨链交易的设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互联;所述至少一个处理器调用所述存储器中的所述指令,以使得所述跨链交易的设备执行上述跨链交易的方法中的步骤。The present application also provides a cross-chain transaction device, including: a memory and at least one processor, the memory stores instructions, the memory and the at least one processor are interconnected by wires; the at least one processor calls The instructions in the memory enable the cross-chain transaction device to execute the steps in the above-mentioned cross-chain transaction method.
本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,也可以为易失性计算机可读存储介质。计算机可读存储介质存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:The present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on the computer, the computer executes the following steps:
S1,在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;S1, when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node The related data corresponding to this transaction is locked;
S2,基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;S2, execute the smart contract based on the transaction information and related data, and push the completion message of the transaction to the client after the transaction is completed;
S3,当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。S3: After the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and associates the transaction corresponding to the current node on the node based on the unlock request. The data is unlocked.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above-described system, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或 一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that: The technical solutions recorded in the embodiments are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种跨链交易的方法,所述跨链交易的方法包括:A method of cross-chain transaction, the method of cross-chain transaction includes:
    S1,在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;S1, when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node The related data corresponding to this transaction is locked;
    S2,基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;S2, execute the smart contract based on the transaction information and related data, and push the completion message of the transaction to the client after the transaction is completed;
    S3,当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。S3: After the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and associates the transaction corresponding to the current node on the node based on the unlock request. The data is unlocked.
  2. 根据权利要求1所述的跨链交易的方法,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,具体包括:The method for cross-chain transactions according to claim 1, wherein the step of locking the associated data corresponding to the transaction on the current node based on the locking request specifically includes:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the current transaction on the node in a predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the current transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,具体包括:The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request specifically includes:
    基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据,执行该解锁智能合约以将本节点上本次交易对应的关联数据进行解锁。Based on the unlock request, write the associated data corresponding to the current transaction on the current node in the predetermined unlock smart contract, and execute the unlock smart contract to unlock the associated data corresponding to the current transaction on the node.
  3. 根据权利要求1所述的跨链交易的方法,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,包括:The method for cross-chain transactions according to claim 1, wherein the step of locking the associated data corresponding to the transaction on the current node based on the locking request comprises:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及第一身份信息,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and first identity information corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,进一步包括:基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据及第二身份信息,执行该解锁智能合约,当所述第二身份信息与所述第一身份信息相同时,将本节点上本次交易对应的关联数据进行解锁。The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request further includes: writing the associated data and the second transaction corresponding to the transaction on the node on the predetermined unlocking smart contract based on the unlock request. 2. Identity information, execute the unlocking smart contract, and when the second identity information is the same as the first identity information, the associated data corresponding to the transaction on the current node is unlocked.
  4. 根据权利要求1所述的跨链交易的方法,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,包括:The method for cross-chain transactions according to claim 1, wherein the step of locking the associated data corresponding to the transaction on the current node based on the locking request comprises:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及锁定时长,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the transaction on the node and the lock duration on the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该跨链交易的方法,还包括:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前时刻与锁定关联数据的时刻的时间差大于等于该锁 定时长时,将本节点上本次交易对应的关联数据进行解锁。The cross-chain transaction method further includes: when the unlock request is not received after pushing the completion message of the transaction to the client, if the time difference between the current moment and the moment when the associated data is locked is greater than or equal to the lock duration, the current The associated data corresponding to this transaction on the node is unlocked.
  5. 根据权利要求1所述的跨链交易的方法,所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤,包括:The method for cross-chain transactions according to claim 1, wherein the step of locking the associated data corresponding to the transaction on the current node based on the locking request comprises:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及区块数量,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and block number corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该跨链交易的方法,还包括:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前区块号与锁定关联数据的时刻的区块号的差值大于等于该区块数量时,将本节点上本次交易对应的关联数据进行解锁。The cross-chain transaction method further includes: when the unlock request is not received after pushing the completion message of the transaction to the client, if the difference between the current block number and the block number at the moment when the associated data is locked is greater than or equal to When the number of blocks is reached, the associated data corresponding to the transaction on this node will be unlocked.
  6. 一种跨链交易的装置,所述跨链交易的装置包括存储器及与所述存储器连接的处理器,所述存储器中存储有可在所述处理器上运行的处理系统,所述处理系统包括:A device for cross-chain transactions. The device for cross-chain transactions includes a memory and a processor connected to the memory. The memory stores a processing system that can run on the processor. The processing system includes :
    锁定模块,用于在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;The lock module is used to receive the transaction information of this transaction sent by the client and the lock request of the corresponding associated data based on the transaction information when the cross-chain transaction is performed between the various nodes of the multi-chain, and based on the lock request, The associated data corresponding to this transaction on this node is locked;
    推送模块,用于基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;The push module is used to execute the smart contract based on the transaction information and associated data, and push the completion message of the transaction to the client after the transaction is completed;
    解锁模块,用于当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。The unlocking module is used for receiving the unlocking request after the client receives the completion message of each node of the multi-chain and sending an unlocking request to each node of the multi-chain respectively, and based on the unlocking request, the current transaction on the node The corresponding associated data is unlocked.
  7. 根据权利要求6所述的跨链交易的装置,所述锁定模块具体用于:According to the cross-chain transaction device according to claim 6, the locking module is specifically configured to:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the current transaction on the node in a predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the current transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,具体包括:The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request specifically includes:
    基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据,执行该解锁智能合约以将本节点上本次交易对应的关联数据进行解锁。Based on the unlock request, write the associated data corresponding to the current transaction on the current node in the predetermined unlock smart contract, and execute the unlock smart contract to unlock the associated data corresponding to the current transaction on the node.
  8. 根据权利要求6所述的跨链交易的装置,所述锁定模块具体用于:According to the cross-chain transaction device according to claim 6, the locking module is specifically configured to:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及第一身份信息,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and first identity information corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,进一步包括:The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request further includes:
    基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据及第二身份信息,执行该解锁智能合约,当所述第二身份信息与所述 第一身份信息相同时,将本节点上本次交易对应的关联数据进行解锁。Based on the unlock request, write the associated data and second identity information corresponding to this transaction on the node on the predetermined unlock smart contract, and execute the unlock smart contract. When the second identity information is the same as the first identity information At the same time, the associated data corresponding to this transaction on this node is unlocked.
  9. 根据权利要求6所述的跨链交易的装置,所述锁定模块具体用于:According to the cross-chain transaction device according to claim 6, the locking module is specifically configured to:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及锁定时长,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the transaction on the node and the lock duration on the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该跨链交易的装置,还具体用于:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前时刻与锁定关联数据的时刻的时间差大于等于该锁定时长时,将本节点上本次交易对应的关联数据进行解锁。The cross-chain transaction device is also specifically used to: when the unlock request is not received after pushing the completion message of this transaction to the client, if the time difference between the current moment and the moment when the associated data is locked is greater than or equal to the lock duration, Unlock the associated data corresponding to this transaction on this node.
  10. 根据权利要求6所述的跨链交易的装置,所述锁定模块具体用于:According to the cross-chain transaction device according to claim 6, the locking module is specifically configured to:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及区块数量,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and block number corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该跨链交易的装置,还具体用于:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前区块号与锁定关联数据的时刻的区块号的差值大于等于该区块数量时,将本节点上本次交易对应的关联数据进行解锁。The cross-chain transaction device is also specifically used for: when the unlock request is not received after pushing the completion message of this transaction to the client, if the difference between the current block number and the block number at the moment when the associated data is locked When the number of blocks is greater than or equal to the number of blocks, the associated data corresponding to the transaction on this node is unlocked.
  11. 一种跨链交易的设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A cross-chain transaction device, including a memory, a processor, and computer-readable instructions stored on the memory and capable of running on the processor. The processor implements the following steps when the processor executes the computer-readable instructions :
    S1,在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定请求将本节点上本次交易对应的关联数据进行锁定;S1, when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the current node The related data corresponding to this transaction is locked;
    S2,基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;S2, execute the smart contract based on the transaction information and related data, and push the completion message of the transaction to the client after the transaction is completed;
    S3,当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。S3: After the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and associates the transaction corresponding to the current node on the node based on the unlock request. The data is unlocked.
  12. 根据权利要求11所述的跨链交易的设备,所述处理器执行所述计算机可读指令实现所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,包括以下步骤:According to the cross-chain transaction device of claim 11, when the processor executes the computer-readable instructions to implement the step of locking the associated data corresponding to the transaction on the current node based on the lock request, the step includes the following step:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the current transaction on the node in a predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the current transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,具体包括:The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request specifically includes:
    基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据,执行该解锁智能合约以将本节点上本次交易对应的关联数据进行解锁。Based on the unlock request, write the associated data corresponding to the current transaction on the current node in the predetermined unlock smart contract, and execute the unlock smart contract to unlock the associated data corresponding to the current transaction on the node.
  13. 根据权利要求11所述的跨链交易的设备,所述处理器执行所述计算机可读指令实现所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,包括以下步骤:According to the cross-chain transaction device of claim 11, when the processor executes the computer-readable instructions to implement the step of locking the associated data corresponding to the transaction on the current node based on the lock request, the step includes the following step:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及第一身份信息,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and first identity information corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,进一步包括:基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据及第二身份信息,执行该解锁智能合约,当所述第二身份信息与所述第一身份信息相同时,将本节点上本次交易对应的关联数据进行解锁。The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request further includes: writing the associated data and the second transaction corresponding to the transaction on the node on the predetermined unlocking smart contract based on the unlock request. 2. Identity information, execute the unlocking smart contract, and when the second identity information is the same as the first identity information, the associated data corresponding to the transaction on the current node is unlocked.
  14. 根据权利要求11所述的跨链交易的设备,所述处理器执行所述计算机可读指令实现所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,包括以下步骤:According to the cross-chain transaction device of claim 11, when the processor executes the computer-readable instructions to implement the step of locking the associated data corresponding to the transaction on the current node based on the lock request, the step includes the following step:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及锁定时长,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the transaction on the node and the lock duration on the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该跨链交易的设备,所述处理器执行所述计算机可读指令实现所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,还包括以下步骤:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前时刻与锁定关联数据的时刻的时间差大于等于该锁定时长时,将本节点上本次交易对应的关联数据进行解锁。In the cross-chain transaction device, when the processor executes the computer-readable instructions to implement the step of locking the associated data corresponding to the transaction on the current node based on the lock request, it further includes the following step: When the completion message of the transaction is pushed to the client and the unlock request is not received, if the time difference between the current time and the time when the associated data is locked is greater than or equal to the lock duration, the associated data corresponding to the transaction on the current node is unlocked.
  15. 根据权利要求11所述的跨链交易的设备,所述处理器执行所述计算机可读指令实现所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,包括以下步骤:According to the cross-chain transaction device of claim 11, when the processor executes the computer-readable instructions to implement the step of locking the associated data corresponding to the transaction on the current node based on the lock request, the step includes the following step:
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及区块数量,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and block number corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该跨链交易的设备,所述处理器执行所述计算机可读指令实现所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,还包括以下步骤:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前区块号与锁定关联数据的时刻的区块号的差值大于等于该区块数量时,将本节点上本次交易对应的关联数据进行解锁。In the cross-chain transaction device, when the processor executes the computer-readable instructions to implement the step of locking the associated data corresponding to the transaction on the current node based on the lock request, it further includes the following step: When the completion message of the transaction is pushed to the client and the unlock request is not received, if the difference between the current block number and the block number at the moment when the associated data is locked is greater than or equal to the number of blocks, the current transaction on this node The corresponding associated data is unlocked.
  16. 一种计算机可读存储介质,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:A computer-readable storage medium that stores computer instructions, and when the computer instructions are executed on a computer, the computer executes the following steps:
    S1,在多链的各个节点间进行跨链交易时,接收客户端发送本次交易的交易信息及该客户端基于该交易信息对相应的关联数据的锁定请求,基于该锁定 请求将本节点上本次交易对应的关联数据进行锁定;S1, when a cross-chain transaction is performed between each node of the multi-chain, the receiving client sends the transaction information of this transaction and the client's lock request for the corresponding associated data based on the transaction information, and based on the lock request, the node The related data corresponding to this transaction is locked;
    S2,基于该交易信息及关联数据执行智能合约,并在完成本次交易后将本次交易的完成消息推送给客户端;S2, execute the smart contract based on the transaction information and related data, and push the completion message of the transaction to the client after the transaction is completed;
    S3,当客户端分别接收到该多链的各个节点的完成消息并分别发送解锁请求给该多链的各个节点后,接收该解锁请求,基于该解锁请求将本节点上本次交易对应的关联数据进行解锁。S3: After the client receives the completion message of each node of the multi-chain and sends an unlock request to each node of the multi-chain, it receives the unlock request, and associates the transaction corresponding to the current node on the node based on the unlock request. The data is unlocked.
  17. 根据权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,使得计算机执行如下步骤:The computer-readable storage medium according to claim 16, when the computer instruction executes the step of locking the associated data corresponding to this transaction on the node based on the lock request on the computer, the computer is caused to perform the following steps :
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the current transaction on the node in a predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the current transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,具体包括:The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request specifically includes:
    基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据,执行该解锁智能合约以将本节点上本次交易对应的关联数据进行解锁。Based on the unlock request, write the associated data corresponding to the current transaction on the current node in the predetermined unlock smart contract, and execute the unlock smart contract to unlock the associated data corresponding to the current transaction on the node.
  18. 根据权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,使得计算机执行如下步骤:The computer-readable storage medium according to claim 16, when the computer instruction executes the step of locking the associated data corresponding to this transaction on the node based on the lock request on the computer, the computer is caused to perform the following steps :
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及第一身份信息,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and first identity information corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    所述基于该解锁请求将本节点上本次交易对应的关联数据进行解锁的步骤,进一步包括:基于该解锁请求在预定的解锁智能合约上写入本节点上本次交易对应的关联数据及第二身份信息,执行该解锁智能合约,当所述第二身份信息与所述第一身份信息相同时,将本节点上本次交易对应的关联数据进行解锁。The step of unlocking the associated data corresponding to the transaction on the current node based on the unlock request further includes: writing the associated data and the second transaction corresponding to the transaction on the node on the predetermined unlocking smart contract based on the unlock request. 2. Identity information, execute the unlocking smart contract, and when the second identity information is the same as the first identity information, the associated data corresponding to the transaction on the current node is unlocked.
  19. 根据权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,使得计算机执行如下步骤:The computer-readable storage medium according to claim 16, when the computer instruction executes the step of locking the associated data corresponding to this transaction on the node based on the lock request on the computer, the computer is caused to perform the following steps :
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及锁定时长,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data corresponding to the transaction on the node and the lock duration on the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该计算机可读存储介质,当所述计算机指令在计算机上运行所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,还使得计算机执行如下步骤:当将本次交易的完成消息推送给客户端后未接收到解锁请求 时,若当前时刻与锁定关联数据的时刻的时间差大于等于该锁定时长时,将本节点上本次交易对应的关联数据进行解锁。The computer-readable storage medium, when the computer instruction executes the step of locking the associated data corresponding to this transaction on the current node based on the lock request on the computer, it also causes the computer to perform the following steps: After the transaction completion message is pushed to the client and the unlock request is not received, if the time difference between the current time and the time when the associated data is locked is greater than or equal to the lock duration, the associated data corresponding to this transaction on the node is unlocked.
  20. 根据权利要求16所述的计算机可读存储介质,当所述计算机指令在计算机上运行所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,使得计算机执行如下步骤:The computer-readable storage medium according to claim 16, when the computer instruction executes the step of locking the associated data corresponding to this transaction on the node based on the lock request on the computer, the computer is caused to perform the following steps :
    基于该锁定请求在预定的锁定智能合约上写入本节点上本次交易对应的关联数据及区块数量,执行该锁定智能合约以将本节点上本次交易对应的关联数据进行锁定;Based on the lock request, write the associated data and block number corresponding to this transaction on the node in the predetermined lock smart contract, and execute the lock smart contract to lock the associated data corresponding to the transaction on the node;
    该计算机可读存储介质,当所述计算机指令在计算机上运行所述基于该锁定请求将本节点上本次交易对应的关联数据进行锁定的步骤时,还使得计算机执行如下步骤:当将本次交易的完成消息推送给客户端后未接收到解锁请求时,若当前区块号与锁定关联数据的时刻的区块号的差值大于等于该区块数量时,将本节点上本次交易对应的关联数据进行解锁。The computer-readable storage medium, when the computer instruction executes the step of locking the associated data corresponding to this transaction on the current node based on the lock request on the computer, it also causes the computer to perform the following steps: When the transaction completion message is pushed to the client and the unlock request is not received, if the difference between the current block number and the block number at the time when the associated data is locked is greater than or equal to the number of blocks, the transaction on this node will be corresponded to The associated data is unlocked.
PCT/CN2019/120569 2019-05-06 2019-11-25 Cross-chain transaction method and apparatus, device, and storage medium WO2020224235A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910370448.5 2019-05-06
CN201910370448.5A CN110232094A (en) 2019-05-06 2019-05-06 Device, method and storage medium across chain transaction

Publications (1)

Publication Number Publication Date
WO2020224235A1 true WO2020224235A1 (en) 2020-11-12

Family

ID=67861184

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/120569 WO2020224235A1 (en) 2019-05-06 2019-11-25 Cross-chain transaction method and apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN110232094A (en)
WO (1) WO2020224235A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110232094A (en) * 2019-05-06 2019-09-13 深圳壹账通智能科技有限公司 Device, method and storage medium across chain transaction
CN110618873A (en) * 2019-09-20 2019-12-27 中国银行股份有限公司 Data locking method, equipment and system based on information system
CN113127892A (en) * 2019-12-31 2021-07-16 华控清交信息科技(北京)有限公司 Data transaction method, device, system and storage medium
CN111399993B (en) * 2020-03-25 2023-03-07 百度国际科技(深圳)有限公司 Cross-chain implementation method, device, equipment and medium for associated transaction request
CN112131307B (en) * 2020-07-15 2021-05-25 北京天德科技有限公司 Novel multi-block chain and multi-intelligent contract interaction architecture
CN111984422B (en) * 2020-09-03 2023-04-28 深圳壹账通智能科技有限公司 Block chain-based data processing method, device and storage medium
CN114579595B (en) * 2022-05-06 2022-08-12 中国信息通信研究院 Data writing method and device, computer readable storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106780028A (en) * 2016-12-08 2017-05-31 天津米游科技有限公司 A kind of point-to-point digital asset method of commerce and system
CN108288159A (en) * 2018-03-07 2018-07-17 物数(上海)信息科技有限公司 Across chain method of commerce, system, equipment and storage medium based on multi-tiling chain
US20180225640A1 (en) * 2017-02-06 2018-08-09 Northern Trust Corporation Systems and methods for issuing and tracking digital tokens within distributed network nodes
CN110232094A (en) * 2019-05-06 2019-09-13 深圳壹账通智能科技有限公司 Device, method and storage medium across chain transaction

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10885060B2 (en) * 2012-02-28 2021-01-05 International Business Machines Corporation On-demand file synchronization
CA3014737A1 (en) * 2016-02-23 2017-08-31 nChain Holdings Limited Blockchain-implemented method for control and distribution of digital content
GB201607477D0 (en) * 2016-04-29 2016-06-15 Eitc Holdings Ltd A method and system for controlling the performance of a contract using a distributed hash table and a peer to peer distributed ledger
SG10202107633XA (en) * 2016-07-29 2021-08-30 Nchain Holdings Ltd Blockchain-implemented method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106780028A (en) * 2016-12-08 2017-05-31 天津米游科技有限公司 A kind of point-to-point digital asset method of commerce and system
US20180225640A1 (en) * 2017-02-06 2018-08-09 Northern Trust Corporation Systems and methods for issuing and tracking digital tokens within distributed network nodes
CN108288159A (en) * 2018-03-07 2018-07-17 物数(上海)信息科技有限公司 Across chain method of commerce, system, equipment and storage medium based on multi-tiling chain
CN110232094A (en) * 2019-05-06 2019-09-13 深圳壹账通智能科技有限公司 Device, method and storage medium across chain transaction

Also Published As

Publication number Publication date
CN110232094A (en) 2019-09-13

Similar Documents

Publication Publication Date Title
WO2020224235A1 (en) Cross-chain transaction method and apparatus, device, and storage medium
EP3740923B1 (en) Multi-approval system using m of n keys to generate a transaction address
CN108900464B (en) Electronic device, block chain-based data processing method, and computer storage medium
CN112840617B (en) Method and computing node for managing blockchain resources, computer readable medium
US9521132B2 (en) Secure data storage
CN111488393B (en) virtual blockchain
TW202025045A (en) Invoice reimbursement method and device based on block chain and electronic device
US7357329B2 (en) IC card, terminal device, and data communication method
US20200082388A1 (en) Authenticating server and method for transactions on blockchain
CN110471982B (en) Data processing method and device based on block chain
CN112037058B (en) Data verification method, device and storage medium
CN113239375B (en) Block chain-based privacy factor data sharing system, method, computer device, and medium
WO2020037927A1 (en) Negotiable block chain transaction method, apparatus, device, and storage medium
WO2020224100A1 (en) Blockchain configuration file processing apparatus, system, and method, and storage medium
US20210297242A1 (en) Method, device, and apparatus for processing distributed data, and medium
WO2021174882A1 (en) Data fragment verification method, apparatus, computer device, and readable storage medium
WO2021012732A1 (en) Blockchain-based information verification apparatus and method, and storage medium
CN112860805A (en) Block chain data interaction method and system
KR20190086301A (en) System and method for distributed database using block chain
CN114157428A (en) Block chain-based digital certificate management method and system
EP3980955A1 (en) Subscription to edits of blockchain transaction
TWM539668U (en) System for opening account online and applying for mobile banking
CN112950183A (en) Cross-link data interchange method, system, device and electronic equipment
CN114117373B (en) Equipment authentication system and method based on secret key
CN113592477B (en) Cross-chain asset transfer method, computer device, and storage medium

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: 19927612

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: 19927612

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 18/03/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19927612

Country of ref document: EP

Kind code of ref document: A1