The present application claims priority of chinese patent application entitled "blockchain standard application model and method for applying same" filed by chinese patent office on 28/8/2018 with application number 201810986825.3, the entire contents of which are incorporated herein by reference.
Disclosure of Invention
The application provides a repudiation-resistant cross-chain transaction method and a block chain system, which can be used for solving the problem that cross-chain transactions cannot be realized because no unified and effective communication mechanism exists between block chain networks and the transaction safety cannot be ensured in the prior art.
In a first aspect, the present application provides a method of anti-repudiation cross-chain transaction, the method comprising:
the public link creates a cross-link transaction, which includes: the service transaction needing to be completed by the transaction initiating chain and the return transaction needing to be completed by the transaction target chain;
the initiating parallel chain forwards a first locking request sent by the public chain to the transaction initiating chain, wherein the first locking request comprises transaction information of the service transaction;
the transaction initiating chain completes the service transaction according to the first locking request and locks the transaction content of the service transaction;
the target parallel chain forwards a second locking request sent by the public chain to the transaction target chain, wherein the second locking request comprises the transaction information of the returned transaction;
the transaction target chain completes the return transaction according to the second locking request and locks the transaction content of the return transaction;
when it is determined that both the service transaction and the return transaction are completed, the public link instructs the transaction initiation link to unlock transaction content of the service transaction and instructs the transaction destination link to unlock transaction content of the return transaction.
Optionally, the initiating parallel chain forwards the first locking request sent by the public chain to the transaction initiating chain, where the initiating parallel chain includes:
receiving the first locking request sent by the public chain according to the cross-chain transaction;
the initiating parallel chain detects whether the transaction initiating chain supports the service transaction according to the transaction information of the service transaction;
when the transaction initiation chain is determined to support the service transaction, the initiation parallel chain forwards the first locking request to the transaction initiation chain;
the target parallel chain forwards a second locking request sent by the public chain to the transaction target chain, and the second locking request comprises:
receiving the second locking request sent by the public chain according to the cross-chain transaction;
the target parallel chain detects whether the transaction target chain supports the return transaction according to the transaction information of the return transaction;
when it is determined that the transaction target chain supports the return transaction, the target parallel chain forwards the second lock request to the transaction target chain.
Optionally, after detecting whether the transaction initiation chain supports the service transaction, the method further includes:
when the transaction initiating chain is determined not to support the service transaction, the initiating parallel chain sends failure information to the public chain, and the failure information is used for informing the public chain that the cross-chain transaction fails;
after the detecting whether the transaction target chain supports the return transaction, the method further comprises:
when the transaction target chain is determined not to support the return transaction, the target parallel chain sends the failure information to the public chain.
Optionally, when the service transaction is completed, the transaction initiation chain sends a service completion response to the initiation parallel chain;
the initiating parallel chain forwards the service completion response to the public chain;
when the return transaction is completed, the transaction target chain sends a return completion response to the target parallel chain;
the target parallel chain forwards the return completion response to the public chain;
if the public link receives the service completion response and the return completion response, it is determined that both the service transaction and the return transaction are completed.
Optionally, the public link completes a first transfer transaction according to the cross-link transaction, and locks a public link permit in the first transfer transaction, where the first transfer transaction is a payment of the public link permit equivalent to the service transaction from the transaction target link to the transaction initiation link;
initiating a parallel chain to receive a service transaction request sent by the public chain, and initiating the service transaction to the transaction initiation chain according to the service transaction request;
the transaction initiation chain completes the service transaction;
when the initiating parallel chain determines that the service transaction is completed, instructing the public chain to unlock a public chain permit in the first transfer transaction;
the public chain initiates a second transfer transaction according to the cross-chain transaction, and locks a public chain certificate in the second transfer transaction, wherein the second transfer transaction is a public chain certificate which is equivalent to the return transaction and paid to the transaction target chain by the transaction initiation chain;
the target parallel chain receives a return transaction request sent by the public chain, and initiates the return transaction to the transaction target chain according to the return transaction request;
the transaction target chain completes the return transaction;
when the target parallel chain determines that the return transaction is complete, instructing the public chain to unlock a public chain permit in the second transfer transaction.
Optionally, before the instructing the public link to unlock the public link certification in the first transfer transaction, the method further includes:
the initiating parallel chain detects whether the service transaction is recorded in a block chain of the initiating parallel chain;
if the service transaction record is detected to be in the block chain of the service transaction record, determining that the service transaction is completed;
before the instructing the public chain to unlock a public chain permit in the second transfer transaction, further comprising:
the target parallel chain detects whether the return transaction is recorded in a block chain of the target parallel chain;
and if the returned transaction record is detected to be in the block chain of the returned transaction record, determining that the returned transaction is completed.
Optionally, the public chain creates a cross-chain transaction, including:
the public link receives a cross-link transaction request sent by the transaction initiation chain, wherein the cross-link transaction request comprises: the transaction content of the cross-chain transaction, and the address information of the transaction initiation chain and the transaction target chain;
and creating the cross-chain transaction according to the cross-chain transaction request.
In a second aspect, the present application provides a blockchain system, comprising: a transaction initiating chain, an initiating parallel chain, a transaction target chain, a target parallel chain and a public chain; the initiating parallel chain is composed of common nodes of the transaction initiating chain and the public chain, and the target parallel chain is composed of common nodes of the target initiating chain and the public chain;
the public chain is used for creating a cross-chain transaction, and the cross-chain transaction comprises the following steps: the service transaction needing to be completed by the transaction initiating chain and the return transaction needing to be completed by the transaction target chain;
the initiating parallel chain is used for forwarding a first locking request sent by the public chain to the transaction initiating chain, wherein the first locking request comprises transaction information of the service transaction;
the transaction initiating chain is used for completing the service transaction according to the first locking request and locking the transaction content of the service transaction;
the target parallel chain is used for forwarding a second locking request sent by the public chain to the transaction target chain, wherein the second locking request comprises the transaction information of the returned transaction;
the transaction target chain is used for completing the return transaction according to the second locking request and locking the transaction content of the return transaction;
the public chain is further used for indicating the transaction initiation chain to unlock the transaction content of the service transaction and indicating the transaction target chain to unlock the transaction content of the return transaction when the service transaction and the return transaction are determined to be completed.
In the scheme provided by the application, a unified and effective communication channel is formed between the transaction initiating chain and the transaction target chain through the public chain, the initiating parallel chain and the target parallel chain. By utilizing the communication channel, when the transaction initiation chain and the transaction target chain carry out cross-chain transaction, whether the opposite side finishes the content appointed in the cross-chain transaction can be determined; moreover, the transaction content of the service transaction and the transaction content of the return transaction are respectively locked by the transaction initiating chain and the transaction target chain, and the respective transaction content is unlocked when the opposite side is determined to finish the transaction, so that the loss caused by incomplete transaction of the opposite side is avoided, the anti-repudiation transaction effect is achieved, and the cross-chain transaction can be safely finished.
Detailed Description
Reference will now be made in detail to 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 examples do not represent all embodiments consistent with the present application. But merely as exemplifications of systems and methods consistent with certain aspects of the application, as recited in the claims.
In the technical solution provided by the present application, a blockchain network refers to a point-to-point network formed by blockchain nodes. The blockchain or data information in blockchain blocks is the transactions recorded by the nodes of the blockchain when transactions occur in the blockchain network. One block comprises a plurality of transactions, and a plurality of blocks form a block chain. Each node in the blockchain network may be a physical node, such as a terminal, a server, or a virtual node. And the nodes in the same block chain network communicate and maintain the operation of the block chain network based on the same consensus mechanism.
In this application, references to a public chain, a transaction initiation chain, a transaction target chain, an initiation parallel chain, and a target parallel chain refer to different blockchain networks that conform to blockchain technology. In the technical scheme provided by the application, a public link is used as a basic platform deployed in the whole network and can be accessed to a plurality of block link networks, such as an industry link, a alliance link and a private link which are built based on public link port specifications. Each blockchain network can be used as a development platform and provides corresponding services for the inside of the network. The public link definition and specification has standard interfaces and modes so as to facilitate network interfacing of other block links, such as a transaction initiation link and a transaction target link. The public chain in the application has the capability of supporting cross-chain intermediary and also has decentralized application and intelligent contractual capability.
The transaction initiation chain refers to a blockchain network for initiating a cross-chain transaction, and the transaction target chain is a blockchain network where a transaction object of the cross-chain transaction is located. In the application, a public chain provides a basic platform, and a transaction initiating chain and a transaction target chain serve as access networks and provide respective functions and services. The transaction initiation chain and the transaction target chain are independent block chain networks, such as Bizhong and Ether Fang, or industry chains and alliance chains developed by different industries, even different private chains or public chains. These separate blockchain networks cannot communicate or transact with each other due to differences, such as differences in consensus mechanisms. Therefore, in the technical solution provided by the present application, the transaction initiation chain and the transaction target chain are connected to the public chain through a parallel chain.
For a blockchain network that accesses a common chain through parallel chains, the parallel chains may consist of common nodes of the common chain and the blockchain network. Since the parallel link node is a common node of the public link and the blockchain network, the parallel link has both functions of the public link and the blockchain network, and both blockchains are stored. Therefore, the parallel chain can convert the information in the block chain network on one side and then transmit the information to the block chain network on the other side. Through the bridging effect in the parallel chain, communication or transaction can be carried out between different blockchain networks. In this application, an initiating parallel chain refers to a parallel chain connecting a male chain and a transaction initiating chain, and a target parallel chain refers to a parallel chain connecting a male chain and a transaction target chain
Based on the components, the public chain can provide cross-chain relay in practical application, and work such as transaction verification, data certification, asset transfer, intelligent contract execution and the like is completed. The public link also provides basic blockchain platform capability, namely, rapidly completing scheme deployment and verification and completing distributed storage and billing programs in the public link network.
The public link can be used for storing the information summary of the corresponding cross-link transaction, namely the transaction summary, besides recording the block chain information of the public link. Related content of cross-chain transaction is recorded through the formatted transaction data. Meanwhile, in order to reduce the occupation of the distributed storage space on the public link, when the public link records certain information, the third-party blockchain information can be recorded through a specific compression algorithm. In addition, for a blockchain network accessing a public chain, the public chain also stores registration information provided when the blockchain network accesses. The registration information includes: the type of service that can be provided, the type of certificate that can be exchanged, the manner in which the transaction is performed, the conditions of the transaction, the address information of each node, and the like.
Referring to fig. 1, a flow diagram of a repudiation resistant cross-chain transaction method according to the present application is exemplarily shown. The method comprises the following steps.
S10, the public chain creates a cross-chain transaction.
In the scheme provided by the embodiment of the application, a public chain is required to be used as an intermediary bridge to communicate a transaction initiation chain and a transaction target chain, and cross-chain transaction between the transaction initiation chain and the transaction target chain is completed. Thus, when a cross-chain transaction needs to be conducted between the transaction initiation chain and the transaction target chain, the cross-chain transaction is created by the public chain. One cross-chain transaction includes two sub-transactions: service transactions that the transaction initiation chain needs to complete and return transactions that the transaction target chain needs to complete. The service transaction is the transaction content required by the transaction initiation chain to pay the transaction target chain to the transaction target chain; the return transaction is the transaction content that the transaction target chain pays the transaction initiation chain requirements to the transaction initiation chain. Therefore, completing a cross-chain transaction requires completing the service transaction and the return transaction in the cross-chain transaction.
Illustratively, the cross-chain transaction between transaction initiation chain a and transaction target chain B is: the certificate a of 50 transaction initiating chains A is exchanged for the certificate B of 1 transaction target chain B. Then, in the cross-chain transaction, the service transaction pays 50 certificates A to the transaction target chain for the transaction initiating chain; and returning the transaction as a transaction target chain and paying 1 certificate b to a transaction initiating chain.
When the transaction initiation chain is to perform cross-chain transaction with the transaction target chain, the transaction initiation chain may invoke the public intelligent contract to send a cross-chain transaction request to the public chain. The cross-chain transaction request includes: the transaction contents which need to be paid by both transaction parties and the address information of the transaction initiation chain and the transaction target chain. And the transaction nodes in the transaction initiation chain broadcast the cross-chain transaction request in the transaction initiation chain. And the node initiating the parallel chain acquires the transaction request and broadcasts in the public chain, so that the public chain acquires the cross-chain transaction request. And after the public chain acquires the cross-chain transaction request, verifying whether the transaction content in the request can be paid or not by the transaction initiating chain and the transaction target chain according to the stored registration information. Specifically, the public chain verifies whether the transaction node can pay the transaction contents which need to be paid by the transaction initiation chain and verifies whether the target node can pay the transaction contents which need to be paid by the transaction target chain. The transaction node is a node which initiates a cross-chain transaction request in a delivery initiation chain, and the target node is a node which performs cross-chain transaction with the transaction node in a transaction target chain.
And when the cross-chain transaction request passes the verification of the public chain, the public chain creates a cross-chain transaction according to the cross-chain transaction request. And if the cross-chain transaction request does not pass the verification of the public chain, if the transaction node cannot pay the transaction content of the service transaction, the public chain informs the transaction initiation chain that the cross-chain transaction fails.
In another embodiment, before the transaction initiation chain sends the cross-chain transaction request, a query transaction is initiated to the public chain by initiating the parallel chain. The inquiry transaction comprises transaction content required by the transaction initiation chain and transaction content which can be paid by the transaction initiation chain. And the public link determines whether a transaction target link capable of achieving the transaction with the transaction initiation link exists in the accessed block link network according to the query transaction and the registration information of the accessed block link network. If the address information exists, the public chain sends the address information of the transaction target chain to the transaction initiating chain by initiating the parallel chain. If not, the public link informs the transaction initiation chain that the cross-link transaction fails. In addition, in the present application, the address information of the transaction initiation chain is used to indicate the account addresses of the transaction node and the target node corresponding to each other in the network of the transaction initiation chain. The address information of the transaction target chain is used for indicating the corresponding account addresses of the transaction node and the target node in the network of the transaction target chain.
Illustratively, trading node a1 wishes to exchange 50 trades for the voucher a of the origination chain a, in exchange for 1 trades for the voucher B of the destination chain B. Thus, transaction node A1 initiates a query transaction to public chain C. The public link determines from the inquiry transaction that transaction node a1 requires 1 witness b and is able to pay for 50 witnesses a. The public link queries other blockchain networks for nodes that can complete a transaction with transaction node a1 based on the contents of the query transaction. One node in the transaction object chain B needs 50 passes a and is willing to pay a maximum of 5 passes B. Then the public chain C will have that node as the target node B1 and send the address information of the transaction target chain B to the transaction initiating chain a.
And S11, the initiating parallel chain forwards the first locking request sent by the public chain to the transaction initiating chain.
After the public link creates the cross-link transaction, the transaction initiation link needs to be notified to complete the service transaction. Thus, the public chain sends a first lock request to the transaction initiation chain by initiating a parallel chain. The first locking request is used for indicating the transaction initiation chain to complete the service transaction and locking the transaction content of the service transaction. Thus, transaction information for the service transaction is included in the first lock request. The transaction information of one transaction comprises address information, transaction modes and transaction conditions of both transaction parties. The transaction mode includes transaction time, block chain information format (template), and the type of the certificate supporting the transaction. The transaction condition includes the transaction contents which the transaction parties need to pay.
Further, as shown in fig. 2, the step of initiating the parallel chain to forward the first locking request sent by the public chain to the transaction initiation chain includes:
and S111, initiating a parallel chain to receive a first locking request sent by a public chain.
And S112, initiating a parallel chain to detect whether the transaction initiation chain supports service transaction.
And S113, if the transaction initiating chain supports service transaction, initiating a parallel chain to forward the first locking request to the transaction initiating chain.
And S114, if the transaction initiating chain does not support service transaction, initiating the parallel chain to send failure information to the public chain.
After the public link creates the cross-link transaction, the service transaction needing to be completed by the transaction initiation link is determined, and a first locking request is generated according to the service transaction. To send the first lock request to the transaction initiation chain, the public chain broadcasts the first lock request in its own node. Since the initiating parallel chain node is also a node in the public chain, the initiating parallel chain can receive the first lock request.
After receiving the first locking request, initiating a parallel chain to detect whether the transaction initiation chain supports service transaction, and further ensuring that cross-chain transaction can be completed. And the initiating parallel chain detects whether the transaction node supports the transaction mode and the transaction condition in the transaction information according to the transaction information in the first locking request. If so, initiating a parallel chain to determine that the transaction initiation chain supports service transaction; if not, initiating a parallel chain to determine that the transaction initiation chain does not support the service transaction.
Illustratively, the cross-chain transaction is to exchange the certificate a of the transaction initiating chain A for the certificate B of the transaction target chain B, the exchange ratio is 50:1, and 100 certificates a/2 certificates B are required to be exchanged. Then, the transaction mode of the service transaction is payment permit a, and the transaction condition is that the number of the payment permit a is 100. And if the transaction node A1 of the transaction initiation chain A only has 98 certificates a and does not meet the transaction condition, initiating the parallel chain AC to determine that the transaction initiation chain A does not support service transaction.
If the transaction initiation chain supports service transaction, a parallel chain is initiated to forward the first locking request to the transaction initiation chain. Specifically, the initiating parallel chain broadcasts a first lock request in the transaction initiation chain. Accordingly, the transaction initiation link receives the first lock request.
If the transaction initiating chain does not support the service transaction, the parallel chain is initiated to send failure information to the public chain. The failure information is used to inform the public chain of the failure of the cross-chain transaction. Specifically, the initiating parallel chain broadcasts failure information in the public chain. Correspondingly, the public link receives the failure information, determines that the cross-link transaction fails, and ends the cross-link transaction. Wherein the failure information includes transaction information of the service transaction.
S12, the transaction initiation chain completes the service transaction and locks the transaction content of the service transaction.
The transaction initiating link receives the first locking request and determines the service transaction to be completed according to the transaction information in the first locking request. Specifically, the maintainer node in the transaction initiation chain completes the service transaction and locks the transaction content of the service transaction. The maintainer node is a node in charge of maintaining the blockchain in the blockchain network and has the accounting right. And initiating a parallel chain to broadcast a first locking request in a transaction initiation chain, and paying the transaction content needing to be paid by the transaction initiation chain in the cross-chain transaction and locking the transaction content after a maintainer node in the transaction initiation chain receives the first locking request.
In the technical solution provided in the present application, a cross-chain transaction generally includes two types: certificate exchange and information service. Wherein, the certificate exchange is to exchange the certificate of the transaction target chain with the certificate of the transaction initiating chain; the information service means that the transaction initiation chain pays a certain amount of certificates to the transaction target chain, and the purchase transaction target chain sends corresponding information data to the transaction initiation chain, or the transaction initiation chain sends the information data to the transaction target chain to exchange the certain amount of certificates. But both certificate exchange and information service are data operation or data operation results. For example, a service transaction is a proof of payment for a certain number of transaction initiation chains. Then, when the service transaction is completed, the maintainer node actually transfers a certain amount of certificates from the account corresponding to the transaction node to the account corresponding to the target node. Since the payment is the evidence of the transaction initiation chain, the transfer operation is completed in the transaction initiation chain and does not involve a cross-chain operation between the transaction initiation chain and the transaction target chain. Therefore, after the maintainer node determines the respective accounts of the transaction node and the target node indicated by the address information of the transaction initiating chain, the payment of the transaction content between the transaction node and the target node can be completed.
Illustratively, the cross-chain transaction is an information service, the transaction initiation chain A pays 50 certificates a of the transaction initiation chain A to the transaction target chain B, and purchases the weather information provided by the transaction target chain B. The service transaction is that the transaction initiation chain A pays 50 certificates a to the transaction target chain B. The maintainer node a2 in the transaction initiation chain a pays 50 certificates a to the account corresponding to the target node B1 in the transaction initiation chain a according to the first locking request sent by the public chain C by the transaction node a1 in the transaction initiation chain, and locks the 50 certificates a.
S13, the target parallel chain forwards the second locking request sent by the public chain to the transaction target chain.
After the public link creates the cross-link transaction, the transaction target link needs to be notified to complete the return transaction. The initiating parallel chain forwards the first lock request sent by the public chain to the transaction initiating chain in the same manner as in step S11 described above. The public chain sends a second lock request to the transaction target chain through the target parallel chain. The second locking request is used for indicating the transaction target chain to complete the return transaction and locking the transaction content of the return transaction. Thus, transaction information for the return transaction is included in the second lock request.
Further, as shown in fig. 3, the step of forwarding the second lock request sent by the public chain to the transaction target chain by the target parallel chain includes:
s131, the target parallel chain receives the second locking request sent by the public chain.
S132, the target parallel chain detects whether the transaction target chain supports return transaction.
And S133, if the transaction target chain supports the return transaction, the target parallel chain forwards the second locking request to the transaction target chain.
And S134, if the transaction target chain does not support the return transaction, the target parallel chain sends failure information to the public chain.
After the public chain creates the cross-chain transaction, determining a return transaction needing to be completed by a transaction target chain, and generating a second locking request according to the return transaction. To send the second lock request to the transaction target chain, the public chain broadcasts the second lock request in its own node. Since the target parallel chain node is also a node in the public chain, the target parallel chain is able to receive the second lock request.
After receiving the second locking request, the target parallel chain detects whether the transaction target chain supports the return transaction, and further ensures that the cross-chain transaction can be completed. And the target parallel chain detects whether the target node supports the transaction mode and the transaction condition in the transaction information according to the transaction information in the second locking request. If so, determining that the transaction target chain supports the return transaction by the target parallel chain; and if not, the target parallel chain determines that the transaction target chain does not support the return transaction.
Illustratively, the cross-chain transaction is to exchange the certificate a of the transaction initiating chain A for the certificate B of the transaction target chain B, the exchange ratio is 50:1, and 100 certificates a/2 certificates B are required to be exchanged. Then, the transaction mode of the returned transaction is payment permit b, and the transaction condition is that the number of the payment permit b is 2. The target node B1 of the trade target chain B has 5 certificates B, and if the trade condition is satisfied, the target parallel chain BC determines that the trade target chain B supports the return trade.
And if the transaction target chain supports the return transaction, the target parallel chain forwards a second locking request to the transaction target chain. Specifically, the target parallel chain broadcasts a second lock request in the transaction target chain. Accordingly, the transaction target link receives the second lock request.
And if the transaction target chain does not support the return transaction, the target parallel chain sends failure information to the public chain. The failure information is used to inform the public chain of the failure of the cross-chain transaction. Specifically, the target parallel chain broadcasts failure information in the public chain. Correspondingly, the public link receives the failure information, determines that the cross-link transaction fails, and ends the cross-link transaction. Wherein the failure information comprises the transaction information of the returned transaction.
S14, the transaction target chain completes the return transaction and locks the transaction content of the return transaction.
The transaction initiation chain completes the service transaction and locks the transaction content of the service transaction in a similar manner as in step S12 described above. And the transaction target link receives the second locking request and determines the return transaction needing to be completed according to the transaction information in the second locking request. Specifically, the maintainer node in the transaction target chain completes the return transaction and locks the transaction content of the return transaction. And the target parallel chain broadcasts a second locking request in the transaction target chain, and after the maintainer node in the transaction target chain receives the second locking request, the transaction content needing to be paid by the transaction target chain in the cross-chain transaction is paid and the transaction content is locked.
Illustratively, the cross-chain transaction is an information service, the transaction initiation chain A pays 50 certificates a of the transaction initiation chain A to the transaction target chain B, and purchases the weather information provided by the transaction target chain B. The return transaction is that the transaction target chain B provides weather information to the transaction initiation chain a. The maintainer node B2 in the transaction destination chain B sends the weather information provided by the destination node B1 to the corresponding account of the transaction node A1 in the transaction destination chain B according to the second lock request sent by the public chain C, and locks the data of the weather information.
It should be noted that, the steps S11 and S12 may be executed before the steps S13 and S14, may be executed after the steps S13 and S14, and may be executed simultaneously with the steps S13 and S14, which is not limited in the embodiment of the present application.
And S15, when the public chain determines that the service transaction and the return transaction are both completed, indicating the transaction initiation chain to unlock the transaction content of the service transaction and indicating the transaction target chain to unlock the transaction content of the return transaction.
Only when the service transaction and the return transaction are completed, the transaction initiation chain and the transaction target chain can unlock corresponding transaction contents, and the anti-repudiation transaction effect is achieved. However, the transaction initiating chain and the transaction target chain cannot directly communicate with each other to determine the transaction condition of the other party, and the public chain needs to confirm the transaction conditions of both parties and instruct unlocking. The public chain is respectively connected with the transaction initiating chain and the transaction target chain through the initiating parallel chain and the target parallel chain. When the service transaction and the return transaction are determined to be completed, the public chain can respectively instruct the transaction initiation chain and the transaction target chain to unlock respective transaction contents through the initiation parallel chain and the target parallel chain, and the cross-chain transaction is completed. Specifically, for the transaction initiation chain, the public chain broadcasts a first unlocking instruction, and then the initiation parallel chain receives the first unlocking instruction and broadcasts in the transaction initiation chain. And when the maintainer node in the transaction initiation chain receives the first unlocking instruction, unlocking the transaction content of the service transaction. And for the transaction target chain, the public chain broadcasts a second unlocking instruction, and the target parallel chain receives the second unlocking instruction and broadcasts in the transaction target chain. And when the maintainer node in the transaction target chain receives the second unlocking instruction, unlocking the transaction content returned to the transaction. When the transaction content of both the service transaction and the return transaction are unlocked, the cross-chain transaction is completed.
In one possible implementation, after the transaction initiation chain completes the service transaction, a service completion response is sent to the initiation parallel chain. And initiating the parallel chain to forward a service completion response to the public chain, and determining that the service transaction is completed by the public chain. In the same way, after the transaction target chain finishes the return transaction, the transaction target chain sends a return completion response to the target parallel chain. And the target parallel chain forwards a return completion response to the public chain, and the public chain determines that the return transaction is completed. And after the public link receives the service completion response and the return completion response, determining that the service transaction and the return transaction are completed.
In the scheme provided by the embodiment of the application, a uniform and effective communication channel is formed between the transaction initiation chain and the transaction target chain through the public chain, the initiation parallel chain and the target parallel chain. By utilizing the communication channel, when the transaction initiation chain and the transaction target chain carry out cross-chain transaction, whether the opposite side finishes the content appointed in the cross-chain transaction can be determined; moreover, the transaction content of the service transaction and the transaction content of the return transaction are respectively locked by the transaction initiating chain and the transaction target chain, and the respective transaction content is unlocked when the opposite side is determined to finish the transaction, so that the loss caused by incomplete transaction of the opposite side is avoided, the anti-repudiation transaction effect is achieved, and the cross-chain transaction can be safely finished.
In the above embodiments, both the transaction initiation chain and the transaction target chain support locking of transaction content. However, in practical applications, there are blockchain networks that do not support locking transactional content. For the case that the transaction initiation chain and/or the transaction target chain is a blockchain network which does not support locking of transaction contents, the application also provides a cross-chain transaction method for resisting repudiation.
Referring to fig. 4, a flow diagram of a repudiation resistant cross-chain transaction method of the present application is exemplarily shown. The method comprises the following steps.
And S40, the public chain completes the first transfer transaction and locks the public chain certificate in the first transfer transaction.
In the embodiment of the present application, the method for creating a cross-chain transaction by a public chain is the same as the method for creating a cross-chain transaction by a public chain in the embodiment of fig. 2. The embodiments of the present application are not described herein again.
After the cross-chain transaction is established, the public chain detects whether a transaction node in a transaction initiation chain and a target node in a transaction target chain have a sufficient number of public chain certifications in a corresponding account in the public chain. A sufficient number of communal certificates means that the value of the communal certificates is greater than the value of the transaction content serving the transaction or returning the transaction. If yes, the public link continues to carry out cross-link transaction; if not, the public link determines that the cross-link transaction fails, and the cross-link transaction is ended.
Illustratively, a cross-chain transaction is a transaction initiation chain a that is redeemed for a voucher B of a transaction target chain B with 50 vouchers a of the transaction initiation chain a. The exchange ratio was 50: 1. The exchange ratio of the certificate card C and the certificate card A of the public chain C is 1: 25. the exchange ratio of the witness B to the witness c is 2: 1. then, the public chain C detects whether the transaction node a1 has no less than 2 certificates C for the corresponding account in the public chain C, and whether the target node B1 has no less than 2 certificates C for the corresponding account in the public chain C.
After detecting and determining that a cross-chain transaction is enabled, the public chain initiates and completes a first tie-back transaction. The first reconciled transaction is a public chain certificate for the transaction target chain paying the transaction initiation chain for a public chain equivalent to the service transaction. Specifically, the maintainer node in the public chain transfers the public chain certificate equivalent to the service transaction from the corresponding account of the target node in the public chain to the corresponding account of the transaction node in the public chain. And after the public link finishes the first transfer transaction, locking the public link certificate in the first transfer transaction.
Illustratively, a cross-chain transaction is a transaction initiation chain a that is redeemed for a voucher B of a transaction target chain B with 50 vouchers a of the transaction initiation chain a. The exchange ratio was 50: 1. The exchange ratio of the certificate card C and the certificate card a of the public chain C is 1: 25. then, after creating the cross-chain transaction, the maintainer node in the public chain C transfers the 2 passes C, the corresponding account in the public chain C by the target node B1, to the corresponding account in the public chain C by the transaction node A1, and locks the 2 passes C.
And S41, the initiating parallel chain receives the service transaction request sent by the public chain, and initiates the service transaction according to the service transaction request.
And after the public chain finishes the first transfer transaction, sending a service transaction request to the initiated parallel chain to request the initiated parallel chain to initiate the service transaction. Thus, the transaction information of the service transaction is included in the service transaction request. And initiating the service transaction to the transaction initiation chain by the initiation parallel chain according to the service transaction request. Specifically, the public link broadcasts a service transaction request in its own node. Accordingly, the service transaction request is received by the initiating parallel link. And initiating the service transaction according to the transaction information of the service transaction by the initiating parallel chain, namely broadcasting the service transaction in the transaction initiating chain.
S42, the transaction initiation chain completes the service transaction.
The transaction initiation link receives the service transaction initiated by the initiated parallel link and completes the service transaction. Specifically, a maintainer node in a transaction initiation chain receives service transactions which are broadcast in the transaction initiation chain by initiating a parallel chain, pays transaction contents which need to be paid by the transaction initiation chain in cross-chain transactions, completes the service transactions, and records the service transactions in a generated block.
And S43, when the parallel chain is initiated to determine that the service transaction is completed, indicating the public chain to unlock the public chain certificate in the first transfer transaction.
After the service transaction is completed, the transaction initiation chain records the completed service transaction in the generated block, and adds the block to the block chain. Because the initiating parallel chain node is also a node in the transaction initiating chain, when the transaction initiating chain synchronizes the block chain, the initiating parallel chain can also acquire the block chain recorded with the service transaction and synchronize to the block chain of the self parallel chain. Initiating a parallel chain to detect whether a service transaction is recorded in a block chain of the parallel chain; if the service transaction record is detected to be in the block chain of the service transaction record, determining that the service transaction is completed; and if the service transaction record is not detected in the blockchain of the service transaction record, determining that the service transaction is not completed.
The initiating parallel chain may send a third unlock instruction to the public chain to instruct the public chain to unlock the public chain voucher in the first reconveying transaction. Specifically, a parallel chain is initiated to broadcast a third unlocking instruction in the public chain, and accordingly, a maintainer node in the public chain receives the third unlocking instruction, determines that the service transaction is completed, and further unlocks the public chain permit in the first transfer transaction.
And S44, completing the second transfer transaction by the public chain, and locking the public chain certificate in the second transfer transaction.
Upon detecting and determining that a cross-chain transaction is enabled, the public chain initiates and completes a second transfer transaction. And the second transfer transaction is a public chain certificate which is equivalent to the returned transaction and is paid from the transaction initiating chain to the transaction target chain. Specifically, the maintainer node in the public chain transfers the public chain certificate equivalent to the returned transaction from the corresponding account of the transaction node in the public chain to the corresponding account of the target node in the public chain. And after the public chain finishes the second transfer transaction, locking the public chain certificate in the second transfer transaction.
Illustratively, a cross-chain transaction is a transaction initiation chain a that is redeemed for a voucher B of a transaction target chain B with 50 vouchers a of the transaction initiation chain a. The exchange ratio was 50: 1. The exchange ratio of the certificate card C to the certificate card b of the public chain C is 2: 1. then, after creating the cross-chain transaction, the maintainer node in the public chain C transfers the 2 certificates C, the corresponding account in the public chain C by the transaction node a1, to the corresponding account in the public chain C by the destination node B1, and locks the 2 certificates C.
And S45, the target parallel chain receives the return transaction request sent by the public chain and initiates the return transaction according to the service transaction request.
And after the public chain finishes the second transfer transaction, sending a return transaction request to the target parallel chain to request the target parallel chain to initiate a return transaction. Thus, the return transaction request includes transaction information for the return transaction. And the target parallel chain initiates a return transaction to the transaction target chain according to the return transaction request. Specifically, the public link broadcasts a return transaction request in its own node. Accordingly, the target parallel link receives a return transaction request. And the target parallel chain initiates a return transaction according to the transaction information of the return transaction, namely, the return transaction is broadcast in the transaction target chain.
S46, the transaction target chain completes the return transaction.
The transaction target link receives the return transaction initiated by the target parallel link and completes the return transaction. Specifically, the maintainer node in the transaction target chain receives a return transaction broadcasted by the target parallel chain in the transaction target chain, pays the transaction content to be paid by the transaction target chain in the cross-chain transaction, completes the return transaction, and records the return transaction in the generated block.
S47, when the target parallel chain determines that the return transaction is complete, instructing the pin to unlock the pin permit in the second transfer transaction.
After the return transaction is completed, the transaction target chain records the completed return transaction in the generated block and adds the block to the block chain. Because the target parallel chain node is also a node in the transaction target chain, when the transaction target chain synchronizes the block chain, the target parallel chain can also acquire the block chain recorded with the return transaction and synchronize to the block chain of the parallel chain of the target parallel chain. Detecting whether the returned transaction is recorded in the block chain of the target parallel chain; if the returned transaction record is detected to be in the block chain of the returned transaction record, determining that the returned transaction is completed; and if the return transaction record is not detected in the blockchain of the return transaction record, determining that the return transaction is not completed.
The target parallel chain may send a fourth unlock instruction to the public chain to instruct the public chain to unlock the public chain collateral certificate in the second transfer transaction. Specifically, the target parallel chain broadcasts a fourth unlocking instruction in the public chain, and accordingly, the maintainer node in the public chain receives the fourth unlocking instruction, determines that the return transaction is completed, and further unlocks the public chain certificate in the second transfer transaction.
It should be noted that, the steps S40 to S43 may be executed before the steps S40 to S43, may be executed after the steps S40 to S43, and may be executed simultaneously with the steps S40 to S43, which is not limited in the embodiment of the present application.
And the public chain certificate in the first transfer transaction and the second transfer transaction is unlocked by the public chain, so that the cross-chain transaction between the transaction target chain and the transaction initiating chain is completed.
In the embodiment of the application, the public chain completes the first transfer transaction and locks the public chain certificate in the transaction. The unlocking condition of the public link certificate is that the service transaction is completed. The public chain thus ensures that the transaction initiation chain can obtain a proof equivalent to the service transaction when the service transaction is completed. Even if the transaction target chain does not complete the return transaction, there is no loss of the transaction initiation chain. Similarly, corresponding to the transaction target chain, the public chain completes the second transfer transaction, locks the public chain certificate in the transaction, and unlocks after the service transaction is completed, so that the transaction target chain can obtain the certificate equivalent to the returned transaction under the condition that the returned transaction is completed. Therefore, the transaction initiation chain and the transaction target chain can avoid the loss caused by incomplete transaction of the other party, and achieve the anti-repudiation transaction effect, thereby ensuring that the cross-chain transaction can be completed safely.
The present application also provides a blockchain system, which can be used to implement the cross-chain transaction method in the above method example. The block chain system comprises: a transaction initiating chain, an initiating parallel chain, a transaction target chain, a target parallel chain and a public chain; the initiating parallel chain is composed of common nodes of the transaction initiating chain and the public chain, and the target parallel chain is composed of common nodes of the target initiating chain and the public chain;
the public chain is used for creating a cross-chain transaction, and the cross-chain transaction comprises the following steps: the service transaction needing to be completed by the transaction initiating chain and the return transaction needing to be completed by the transaction target chain;
the initiating parallel chain is used for forwarding a first locking request sent by the public chain to the transaction initiating chain, wherein the first locking request comprises transaction information of the service transaction;
the transaction initiating chain is used for completing the service transaction according to the first locking request and locking the transaction content of the service transaction;
the target parallel chain is used for forwarding a second locking request sent by the public chain to the transaction target chain, wherein the second locking request comprises the transaction information of the returned transaction;
the transaction target chain is used for completing the return transaction according to the second locking request and locking the transaction content of the return transaction;
the public chain is further used for indicating the transaction initiation chain to unlock the transaction content of the service transaction and indicating the transaction target chain to unlock the transaction content of the return transaction when the service transaction and the return transaction are determined to be completed.
In the block chain system provided by the application, a uniform and effective communication channel is formed between the transaction initiating chain and the transaction target chain through the public chain, the initiating parallel chain and the target parallel chain. By utilizing the communication channel, when the transaction initiation chain and the transaction target chain carry out cross-chain transaction, whether the opposite side finishes the content appointed in the cross-chain transaction can be determined; moreover, the transaction content of the service transaction and the transaction content of the return transaction are respectively locked by the transaction initiating chain and the transaction target chain, and the respective transaction content is unlocked when the opposite side is determined to finish the transaction, so that the loss caused by incomplete transaction of the opposite side is avoided, the anti-repudiation transaction effect is achieved, and the cross-chain transaction can be safely finished.
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. Further, in the description of the present application, "a plurality" means two or more than two unless otherwise specified. In addition, in order to facilitate clear description of technical solutions of the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items having substantially the same functions and actions. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
The above-described embodiments of the present application do not limit the scope of the present application.