Multi-user relay chain cross-chain method and device based on simulation execution

Through the multi-user relay chain cross-chain method based on simulation execution, the complexity and trust problems caused by the rollback mechanism in the prior art are solved, and a trustworthy relay cross-chain and simplified application contract design is realized.

CN119696760AActive Publication Date: 2025-03-25SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510039360.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-03-25
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

The existing cross-chain technology of relay chains relies on rollback mechanisms, which makes application contract design complex and difficult to gain user trust.

Method used

The multi-user relay chain cross-chain method based on simulation execution is adopted, and cross-chain information is registered through the gateway proxy of the application chain and the relay chain, cross-chain simulation execution is carried out, and the results are confirmed by verification gateway verification and voting.

Benefits of technology

While avoiding rollbacks, a trusted relay cross-chain is implemented, which simplifies application contract design and enhances the credibility of cross-chain execution results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119696760A_ABST
    Figure CN119696760A_ABST
Patent Text Reader

Abstract

According to the multi-user relay chain cross-chain method and device based on simulation execution, a multi-user relay chain cross-chain scheme is constructed based on simulation execution, the cross-chain trust is enhanced through the relay chain, and meanwhile design complexity brought by a rollback mechanism of a traditional relay chain to an application contract is avoided; secondly, in a preparation stage, cross-chain starting can only be carried out under the condition that cross-chain information on all user chains is consistent, and the consistency of cross-chain starting is ensured by using a block chain smart contract; and finally, a simulation execution result is also recorded in the block chain and is verified by a preset number of people and voted to be confirmed, so that the credibility of the execution result in the stage is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a multi-user relay chain cross-chain method and device based on simulation execution. Background Art

[0002] In recent years, with the development of blockchain and the emergence of various blockchains, cross-chain technologies such as hash-locked time contracts, distributed key control, middlemen, side chains, and relay chains have been proposed to solve the problem of isolated islands that cannot communicate between blockchains. Among them, relay chain cross-chain technology is the most widely used.

[0003] At present, there are many relay chain cross-chain projects both at home and abroad. Most of them rely on the rollback mechanism to implement cross-chain cancellation when the application contract call fails. However, rollback not only makes the design of application contracts more complicated, but also is not conducive to cross-chain gaining the trust of shallow users.

[0004] In summary, a relay cross-chain system based on simulated execution is needed to achieve trusted relay cross-chain while avoiding rollback. Summary of the invention

[0005] The embodiments of the present invention provide a multi-user relay chain cross-chain method and device based on simulation execution, which can achieve a trusted relay cross-chain while avoiding rollback.

[0006] According to one aspect of the present invention, a multi-user relay chain cross-chain method based on simulation execution is provided, comprising:

[0007] Register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent;

[0008] After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, constructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, writes the result into the relay contract through the gateway agent, and triggers the verification gateway to verify and vote on the simulation execution result;

[0009] After the voting result is passed, the cross-chain simulation execution request is received through the application chain gateway agent, the application contract is executed, and the cross-chain execution result is determined.

[0010] Optionally, the application chain gateway agent and the relay chain gateway agent are registered in the relay contract, and the cross-chain is enabled when the cross-chain information is consistent, including:

[0011] Determine the cross-chain transaction contract parameter CTX of each cross-chain user Ui, wherein CTX includes the specific transaction Txi of each application chain and the hash value H of each transaction after the hash value Hi is concatenated, wherein each cross-chain user has the authority to execute transactions on the blockchain;

[0012] Each cross-chain user Ui calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is the CTX;

[0013] After each of the application chain gateway agents monitors that the cross-chain preparation method with the cross-chain parameter CTX is called by the user, it constructs a cross-chain preparation request through CTX and Ui and sends it to the relay chain gateway agent;

[0014] After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

[0015] Optionally, enabling the cross-chain when the cross-chain information is consistent includes:

[0016] After the relay contract is called, the hash value H in CTX is used as the key to check whether there is a value corresponding to key H in the cross-chain transaction storage of the relay contract;

[0017] If there is no corresponding value, the value of H with Txi as the key is stored in the cross-chain transaction storage of the relay contract, and is stored in the cross-chain user storage of the relay contract with H as the key and a set S containing only contract parameters Ui as the value;

[0018] If there is a corresponding value, compare the value TXi in the cross-chain transaction storage with Txi in the CTX to see if they are consistent: if they are consistent, use H in the CTX as the key in the user storage of the relay contract to obtain the corresponding set S, and if it is verified that the elements in S are not the same as the contract parameter Ui, add Ui to the relay S, and store the updated S value in the relay contract storage with H as the key;

[0019] The relay contract checks the number of elements n1 contained in the set S with the key H in each cross-chain user storage. If its number is equal to the number of transactions n2 contained in the value TXi with the key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi and H as parameters, and marks the cross-chain result with the key H as prepared successfully.

[0020] Optionally, after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, and writes the result into the relay contract through the gateway agent, including:

[0021] Get TXi and H in the call parameters, construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by a single transaction to the corresponding application chain gateway agent in a concurrent manner;

[0022] After receiving the cross-chain simulation execution request, the gateway agent calls the cross-chain simulation execution method of the cross-chain contract in the application chain, and the cross-chain parameters are still the single transaction TXi and H;

[0023] Each cross-chain contract attempts to lock the application contract to be executed. If the application chain gateway agent obtains an error returned by the application contract, it will wait for a preset time and then execute the locking operation. In the locked state, it ensures that the application contract is temporarily not executed by callers other than the cross-chain contract;

[0024] The cross-chain contract calls the data acquisition method of the application contract to obtain the data value of the current application contract;

[0025] The cross-chain contract constructs a corresponding simulation method according to the method to be executed in the application contract;

[0026] The cross-chain contract executes the simulation method, and according to the execution result of the simulation method, stores the cross-chain simulation result with H as the key in the cross-chain contract;

[0027] After the gateway agent monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent;

[0028] The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is a failure, the cross-chain simulation result with the top-level key of the relay contract as H and the second-top-level key as Hi is marked as a failure, and the cross-chain result with the relay contract key as H is also marked as a simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract as H and the second-top-level key as Hi is marked as pending approval.

[0029] Optionally, trigger the verification gateway to verify and vote on the simulation execution results, including:

[0030] The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; each verification application chain gateway agent queries the blockchain block. If the result in the block is consistent with the received result, a cross-chain simulation approval request containing TXi and H is sent to the relay chain gateway; otherwise, a cross-chain simulation opposition request containing TXi and H is sent.

[0031] After the relay chain gateway receives the cross-chain simulation approval or disapproval request, it records the number of cross-chain simulation approval or disapproval votes with the top-level key H and the second-top-level key Hi of the relay contract plus one, and the total number of votes plus one;

[0032] After the votes are updated, if the number of votes against exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract is marked as failed, and the cross-chain result with the key H is also marked as simulation failure, and the process ends; otherwise, if the number of votes in favor exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi in the relay contract is marked as successful.

[0033] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with Txi and H as parameters.

[0034] Optionally, receiving the cross-chain simulation execution request through the application chain gateway agent and executing the application contract includes:

[0035] After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi and H in its call parameters, constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent respectively;

[0036] After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

[0037] Optionally, determining the cross-chain execution result includes:

[0038] The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call is successful; after the call is successful, the cross-chain contract unlocks the application contract, marks the top-level key as H, and the second-level key as Hi, and the application contract call is successful;

[0039] After the gateway agent monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent;

[0040] After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful;

[0041] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain execution, the relay contract marks the cross-chain result with key H as success.

[0042] According to another aspect of the present invention, a multi-user relay chain cross-chain device based on simulation execution is provided, comprising:

[0043] The preparation unit is used to register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent;

[0044] The simulation execution unit is used to call the cross-chain contract, lock the given application contract, reconstruct the simulation method of the application contract and execute it after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, write the success or failure of the simulation execution result into the cross-chain contract, write the result into the relay contract through the gateway agent, and trigger the verification gateway to verify and vote on the simulation execution result;

[0045] The confirmation execution unit is used to receive the cross-chain simulation execution request through the application chain gateway agent after the voting result is passed, execute the application contract, and determine the cross-chain execution result.

[0046] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0047] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the multi-user relay chain cross-chain method based on simulation execution as described in any embodiment of the present invention.

[0048] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-user relay chain cross-chain method based on simulation execution described in any embodiment of the present invention when executed.

[0049] The embodiment of the present invention provides a multi-user relay chain cross-chain method and device based on simulated execution, constructs a multi-user relay chain cross-chain solution based on simulated execution, uses the relay chain to enhance cross-chain trust while avoiding the design complexity brought to the application contract by the rollback mechanism of the traditional relay chain; secondly, in the preparation stage, the cross-chain can be started only when the cross-chain information on all user chains is consistent, and the consistency of cross-chain startup is guaranteed by the blockchain smart contract; finally, the result of the simulated execution is also recorded in the blockchain and verified and voted by a preset number of people, thereby enhancing the credibility of the execution result of this stage.

[0050] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 It is a flowchart of a multi-user relay chain cross-chain method based on simulation execution provided by one embodiment of the present invention;

[0053] Figure 2 It is a cross-chain data infrastructure structure diagram provided by an embodiment of the present invention;

[0054] Figure 3 It is a schematic diagram of a contract storage provided by an embodiment of the present invention;

[0055] Figure 4 is a schematic diagram of a cross-chain architecture provided by an embodiment of the present invention;

[0056] Figure 5 It is a structural schematic diagram of a multi-user relay chain cross-chain device based on simulation execution provided by one embodiment of the present invention;

[0057] Figure 6 It is a structural diagram of an electronic device for implementing a multi-user relay chain cross-chain method based on simulation execution according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0059] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0060] Blockchain: Blockchain is a distributed shared ledger. In blockchain, data is stored by multiple parties, and multiple parties use consensus algorithms to achieve consistency of multi-node data. In blockchain, data can only be appended and cannot be deleted or modified. The new blockchain is programmable. Users can use smart contracts to encode business rules into the blockchain. Rules (codes) cannot be deleted or modified like data. Codes are automatically executed when called and cannot be skipped. The results of execution are also written into the blockchain. Since data is stored by multiple parties and the data on the chain cannot be tampered with, blockchain can be used to achieve trusted data sharing among multiple parties.

[0061] Cross-chain: Cross-chain is a technology that enables the transfer and circulation of values ​​between different blockchain systems through a specific mechanism, thus breaking the barrier of non-communication between traditional blockchains and forming a larger blockchain network. The development of cross-chain technology will help the application and implementation of blockchain technology in more fields, thereby promoting the development and growth of the entire blockchain industry.

[0062] Figure 1 is a flowchart of a multi-user relay chain cross-chain method based on simulation execution provided by an embodiment of the present invention, such as Figure 1 As shown, the method may include the following steps:

[0063] S110. Register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent.

[0064] In the embodiment of the present invention, the application chain gateway agent and the relay chain gateway agent are registered in the relay contract, and the cross-chain is enabled when the cross-chain information is consistent, including:

[0065] Determine the cross-chain transaction contract parameter CTX of each cross-chain user Ui, wherein CTX includes the specific transaction Txi of each application chain and the hash value H of each transaction after the hash value Hi is concatenated, wherein each cross-chain user has the authority to execute transactions on the blockchain;

[0066] Each cross-chain user Ui calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is the CTX;

[0067] After each of the application chain gateway agents monitors that the cross-chain preparation method with the cross-chain parameter CTX is called by the user, it constructs a cross-chain preparation request through CTX and Ui and sends it to the relay chain gateway agent;

[0068] After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

[0069] In the embodiment of the present invention, the step of starting a cross-chain when the cross-chain information is consistent includes:

[0070] After the relay contract is called, the hash value H in CTX is used as the key to check whether there is a value corresponding to key H in the cross-chain transaction storage of the relay contract;

[0071] If there is no corresponding value, the value of H with Txi as the key is stored in the cross-chain transaction storage of the relay contract, and is stored in the cross-chain user storage of the relay contract with H as the key and a set S containing only contract parameters Ui as the value;

[0072] If there is a corresponding value, compare the value TXi in the cross-chain transaction storage with Txi in the CTX to see if they are consistent: if they are consistent, use H in the CTX as the key in the user storage of the relay contract to obtain the corresponding set S, and if it is verified that the elements in S are not the same as the contract parameter Ui, add Ui to the relay S, and store the updated S value in the relay contract storage with H as the key;

[0073] The relay contract checks the number of elements n1 contained in the set S with the key H in each cross-chain user storage. If its number is equal to the number of transactions n2 contained in the value TXi with the key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi and H as parameters, and marks the cross-chain result with the key H as prepared successfully.

[0074] The above is the preparation stage before the cross-chain operation. Each user {Ui (i = 1, 2, 3, 4, 5, ...)} negotiates and confirms the cross-chain transaction CTX offline. CTX contains the specific transactions of each application chain {TXi (i = 1, 2, 3, 4, 5, ...)}, and the hash value H of each transaction hash value {Hi (i = 1, 2, 3, 4, 5, ...)}. Among them, Hi is stored in Txi, and user Ui has the authority to execute transaction TXi on the blockchain (that is, it has the key required to sign the transaction). Figure 2 This is a cross-chain data infrastructure diagram provided by an embodiment of the present invention.

[0075] Figure 3 It is a schematic diagram of a contract storage provided by an embodiment of the present invention. Each user {Ui (i = 1, 2, 3, 4, 5, ...)} calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is CTX.

[0076] After the gateway agent corresponding to each application chain listens to the cross-chain preparation method with the cross-chain parameter CTX being called by user Ui, it constructs a cross-chain preparation request with CTX and Ui and sends it to the relay chain gateway agent.

[0077] After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

[0078] After the relay contract is called, the hash value H in CTX is used as the key to check whether there is a value corresponding to key H in the cross-chain transaction storage of the relay contract.

[0079] If there is no corresponding value, the relay contract uses {TXi (i = 1, 2, 3, 4, 5, ...)} as the value of key H, and stores it in the cross-chain transaction storage of the relay contract, and stores it in the cross-chain user storage of the relay contract with H as the key and a set S containing only contract parameters Ui as the value;

[0080] If there is a corresponding value, compare the value {TXi (i = 1, 2, 3, 4, 5, ...)} in the cross-chain transaction storage with {TXi (i = 1, 2, 3, 4, 5, ...)} in the contract parameter CTX for consistency: If they are consistent, use H in CTX as the key in the user storage of the relay contract to obtain the corresponding set S, and if it is checked that the elements in S are not the same as the contract parameter Ui, add Ui to the relay S, and store the updated S value in the relay contract storage with H as the key; if they are inconsistent, no processing is done.

[0081] The relay contract checks the number of elements n1 contained in the set S with key H in the user storage. If its number is equal to the number of transactions n2 contained in the value {TXi(i=1,2,3,4,5,…)} with key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi(i=1,2,3,4,5,…) and H as parameters, and marks the cross-chain result with key H as prepared successfully; otherwise, the execution ends.

[0082] S120. After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, writes the result into the relay contract through the gateway agent, and triggers the verification gateway to verify and vote on the simulation execution result.

[0083] In an embodiment of the present invention, after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, the cross-chain contract is called, the given application contract is locked, and then the simulation method of the application contract is constructed and executed, and the success or failure of the simulation execution result is written into the cross-chain contract, and the result is written into the relay contract through the gateway agent, including:

[0084] Get TXi and H in the call parameters, construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by a single transaction to the corresponding application chain gateway agent in a concurrent manner;

[0085] After receiving the cross-chain simulation execution request, the gateway agent calls the cross-chain simulation execution method of the cross-chain contract in the application chain, and the cross-chain parameters are still the single transaction TXi and H;

[0086] Each cross-chain contract attempts to lock the application contract to be executed. If the application chain gateway agent obtains an error returned by the application contract, it will wait for a preset time and then execute the locking operation. In the locked state, it ensures that the application contract is temporarily not executed by callers other than the cross-chain contract;

[0087] The cross-chain contract calls the data acquisition method of the application contract to obtain the data value of the current application contract;

[0088] The cross-chain contract constructs a corresponding simulation method according to the method to be executed in the application contract;

[0089] The cross-chain contract executes the simulation method, and according to the execution result of the simulation method, stores the cross-chain simulation result with H as the key in the cross-chain contract;

[0090] After the gateway agent monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent;

[0091] The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is a failure, the cross-chain simulation result with the top-level key of the relay contract as H and the second-top-level key as Hi is marked as a failure, and the cross-chain result with the relay contract key as H is also marked as a simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract as H and the second-top-level key as Hi is marked as pending approval.

[0092] In the embodiment of the present invention, triggering the verification gateway to verify and voting on the simulation execution result includes:

[0093] The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; each verification application chain gateway agent queries the blockchain block. If the result in the block is consistent with the received result, a cross-chain simulation approval request containing TXi and H is sent to the relay chain gateway; otherwise, a cross-chain simulation opposition request containing TXi and H is sent.

[0094] After the relay chain gateway receives the cross-chain simulation approval or disapproval request, it records the number of cross-chain simulation approval or disapproval votes with the top-level key H and the second-top-level key Hi of the relay contract, and adds one to the total number of votes.

[0095] After the votes are updated, if the number of votes against exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract is marked as failed, and the cross-chain result with the key H is also marked as simulation failure, and the process ends; otherwise, if the number of votes in favor exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi in the relay contract is marked as successful.

[0096] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with Txi and H as parameters.

[0097] The above is the simulation execution stage of cross-chain execution. After the relay gateway agent monitors the call of the cross-chain simulation execution method of the relay chain contract, it obtains TXi (i = 1, 2, 3, 4, 5, ...) and H in its call parameters. Construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by a single transaction to the corresponding application chain gateway agent in a concurrent manner.

[0098] After receiving the cross-chain simulation execution request, the gateway agent of the application chain calls the cross-chain simulation execution method of the cross-chain contract in the application chain. The cross-chain parameters are still the single transaction TXi and H.

[0099] The cross-chain contracts of each application chain attempt to lock the application contract to be executed. If the locking fails because the application contract has been locked, the application chain gateway agent will wait for a while and retry the locking operation after obtaining the error returned by the application contract; if the locking is successful, it is guaranteed that the application contract will not be executed by callers other than the cross-chain contract for the time being.

[0100] The cross-chain contract of the application chain calls the data acquisition method of the application contract to obtain the data value of the current application contract;

[0101] The cross-chain contract of the application chain constructs the corresponding simulation method according to the method to be executed in the application contract (data acquisition is changed to data obtained from the above cross-chain contract, the data storage method is omitted, and the rest of the logic remains unchanged).

[0102] The cross-chain contract of the application chain executes the constructed simulation method, and stores the cross-chain simulation result (including TXi and success / failure) with H as the key in the cross-chain contract according to the success / failure of the execution of the simulation method.

[0103] After the gateway agent of the application chain listens to the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent.

[0104] The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is a failure, the cross-chain simulation result with the top-level key of the relay contract as H and the second-level key as Hi is marked as a failure, and the cross-chain result with the relay contract key as H is also marked as a simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract as H and the second-level key as Hi is marked as pending approval, and the next step is executed.

[0105] The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; each verification application chain gateway agent queries the blockchain block. If the result in the block is consistent with the received result, a cross-chain simulation approval request containing TXi and H is sent to the relay chain gateway; otherwise, a cross-chain simulation opposition request containing TXi and H is sent.

[0106] After the relay chain gateway receives the cross-chain simulation approval / disapproval request, it records the number of approval / disapproval votes for the cross-chain simulation with the top-level key H and the second-level key Hi of the relay contract, and adds one to the total number of votes. After the number of votes is updated, if the number of disapproval votes exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract is marked as failed, and the cross-chain result with the key H is also marked as simulation failure, and the simulation ends; otherwise, if the number of approval votes exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi of the relay contract is marked as successful.

[0107] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, then the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with {TXi (i = 1, 2, 3, 4, 5, ...)} and H as parameters.

[0108] S130. After the voting result is passed, the cross-chain simulation execution request is received through the application chain gateway agent, the application contract is executed, and the cross-chain execution result is determined.

[0109] In an embodiment of the present invention, receiving the cross-chain simulation execution request through the application chain gateway agent and executing the application contract includes:

[0110] After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi and H in its call parameters, constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent respectively;

[0111] After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

[0112] In the embodiment of the present invention, determining the cross-chain execution result includes:

[0113] The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call is successful; after the call is successful, the cross-chain contract unlocks the application contract, marks the top-level key as H, and the second-level key as Hi, and the application contract call is successful;

[0114] After the gateway agent monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent;

[0115] After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful;

[0116] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain execution, the relay contract marks the cross-chain result with key H as success.

[0117] The above is the confirmation execution stage of cross-chain execution. After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi (i = 1, 2, 3, 4, 5, ...) and H in its call parameters. Construct a cross-chain execution request containing a single transaction TXi and H, and send the cross-chain execution request constructed by a single transaction to the corresponding application chain gateway agent in a concurrent manner.

[0118] After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

[0119] The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call is successful (because the successful simulation execution of the aforementioned application contract shows that there is no problem with the contract call method and parameters, and the distributed characteristics of the blockchain also make the probability of service unavailability extremely small, so the probability of failure here is extremely small); after the call is successful, the cross-chain contract unlocks the application contract, marks the top-level key as H, and the second-top-level key as Hi. The application contract call is successful.

[0120] After the gateway agent of the application chain monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the gateway agent of the relay chain.

[0121] After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful.

[0122] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and cross-chain execution is successful, the relay contract marks the cross-chain result with key H as success.

[0123] Figure 4 This is a schematic diagram of a cross-chain architecture provided by an embodiment of the present invention. This solution builds a multi-user relay chain cross-chain solution based on simulated execution. While using the relay chain to enhance cross-chain trust, it avoids the design complexity brought to the application contract by the rollback mechanism of the traditional relay chain; secondly, in the preparation stage, the cross-chain can be started only when the cross-chain information on all user chains is consistent, and the consistency of cross-chain startup is guaranteed by blockchain smart contracts; finally, the results of the simulated execution are also recorded in the blockchain and verified and voted by a preset number of people, which enhances the credibility of the execution results of this stage.

[0124] Figure 5 1 is a schematic diagram of a multi-user relay chain cross-chain device based on simulation execution provided by an embodiment of the present invention, including:

[0125] The preparation unit 510 is used to register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent;

[0126] The simulation execution unit 520 is used to call the cross-chain contract, lock the given application contract, reconstruct the simulation method of the application contract and execute it after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, write the success or failure of the simulation execution result into the cross-chain contract, write the result into the relay contract through the gateway agent, and trigger the verification gateway to verify and vote on the simulation execution result;

[0127] The confirmation execution unit 530 is used to receive the cross-chain simulation execution request through the application chain gateway agent after the voting result is passed, execute the application contract, and determine the cross-chain execution result.

[0128] It is understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the multi-user relay chain cross-chain device based on simulation execution. In other embodiments of the present invention, the multi-user relay chain cross-chain device based on simulation execution may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0129] The information interaction, execution process and other contents between the units in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.

[0130] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0131] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0132] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0133] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a multi-user relay chain cross-chain method based on simulation execution.

[0134] In some embodiments, the multi-user relay chain cross-chain method based on simulated execution may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the multi-user relay chain cross-chain method based on simulated execution described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the multi-user relay chain cross-chain method based on simulated execution in any other appropriate manner (e.g., by means of firmware).

[0135] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0136] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0137] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0138] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0139] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0140] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0141] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0142] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A multi-user relay chain cross-chain method based on simulation execution, characterized in that: include: Register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent; After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, constructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, writes the result into the relay contract through the gateway agent, and triggers the verification gateway to verify and vote on the simulation execution result; After the voting result is passed, the cross-chain simulation execution request is received through the application chain gateway agent, the application contract is executed, and the cross-chain execution result is determined.

2. The method according to claim 1, characterized in that The application chain gateway agent and the relay chain gateway agent are registered in the relay contract, and the cross-chain is enabled when the cross-chain information is consistent, including: Determine the cross-chain transaction contract parameter CTX of each cross-chain user Ui, wherein CTX includes the specific transaction Txi of each application chain and the hash value H of each transaction after the hash value Hi is concatenated, wherein each cross-chain user has the authority to execute transactions on the blockchain; Each cross-chain user Ui calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is the CTX; After each of the application chain gateway agents monitors that the cross-chain preparation method with the cross-chain parameter CTX is called by the user, it constructs a cross-chain preparation request through CTX and Ui and sends it to the relay chain gateway agent; After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

3. The method according to claim 1, characterized in that The step of enabling cross-chain when cross-chain information is consistent includes: After the relay contract is called, the hash value H in CTX is used as the key to check whether there is a value corresponding to key H in the cross-chain transaction storage of the relay contract; If there is no corresponding value, the value of H with Txi as the key is stored in the cross-chain transaction storage of the relay contract, and is stored in the cross-chain user storage of the relay contract with H as the key and a set S containing only contract parameters Ui as the value; If there is a corresponding value, compare the value TXi in the cross-chain transaction storage with Txi in the CTX to see if they are consistent: if they are consistent, use H in the CTX as the key in the user storage of the relay contract to obtain the corresponding set S, and if it is verified that the elements in S are not the same as the contract parameter Ui, add Ui to the relay S, and store the updated S value in the relay contract storage with H as the key; The relay contract checks the number of elements n1 contained in the set S with the key H in each cross-chain user storage. If its number is equal to the number of transactions n2 contained in the value TXi with the key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi and H as parameters, and marks the cross-chain result with the key H as prepared successfully.

4. The method according to claim 3, characterized in that After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, constructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, and writes the result into the relay contract through the gateway agent, including: Get TXi and H in the call parameters, construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by a single transaction to the corresponding application chain gateway agent in a concurrent manner; After receiving the cross-chain simulation execution request, the gateway agent calls the cross-chain simulation execution method of the cross-chain contract in the application chain, and the cross-chain parameters are still the single transaction TXi and H; Each cross-chain contract attempts to lock the application contract to be executed. If the application chain gateway agent obtains an error returned by the application contract, it will wait for a preset time and then execute the locking operation. In the locked state, it ensures that the application contract is temporarily not executed by callers other than the cross-chain contract; The cross-chain contract calls the data acquisition method of the application contract to obtain the data value of the current application contract; The cross-chain contract constructs a corresponding simulation method according to the method to be executed in the application contract; The cross-chain contract executes the simulation method, and according to the execution result of the simulation method, stores the cross-chain simulation result with H as the key in the cross-chain contract; After the gateway agent monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent; The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is a failure, the cross-chain simulation result with the top-level key of the relay contract as H and the second-top-level key as Hi is marked as a failure, and the cross-chain result with the relay contract key as H is also marked as a simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract as H and the second-top-level key as Hi is marked as pending approval.

5. The method according to claim 4, characterized in that Triggering the verification gateway to verify and vote on the simulation execution results, including: The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; each verification application chain gateway agent queries the blockchain block. If the result in the block is consistent with the received result, a cross-chain simulation approval request containing TXi and H is sent to the relay chain gateway; otherwise, a cross-chain simulation opposition request containing TXi and H is sent. After the relay chain gateway receives the cross-chain simulation approval or disapproval request, it records the number of cross-chain simulation approval or disapproval votes with the top-level key H and the second-top-level key Hi of the relay contract plus one, and the total number of votes plus one; After the votes are updated, if the number of votes against exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract is marked as failed, and the cross-chain result with the key H is also marked as simulation failure, and the process ends; otherwise, if the number of votes in favor exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi in the relay contract is marked as successful. If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with Txi and H as parameters.

6. The method according to claim 1, characterized in that The receiving the cross-chain simulation execution request through the application chain gateway agent and executing the application contract includes: After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi and H in its call parameters, constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent respectively; After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

7. According to the method of claim 1, determining the cross-chain execution result comprises: The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call succeeds; After the call is successful, the cross-chain contract unlocks the application contract, marks the top-level key as H, and the second-level key as Hi, and the application contract call is successful; After the gateway agent monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent; After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful; If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain execution, the relay contract marks the cross-chain result with key H as success.

8. A multi-user relay chain cross-chain device based on simulation execution, characterized in that: include: The preparation unit is used to register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent; The simulation execution unit is used to call the cross-chain contract, lock the given application contract, reconstruct the simulation method of the application contract and execute it after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, write the success or failure of the simulation execution result into the cross-chain contract, write the result into the relay contract through the gateway agent, and trigger the verification gateway to verify and vote on the simulation execution result; The confirmation execution unit is used to receive the cross-chain simulation execution request through the application chain gateway agent after the voting result is passed, execute the application contract, and determine the cross-chain execution result.

9. An electronic device, characterized in that include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the multi-user relay chain cross-chain method based on simulation execution as described in any one of claims 1-7.

10. A computer readable medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-user relay chain cross-chain method based on simulation execution as described in any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Method for guaranteeing consistency of cross-blockchain transactions of blockchain

    CN112507393A

  • Relay chain-based cross-chain asset transaction method, system and equipment

    CN115601168A

  • Relay chain-based cross-chain system

    CN117440032A

  • System and method for universal blockchain interoperability

    US20200278958A1