CN112235110B - Cross-chain service processing method and device of block chain and electronic equipment - Google Patents

Cross-chain service processing method and device of block chain and electronic equipment Download PDF

Info

Publication number
CN112235110B
CN112235110B CN202011465454.8A CN202011465454A CN112235110B CN 112235110 B CN112235110 B CN 112235110B CN 202011465454 A CN202011465454 A CN 202011465454A CN 112235110 B CN112235110 B CN 112235110B
Authority
CN
China
Prior art keywords
password
intelligent contract
hash value
party device
submitted
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202011465454.8A
Other languages
Chinese (zh)
Other versions
CN112235110A (en
Inventor
刘珂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202011465454.8A priority Critical patent/CN112235110B/en
Publication of CN112235110A publication Critical patent/CN112235110A/en
Application granted granted Critical
Publication of CN112235110B publication Critical patent/CN112235110B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The embodiment of the specification provides a method and a device for processing a block chain cross-chain service, and an electronic device, wherein the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain. The method is applied to the intermediate side equipment and comprises the following steps: and generating a third password, calculating a third hash value of the third password, and acquiring a first hash value of the first password and a second hash value of the second password. And initiating a transaction for deploying the first intelligent contract to the first blockchain, sending the third hash value to the second-party device, and submitting the third password to the first intelligent contract and the second intelligent contract. And submitting the first password to a second intelligent contract of the second blockchain, and submitting the second password to a first intelligent contract of the first blockchain. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.

Description

Cross-chain service processing method and device of block chain and electronic equipment
Technical Field
One or more embodiments of the present disclosure relate to the field of blockchain technologies, and in particular, to a method and an apparatus for processing a cross-chain service of a blockchain, and an electronic device.
Background
With the continuous development of technology, the block chain technology has been applied to many fields, such as the digital finance field. Currently, many services need to be completed across chains, and therefore, multiple parties are needed to complete multiple services. But due to delay or error, part of the services may be completed and part of the services may not be completed, so that the participants of the part of the services are lost.
Disclosure of Invention
In order to solve one of the above technical problems, one or more embodiments of the present disclosure provide a method, an apparatus, and an electronic device for processing a cross-chain service of a block chain.
According to a first aspect, a method for processing a block chain cross-chain service is provided, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to the intermediate side equipment and comprises the following steps:
generating a third password in response to receiving the cross-link service information sent by the second party equipment, and calculating a third hash value of the third password;
receiving a first hash value of a first password sent by the first party equipment and a second hash value of a second password sent by the second party equipment; the first password is generated by the first party device; the second password is generated by the second party device;
initiating a transaction to the first blockchain to deploy the first smart contract; the first intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the first intelligent contract comprises first judgment logic and first business logic, the first judgment logic verifies whether the first password, the second password and the third password are submitted to the first intelligent contract based on the first hash value, the second hash value and the third hash value, judges whether a first execution condition is met based on the verification result, and triggers the execution of the first business logic if the first execution condition is met; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract;
sending the third hash value to the second party device; the third hash value is used to create the second intelligent contract deployed on the second blockchain;
submitting the third password to the first intelligent contract and the second intelligent contract;
in an instance in which it is determined that the first cipher has been submitted to the first intelligent contract, submitting the first cipher to a second intelligent contract of the second blockchain; and
in an instance in which it is determined that the second cipher has been submitted to the second intelligent contract, submitting the second cipher to a first intelligent contract of the first blockchain.
Optionally, the first judgment logic further judges whether a first unlocking condition is satisfied; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract; triggering execution of the first business logic if the first unlocking condition has been met at the end of a preset time period.
Optionally, after submitting the third password to the first intelligent contract and the second intelligent contract, the method further includes:
acquiring a first log of the first block chain and a second log of the second block chain;
viewing a first updated content of the world state of the first blockchain from the first log and viewing a second updated content of the world state of the second blockchain from the second log;
based on the first updated content, determining whether the first password is submitted to the first intelligent contract, and based on the second updated content, determining that the second password is submitted to the second intelligent contract.
Optionally, the first party device and the intermediate party device perform a service for transferring the first party resource through the first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through the second intelligent contract.
According to a second aspect, a method for processing a block chain cross-chain service is provided, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to the second-party equipment and comprises the following steps:
acquiring cross-chain service information and sending the cross-chain service information to the first party equipment and the intermediate party equipment;
generating a second password, and calculating a second hash value of the second password;
receiving a first hash value of a first password sent by the first party equipment and a third hash value of a third password sent by the intermediate party equipment; the first password is generated by the first party device; the third password is generated by the intermediary device;
initiating a transaction to the second blockchain to deploy the second smart contract; the second intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the second intelligent contract comprises second judgment logic and second business logic; the second judgment logic verifies whether the first password, the second password and the third password are submitted to the second intelligent contract or not based on the first hash value, the second hash value and the third hash value, judges whether a second execution condition is met or not based on the verification result, and triggers the execution of the second business logic if the second execution condition is met; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract;
sending the second hash value to the intermediary device; the second hash value is used to create the first intelligent contract deployed in the first blockchain;
determining from state information of the second intelligent contract deployed in the second blockchain whether the third password has been submitted to the second intelligent contract;
submitting the second password to the second intelligent contract at least on a condition that the third password has been submitted to the second intelligent contract.
Optionally, submitting the second password to the second intelligent contract at least on condition that the third password has been submitted to the second intelligent contract comprises:
submitting the second password to the second intelligent contract if the third password has been submitted to the second intelligent contract and a message is received from the first party device that the third password has been submitted to the first intelligent contract.
Optionally, the second judgment logic further judges whether a second unlocking condition is satisfied; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract; triggering execution of the second business logic if the second unlocking condition has been met at the end of a preset time period.
Optionally, the first party device and the intermediate party device perform a service for transferring the first party resource through the first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through the second intelligent contract.
According to a third aspect, a method for processing a block chain cross-chain service is provided, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to a node of the first blockchain, and comprises the following steps:
deploying the first smart contract in response to a transaction initiated by the intermediary device to deploy the first smart contract; the first intelligent contract comprises first judgment logic and first business logic;
in response to receiving a transaction invoking the first intelligent contract, executing the first judgment logic, verifying whether the first password, the second password, and the third password are submitted to the first intelligent contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, and judging whether a first execution condition is satisfied based on a result of the verification; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and if the first execution condition is met within a preset time period, executing the first service logic.
Optionally, the first judgment logic further judges whether a first unlocking condition is satisfied based on the verification result; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract;
the method further comprises the following steps:
at the moment when the preset time period is finished, if the first unlocking condition is met, executing the first service logic;
and at the moment when the preset time period is finished, if the first unlocking condition is not met, destroying the first intelligent contract.
According to a fourth aspect, a method for processing a block chain cross-chain service is provided, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to a node of the second blockchain, and comprises the following steps:
deploying the second smart contract in response to a transaction initiated by the second party device to deploy the second smart contract; the second intelligent contract comprises second judgment logic and second business logic;
in response to receiving a transaction invoking the second intelligent contract, executing the second decision logic, verifying whether the first password, the second password, and the third password are submitted to the second intelligent contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, and deciding whether a second execution condition is satisfied based on a result of the verifying; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and if the second execution condition is met within a preset time period, executing the second service logic.
Optionally, the second determination logic further determines whether a second unlocking condition is satisfied based on the verification result; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract;
the method further comprises the following steps:
at the moment when the preset time period is finished, if the second unlocking condition is met, executing the second service logic;
and at the moment when the preset time period is finished, if the second unlocking condition is not met, destroying the second intelligent contract.
According to a fifth aspect, there is provided a block chain cross-chain service processing apparatus, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the device is applied to the intermediate side equipment and comprises:
the generating module is used for responding to the received cross-chain service information sent by the second party equipment, generating a third password and calculating a third hash value of the third password;
a receiving module, configured to receive a first hash value of a first password sent by the first party device and a second hash value of a second password sent by the second party device; the first password is generated by the first party device; the second password is generated by the second party device;
a transaction module to initiate a transaction to deploy the first smart contract to the first blockchain; the first intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the first intelligent contract comprises first judgment logic and first business logic, the first judgment logic verifies whether the first password, the second password and the third password are submitted to the first intelligent contract based on the first hash value, the second hash value and the third hash value, judges whether a first execution condition is met based on the verification result, and triggers the execution of the first business logic if the first execution condition is met; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract;
a sending module, configured to send the third hash value to the second party device; the third hash value is used to create the second intelligent contract deployed on the second blockchain;
a first submission module to submit the third password to the first intelligent contract and the second intelligent contract;
a second submission module to submit the first password to a second intelligent contract of the second blockchain in the event that it is determined that the first password has been submitted to the first intelligent contract; and
a third submission module to submit the second password to the first intelligent contract of the first blockchain in the event that it is determined that the second password has been submitted to the second intelligent contract.
Optionally, the first judgment logic further judges whether a first unlocking condition is satisfied; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract; triggering execution of the first business logic if the first unlocking condition has been met at the end of a preset time period.
Optionally, the apparatus further comprises:
an obtaining module, configured to obtain a first log of the first block chain and a second log of the second block chain;
a viewing module for viewing a first updated content of the world state of the first blockchain from the first log and viewing a second updated content of the world state of the second blockchain from the second log;
a determination module to determine whether the first password was submitted to the first intelligent contract based on the first updated content and to determine that the second password was submitted to the second intelligent contract based on the second updated content.
Optionally, the first party device and the intermediate party device perform a service for transferring the first party resource through the first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through the second intelligent contract.
According to a sixth aspect, a block chain cross-chain service processing apparatus is provided, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the device is applied to the second-party equipment and comprises:
an obtaining module, configured to determine cross-link service information and send the cross-link service information to the first party device and the intermediate party device;
the generating module is used for generating a second password and calculating a second hash value of the second password;
a receiving module, configured to receive a first hash value of a first password sent by the first party device and a third hash value of a third password sent by the intermediary device; the first password is generated by the first party device; the third password is generated by the intermediary device;
a transaction module to initiate a transaction to deploy the second smart contract to the second blockchain; the second intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the second intelligent contract comprises second judgment logic and second business logic; the second judgment logic verifies whether the first password, the second password and the third password are submitted to the second intelligent contract or not based on the first hash value, the second hash value and the third hash value, judges whether a second execution condition is met or not based on the verification result, and triggers the execution of the second business logic if the second execution condition is met; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract;
a sending module, configured to send the second hash value to the intermediary device; the second hash value is used to create the first intelligent contract deployed in the first blockchain;
a determination module to determine whether the third cipher has been submitted to the second intelligent contract from state information of the second intelligent contract deployed in the second blockchain;
a submission module to submit the second password to the second intelligent contract, at least on a condition that the third password has been submitted to the second intelligent contract.
Optionally, the submission module is configured to:
submitting the second password to the second intelligent contract if the third password has been submitted to the second intelligent contract and a message is received from the first party device that the third password has been submitted to the first intelligent contract.
Optionally, the second judgment logic further judges whether a second unlocking condition is satisfied; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract; triggering execution of the second business logic if the second unlocking condition has been met at the end of a preset time period.
Optionally, the first party device and the intermediate party device perform a service for transferring the first party resource through the first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through the second intelligent contract.
According to a seventh aspect, there is provided a block chain cross-chain service processing apparatus, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the device is applied to the node of the first block chain and comprises:
a deployment module to deploy the first smart contract in response to a transaction initiated by the intermediary device to deploy the first smart contract; the first intelligent contract comprises first judgment logic and first business logic;
a judging module, configured to execute the first judging logic in response to receiving a transaction invoking the first intelligent contract, verify whether the first password, the second password, and the third password are submitted to the first intelligent contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, and judge whether a first execution condition is satisfied based on a result of the verification; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and the service module is used for executing the first service logic when the first execution condition is met in a preset time period.
Optionally, the first judgment logic further judges whether a first unlocking condition is satisfied based on the verification result; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract;
the device further comprises:
the execution module is used for executing the first service logic at the moment when the preset time interval is finished and if the first unlocking condition is met; and if the first unlocking condition is not met, destroying the first intelligent contract.
According to an eighth aspect, a block chain cross-chain service processing apparatus is provided, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the device is applied to the node of the second block chain and comprises:
a deployment module to deploy the second smart contract in response to a transaction initiated by the second party device to deploy the second smart contract; the second intelligent contract comprises second judgment logic and second business logic;
a determining module, configured to execute the second determining logic in response to receiving a transaction invoking the second intelligent contract, verify whether the first password, the second password, and the third password are submitted to the second intelligent contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, and determine whether a second execution condition is satisfied based on a result of the verification; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and the service module is used for executing the second service logic when the second execution condition is met in a preset time period.
Optionally, the second determination logic further determines whether a second unlocking condition is satisfied based on the verification result; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract;
the device further comprises:
the execution module is used for executing the second service logic at the moment when the preset time interval is finished and if the second unlocking condition is met; and if the second unlocking condition is not met, destroying the second intelligent contract.
According to a ninth aspect, there is provided a computer readable storage medium, storing a computer program which, when executed by a processor, implements the method of any of the first to fourth aspects above.
According to a tenth aspect, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of the first to fourth aspects when executing the program.
The technical scheme provided by the embodiment of the specification can have the following beneficial effects:
embodiments of the present specification provide a method and an apparatus for processing a block chain cross-chain service, where a third password is generated in response to receiving cross-chain service information sent by a second party device, a third hash value of the third password is calculated, and a first hash value of the first password sent by the first party device and a second hash value of the second password sent by the second party device are received. And initiating a transaction for deploying the first intelligent contract to the first blockchain, sending the third hash value to the second-party device, and submitting the third password to the first intelligent contract and the second intelligent contract. And in the event that it is determined that the first password has been submitted to the first intelligent contract, submitting the first password to a second intelligent contract of the second blockchain. In an instance in which it is determined that the second cipher has been submitted to the second intelligent contract, submitting the second cipher to the first intelligent contract of the first blockchain. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
Another method and apparatus for processing a chaining-crossing service of a blockchain provided in an embodiment of the present specification generate a second password by obtaining information of the chaining-crossing service and sending the information of the chaining-crossing service to a first party device and an intermediate party device, calculate a second hash value of the second password, and receive a first hash value of the first password sent by the first party device and a third hash value of a third password sent by the intermediate party device. The method comprises the steps of initiating a transaction for deploying a second intelligent contract to a second blockchain, sending a second hash value to an intermediary device, determining whether a third password has been submitted to the second intelligent contract from state information of the second intelligent contract deployed in the second blockchain, and submitting the second password to the second intelligent contract at least under the condition that the third password has been submitted to the second intelligent contract. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
Another method and apparatus for processing a chain-crossing service of a block chain provided in an embodiment of this specification deploy a first intelligent contract in response to a transaction initiated by an intermediary device to deploy the first intelligent contract, execute a first judgment logic in response to receiving the transaction to invoke the first intelligent contract, and execute a first service logic if a first execution condition is satisfied within a preset time period. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
Another method and apparatus for processing a chain-crossing service of a block chain provided in an embodiment of this specification deploy a second intelligent contract in response to a transaction initiated by a second party device to deploy the second intelligent contract, execute a second judgment logic in response to receiving the transaction to invoke the second intelligent contract, and execute a second service logic if a second execution condition is satisfied within a preset time period. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a cross-chain service processing scenario of a block chain in the prior art;
FIG. 2 is a schematic diagram illustrating a scenario of cross-chain business processing of a blockchain according to an exemplary embodiment of the present specification;
FIG. 3 is a flow diagram illustrating a method for cross-chain traffic processing for blockchains in accordance with an exemplary embodiment of the present description;
FIG. 4 is a flow diagram illustrating another method for cross-chain traffic handling for blockchains in accordance with an illustrative embodiment of the present description;
FIG. 5 is a flow diagram illustrating another method for inter-chain traffic handling for blockchains in accordance with an illustrative embodiment of the present description;
FIG. 6 is a flow diagram illustrating another method for inter-chain traffic handling for blockchains in accordance with an illustrative embodiment of the present description;
FIG. 7 is a flow diagram illustrating another method for inter-chain traffic handling for blockchains in accordance with an illustrative embodiment of the present description;
FIG. 8 is a flow diagram illustrating another method for inter-chain traffic handling for blockchains in accordance with an illustrative embodiment of the present description;
FIG. 9 is a block diagram of a blockchain cross-chain traffic processing apparatus shown in accordance with an exemplary embodiment of the present specification;
FIG. 10 is a block diagram of another block chain inter-chain traffic processing apparatus shown in accordance with an exemplary embodiment of the present specification;
FIG. 11 is a block diagram of another block chain cross-chain traffic processing apparatus shown in accordance with an exemplary embodiment of the present specification;
FIG. 12 is a block diagram of another block chain inter-chain traffic processing apparatus shown in accordance with an exemplary embodiment of the present specification;
fig. 13 is a schematic structural diagram illustrating an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Fig. 1 is a schematic diagram illustrating a conventional cross-chain service processing scenario of a blockchain.
In the scenario shown in fig. 1, the first party, the second party and the intermediate party are parties participating in the cross-chain service. The first party device, the second party device and the intermediary device are devices which are in butt joint with the first party, the second party and the intermediary party respectively. The chain-crossing service can be a transfer service, and transfer to the middle party from the second direction is completed through a second target intelligent contract deployed in the second block chain. And completing the transfer to the first party in the middle direction through a first target intelligent contract deployed in the first block chain.
First, a target password is randomly generated by the second party device, and a target hash value of the target password is calculated. And transmitting the target password to the first party equipment in an online or offline mode, and sending the target hash value to the intermediate party equipment.
The second party device then creates a second target intelligent contract using the target hash value and initiates a transaction to deploy the second target intelligent contract to the second blockchain. The node of the second blockchain deploys a second target smart contract in the second blockchain. The intermediary device creates a first target intelligent contract using the target hash value and initiates a transaction to deploy the first target intelligent contract to the first blockchain. The node of the first blockchain deploys the first target smart contract in the first blockchain.
Finally, the first party device submits the target password to the first target intelligent contract first, so that the first block chain executes the first target intelligent contract, and the transfer of the intermediate party to the first party is completed. The intermediary device may obtain the target password from the first blockchain and submit the target password to the second target intelligent contract, causing the second blockchain to execute the second target intelligent contract, thereby completing the transfer of the second party to the intermediary.
However, if the transfer of the intermediate party to the first party is completed, the target password may not be successfully submitted to the second target intelligent contract as long as a delay or packet loss condition (which may occur) occurs, and finally the transfer service of the second party to the intermediate party cannot be completed, so that only part of the cross-link service is completed, thereby causing the loss of the intermediate party. The embodiments of the present specification provide a cross-chain service processing scheme for multiple block chains, which can solve the above technical problems.
Fig. 2 is a schematic diagram illustrating a cross-chain service processing scenario of a blockchain according to an exemplary embodiment.
In the scenario shown in fig. 2, the first party, the second party and the intermediate party are parties participating in the cross-chain service. The first party device, the second party device and the intermediary device are devices which are in butt joint with the first party, the second party and the intermediary party respectively. The chain-crossing service can be a transfer service, and transfer to the middle party from the second direction is completed through a second intelligent contract deployed in the second block chain. And completing the transfer to the first party in the middle direction through the first intelligent contract deployed in the first block chain.
First, in step 202, the second party device sends a cross-link service request carrying cross-link service information to the intermediate party device and the first party device, respectively, in response to receiving the cross-link service information sent by the user terminal. For example, if the cross-chain service is a transfer service, the cross-chain service information may include the asset type and transfer amount involved in the transfer from the second party to the intermediate party, the asset type and transfer amount involved in the transfer from the intermediate party to the first party, and the like. The cross-chain business information may be used to create a first intelligent contract and a second intelligent contract. In step 204, the first party device randomly generates a first password in response to the cross-link service request, and calculates a first hash value of the first password. The second party device generates a second password and calculates a second hash value of the second password. And the intermediate side equipment responds to the cross-chain service request, randomly generates a third password and calculates a third hash value of the third password.
Then, in step 206, the second party device sends the second hash value to the intermediary device, the intermediary device sends the third hash value to the second party device, and the first party device sends the first hash value to the intermediary device and the second party device, respectively. And enabling the intermediate side equipment and the second side equipment to have a first hash value, a second hash value and a third hash value, wherein the first hash value, the second hash value and the third hash value are used for creating a first intelligent contract and a second intelligent contract. In step 208, the second party device initiates a transaction to deploy a second intelligent contract to the second blockchain, and the nodes of the second blockchain deploy the second intelligent contract in the second blockchain. The intermediary device initiates a transaction to deploy a first intelligent contract to the first blockchain, and the nodes of the first blockchain deploy the first intelligent contract in the first blockchain.
Next, in step 210, the intermediary device submits the third password to the first intelligent contract by initiating a transaction to the first blockchain invoking the first intelligent contract, and submits the third password to the second intelligent contract by initiating a transaction to the second blockchain invoking the second intelligent contract. And the node of the first blockchain calls the first intelligent contract for verification and determines that the third password is submitted to the first intelligent contract. And the node of the second blockchain calls the second intelligent contract for verification and determines that the third password is submitted to the second intelligent contract.
The first party device determines that the third password has been submitted to the first intelligent contract by examining the status of the first intelligent contract. The second party device determines that the third password has been submitted to the second intelligent contract by examining the status of the second intelligent contract. Optionally, the first party device may also send the state of the first intelligent contract to the second party device, and the second party device may send the state of the second intelligent contract to the first party device. The first party device submits the first password to the first intelligent contract by initiating a transaction to the first blockchain that invokes the first intelligent contract upon determining that the third password has been submitted to the first intelligent contract and the second intelligent contract. The second-party device submits the second password to the second smart contract by initiating a transaction to the second blockchain that invokes the second smart contract upon determining that the third password has been submitted to the first smart contract and the second smart contract.
The node of the first blockchain invokes the first intelligent contract for verification and determines that the first password has been submitted to the first intelligent contract. And the node of the second blockchain calls the second intelligent contract for verification and determines that the second password is submitted to the second intelligent contract.
And the intermediate side equipment acquires the first password and the second password from the first block chain and the second block chain through the node of the first block chain and the node of the second block chain respectively. And submitting the second password to the first intelligent contract by initiating a transaction to the first blockchain that invokes the first intelligent contract. The first password is submitted to the second smart contract by initiating a transaction to the second blockchain that invokes the second smart contract.
And the node of the first blockchain calls the first intelligent contract for verification and determines that the second password is submitted to the first intelligent contract. If a preset first condition is met (for example, the first condition is that the first password, the second password and the third password are all submitted to the first intelligent contract), the node of the first block chain calls the first intelligent contract to perform the service of transferring from the middle part to the first part.
And the node of the second blockchain calls the second intelligent contract for verification and determines that the first password is submitted to the second intelligent contract. If a preset second condition is met (for example, the second condition is that the first password, the second password and the third password are all submitted to the second intelligent contract), the node of the second block chain calls the second intelligent contract to perform the service of transferring from the second party to the middle party.
And finally, the node of the first block chain informs the intermediate side equipment and the first side equipment of service completion, and the node of the second block chain informs the second side equipment and the intermediate side equipment of service completion.
The embodiments provided in the present specification will be described in detail with reference to specific examples.
As shown in fig. 3, fig. 3 is a flowchart illustrating a method for processing a blockchain cross-chain service, which is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first blockchain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second blockchain, according to an exemplary embodiment. Those skilled in the art will appreciate that the mediator device may be any computing, processing capable device, platform, server, or cluster of devices. The method comprises the following steps:
in step 302, in response to receiving the cross-link service information sent by the second party device, a third password is generated, and a third hash value of the third password is calculated.
In step 304, a first hash value of a first password sent by a first-party device and a second hash value of a second password sent by a second-party device are received.
In this embodiment, the cross-chain service may be a service related to resource transfer, for example, the cross-chain service may be a transfer service, or a redemption service, etc. The cross-link service may also be a service related to resource allocation, and the cross-link service may also be a service related to information exchange and the like. It is to be understood that the cross-chain service may be any service suitable for being performed between different blockchains, and the embodiment is not limited to a specific type of the cross-chain service.
In this embodiment, the cross-chain service may be performed by the first-party device and the intermediate-party device through a first intelligent contract deployed in the first blockchain, and the intermediate-party device and the second-party device through a second intelligent contract deployed in the second blockchain. Optionally, the cross-chain service may be a transfer service, where the first party device and the intermediate party device perform a service for transferring the first party resource through a first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through a second intelligent contract.
In this embodiment, the first-party device, the second-party device, and the intermediary device are devices (which may be any device, platform, server, or device cluster with computing and processing capabilities) that interface with the participants in the cross-chain service. For example, if the cross-chain service is a transfer service, the first party device is a device interfacing with the receiving party, the second party device is a device interfacing with the paying party, and the intermediary device is a device interfacing with the intermediary.
In this embodiment, the second party device may send the cross-link service information to the intermediate party device and the first party device, respectively, in response to receiving the cross-link service information sent by the user terminal. For example, if the cross-chain service is a transfer service, the cross-chain service information may include the type of asset and the transfer amount involved in transferring the transfer to the intermediary from the payment side, the type of asset and the transfer amount involved in transferring the transfer to the receiving side by the intermediary, and the like. The cross-chain business information may be used to create a first intelligent contract and a second intelligent contract. And the second party device randomly generates a second password and calculates a second hash value of the second password. And meanwhile, responding to the cross-link service information, randomly generating a first password by the first party equipment, and calculating a first hash value of the first password. A third password is randomly generated by the intermediary device and a third hash value of the third password is calculated. Then, the first-party device and the second-party device respectively send the first hash value and the second hash value to the intermediate-party device.
In step 306, a transaction is initiated to the first blockchain to deploy the first smart contract.
In this embodiment, a transaction is initiated by the intermediary device to a first blockchain to deploy a first intelligent contract generated based on the first hash value, the second hash value, the third hash value, and the cross-chain traffic information. The first intelligent contract may include first judgment logic and first business logic. The first judgment logic verifies whether the first password, the second password, and the third password are submitted to the first smart contract based on the first hash value, the second hash value, and the third hash value, and judges whether the first execution condition is satisfied based on a result of the verification. The first execution condition may include the first password, the second password, and the third password all being submitted to the first smart contract. And if the first execution condition is met within the preset time period, triggering the execution of the first service logic, thereby completing the service part of the first party equipment and the intermediate party equipment in the cross-chain service through the first block chain. And if the first execution condition is not met in the preset time period, triggering to destroy the first intelligent contract after the preset time period is ended.
In step 308, the third hash value is sent to the second party device.
In this embodiment, the intermediary device sends the third hash value to the second party device, so that the second party device creates the second intelligent contract deployed on the second blockchain by using the third hash value.
In step 310, the third password is submitted to the first intelligent contract and the second intelligent contract.
In this embodiment, after the first intelligent contract and the second intelligent contract are deployed on the first blockchain and the second blockchain, respectively, the intermediary device may submit the third password to the first intelligent contract and the second intelligent contract, respectively.
Specifically, the mediator device may initiate a first transaction to the first blockchain invoking a first intelligent contract, the contract parameters carried in the first transaction including a third password. The node of the first blockchain submits the third password to the first smart contract in response to the first transaction. And the intermediary device may initiate a second transaction to the second blockchain invoking a second intelligent contract, where the contract parameters carried in the second transaction include a third password. The node of the second blockchain submits a third password to the second smart contract in response to the second transaction.
In step 312, in the event that it is determined that the first password has been submitted to the first intelligent contract, the first password is submitted to a second intelligent contract of the second blockchain.
In step 314, in the event that it is determined that the second password has been submitted to the second intelligent contract, the second password is submitted to the first intelligent contract of the first blockchain.
In this embodiment, the intermediary device may obtain a first log of the first blockchain and view first updated content of the world state of the first blockchain from the first log. And determining whether the first password is submitted to the first intelligent contract or not based on the first updating content, and acquiring the first password from the first updating content if the first password is submitted to the first intelligent contract. If it is determined that the first password is not submitted to the first intelligent contract, the operations of obtaining the first log of the first blockchain and thereafter may be re-executed after a preset time period.
And the intermediate side device can also acquire a second log of the second block chain and view second update content of the world state of the second block chain from the second log. And determining whether the second password is submitted to a second intelligent contract or not based on the second updating content, and acquiring the second password from the second updating content if the second password is submitted to the second intelligent contract. If it is determined that the second password is not submitted to the second smart contract, the operations of obtaining the second log of the second blockchain and the subsequent operations may be re-executed after a preset time period.
In this embodiment, after the first password is acquired, the first password is submitted to the second smart contract. And after the second password is acquired, submitting the second password to the first intelligent contract.
In the method for processing a chain-crossing service of a blockchain provided in the foregoing embodiment of the present specification, a third password is generated in response to receiving chain-crossing service information sent by a second party device, a third hash value of the third password is calculated, and a first hash value of a first password sent by the first party device and a second hash value of a second password sent by the second party device are received. And initiating a transaction for deploying the first intelligent contract to the first blockchain, sending the third hash value to the second-party device, and submitting the third password to the first intelligent contract and the second intelligent contract. And in the event that it is determined that the first password has been submitted to the first intelligent contract, submitting the first password to a second intelligent contract of the second blockchain. In an instance in which it is determined that the second cipher has been submitted to the second intelligent contract, submitting the second cipher to the first intelligent contract of the first blockchain. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
In some optional embodiments, the first determination logic is further to determine whether a first unlock condition is satisfied, the first unlock condition including any two of the first password, the second password, and the third password being submitted to the first smart contract. At the end of the preset time period, the execution of the first business logic is triggered in case the first unlocking condition has been met. And if the first unlocking condition is not met, triggering the destruction of the first intelligent contract.
In this embodiment, the first judgment logic further judges whether the first unlocking condition is satisfied in addition to judging whether the first execution condition is satisfied, and executes the first service logic when the first unlocking condition is satisfied at the time when the preset time period ends. Therefore, the occurrence of the situation that the cross-link service is only partially completed is further reduced, the success rate of executing the cross-link service is improved, and the reliability of the cross-link service is further improved.
Fig. 4 is a flowchart illustrating another method for processing a chain-crossing service of a blockchain according to an exemplary embodiment, where the chain-crossing service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first blockchain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second blockchain, and the method may be applied to the second party device. Those skilled in the art will appreciate that the second party device may be any computing, processing capable device, platform, server, or cluster of devices. The method comprises the following steps:
in step 402, cross-link service information is obtained, and the cross-link service information is sent to the first party device and the intermediate party device, a second password is generated, and a second hash value of the second password is calculated.
In step 404, a first hash value of the first password sent by the first-party device and a third hash value of the third password sent by the intermediary-party device are received.
In this embodiment, the cross-chain service may be performed by the first-party device and the intermediate-party device through a first intelligent contract deployed in the first blockchain, and the intermediate-party device and the second-party device through a second intelligent contract deployed in the second blockchain. Optionally, the cross-chain service may be a transfer service, where the first party device and the intermediate party device perform a service for transferring the first party resource through a first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through a second intelligent contract.
In this embodiment, the first-party device, the second-party device, and the intermediary device are devices (which may be any device, platform, server, or device cluster with computing and processing capabilities) that interface with the participants in the cross-chain service. For example, if the cross-chain service is a transfer service, the first party device is a device interfacing with the receiving party, the second party device is a device interfacing with the paying party, and the intermediary device is a device interfacing with the intermediary.
In this embodiment, the second party device receives the cross-link service information sent by the user terminal, and sends the cross-link service information to the first party device and the intermediate party device. A first password is randomly generated by a first party device and a first hash value of the first password is calculated. A second password is randomly generated by the second party device and a second hash value of the second password is calculated. A third password is randomly generated by the intermediary device and a third hash value of the third password is calculated. Then, the first party device and the intermediate party device respectively send the first hash value and the third hash value to the second party device.
In step 406, a transaction is initiated to deploy a second smart contract to the second blockchain.
In this embodiment, a transaction is initiated by the second party device to a second blockchain to deploy a second intelligent contract, the second intelligent contract generated based on the first hash value, the second hash value, the third hash value, and the cross-chain traffic information. The second intelligent contract may include second decision logic and second business logic. The second judgment logic verifies whether the first password, the second password, and the third password are submitted to the second smart contract based on the first hash value, the second hash value, and the third hash value, and judges whether a second execution condition is satisfied based on a result of the verification. The second execution condition includes that the first password, the second password and the third password are all submitted to the second intelligent contract. And triggering the execution of the second service logic under the condition that a second execution condition is met within a preset time period, thereby completing the service part of the second party equipment and the intermediate party equipment in the cross-chain service through the second block chain. If the second execution condition is not met within the preset time period, the destruction of the second intelligent contract can be triggered after the preset time period is ended.
In step 408, the second hash value is sent to the intermediary device.
In this embodiment, the second party device sends the second hash value to the intermediary device, so that the intermediary device creates the first intelligent contract deployed on the first blockchain using the second hash value.
In step 410, it is determined from the state information of the second intelligent contract deployed in the second blockchain whether the third password has been submitted to the second intelligent contract.
In this embodiment, status information for the second intelligent contract may be obtained from the second blockchain, checked, and a determination made as to whether the third password has been submitted to the second intelligent contract.
In step 412, the second password is submitted to the second intelligent contract, at least on condition that the third password has been submitted to the second intelligent contract.
In one implementation, the second password may be submitted to the second intelligent contract on a condition that the third password has been submitted to the second intelligent contract. In another implementation, the second password may also be submitted to the second smart contract on a condition that it is determined that the third password has been submitted to the second smart contract and that the third password has been submitted to the first smart contract.
Specifically, the second party device may initiate a third transaction to the second blockchain invoking the second intelligent contract, the contract parameters carried in the third transaction including the second password. The node of the second blockchain submits a second password to a second smart contract in response to the third transaction.
In the method for processing a chain crossing service of a block chain provided in the foregoing embodiment of the present specification, a second password is generated by acquiring chain crossing service information and sending the chain crossing service information to a first party device and an intermediate party device, a second hash value of the second password is calculated, and a first hash value of the first password sent by the first party device and a third hash value of a third password sent by the intermediate party device are received. The method comprises the steps of initiating a transaction for deploying a second intelligent contract to a second blockchain, sending a second hash value to an intermediary device, determining whether a third password has been submitted to the second intelligent contract from state information of the second intelligent contract deployed in the second blockchain, and submitting the second password to the second intelligent contract at least under the condition that the third password has been submitted to the second intelligent contract. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
In other optional embodiments, the second determination logic is further configured to determine whether a second unlock condition is satisfied, where the second unlock condition includes any two of the first password, the second password, and the third password being submitted to the second smart contract. At the end of the preset time period, the execution of the second service logic is triggered in case the second unlocking condition has been fulfilled. And if the second unlocking condition is not met, triggering the destruction of the second intelligent contract.
In this embodiment, the second judgment logic further judges whether the second unlocking condition is satisfied in addition to judging whether the second execution condition is satisfied, and executes the second service logic at the time when the preset time period ends and under the condition that the second unlocking condition is satisfied. Therefore, the occurrence of the situation that the cross-link service is only partially completed is further reduced, the success rate of executing the cross-link service is improved, and the reliability of the cross-link service is further improved.
Fig. 5 is a flowchart illustrating another method for processing a chain-crossing service of a blockchain according to an exemplary embodiment, where the chain-crossing service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first blockchain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second blockchain, and the method may be applied to a node of the first blockchain. Those skilled in the art will appreciate that the nodes of the first blockchain may be any computing, processing capable device, platform, server, or cluster of devices. The method comprises the following steps:
in step 502, a first smart contract is deployed in response to a transaction initiated by an intermediary device to deploy the first smart contract.
In this embodiment, the first intelligent contract may include first judgment logic and first business logic. The first judgment logic verifies whether the first password, the second password, and the third password are submitted to the first smart contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, and judges whether the first execution condition is satisfied based on a result of the verification.
The first password, the second password and the third password are generated by the first party device, the second party device and the intermediate party device respectively. The first execution condition may include the first password, the second password, and the third password all being submitted to the first smart contract.
In this embodiment, if the first execution condition is met within the preset time period, the execution of the first service logic is triggered, so that the service part performed by the first party device and the intermediate party device through the first block chain in the chain crossing service is completed. And if the first execution condition is not met within the preset time period, triggering the destruction of the first intelligent contract after the preset time period is ended.
The following table illustrates the contents of a first intelligent contract in accordance with an exemplary embodiment:
Figure DEST_PATH_IMAGE001
the transfer relation indicates that the paying party is an intermediate party, the receiving party is a first party, the asset type indicates that the dollar transfer service is carried out, the transfer amount is $ 100, and the transfer relation is within a preset time period within the timeout time (10 minutes) from the moment of executing the first intelligent contract. The first execution condition is that the first password, the second password and the third password are all submitted to the first intelligent contract.
The first judgment logic may perform hash calculation on the password to be verified submitted to the first intelligent contract to obtain a hash value to be verified. And verifying the hash value to be verified according to the first hash value, the second hash value and the third hash value to determine whether the password to be verified submitted to the first intelligent contract is the first password, the second password or the third password, and further judging whether the first execution condition is met. And if the first execution condition is met within 10 minutes from the moment of executing the first intelligent contract, executing the transfer operation.
In step 504, first decision logic is executed in response to receiving a transaction invoking a first smart contract.
In step 506, if the first execution condition is satisfied within the predetermined time period, the first service logic is executed.
In this embodiment, in response to receiving a transaction invoking a first intelligent contract, a first judgment logic is executed to obtain a submitted password to be verified from contract parameters carried in the transaction. And carrying out Hash calculation on the password to be verified to obtain a Hash value to be verified. And if the hash value to be verified is consistent with the first hash value, determining that the password to be verified is the first password, and determining that the first password is submitted to the first intelligent contract. And if the hash value to be verified is consistent with the second hash value, determining that the password to be verified is the second password, and determining that the second password is submitted to the first intelligent contract. And if the hash value to be verified is consistent with the third hash value, determining that the password to be verified is a third password, and determining that the third password is submitted to the first intelligent contract.
In this embodiment, the password submitted to the first smart contract may be marked or recorded, and when it is determined that the first password, the second password, and the third password are all submitted to the first smart contract, it may be determined that the first execution condition is satisfied. And if the first execution condition is met within the preset time period, executing the first service logic.
In the method for processing a chain-crossing service of a block chain provided in the foregoing embodiment of the present specification, a first intelligent contract is deployed by responding to a transaction initiated by an intermediary device to deploy a first intelligent contract, a first judgment logic is executed by responding to a received transaction to invoke the first intelligent contract, and a first service logic is executed if a first execution condition is met within a preset time period. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
Fig. 6 is a flowchart illustrating another method for processing a chain-crossing service of a blockchain according to an exemplary embodiment, where the chain-crossing service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first blockchain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second blockchain, and the method may be applied to a node of the first blockchain. Those skilled in the art will appreciate that the nodes of the first blockchain may be any computing, processing capable device, platform, server, or cluster of devices. The method comprises the following steps:
in step 602, a first smart contract is deployed in response to a transaction initiated by an intermediary device to deploy the first smart contract.
In this embodiment, the first intelligent contract may include first judgment logic and first business logic. The first judgment logic verifies whether the first password, the second password, and the third password are submitted to the first smart contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, judges whether a first execution condition is satisfied based on a result of the verification, and judges whether a first unlocking condition is satisfied.
The first password, the second password and the third password are generated by the first party device, the second party device and the intermediate party device respectively. The first execution condition may include the first password, the second password, and the third password all being submitted to the first smart contract. The first unlocking condition may include any two of the first password, the second password, and the third password being submitted to the first smart contract.
In this embodiment, if the first execution condition is met within the preset time period, the execution of the first service logic is triggered, so that the service part performed by the first party device and the intermediate party device through the first block chain in the chain crossing service is completed. If the first executing condition is not met in the preset time period, at the end time of the preset time period, if the first unlocking condition is met, executing the first business logic, and if the first unlocking condition is not met, destroying the first intelligent contract.
Shown in the following table, is the contents of another first intelligent contract, shown in accordance with an exemplary embodiment:
Figure 176403DEST_PATH_IMAGE002
the transfer relation indicates that the paying party is an intermediate party, the receiving party is a first party, the asset type indicates that the dollar transfer service is carried out, the transfer amount is $ 100, and the transfer relation is within a preset time period within the timeout time (10 minutes) from the moment of executing the first intelligent contract. The first execution condition is that the first password, the second password and the third password are all submitted to the first intelligent contract. The first unlocking condition is that any two of the first password, the second password and the third password are submitted to the first intelligent contract.
The first judgment logic may perform hash calculation on the password to be verified submitted to the first intelligent contract to obtain a hash value to be verified. And verifying the hash value to be verified according to the first hash value, the second hash value and the third hash value to determine whether the password to be verified submitted to the first intelligent contract is the first password, the second password or the third password, and further judging whether the first execution condition is met and whether the first unlocking condition is met.
And if the first unlocking condition is met within the timeout time from the moment of executing the first intelligent contract, changing the overtime direction from 'destruction' in the initial state to 'execution'. The first smart contract is in an unlocked state. A first smart contract for the unlocked state, as shown in the following table:
Figure 155861DEST_PATH_IMAGE003
and if the first execution condition is met within the overtime time, executing the transfer operation. If the time of the overtime time does not meet the first execution condition, if the overtime direction is 'destroy', destroying the first intelligent contract, and if the overtime direction is 'execute', executing the transfer operation of the first service logic.
In step 604, a first decision logic is executed in response to receiving a transaction invoking a first smart contract.
In step 606, if the first execution condition is satisfied within the preset time period, the first service logic is executed.
In step 608, at the end of the preset time period, if the first unlocking condition is satisfied, the first service logic is executed.
In step 610, at the end of the preset time period, if the first unlocking condition is not met, the first intelligent contract is destroyed.
In this embodiment, in response to receiving a transaction invoking a first intelligent contract, a first judgment logic is executed to obtain a submitted password to be verified from contract parameters carried in the transaction. And carrying out Hash calculation on the password to be verified to obtain a Hash value to be verified. And if the hash value to be verified is consistent with the first hash value, determining that the password to be verified is the first password, and determining that the first password is submitted to the first intelligent contract. And if the hash value to be verified is consistent with the second hash value, determining that the password to be verified is the second password, and determining that the second password is submitted to the first intelligent contract. And if the hash value to be verified is consistent with the third hash value, determining that the password to be verified is a third password, and determining that the third password is submitted to the first intelligent contract.
In this embodiment, the password submitted to the first intelligent contract may be marked or recorded, and when any two of the first password, the second password, and the third password are determined to be submitted to the first intelligent contract, it may be determined that the first unlocking condition is satisfied. The first execution condition may be determined to be satisfied when it is determined that the first password, the second password, and the third password are all submitted to the first smart contract.
And if the first execution condition is met within the preset time period, executing the first service logic. And at the moment when the preset time interval is finished, if the first unlocking condition is met, executing a first service logic. And at the moment when the preset time period is finished, if the first unlocking condition is not met, destroying the first intelligent contract.
The method for processing a chain-crossing service of a block chain provided in the foregoing embodiment of the present specification deploys a first intelligent contract in response to a transaction initiated by an intermediary device to deploy the first intelligent contract, and executes a first determination logic in response to receiving the transaction to invoke the first intelligent contract. And if the first executing condition is met within the preset time period, executing the first service logic, if the first unlocking condition is met at the moment when the preset time period is ended, executing the first service logic, and if the first unlocking condition is not met at the moment when the preset time period is ended, destroying the first intelligent contract. Therefore, the occurrence of the situation that the cross-link service is only partially completed is further reduced, the success rate of executing the cross-link service is improved, and the reliability of the cross-link service is further improved.
Fig. 7 is a flowchart illustrating another method for processing a chain-crossing service of a blockchain according to an exemplary embodiment, where the chain-crossing service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first blockchain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second blockchain, and the method may be applied to a node of the second blockchain. Those skilled in the art will appreciate that the nodes of the second blockchain may be any computing, processing capable device, platform, server, or cluster of devices. The method comprises the following steps:
in step 702, a second smart contract is deployed in response to a transaction initiated by a second party device to deploy the second smart contract.
In this embodiment, the second intelligent contract may include second decision logic and second business logic. The second judgment logic verifies whether the first password, the second password, and the third password are submitted to the second smart contract based on the first hash value of the first password, the second hash value of the second password, and the third hash value of the third password, and judges whether the second execution condition is satisfied based on a result of the verification.
The first password, the second password and the third password are generated by the first party device, the second party device and the intermediate party device respectively. The second execution condition may include the first password, the second password, and the third password all being submitted to the second smart contract.
In this embodiment, if the second execution condition is satisfied within the preset time period, the execution of the second service logic is triggered, so that the service part performed by the second party device and the intermediate party device through the second block chain in the chain crossing service is completed. And if the second execution condition is not met within the preset time period, triggering the destruction of the second intelligent contract after the preset time period is ended.
The contents of a second intelligent contract, shown according to an exemplary embodiment, are as follows:
Figure 263494DEST_PATH_IMAGE004
the transfer relation indicates that the paying party is a second party, the receiving party is an intermediate party, the asset type indicates that bit currency transfer service is carried out, the transfer amount is 50 bit currency, and the transfer time is within a preset time period within 10 minutes from the moment of executing the second intelligent contract. The second execution condition is that the first password, the second password, and the third password are all submitted to a second smart contract.
The second judgment logic may perform hash calculation on the password to be verified submitted to the second intelligent contract to obtain a hash value to be verified. And verifying the hash value to be verified according to the first hash value, the second hash value and the third hash value to determine whether the password to be verified submitted to the second intelligent contract is the first password, the second password or the third password, and further judging whether the second execution condition is met. And if the second execution condition is met within 10 minutes from the moment of executing the second intelligent contract, executing the transfer operation.
In step 704, second decision logic is executed in response to receiving a transaction invoking a second smart contract.
In step 706, if the second execution condition is satisfied within the preset time period, the second service logic is executed.
In this embodiment, in response to receiving a transaction invoking a second intelligent contract, a second judgment logic is executed to obtain a submitted password to be verified from contract parameters carried in the transaction. And carrying out Hash calculation on the password to be verified to obtain a Hash value to be verified. And if the hash value to be verified is consistent with the first hash value, determining that the password to be verified is the first password, and determining that the first password is submitted to the second intelligent contract. And if the hash value to be verified is consistent with the second hash value, determining that the password to be verified is the second password, and determining that the second password is submitted to the second intelligent contract. And if the hash value to be verified is consistent with the third hash value, determining that the password to be verified is a third password, and determining that the third password is submitted to a second intelligent contract.
In this embodiment, the password submitted to the second smart contract may be marked or recorded, and when it is determined that the first password, the second password, and the third password are all submitted to the second smart contract, it may be determined that the second execution condition is satisfied. And if the second execution condition is met within the preset time period, executing the second service logic.
In the method for processing a chain-crossing service of a block chain provided in the foregoing embodiment of the present specification, a second intelligent contract is deployed in response to a transaction initiated by a second party device to deploy a second intelligent contract, a second judgment logic is executed in response to receiving a transaction to invoke the second intelligent contract, and a second service logic is executed if a second execution condition is met within a preset time period. Therefore, the occurrence of the situation that the cross-chain service is only partially completed is reduced, and the reliability of the cross-chain service is improved.
Fig. 8 is a flowchart illustrating another method for processing a chain-crossing service of a blockchain according to an exemplary embodiment, where the chain-crossing service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first blockchain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second blockchain, and the method may be applied to a node of the second blockchain. Those skilled in the art will appreciate that the nodes of the second blockchain may be any computing, processing capable device, platform, server, or cluster of devices. The method comprises the following steps:
in step 802, a second smart contract is deployed in response to a transaction initiated by a second party device to deploy the second smart contract.
In this embodiment, the second intelligent contract may include second decision logic and second business logic. The second judgment logic verifies whether the first password, the second password, and the third password are submitted to the second smart contract based on the first hash value of the first password, the second hash value of the second password, and the third hash value of the third password, judges whether a second execution condition is satisfied based on a result of the verification, and judges whether a second unlocking condition is satisfied.
The first password, the second password and the third password are generated by the first party device, the second party device and the intermediate party device respectively. The second execution condition may include the first password, the second password, and the third password all being submitted to the second smart contract. The second unlocking condition may include any two of the first password, the second password, and the third password being submitted to the second smart contract.
In this embodiment, if the second execution condition is satisfied within the preset time period, the execution of the second service logic is triggered, so that the service part performed by the second party device and the intermediate party device through the second block chain in the chain crossing service is completed. And if the second execution condition is not met in the preset time period, executing a second business logic at the end moment of the preset time period if the second unlocking condition is met, and if the second unlocking condition is not met, destroying the second intelligent contract.
Shown in the following table, is the contents of another second intelligent contract shown in accordance with an exemplary embodiment:
Figure DEST_PATH_IMAGE005
the transfer relation indicates that the paying party is the second party, the receiving party is the middle party, the asset type indicates that the bitcoin transfer service is carried out, the transfer amount is $ 50, and the transfer time is within a preset time period within 10 minutes from the moment of executing the second intelligent contract. The second execution condition is that the first password, the second password, and the third password are all submitted to a second smart contract. The second unlocking condition is that any two of the first password, the second password and the third password are submitted to the second intelligent contract.
The second judgment logic may perform hash calculation on the password to be verified submitted to the second intelligent contract to obtain a hash value to be verified. And verifying the hash value to be verified according to the first hash value, the second hash value and the third hash value to determine whether the password to be verified submitted to the second intelligent contract is the first password, the second password or the third password, and further judging whether a second execution condition is met and whether a second unlocking condition is met.
And if the second unlocking condition is met within the timeout time from the moment of executing the second intelligent contract, changing the overtime direction from 'destruction' in the initial state to 'execution'. The second smart contract is in an unlocked state. A second smart contract for unlocked state, as shown in the following table:
Figure 721020DEST_PATH_IMAGE006
and if the second execution condition is met within the overtime time, executing the transfer operation. If the time of the overtime time does not meet the second execution condition, if the overtime direction is 'destroy', destroying the second intelligent contract, and if the overtime direction is 'execute', executing the transfer operation of the second service logic.
In step 804, second decision logic is executed in response to receiving a transaction invoking a second smart contract.
In step 806, if the second execution condition is satisfied within the predetermined time period, the second service logic is executed.
In step 808, at the end of the preset time period, if the second unlocking condition is satisfied, a second service logic is executed.
In step 810, at the time when the preset time period ends, if the second unlocking condition is not met, the second intelligent contract is destroyed.
In this embodiment, in response to receiving a transaction invoking a second intelligent contract, a second judgment logic is executed to obtain a submitted password to be verified from contract parameters carried in the transaction. And carrying out Hash calculation on the password to be verified to obtain a Hash value to be verified. And if the hash value to be verified is consistent with the first hash value, determining that the password to be verified is the first password, and determining that the first password is submitted to the second intelligent contract. And if the hash value to be verified is consistent with the second hash value, determining that the password to be verified is the second password, and determining that the second password is submitted to the second intelligent contract. And if the hash value to be verified is consistent with the third hash value, determining that the password to be verified is a third password, and determining that the third password is submitted to a second intelligent contract.
In this embodiment, the password submitted to the second intelligent contract may be marked or recorded, and when any two of the first password, the second password, and the third password are determined to be submitted to the second intelligent contract, it may be determined that the second unlocking condition is satisfied. The second execution condition may be determined to be satisfied when it is determined that the first password, the second password, and the third password are all submitted to the second smart contract.
And if the second execution condition is met within the preset time period, executing the second service logic. And at the moment when the preset time interval is finished, if the second unlocking condition is met, executing a second service logic. And at the moment when the preset time period is finished, if the second unlocking condition is not met, destroying the second intelligent contract.
The method for processing a chain-crossing service of a block chain provided in the foregoing embodiment of the present specification deploys a second intelligent contract in response to a transaction initiated by a second-party device to deploy the second intelligent contract, and executes a second judgment logic in response to receiving the transaction to invoke the second intelligent contract. And if the second execution condition is met within the preset time period, executing the second service logic, and at the moment when the preset time period is finished, if the second unlocking condition is met, executing the second service logic, and at the moment when the preset time period is finished, if the second unlocking condition is not met, destroying the second intelligent contract. Therefore, the occurrence of the situation that the cross-link service is only partially completed is further reduced, the success rate of executing the cross-link service is improved, and the reliability of the cross-link service is further improved.
It should be noted that although in the above embodiments, the operations of the methods of the embodiments of the present specification have been described in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Rather, the steps depicted in the flowcharts may change the order of execution. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
The following schematically illustrates aspects of one or more embodiments of the present disclosure in connection with an application example of cross-chain service processing of a blockchain.
The application scenario may be: user A needs to pay m Ether money to user B, but user A only holds the dollar, so user A needs to pay n dollars to the intermediary through the second blockchain before paying m Ether money to user B through the first blockchain by the intermediary.
In one implementation, first, after determining to perform a cross-link service, a first party device docked with a user B generates a first password, and calculates a first hash value of the first password. A second party device docked with user a generates a second password and calculates a second hash value of the second password. The intermediary device, which is docked with the intermediary, generates a third password and calculates a third hash value of the third password. And the second-party device acquires the first hash value and the third hash value from the first-party device and the intermediate-party device respectively to create a second intelligent contract which needs to be deployed on the second blockchain. The intermediate side device obtains the first hash value and the second hash value from the first side device and the second side device respectively to create a first intelligent contract which needs to be deployed on the first block chain.
The second party device then initiates a transaction to deploy the second intelligent contract to the second blockchain, causing a node of the second blockchain to deploy the second intelligent contract in the second blockchain. And the intermediate party equipment initiates a transaction for deploying the first intelligent contract to the first blockchain, so that the node of the first blockchain deploys the first intelligent contract in the first blockchain.
The first intelligent contract comprises first judgment logic and first service logic, the first judgment logic is used for verifying whether the first password, the second password and the third password are submitted to the first intelligent contract or not, and judging whether a first execution condition is met or not based on a verification result, and the first execution condition comprises that the first password, the second password and the third password are all submitted to the first intelligent contract. And when the first execution condition is met, executing the first service logic to finish the first service of paying m Ethernet coins to the user B by the intermediate party mechanism.
The second intelligent contract comprises second judgment logic and second business logic, the second judgment logic is used for verifying whether the first password, the second password and the third password are submitted to the second intelligent contract or not, and judging whether a second execution condition is met or not based on a verification result, and the second execution condition comprises that the first password, the second password and the third password are all submitted to the second intelligent contract. Upon satisfaction of the second execution condition, second service logic is executed to complete the second service for user a to pay $ n to the intermediary authority.
The intermediary device then initiates transactions invoking the first intelligent contract and invoking the second intelligent contract to the first blockchain and the second blockchain, respectively, to submit the third password to the first intelligent contract and the second intelligent contract, respectively. The first-party device continuously checks the status of the first intelligent contract on the first blockchain to determine whether the third password is submitted to the first intelligent contract. And submitting the first password to the first intelligent contract after determining that the third password is submitted to the first intelligent contract. Likewise, the second party device submits the second password to the second smart contract upon determining that the third password is submitted to the second smart contract.
The intermediary device then obtains the first password from the first blockchain and submits the first password to the second smart contract. And obtaining a second password from the second blockchain and submitting the second password to the first intelligent contract.
And finally, if the first password, the second password and the third password are submitted to the first intelligent contract and the second intelligent contract within a preset time period, the first intelligent contract completes the first service of paying m Ethernet coins to the user B by the intermediate party mechanism, and the second intelligent contract completes the second service of paying n dollars to the intermediate party mechanism by the user A, so that the cross-chain service is completed.
In one case, due to a delay or packet loss, the third password is not successfully submitted to the first smart contract, the first party device cannot submit the first password to the first smart contract, and the intermediate party device cannot submit the first password to the second smart contract. In a preset time period, the first password cannot be submitted to the first intelligent contract and the second intelligent contract, and finally, after the preset time period is exceeded, both the first intelligent contract and the second intelligent contract are destroyed, and both the first service and the second service cannot be executed, so that a result that only part of the cross-chain service is completed is avoided. Similarly, if the third password is not successfully submitted to the second intelligent contract, the result that only part of the cross-chain business is completed will not finally occur.
In another case, the third password is successfully submitted to the first smart contract and the second smart contract, the first password is successfully submitted to the first smart contract, but the second password is not successfully submitted to the second smart contract due to a time delay or packet loss condition. The intermediary device may not be able to obtain the second password or submit the second password to the first smart contract. And finally, after the preset time period is exceeded, the first intelligent contract and the second intelligent contract are destroyed, and the first service and the second service are not executed, so that the result that only part of the cross-chain service is completed is avoided. Similarly, the third password is successfully submitted to the first intelligent contract and the second intelligent contract, and the second password is successfully submitted to the second intelligent contract, but due to the condition of time delay or packet loss, the first password is not successfully submitted to the first intelligent contract, and finally, the result that only part of the cross-chain service is completed does not occur.
Therefore, by applying the scheme, the problem that most of the cross-link services cannot be completed normally due to time delay or packet loss can be solved. The method greatly reduces the occurrence of the situation that the cross-chain service is only partially completed, and improves the reliability of the cross-chain service.
In another implementation manner, first, after determining to perform a cross-link service, a first party device docked with a user B generates a first password, and calculates a first hash value of the first password. A second party device docked with user a generates a second password and calculates a second hash value of the second password. The intermediary device, which is docked with the intermediary, generates a third password and calculates a third hash value of the third password. And the second-party device acquires the first hash value and the third hash value from the first-party device and the intermediate-party device respectively to create a second intelligent contract which needs to be deployed on the second blockchain. The intermediate side device obtains the first hash value and the second hash value from the first side device and the second side device respectively to create a first intelligent contract which needs to be deployed on the first block chain.
The second party device then initiates a transaction to deploy the second intelligent contract to the second blockchain, causing a node of the second blockchain to deploy the second intelligent contract in the second blockchain. And the intermediate party equipment initiates a transaction for deploying the first intelligent contract to the first blockchain, so that the node of the first blockchain deploys the first intelligent contract in the first blockchain.
The first intelligent contract comprises first judgment logic and first service logic, wherein the first judgment logic is used for verifying whether the first password, the second password and the third password are submitted to the first intelligent contract or not, and judging whether a first execution condition is met or not and whether a first unlocking condition is met or not based on a verification result. The first execution condition includes that the first password, the second password and the third password are all submitted to the first intelligent contract. The first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract. And executing the first business logic when the first execution condition is met in a preset time period. And at the end of the preset time period, if the first unlocking condition is met, triggering the execution of the first service logic. And if the first unlocking condition is not met, destroying the first intelligent contract. Wherein the first service logic is to complete a first service in which the intermediary party authority pays m ethernet coins to the user B.
The second intelligent contract comprises second judgment logic and second service logic, and the second judgment logic is used for verifying whether the first password, the second password and the third password are submitted to the second intelligent contract or not, and judging whether a second execution condition is met or not and whether a second unlocking condition is met or not based on the verification result. The second execution condition includes that the first password, the second password and the third password are all submitted to the second intelligent contract. The second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract. And triggering to execute the second business logic in the case that a second execution condition is met within a preset time period. And at the end of the preset time interval, if the second unlocking condition is met, triggering the execution of the second service logic. And if the second unlocking condition is not met, destroying the second intelligent contract. Wherein the second service logic is to complete a second service for user a to pay $ n to the intermediary authority.
The intermediary device then initiates transactions invoking the first intelligent contract and invoking the second intelligent contract to the first blockchain and the second blockchain, respectively, to submit the third password to the first intelligent contract and the second intelligent contract, respectively. The first party device continuously checks the status of the first intelligent contract on the first blockchain to determine whether the third password is submitted to the first intelligent contract, and sends the result of the determination to the second party device. The second party device also continuously checks the status of the second intelligent contract on the second blockchain to determine whether the third password is submitted to the second intelligent contract, and sends the result of the determination to the first party device. And submitting the first password to the first intelligent contract after the first party device determines that the third password is submitted to the first intelligent contract and the third password is submitted to the second intelligent contract. Similarly, the second password is submitted to the second smart contract when the second party device determines that the third password has been submitted to the first smart contract and the third password has been submitted to the second smart contract.
The intermediary device then obtains the first password from the first blockchain and submits the first password to the second smart contract. And obtaining a second password from the second blockchain and submitting the second password to the first intelligent contract.
And finally, if the first password, the second password and the third password are submitted to the first intelligent contract and the second intelligent contract within a preset time period, the first intelligent contract completes the first service of paying m Ethernet coins to the user B by the intermediate party mechanism, and the second intelligent contract completes the second service of paying n dollars to the intermediate party mechanism by the user A, so that the cross-chain service is completed. If the first service is not finished at the moment when the preset time period is over, and any two of the first password, the second password and the third password are submitted to the first intelligent contract, the first service is finished by the first intelligent contract, otherwise, the first intelligent contract is destroyed. Similarly, if the second service is not finished at the moment when the preset time period is over, and any two of the first password, the second password and the third password are submitted to the second intelligent contract, the second service is finished by the second intelligent contract, otherwise, the second intelligent contract is destroyed.
In one case, the third password is not successfully submitted to the first smart contract due to a delay or packet loss. And the first party equipment checks the state of the first intelligent contract, determines that the third password is not successfully submitted to the first intelligent contract, and then sends the checked result to the second party equipment. At this time, the first party device does not submit the first password to the first intelligent contract, and the second party device does not submit the second password to the second intelligent contract. And finally, after the preset time period is exceeded, the first intelligent contract and the second intelligent contract are destroyed, and the first service and the second service are not executed, so that the result that only part of the cross-chain service is completed is avoided. Similarly, if the third password was not successfully submitted to the second smart contract. And the second party equipment checks the state of the second intelligent contract, determines that the third password is not successfully submitted to the second intelligent contract, and then sends the checked result to the first party equipment, so that the result that only part of the cross-link service is completed is avoided.
In another case, the third password is not successfully submitted to the first smart contract due to a delay or packet loss. The first party device checks the status of the first smart contract but the check result is in error, the check result indicating that the third password was successfully submitted to the first smart contract. The first party device sends the error check result to the second party device. At this point, the first party device submits the first password to the first intelligent contract and the second party device submits the second password to the second intelligent contract. Thus, the intermediary device may obtain the first password and the second password, respectively, and submit the first password to the second smart contract and the second password to the first smart contract. At least a first password and a second password are submitted to a first intelligent contract, and the first password, the second password and a third password are submitted to a second intelligent contract within a preset time period. Finally, after the preset time period is finished, the first intelligent contract finishes the first service, and the second intelligent contract finishes the second service, so that the result that only part of the cross-link service is finished can not occur. Similarly, if the third password was not successfully submitted to the second smart contract. The second party device checks that the result of the status of the second smart contract is erroneous, the check result indicating that the third password was successfully submitted to the second smart contract. The second-party device sends the error checking result to the first-party device, and finally, the result that only part of the cross-chain service is completed does not occur.
In yet another case, the third password is successfully submitted to the first smart contract. The first party device checks the status of the first intelligent contract, the check indicating that the third password was successfully submitted to the first intelligent contract. The first party device sends the inspection result to the second party device. The second party device checks the status of the second intelligent contract, the check indicating that the third password was successfully submitted to the second intelligent contract. The second party device sends the inspection result to the first party device. At this point, the first party device submits the first password to the first intelligent contract and the second party device submits the second password to the second intelligent contract. However, due to the situation of time delay or packet loss, the first password is not submitted to the first intelligent contract, and therefore, the intermediate device can only obtain the second password and submit the second password to the first intelligent contract. At least a third password and a second password are submitted to the first smart contract and at least the second password and the third password are submitted to the second smart contract within a preset time period. Finally, after the preset time period is finished, the first intelligent contract finishes the first service, and the second intelligent contract finishes the second service, so that the result that only part of the cross-link service is finished can not occur. Similarly, if the second password is not submitted to the second smart contract due to a delay or packet loss, a result that only part of the cross-link service is completed finally does not occur.
In yet another case, the third password is successfully submitted to the first smart contract. The first party device checks the status of the first intelligent contract, the check indicating that the third password was successfully submitted to the first intelligent contract. The first party device sends the inspection result to the second party device. The second party device checks the status of the second intelligent contract, the check indicating that the third password was successfully submitted to the second intelligent contract. The second party device sends the inspection result to the first party device. At this point, the first party device submits the first password to the first intelligent contract and the second party device submits the second password to the second intelligent contract. Thus, the intermediary device may obtain the first password and the second password, respectively, and submit the first password to the second smart contract and the second password to the first smart contract. But the first password is not submitted to the second smart contract due to a delay or packet loss. The first password, the second password, and the third password are all submitted to the first smart contract, and at least the third password and the second password are submitted to the second smart contract within a preset time period. Finally, after the preset time period is finished, the first intelligent contract finishes the first service, and the second intelligent contract finishes the second service, so that the result that only part of the cross-link service is finished can not occur. Similarly, if the second password is not submitted to the first intelligent contract due to the condition of time delay or packet loss, the result that only part of the cross-link service is completed finally does not occur.
Therefore, the problem that the cross-link service cannot be completed normally due to time delay or packet loss can be further solved by applying the scheme. The occurrence of the situation that the cross-link service is only partially completed is further reduced, the reliability of the cross-link service is improved, and the success rate of executing the cross-link service is further improved.
Corresponding to the foregoing embodiments of the method for processing a cross-chain service of a blockchain, this specification further provides embodiments of a cross-chain service processing apparatus of a blockchain.
As shown in fig. 9, fig. 9 is a block diagram of an apparatus for processing a block chain cross-chain service according to an exemplary embodiment, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain, and the apparatus is applied to the intermediate party device, and the apparatus may include: a generating module 901, a receiving module 902, a trading module 903, a sending module 904, a first submitting module 905, a second submitting module 906 and a third submitting module 907.
The generating module 901 is configured to generate a third password in response to receiving the cross-link service information sent by the second party device, and calculate a third hash value of the third password.
A receiving module 902, configured to receive a first hash value of a first password sent by a first party device and a second hash value of a second password sent by a second party device, where the first password is generated by the first party device and the second password is generated by the second party device.
A trade module 903 configured to initiate a trade for deploying the first intelligent contract to the first blockchain. The first intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information. The first intelligent contract comprises a first judgment logic and a first service logic, the first judgment logic verifies whether the first password, the second password and the third password are submitted to the first intelligent contract based on the first hash value, the second hash value and the third hash value, judges whether a first execution condition is met based on a verification result, and triggers the execution of the first service logic under the condition that the first execution condition is met. The first execution condition includes that the first password, the second password and the third password are all submitted to the first intelligent contract.
A sending module 904 configured to send a third hash value to the second party device, the third hash value being used to create a second intelligent contract deployed on the second blockchain.
A first submission module 905 is configured to submit the third password to the first intelligent contract and the second intelligent contract.
A second submission module 906 for submitting the first password to a second intelligent contract of the second blockchain in the event that it is determined that the first password has been submitted to the first intelligent contract.
A third submission module 907 for submitting the second cipher to the first intelligent contract of the first blockchain in the event that it is determined that the second cipher has been submitted to the second intelligent contract.
In some optional embodiments, the first determination logic further determines whether a first unlock condition is satisfied. The first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract, and the execution of the first business logic is triggered when the first unlocking condition is met at the end of the preset time period.
In further alternative embodiments, the apparatus may further comprise: an acquisition module, a viewing module and a determination module (not shown in the figures).
The obtaining module is used for obtaining a first log of the first block chain and a second log of the second block chain.
And the viewing module is used for viewing first updating content of the world state of the first block chain from the first log and viewing second updating content of the world state of the second block chain from the second log.
A determination module to determine whether the first password is submitted to the first intelligent contract based on the first updated content and to determine that the second password is submitted to the second intelligent contract based on the second updated content.
In other optional embodiments, the first party device and the intermediate party device perform a service for transferring the first party resource through a first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through a second intelligent contract.
As shown in fig. 10, fig. 10 is a block diagram of an apparatus for processing a block chain cross-chain service according to an exemplary embodiment, where the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain, and the apparatus is applied to the second party device, and the apparatus may include: the system comprises an acquisition module 1001, a generation module 1002, a reception module 1003, a transaction module 1004, a transmission module 1005, a determination module 1006 and a submission module 1007.
The acquiring module 1001 is configured to acquire cross-link service information and send the cross-link service information to the first party device and the intermediate party device;
the generating module 1002 is configured to generate a second password and calculate a second hash value of the second password.
The receiving module 1003 is configured to receive a first hash value of a first password sent by the first party device and a third hash value of a third password sent by the intermediate party device, where the first password is generated by the first party device, and the third password is generated by the intermediate party device.
A trade module 1004 for initiating a trade for deploying a second smart contract to the second blockchain. The second intelligent contract comprises a second judgment logic and a second service logic, the second judgment logic verifies whether the first password, the second password and the third password are submitted to the second intelligent contract based on the first hash value, the second hash value and the third hash value, judges whether a second execution condition is met based on a verification result, and triggers the execution of the second service logic in the case that the second execution condition is met. The second execution condition includes that the first password, the second password and the third password are all submitted to the second intelligent contract.
A sending module 1005, configured to send the second hash value to the intermediary device, where the second hash value is used to create the first intelligent contract deployed in the first blockchain.
A determining module 1006 is configured to determine whether the third password has been submitted to the second intelligent contract from the state information of the second intelligent contract deployed in the second blockchain.
A submission module 1007 configured to submit the second password to the second intelligent contract, at least if the third password has been submitted to the second intelligent contract.
In some optional embodiments, the submit module 1007 is configured to: if the third password has been submitted to the second intelligent contract and a message is received from the first party device that the third password has been submitted to the first intelligent contract, submitting the second password to the second intelligent contract.
In other alternative embodiments, the second determination logic further determines whether a second unlock condition is satisfied. The second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to a second intelligent contract, and the execution of the second business logic is triggered when the second unlocking condition is met at the end of the preset time period.
In other optional embodiments, the first party device and the intermediate party device perform a service for transferring the first party resource through a first intelligent contract, and the intermediate party device and the second party device perform a service for transferring the second party resource through a second intelligent contract.
As shown in fig. 11, fig. 11 is a block diagram of an apparatus for processing a block chain cross-chain service according to an exemplary embodiment, where the cross-chain service is performed by a first party device and an intermediary party device through a first intelligent contract deployed in a first block chain, and the intermediary party device and a second party device through a second intelligent contract deployed in a second block chain, and the apparatus is applied to a node of the first block chain, and the apparatus may include: a deployment module 1101, a judgment module 1102 and a business module 1103.
Wherein the deploying module 1101 is configured to deploy the first intelligent contract in response to a transaction initiated by the intermediary device to deploy the first intelligent contract. The first intelligent contract comprises first judgment logic and first business logic.
The determining module 1102 is configured to execute a first determining logic in response to receiving a transaction invoking a first intelligent contract, verify whether the first password, the second password, and the third password are submitted to the first intelligent contract based on a first hash value of the first password, a second hash value of the second password, and a third hash value of the third password, and determine whether a first executing condition is satisfied based on a result of the verification. The first execution condition includes that the first password, the second password and the third password are all submitted to the first intelligent contract. The first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively.
The service module 1103 is configured to execute the first service logic when the first execution condition is met within a preset time period.
In other optional embodiments, the first determination logic further determines whether a first unlocking condition is satisfied based on a result of the verification, the first unlocking condition including any two of the first password, the second password, and the third password being submitted to the first smart contract.
The device also includes: an execution module (not shown).
The execution module is used for executing the first business logic at the moment when the preset time interval is finished if the first unlocking condition is met, and destroying the first intelligent contract if the first unlocking condition is not met.
As shown in fig. 12, fig. 12 is a block diagram of an apparatus for processing a block chain cross-chain service according to an exemplary embodiment, where the cross-chain service is performed by a first party device and an intermediary party device through a first intelligent contract deployed in a first block chain, and the intermediary party device and a second party device through a second intelligent contract deployed in a second block chain, and the apparatus is applied to a node of the second block chain, and the apparatus may include: a deployment module 1201, a judgment module 1202 and a service module 1203.
The deploying module 1201 is configured to deploy a second intelligent contract in response to a transaction initiated by a second-party device to deploy the second intelligent contract, where the second intelligent contract includes second judgment logic and second business logic.
The determining module 1202 is configured to execute a second determining logic in response to receiving a transaction invoking a second intelligent contract, verify whether the first password, the second password, and the third password are submitted to the second intelligent contract based on the first hash value of the first password, the second hash value of the second password, and the third hash value of the third password, and determine whether a second executing condition is satisfied based on a result of the verification. The second execution condition includes that the first password, the second password and the third password are all submitted to the second intelligent contract. The first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively.
The service module 1203 is configured to execute a second service logic when a second execution condition is met within a preset time period.
In some optional embodiments, the second determination logic further determines whether the second unlocking condition is satisfied based on a result of the verification. The second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract.
The device also includes: an execution module (not shown).
And the execution module is used for executing a second service logic at the moment when the preset time period is finished if a second unlocking condition is met, and destroying a second intelligent contract if the second unlocking condition is not met.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of one or more embodiments of the present specification. One of ordinary skill in the art can understand and implement it without inventive effort.
One or more embodiments of the present specification further provide a computer-readable storage medium, where the storage medium stores a computer program, and the computer program is operable to execute the method for processing a cross-chain service of a block chain provided in any one of the embodiments of fig. 3 to fig. 8.
Corresponding to the above method for processing a chain-crossing service of a block chain, one or more embodiments of the present specification further provide a schematic structural diagram of an electronic device according to an exemplary embodiment of the present specification, shown in fig. 13. Referring to fig. 13, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. And the processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the cross-chain service processing device of the block chain on the logic level. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. In some cases, the actions or steps recited in the present application may be performed in an order different than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
It will be further appreciated by those of ordinary skill in the art that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application. The software modules may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (26)

1. A method for processing a cross-chain service of a block chain is provided, wherein the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to the mediator device, and comprises the following steps:
generating a third password in response to receiving the cross-link service information sent by the second party equipment, and calculating a third hash value of the third password;
receiving a first hash value of a first password sent by the first party equipment and a second hash value of a second password sent by the second party equipment; the first password is generated by the first party device; the second password is generated by the second party device;
initiating a transaction to the first blockchain to deploy the first smart contract; the first intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the first intelligent contract comprises a first judgment flow and a first business flow, the first judgment flow verifies whether the first password, the second password and the third password are submitted to the first intelligent contract based on the first hash value, the second hash value and the third hash value, judges whether a first execution condition is met based on the verification result, and triggers the execution of the first business flow if the first execution condition is met; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract;
sending the third hash value to the second party device; the third hash value is used to create the second intelligent contract deployed on the second blockchain;
submitting the third password to the first intelligent contract and the second intelligent contract;
in an instance in which it is determined that the first cipher has been submitted to the first intelligent contract, submitting the first cipher to a second intelligent contract of the second blockchain; and
in an instance in which it is determined that the second cipher has been submitted to the second intelligent contract, submitting the second cipher to a first intelligent contract of the first blockchain.
2. The method of claim 1, wherein the first determining process further determines whether a first unlocking condition is satisfied; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract; if the first execution condition is met within a preset time period, triggering the execution of the first business process, and if the first execution condition is not met within the preset time period, triggering the execution of the first business process under the condition that the first unlocking condition is met at the moment when the preset time period is over.
3. The method of claim 1, wherein after submitting the third password to the first and second smart contracts, further comprising:
acquiring a first log of the first block chain and a second log of the second block chain;
viewing a first updated content of the world state of the first blockchain from the first log and viewing a second updated content of the world state of the second blockchain from the second log;
based on the first updated content, determining whether the first password is submitted to the first intelligent contract, and based on the second updated content, determining that the second password is submitted to the second intelligent contract.
4. A method according to any one of claims 1 to 3 wherein the first party device and the intermediate party device conduct first party resource roll-in traffic via the first intelligent contract and the intermediate party device and the second party device conduct second party resource roll-out traffic via the second intelligent contract.
5. A method for processing a cross-chain service of a block chain is provided, wherein the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to the second party device, and comprises the following steps:
acquiring cross-chain service information and sending the cross-chain service information to the first party equipment and the intermediate party equipment;
generating a second password, and calculating a second hash value of the second password;
receiving a first hash value of a first password sent by the first party equipment and a third hash value of a third password sent by the intermediate party equipment; the first password is generated by the first party device; the third password is generated by the intermediary device;
initiating a transaction to the second blockchain to deploy the second smart contract; the second intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the second intelligent contract comprises a second judgment process and a second business process; the second judgment flow verifies whether the first password, the second password and the third password are submitted to the second intelligent contract or not based on the first hash value, the second hash value and the third hash value, judges whether a second execution condition is met or not based on the verification result, and triggers the execution of the second business flow if the second execution condition is met; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract;
sending the second hash value to the intermediary device; the second hash value is used to create the first intelligent contract deployed in the first blockchain;
determining from state information of the second intelligent contract deployed in the second blockchain whether the third password has been submitted to the second intelligent contract;
submitting the second password to the second intelligent contract at least on a condition that the third password has been submitted to the second intelligent contract.
6. The method of claim 5, wherein the submitting the second password to the second intelligent contract, at least on a condition that the third password has been submitted to the second intelligent contract, comprises:
submitting the second password to the second intelligent contract if the third password has been submitted to the second intelligent contract and a message is received from the first party device that the third password has been submitted to the first intelligent contract.
7. The method of claim 6, wherein the second determining process further determines whether a second unlocking condition is satisfied; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract; and if the second execution condition is met within a preset time period, triggering the execution of the second business process, and if the second execution condition is not met within the preset time period, triggering the execution of the second business process under the condition that the second unlocking condition is met at the moment when the preset time period is ended.
8. A method according to any one of claims 5 to 7 wherein the first party device and the intermediate party device conduct first party resource roll-in traffic via the first intelligent contract and the intermediate party device and the second party device conduct second party resource roll-out traffic via the second intelligent contract.
9. A method for processing a cross-chain service of a block chain is provided, wherein the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to a node of the first blockchain, and comprises the following steps:
in response to a transaction initiated by the intermediary device to deploy the first intelligent contract, deploying the first intelligent contract using a first hash value of a first password, a second hash value of a second password, and a third hash value of a third password; the first intelligent contract comprises a first judgment process and a first business process;
executing the first judgment process in response to receiving a transaction for calling the first intelligent contract, verifying whether the first password, the second password and the third password are submitted to the first intelligent contract based on a first hash value of the first password, a second hash value of the second password and a third hash value of the third password, and judging whether a first execution condition is met based on a verification result; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and if the first execution condition is met within a preset time period, executing the first business process.
10. The method according to claim 9, wherein the first determination process further determines whether a first unlocking condition is satisfied based on a result of the verification; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract;
if the first execution condition is not satisfied within the preset time period, the method further includes:
at the moment when the preset time period is finished, if the first unlocking condition is met, executing the first business process;
and at the moment when the preset time period is finished, if the first unlocking condition is not met, destroying the first intelligent contract.
11. A method for processing a cross-chain service of a block chain is provided, wherein the cross-chain service is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the method is applied to a node of the second blockchain, and comprises the following steps:
in response to a transaction initiated by the second party device to deploy the second smart contract, deploying the second smart contract using the first hash value of the first password, the second hash value of the second password, and the third hash value of the third password; the second intelligent contract comprises a second judgment process and a second business process;
executing the second judgment process in response to receiving a transaction for calling the second intelligent contract, verifying whether the first password, the second password and the third password are submitted to the second intelligent contract based on the first hash value of the first password, the second hash value of the second password and the third hash value of the third password, and judging whether a second execution condition is met based on the verification result; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and if the second execution condition is met within a preset time period, executing the second business process.
12. The method according to claim 11, wherein the second determination process further determines whether a second unlocking condition is satisfied based on a result of the verification; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract;
if the second execution condition is not satisfied within the preset time period, the method further includes:
at the moment when the preset time period is finished, if the second unlocking condition is met, executing the second business process;
and at the moment when the preset time period is finished, if the second unlocking condition is not met, destroying the second intelligent contract.
13. A block chain cross-chain business processing device is provided, wherein the cross-chain business is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the device is applied to the intermediate device and comprises:
the generating module is used for responding to the received cross-chain service information sent by the second party equipment, generating a third password and calculating a third hash value of the third password;
a receiving module, configured to receive a first hash value of a first password sent by the first party device and a second hash value of a second password sent by the second party device; the first password is generated by the first party device; the second password is generated by the second party device;
a transaction module to initiate a transaction to deploy the first smart contract to the first blockchain; the first intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the first intelligent contract comprises a first judgment flow and a first business flow, the first judgment flow verifies whether the first password, the second password and the third password are submitted to the first intelligent contract based on the first hash value, the second hash value and the third hash value, judges whether a first execution condition is met based on the verification result, and triggers the execution of the first business flow if the first execution condition is met; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract;
a sending module, configured to send the third hash value to the second party device; the third hash value is used to create the second intelligent contract deployed on the second blockchain;
a first submission module to submit the third password to the first intelligent contract and the second intelligent contract;
a second submission module to submit the first password to a second intelligent contract of the second blockchain in the event that it is determined that the first password has been submitted to the first intelligent contract; and
a third submission module to submit the second password to the first intelligent contract of the first blockchain in the event that it is determined that the second password has been submitted to the second intelligent contract.
14. The apparatus of claim 13, wherein the first determining process further determines whether a first unlocking condition is satisfied; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract; if the first execution condition is met within a preset time period, triggering the execution of the first business process, and if the first execution condition is not met within the preset time period, triggering the execution of the first business process under the condition that the first unlocking condition is met at the moment when the preset time period is over.
15. The apparatus of claim 13, wherein the apparatus further comprises:
an obtaining module, configured to obtain a first log of the first block chain and a second log of the second block chain;
a viewing module for viewing a first updated content of the world state of the first blockchain from the first log and viewing a second updated content of the world state of the second blockchain from the second log;
a determination module to determine whether the first password was submitted to the first intelligent contract based on the first updated content and to determine that the second password was submitted to the second intelligent contract based on the second updated content.
16. An apparatus according to any of claims 13-15, wherein the first party device and the intermediary device conduct traffic for transfer-in of first party resources via the first intelligent contract, and the intermediary device and the second party device conduct traffic for transfer-out of second party resources via the second intelligent contract.
17. A block chain cross-chain business processing device is provided, wherein the cross-chain business is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the device is applied to the second-party equipment, and comprises:
an obtaining module, configured to obtain cross-link service information and send the cross-link service information to the first party device and the intermediate party device;
the generating module is used for generating a second password and calculating a second hash value of the second password;
a receiving module, configured to receive a first hash value of a first password sent by the first party device and a third hash value of a third password sent by the intermediary device; the first password is generated by the first party device; the third password is generated by the intermediary device;
a transaction module to initiate a transaction to deploy the second smart contract to the second blockchain; the second intelligent contract is generated based on the first hash value, the second hash value, the third hash value and the cross-chain business information; the second intelligent contract comprises a second judgment process and a second business process; the second judgment flow verifies whether the first password, the second password and the third password are submitted to the second intelligent contract or not based on the first hash value, the second hash value and the third hash value, judges whether a second execution condition is met or not based on the verification result, and triggers the execution of the second business flow if the second execution condition is met; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract;
a sending module, configured to send the second hash value to the intermediary device; the second hash value is used to create the first intelligent contract deployed in the first blockchain;
a determination module to determine whether the third cipher has been submitted to the second intelligent contract from state information of the second intelligent contract deployed in the second blockchain;
a submission module to submit the second password to the second intelligent contract, at least on a condition that the third password has been submitted to the second intelligent contract.
18. The apparatus of claim 17, wherein the commit module is configured to:
submitting the second password to the second intelligent contract if the third password has been submitted to the second intelligent contract and a message is received from the first party device that the third password has been submitted to the first intelligent contract.
19. The apparatus of claim 18, wherein the second determining process further determines whether a second unlocking condition is satisfied; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract; and if the second execution condition is met within a preset time period, triggering the execution of the second business process, and if the second execution condition is not met within the preset time period, triggering the execution of the second business process under the condition that the second unlocking condition is met at the moment when the preset time period is ended.
20. An apparatus according to any of claims 17-19, wherein the first party device and the intermediary device conduct traffic for transfer-in of first party resources via the first intelligent contract, and the intermediary device and the second party device conduct traffic for transfer-out of second party resources via the second intelligent contract.
21. A block chain cross-chain business processing device is provided, wherein the cross-chain business is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the apparatus is applied to a node of the first blockchain, and comprises:
a deployment module, configured to deploy the first intelligent contract using a first hash value of a first password, a second hash value of a second password, and a third hash value of a third password in response to a transaction initiated by the intermediary device to deploy the first intelligent contract; the first intelligent contract comprises a first judgment process and a first business process;
the judging module is used for responding to the received transaction for calling the first intelligent contract, executing the first judging process, verifying whether the first password, the second password and the third password are submitted to the first intelligent contract or not based on the first hash value of the first password, the second hash value of the second password and the third hash value of the third password, and judging whether a first executing condition is met or not based on the verification result; the first execution condition comprises that the first password, the second password and the third password are all submitted to the first smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and the business module is used for executing the first business process when the first execution condition is met in a preset time period.
22. The apparatus according to claim 21, wherein the first determination process further determines whether a first unlocking condition is satisfied based on a result of the verification; the first unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the first intelligent contract;
the device further comprises:
the execution module is used for executing the first business process when the first execution condition is not met in the preset time period and when the preset time period is over and the first unlocking condition is met; and if the first unlocking condition is not met, destroying the first intelligent contract.
23. A block chain cross-chain business processing device is provided, wherein the cross-chain business is performed by a first party device and an intermediate party device through a first intelligent contract deployed in a first block chain, and the intermediate party device and a second party device through a second intelligent contract deployed in a second block chain; the apparatus is applied to a node of the second blockchain, and the apparatus comprises:
a deployment module, configured to deploy the second intelligent contract using a first hash value of a first password, a second hash value of a second password, and a third hash value of a third password in response to a transaction initiated by the second party device to deploy the second intelligent contract; the second intelligent contract comprises a second judgment process and a second business process;
the judging module is used for responding to the received transaction for calling the second intelligent contract, executing the second judging process, verifying whether the first password, the second password and the third password are submitted to the second intelligent contract or not based on the first hash value of the first password, the second hash value of the second password and the third hash value of the third password, and judging whether a second executing condition is met or not based on the verification result; the second execution condition comprises that the first password, the second password and the third password are all submitted to the second smart contract; the first password, the second password, and the third password are generated by the first party device, the second party device, and the intermediary device, respectively;
and the service module is used for executing the second service process when the second execution condition is met in a preset time period.
24. The apparatus according to claim 23, wherein the second determination procedure further determines whether a second unlocking condition is satisfied based on a result of the verification; the second unlocking condition comprises that any two of the first password, the second password and the third password are submitted to the second intelligent contract;
the device further comprises:
the execution module is used for executing the second business process if the second execution condition is not met in the preset time period and the second unlocking condition is met at the end of the preset time period; and if the second unlocking condition is not met, destroying the second intelligent contract.
25. A computer-readable storage medium, which stores a computer program which, when executed by a processor, implements the method of any of claims 1-12 above.
26. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of the preceding claims 1-12 when executing the computer program.
CN202011465454.8A 2020-12-14 2020-12-14 Cross-chain service processing method and device of block chain and electronic equipment Active CN112235110B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011465454.8A CN112235110B (en) 2020-12-14 2020-12-14 Cross-chain service processing method and device of block chain and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011465454.8A CN112235110B (en) 2020-12-14 2020-12-14 Cross-chain service processing method and device of block chain and electronic equipment

Publications (2)

Publication Number Publication Date
CN112235110A CN112235110A (en) 2021-01-15
CN112235110B true CN112235110B (en) 2021-03-23

Family

ID=74123698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011465454.8A Active CN112235110B (en) 2020-12-14 2020-12-14 Cross-chain service processing method and device of block chain and electronic equipment

Country Status (1)

Country Link
CN (1) CN112235110B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112396427B (en) * 2021-01-19 2021-04-23 北京连琪科技有限公司 Cross-chain interchange operation method for general scenes

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109685489A (en) * 2018-12-28 2019-04-26 杭州云象网络技术有限公司 A kind of assets across chain method of commerce between block chain

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109214818B (en) * 2017-06-30 2021-06-15 华为技术有限公司 Cross-chain transaction method and device
CN108848119B (en) * 2018-04-03 2020-04-28 阿里巴巴集团控股有限公司 Cross-block-chain interaction method, device, system and electronic equipment
EP3932021A4 (en) * 2019-03-01 2022-11-09 ZeU Technologies, Inc. Blockchain-based secure email system
CN111724170B (en) * 2020-03-05 2022-10-11 支付宝(杭州)信息技术有限公司 Service processing system, service processing method, device and equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109685489A (en) * 2018-12-28 2019-04-26 杭州云象网络技术有限公司 A kind of assets across chain method of commerce between block chain

Also Published As

Publication number Publication date
CN112235110A (en) 2021-01-15

Similar Documents

Publication Publication Date Title
CN107301600B (en) Core construction method of block chain Internet model for cross-chain transaction
US20220366416A1 (en) Temporary consensus networks in a resource transfer system
US20220391890A1 (en) Private networks and content requests in a resource transfer system
CN110011996B (en) Application authorization method and device based on block chain and electronic equipment
US20230040935A1 (en) One way functions in a resource transfer system
WO2018232493A1 (en) A network of doubly-chained blockchains capable of cross-chain transactions
TWI636411B (en) System to provide non-repudiation for non-blockchain node and method thereof
US20220351177A1 (en) Hold condition in a resource transfer system
CN106411950B (en) Authentication method, apparatus and system based on block chain transaction id
US20220350658A1 (en) Transfer costs in a resource transfer system
CN111640017A (en) Transaction correctness verification method and device applied to alliance chain cross-chain transfer
EP3885956A1 (en) Transaction processing method and device
CN111784518A (en) Block chain cross-chain processing method and device, computer equipment and storage medium
CN111199481A (en) Distributed transaction network based on asynchronous directed acyclic graph
CN108776896A (en) Digital cash wallet business management method based on multi-signature and system
US20160342984A1 (en) Loop transfer in a resource transfer system
CN112235110B (en) Cross-chain service processing method and device of block chain and electronic equipment
WO2017060817A1 (en) Temporary consensus networks in a resource transfer system
CN108762895B (en) Method and device for processing distributed transaction
CN113506112A (en) Receivable account right confirming method and device and electronic equipment
CN113052587A (en) Transfer service processing method and device based on block chain
WO2022206433A1 (en) Method and apparatus for pre-executing chaincode in fabric blockchain
WO2017060816A1 (en) Private networks and content requests in a resource transfer system
CN114154969B (en) Large-scale trading and settlement method based on block chain
CN113781230A (en) Transaction processing method and device based on block chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40046320

Country of ref document: HK