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 parallel chain-based cross-chain transaction method, a parallel chain-based cross-chain transaction device and a blockchain system, which can be used for solving the problem that in the prior art, cross-chain transactions can not be performed between different blockchain networks, so that the transactions based on blockchains are limited to the interior of a single blockchain network.
In a first aspect, the present application provides a parallel chain-based cross-chain transaction method, including:
determining a cross-chain transaction to be completed between a transaction initiation chain and a transaction target chain;
according to the cross-chain transaction, instructing a transaction target chain to pay transaction content required by the transaction initiation chain in the cross-chain transaction;
and when the transaction target chain is detected to complete payment, instructing a transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction.
Optionally, the instructing the transaction target chain to pay the transaction content of the transaction initiation chain requirement in the cross-chain transaction includes:
calling an execution intelligent contract of the transaction target chain to generate a first transaction instruction, wherein the first transaction instruction is used for informing the transaction target chain to pay the transaction content required by the transaction initiation chain in the cross-chain transaction;
and sending the first transaction instruction to the transaction target chain so that the transaction target chain verifies the first transaction instruction and pays for the transaction content required by the transaction initiation chain.
Optionally, the instructing the transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction includes:
calling an execution intelligent contract of the transaction initiation chain to generate a second transaction instruction, wherein the second transaction instruction is used for informing the transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction;
and sending the second transaction instruction to the transaction target chain so that the transaction initiation chain verifies the second transaction instruction and pays for the transaction content required by the transaction target chain.
Optionally, the determining a cross-chain transaction to be completed between the transaction initiation chain and the transaction target chain includes:
acquiring a cross-chain transaction initiated by the transaction initiation chain;
detecting whether the cross-chain transaction is recorded in a parallel chain blockchain;
and if the parallel chain block chain is detected not to record the cross-chain transaction, determining the cross-chain transaction as the cross-chain transaction to be completed.
Optionally, the method further comprises:
acquiring a block chain of the transaction initiating chain or the transaction target chain;
and updating the parallel chain block chain according to the block chain of the transaction initiating chain or the transaction target chain.
Optionally, the updating the parallel chain block chain includes:
generating summary information according to the blockchain of the transaction initiating chain or the transaction target chain, wherein the summary information is used for indicating the transaction recorded in the blockchain of the transaction initiating chain or the transaction target chain;
generating a block comprising the summary information, and adding the block to the parallel chain block chain.
In a second aspect, the present application provides a parallel chain-based blockchain inter-chain transaction apparatus, which is deployed in a parallel chain node, including:
the transaction determining module is used for determining the cross-chain transaction to be completed between the transaction initiating chain and the transaction target chain;
the transaction instruction module is used for instructing a transaction target chain to pay the transaction content required by the transaction initiation chain in the cross-chain transaction according to the cross-chain transaction; and when the transaction target chain is detected to complete payment, instructing a transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction.
In a third aspect, the present application provides a parallel chain-based blockchain system, the blockchain system comprising: the system comprises a transaction initiating chain, a parallel chain and a transaction target chain, wherein the parallel chain consists of common nodes of the transaction initiating chain and the transaction target chain;
the parallel chain is used for determining a cross-chain transaction to be completed between the transaction initiating chain and the transaction target chain; according to the cross-chain transaction, instructing a transaction target chain to pay transaction content required by the transaction initiation chain in the cross-chain transaction; when the transaction target chain is detected to be paid completely, a transaction initiating chain is instructed to pay the transaction content required by the transaction target chain in the cross-chain transaction;
the transaction target chain is used for paying the transaction content required by the transaction initiation chain in the cross-chain transaction according to the indication of the parallel chain;
and the transaction initiating chain is used for paying the transaction content required by the transaction target chain in the cross-chain transaction according to the indication of the parallel chain.
In the scheme provided by the application, the parallel chain pays the transaction contents which need to be paid respectively according to the cross-chain transaction instruction transaction initiating chain and the transaction target chain, and then the cross-chain transaction is completed. Because the parallel chain node is a common node of the transaction initiation chain and the transaction target chain, the parallel chain can participate in the transaction of the transaction initiation chain and the transaction of the transaction target chain. The parallel chain utilizes the characteristic, and is regulated and controlled in the middle in the transaction process to connect the transaction initiating chain and the transaction target chain, so that the difference between two parties is overcome, the cross-chain transaction between different chains is realized, and the transaction of the block chain is not limited in a single block chain network.
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 scheme provided by the application, the blockchain network refers to a point-to-point network formed by blockchain nodes, and the blockchain network can perform distributed storage, public consensus, digital encryption, transaction accounting and verification. The data information in the blockchain or blockchain blocks is the transaction information of the nodes of the blockchain according to the transaction record when the transaction occurs in the blockchain network. One block comprises transaction information of 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 the present application, the transaction initiation chain, the transaction target chain and the parallel chain refer to different blockchain networks conforming to the blockchain technology. 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. 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 by a parallel chain.
In the present application, a parallel chain consists of nodes common to a transaction initiation chain and a transaction target chain. Because the parallel chain node is a common node of the transaction initiating chain and the transaction target chain, the parallel chain has the functions of the transaction initiating chain and the transaction target chain at the same time, and the blockchain of both parties is 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 the transaction initiation chain and the transaction target chain.
Illustratively, as shown in FIG. 1, a schematic diagram of a network architecture between a transaction initiation chain, a transaction target chain, and parallel chains is shown. The parallel link node 101, which is a common node of the transaction initiation link 11 and the transaction destination link 12, can be connected to and communicate with both the transaction initiation link node 111 and the transaction destination link node 121.
Referring to fig. 2, a flow chart of a parallel chain based cross-chain transaction method according to the present application is exemplarily shown. The method comprises the following steps.
And S20, determining the cross-chain transaction to be completed between the transaction initiation chain and the transaction target chain.
In the scheme provided by the application, cross-chain transactions between a transaction initiation chain and a transaction target chain need to be completed through a parallel chain. Thus, the cross-chain transaction to be completed between the transaction initiation chain and the transaction target chain is determined by the parallel chain. The to-be-completed cross-chain transaction refers to a cross-chain transaction which is already sent to the parallel chain but is not completed, and includes transaction related information, such as address information of both transaction parties, transaction conditions, transaction contents which both transaction parties need to pay, and the like. One transaction means that two transaction parties respectively pay the transaction content required by the other party according to the transaction conditions. Thus, a single cross-chain transaction actually includes two sub-transactions. One sub-transaction is the transaction content of the transaction initiation chain paying the transaction target chain requirement to the transaction target chain. The other sub-transaction is the transaction content of the transaction target chain paying the transaction initiation chain requirements to the transaction initiation chain. Therefore, to complete one cross-chain transaction, two sub-transactions in the cross-chain transaction need to be completed.
Illustratively, the cross-chain transaction between transaction initiation chain a and transaction target chain B is: the voucher a of the 50 transaction initiating chain A is exchanged for the voucher B of the 5 transaction target chain B. Then, the two sub-transactions actually included in the cross-chain transaction are: the transaction initiation chain pays 50 passes a to the transaction target chain and the transaction target chain pays 5 passes b to the transaction initiation chain.
Further, as shown in fig. 3, in the above step S20, the parallel chain determines the cross-chain transaction to be completed between the transaction initiation chain and the transaction target chain, and includes the following sub-steps.
S201, acquiring cross-chain transaction initiated by a transaction initiation chain.
S202, detecting whether the cross-chain transaction is recorded in the parallel chain block chain.
S203, if the parallel chain block chain is detected to have no record of cross-chain transaction, determining the cross-chain transaction as the cross-chain transaction to be completed.
To determine the cross-chain transaction to be completed, the parallel chain needs to acquire the cross-chain transaction first. In a blockchain network, the node that initiates a transaction is referred to as a transaction node. The transaction node in the transaction initiation chain initiates a cross-chain transaction and broadcasts the cross-chain transaction in the transaction initiation chain. Correspondingly, the parallel chain link point receives the cross-chain transaction, and the parallel chain acquires the cross-chain transaction initiated by the transaction initiation chain.
In the embodiment of the present application, since the cross-chain transaction initiated by the transaction initiation chain actually includes two sub-transactions, a parallel chain is required to instruct the transaction initiation chain and the transaction target chain to complete the two sub-transactions. Thus, the manner in which a transaction initiates a chain-initiated cross-chain transaction includes two types.
First, a transaction initiation chain initiates a transaction request to initiate a cross-chain transaction. The transaction request only includes information related to the cross-chain transaction, such as transaction conditions, address information of both transaction parties and the like. The transaction node sends the transaction request to the parallel chain. Accordingly, the parallel chain determines the corresponding cross-chain transaction according to the information in the transaction request.
Second, the transaction initiation chain initiates a trigger transaction to initiate a cross-chain transaction. The trigger transaction is a special transaction, which has the same transaction form as the common transaction form in the transaction initiation chain, but requires a special agreement on a specific transaction form, for example, a transaction with an agreed amount of evidence for transfer of 0. The transaction initiation chain initiates the trigger transaction, and the transaction object is a cross-chain transaction intelligent contract. And the node completing the triggered transaction generates a transaction result by triggering the cross-chain transaction intelligent contract. The transaction results include information related to the cross-chain transaction. And the transaction initiating chain node generates a block containing the transaction result, adds the block into the block chain, and broadcasts the block. Correspondingly, after the parallel chain obtains the transaction result in the block, determining the cross-chain transaction initiated by the transaction initiation chain.
Illustratively, the transaction initiation chain initiates a trigger transaction, which is the payment of 1 permit to the cross-chain transaction intelligent contract; and, the trigger transaction includes information related to the cross-chain transaction. And the node which completes the trigger transaction executes the cross-chain transaction intelligent contract, generates a block containing the transaction result, adds the block into the block chain, and broadcasts the block chain. Accordingly, due to the trigger transaction completed by the node, 1 voucher paid to the cross-chain transaction intelligent contract in the trigger transaction is acquired as the reward voucher.
The block chain stored in the parallel chain comprises a block chain of a transaction initiating chain and a block chain of a transaction target chain, and the block chains of the transaction initiating chain and the transaction target chain record respective completed transactions. Thus, the parallel chain may detect whether a cross-chain transaction is recorded in a parallel chain blockchain to determine whether the cross-chain transaction is complete; if the cross-chain transaction record is in the parallel chain block chain, determining that the cross-chain transaction is completed; and if the cross-chain transaction is not recorded in the parallel chain block chain, determining that the cross-chain transaction is to be completed. The cross-chain transaction is recorded in the parallel chain block chain, which means that two sub-transactions in the cross-chain transaction are recorded in the parallel chain block chain.
Illustratively, the cross-chain transaction between transaction initiation chain a and transaction target chain B is: the voucher a of the 50 transaction initiating chain A is exchanged for the voucher B of the 5 transaction target chain B. Then, the parallel chain detects in the parallel chain block chain whether 50 passes a paid by the transaction initiation chain a to the transaction target chain B are recorded, and whether 5 passes B paid by the transaction target chain B to the transaction initiation chain a are recorded.
In another embodiment, the parallel chain may determine the cross-chain transaction to be completed by invoking a query intelligence contract. Because the cross-chain transaction comprises two sub-transactions, the parallel chain can respectively inquire the two sub-transactions through respective inquiry intelligent contracts of the transaction initiation chain and the transaction target chain. For the sub-transactions needing to be completed by the transaction initiation chain, the parallel chain calls an intelligent query contract in the transaction initiation chain to query whether the sub-transactions are completed; and for the sub-transactions needing to be completed by the transaction target chain, the parallel chain calls the query intelligent contract in the transaction target chain to query whether the sub-transactions are completed or not.
In one possible implementation, the transaction node initiates a query transaction before initiating the cross-link transaction. The inquiry transaction comprises transaction content required by the transaction initiation chain and transaction content which can be paid by the transaction initiation chain. The parallel chain determines whether the transaction target chain can complete a transaction with the transaction initiation chain according to the query transaction. If a target node capable of achieving transaction with the transaction node exists in the transaction target chain, the parallel chain sends related information of the target node to the transaction node, such as address information of the target node, transaction conditions and the like. And the transaction node initiates cross-chain transaction according to the related information of the target node.
Illustratively, trading node a1 wishes to exchange 50 trades for the witness a of the origination chain a, in exchange for 5 trades for the witness B of the destination chain B. Thus, transaction node A1 initiates a query transaction. The parallel chain determines from the query transaction that transaction node a1 requires 5 passes a and is able to pay 50 passes b. The parallel chain queries the transaction target chain B for whether there is a target node B1 that can reach a transaction with the transaction node A1 based on the content of the query transaction. One node in the transaction object chain B needs 50 passes a and is willing to pay a maximum of 7 passes B. Then the parallel chain takes that node as the target node and sends the target node's relevant information to trading node a 1. The transaction node A1 initiates a cross-chain transaction based on the relevant information of the target node B1.
In another possible implementation, the transaction node directly initiates the cross-chain transaction. The transaction content required by the transaction initiation chain and the transaction content which can be paid by the transaction initiation chain are also included in the cross-chain transaction, but the target node which is the transaction object is not indicated. The parallel chain determines whether the transaction target chain can complete a transaction with the transaction initiation chain according to the cross-chain transaction. If a target node capable of achieving transaction with the transaction node exists in the transaction target chain, directly executing subsequent cross-chain transaction by the parallel chain; if no target node capable of achieving the transaction with the transaction node exists in the transaction target chain, the parallel chain informs the transaction node of transaction failure.
And S21, the transaction target chain is instructed to pay the transaction content required by the transaction initiation chain in the cross-chain transaction.
After the parallel chain determines the cross-chain transaction to be completed, according to the cross-chain transaction to be completed, a transaction target chain is indicated to pay transaction content required by a transaction initiation chain in the cross-chain transaction. Specifically, since the parallel chain node is also a node in the transaction target chain, the parallel chain has a complete function of the transaction target chain, and the execution intelligent contract of the transaction target chain can be directly invoked to instruct the transaction target chain to pay the transaction content required by the transaction initiation chain in the cross-chain transaction. The parallel chain calls an execution intelligent contract of the transaction target chain, and the maintainer node in the transaction target chain completes corresponding sub-transactions, namely, the transaction content required by the transaction initiation chain in the cross-chain transaction is paid. The maintainer node is a node in charge of maintaining the blockchain in the blockchain network and has the accounting right. The maintainer node in the transaction destination chain records the sub-transaction in the generated block after completing the corresponding sub-transaction. The transaction target chain is synchronized with the parallel chain blocks, i.e. the parallel chain synchronizes the block chain of the transaction target chain.
Further, as shown in fig. 4, in the step S21, the parallel chain indicates the transaction target chain to pay the transaction content required by the transaction initiation chain in the cross-chain transaction, and includes the following sub-steps.
S211, the parallel chain calls an execution intelligent contract of the transaction target chain to generate a first transaction instruction.
S212, the parallel chain sends the first trading instruction to the trading target chain.
And S213, the transaction target chain pays the transaction content required by the transaction initiation chain in the cross-chain transaction.
The parallel chain calls an execution intelligent contract of the transaction target chain to generate a first transaction instruction. Since the first transaction instruction is used for notifying the transaction target chain of the transaction content required by the transaction initiation chain in the cross-chain transaction, the first transaction instruction includes payment-related information, such as address information and transaction content specifically requiring payment. The parallel chain sends the first transaction instruction to the transaction target chain, namely the first transaction instruction is broadcasted in the transaction target chain. And when the maintainer node in the transaction initiating chain receives the first transaction instruction, verifying the first transaction instruction, paying the transaction content required by the transaction initiating chain in the cross-chain transaction, and recording in the generated block. And the block generated by the broadcast of the transaction initiating chain reaches consensus in the nodes of the transaction initiating chain and confirms that the payment is completed.
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, when the transaction initiation chain pays a certain amount of certificates of the transaction initiation chain to the transaction target chain, the maintainer node actually transfers the certain amount of certificates to the account corresponding to the transaction 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 address information, the transaction condition and other information of the respective accounts of the transaction node and the target node, 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. And indicating the transaction content paid by the transaction target chain B as specific weather information in the parallel chain. The maintainer node B2 in the transaction destination chain B sends specific weather information to the account corresponding to the transaction node A1 in the transaction initiation chain A according to the address information of the transaction node A1.
It should be noted that, in the to-be-completed cross-chain transaction, a situation may occur that the transaction target chain has paid the corresponding transaction content, but the transaction initiation chain has not paid. For such a to-be-completed cross-chain transaction, the parallel chain no longer performs step S21, but directly performs step S22.
And S22, when the transaction target chain is detected to complete payment, the transaction initiating chain is indicated to pay the transaction content required by the transaction target chain in the cross-chain transaction.
The parallel chain needs to detect whether the transaction target chain completes payment after indicating the transaction target chain to pay the transaction content required by the transaction initiation chain. The parallel chain can indicate the transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction only when the transaction target chain completes payment. Because the maintainer node in the transaction target chain records the paid transaction content in the generated block and broadcasts the block chain in the transaction target chain, the parallel chain can detect whether the transaction target chain completes payment according to the synchronous transaction target chain block chain in the parallel chain block chain.
In another embodiment of the application, the parallel chain may detect whether the transaction target chain completes payment by invoking a query intelligent contract of the transaction target chain. Because of the way of detecting whether the transaction target chain completes payment according to the parallel chain block chain, the parallel chain needs to synchronize the block chain of the transaction target chain first. When the transaction target chain has paid the transaction content, but the parallel chain has not synchronized the blockchain of the transaction target chain, the parallel chain cannot know that the transaction target chain has completed payment. But the parallel chain can be inquired by calling an inquiry intelligent contract, the payment of the transaction target chain can be determined more quickly, and the efficiency of cross-chain transaction is improved.
Similar to the way that the parallel chain indicates the transaction target chain to pay the transaction content, since the parallel chain node is also a node in the transaction initiation chain, the parallel chain has the complete function of the transaction initiation chain, and the execution intelligent contract of the transaction initiation chain can be directly called to indicate the transaction content required by the transaction initiation chain in the transaction initiation chain payment cross-chain transaction. Specifically, the parallel chain invokes an execution intelligent contract of the transaction initiation chain, and the maintainer node in the transaction initiation chain completes the corresponding sub-transaction, namely, the transaction content required by the payment transaction target chain. After the maintainer node in the transaction initiation chain completes the corresponding sub-transaction, the maintainer node records in the generated block. The transaction initiation chain is synchronized with the parallel chain blocks, i.e., the parallel chain synchronizes the blockchains of the transaction initiation chain.
After the transaction initiation chain completes payment, the parallel chain can determine that the transaction initiation chain completes payment by detecting the parallel chain block chain or calling an intelligent inquiry contract of the transaction initiation chain, and further determine that the cross-chain transaction is completed.
Further, as shown in fig. 5, in the above step S22, the parallel chain indicates the transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction, and includes the following sub-steps.
And S221, the parallel chain calls an execution intelligent contract of the transaction initiating chain to generate a second transaction instruction.
S222, the parallel chain sends the second transaction instruction to the transaction initiation chain.
And S223, the transaction initiation chain pays the transaction content required by the transaction target chain in the cross-chain transaction.
And the parallel chain calls an execution intelligent contract of the transaction initiating chain to generate a second transaction instruction. Since the second transaction instruction is used for informing the transaction initiation chain of the transaction content required by the payment transaction destination chain, the second transaction instruction includes the payment-related transaction information, such as address information, and the transaction content specifically requiring payment. The parallel chain sends the second transaction instruction to the transaction target chain, namely the second transaction instruction is broadcasted in the transaction target chain. And after the maintainer node in the transaction initiating chain receives the second transaction instruction, verifying the second transaction instruction, paying the transaction content required by the transaction initiating chain, and recording the transaction in the generated block. And the block generated by the broadcast of the transaction target chain reaches consensus in the nodes of the transaction target chain and confirms that the payment is 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 transaction content paid by the transaction initiation chain a is indicated to be 50 certificates a in the parallel chain. The maintainer node in the transaction initiating chain a pays 50 witnesses a to the target node B1 in the transaction target chain B based on the address information in the second transaction instruction.
In one possible implementation, the transaction object chain locks the transaction content when the transaction content required by the transaction initiation chain is paid for. And after the parallel chain determines that the transaction initiating chain finishes payment, the parallel chain sends the information that the transaction initiating chain finishes payment to the transaction target chain. And after the transaction target chain determines that the transaction initiating chain pays the transaction contents required by the transaction target chain, unlocking the transaction contents paid by the transaction target chain. By locking the transaction content, the loss of the transaction initiation chain due to the fact that the transaction initiation chain does not pay the corresponding transaction content is prevented, and the effect of resisting repudiation is achieved.
In the embodiment of the application, the parallel chain indicates the transaction initiating chain and the transaction target chain to pay the transaction contents which need to be paid respectively according to the cross-chain transaction, and then the cross-chain transaction is completed. Because the parallel chain node is a common node of the transaction initiation chain and the transaction target chain, the parallel chain can participate in the transaction of the transaction initiation chain and the transaction of the transaction target chain. The parallel chain utilizes the characteristic, and is regulated and controlled in the middle in the transaction process to connect the transaction initiating chain and the transaction target chain, so that the difference between two parties is overcome, the cross-chain transaction between different chains is realized, and the transaction of the block chain is not limited in a single block chain network.
In the technical scheme provided by the application, in the process of cross-chain transaction of the parallel chain, the blockchains of the transaction initiating chain and the transaction target chain are synchronized to update the blockchains of the parallel chain. Because the parallel chain node is a common node of the transaction initiating chain and the transaction target chain, the parallel chain can directly acquire the block chain of the transaction initiating chain or the transaction target chain and update the block chain of the parallel chain. Specifically, in the technical solution provided by the present application, there are two updating methods for the parallel chain block chain.
In one possible implementation, for a blockchain network connected by parallel chains, the parallel chains synchronously update the parallel-chain blockchains using the same consensus mechanism as for the blockchain network. Parallel chain nodes serve as nodes in the blockchain network, and blockchains are synchronized in the same way as other nodes. The parallel chain blockchains are the same as the blockchains of the blockchain network.
In another possible implementation manner, for a blockchain network connected by parallel chains, only summary information of transactions in the blockchain network is recorded in the parallel chain blockchain. Specifically, after the blockchain of the transaction initiating chain or the transaction target chain is obtained, the parallel chain generates summary information according to the blockchain of the transaction initiating chain or the transaction target chain. The summary information is used to indicate the transactions recorded in the blockchain of the corresponding blockchain network. And the parallel chain regenerates a block comprising the summary information, and adds the block to the parallel chain block chain to realize the updating of the parallel chain block chain. By recording the summary information, the data quantity required to be stored by the parallel chain is reduced, and the occupation of the storage space on the parallel chain is reduced.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
FIG. 6 is a block diagram illustrating a parallel chain based cross-chain transaction apparatus in accordance with an exemplary embodiment. The device can be deployed at a parallel chain node, and has the functions of implementing the method examples, and the functions can be implemented by hardware, and can also be implemented by hardware executing corresponding software. The apparatus may include: a transaction determination module 601 and a transaction indication module 602.
The transaction determining module 601 is configured to determine a cross-chain transaction to be completed between a transaction initiation chain and a transaction target chain.
A transaction instruction module 602, configured to instruct, according to the cross-chain transaction, a transaction target chain to pay for transaction content required by the transaction initiation chain in the cross-chain transaction; and when the transaction target chain is detected to complete payment, instructing a transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction.
In the device provided by the embodiment of the application, the parallel chain pays the transaction contents which need to be paid respectively according to the cross-chain transaction instruction transaction initiating chain and the transaction target chain, and then the cross-chain transaction is completed. Because the parallel chain node is a common node of the transaction initiation chain and the transaction target chain, the parallel chain can participate in the transaction of the transaction initiation chain and the transaction of the transaction target chain. The parallel chain utilizes the characteristic, and is regulated and controlled in the middle in the transaction process to connect the transaction initiating chain and the transaction target chain, so that the difference between two parties is overcome, the cross-chain transaction between different chains is realized, and the transaction of the block chain is not limited in a single block chain network.
Optionally, the transaction indication module 602 is specifically configured to: calling an execution intelligent contract of the transaction target chain to generate a first transaction instruction, wherein the first transaction instruction is used for informing the transaction target chain to pay the transaction content required by the transaction initiation chain in the cross-chain transaction; and sending the first transaction instruction to the transaction target chain so that the transaction target chain verifies the first transaction instruction and pays for the transaction content required by the transaction initiation chain.
Optionally, the transaction indication module 602 is specifically configured to: calling an execution intelligent contract of the transaction initiation chain to generate a second transaction instruction, wherein the second transaction instruction is used for informing the transaction initiation chain to pay the transaction content required by the transaction target chain in the cross-chain transaction; and sending the second transaction instruction to the transaction target chain so that the transaction initiation chain verifies the second transaction instruction and pays for the transaction content required by the transaction target chain.
Optionally, the transaction determination module 601 is specifically configured to: acquiring a cross-chain transaction initiated by the transaction initiation chain; detecting whether the cross-chain transaction is recorded in a parallel chain blockchain; when detecting that the parallel chain block chain does not record the cross-chain transaction, determining the cross-chain transaction as the cross-chain transaction to be completed.
Optionally, the apparatus further comprises: and a block updating module.
The block updating module is used for acquiring a block chain of the transaction initiating chain or the transaction target chain; and updating the parallel chain block chain according to the block chain of the transaction initiating chain or the transaction target chain.
Optionally, the block update module is specifically configured to: generating summary information according to the blockchain of the transaction initiating chain or the transaction target chain, wherein the summary information is used for indicating the transaction recorded in the blockchain of the transaction initiating chain or the transaction target chain; generating a block comprising the summary information, and adding the block to the parallel chain block chain.
Based on the above transaction method, the present application further provides a blockchain system based on a parallel chain, the system including: the system comprises a transaction initiating chain, a parallel chain and a transaction target chain, wherein the parallel chain consists of common nodes of the transaction initiating chain and the transaction target chain;
the parallel chain is used for determining a cross-chain transaction to be completed between the transaction initiating chain and the transaction target chain; according to the cross-chain transaction, instructing a transaction target chain to pay transaction content required by the transaction initiation chain in the cross-chain transaction; when the transaction target chain is detected to be paid completely, a transaction initiating chain is instructed to pay the transaction content required by the transaction target chain in the cross-chain transaction;
the transaction target chain is used for paying the transaction content required by the transaction initiation chain in the cross-chain transaction according to the indication of the parallel chain;
and the transaction initiating chain is used for paying the transaction content required by the transaction target chain in the cross-chain transaction according to the indication of the parallel chain.
In the blockchain system provided by the application, the transaction initiating chain and the transaction target chain are connected through the parallel chain, and the transaction contents which need to be paid are paid according to the instruction of the parallel chain, so that cross-chain transaction is completed. Because the parallel chain node is a common node of the transaction initiation chain and the transaction target chain, the parallel chain can participate in the transaction of the transaction initiation chain and the transaction of the transaction target chain. The parallel chain utilizes the characteristic, and is regulated and controlled in the middle in the transaction process to connect the transaction initiating chain and the transaction target chain, so that the difference between two parties is overcome, the cross-chain transaction between different chains is realized, and the transaction of the block chain is not limited in a single block chain network.
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.