A multi-chain message table transaction processing method and cross-chain system for cross-chain

By using the built-in cross-chain transaction management contract and multi-chain message table in the (n+1)-dimensional relay chain model to disassemble and store transactions, the problems of low transaction processing efficiency and difficulty in maintaining consistency in cross-chain technology are solved. , achieving efficient execution and implementation of cross-chain applications.

CN112882802BActive Publication Date: 2024-10-22HANGZHOU YUNXIANG NETWORK TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110137193.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-01
Publication Date
2024-10-22
Estimated Expiration
2041-02-01

AI Technical Summary

Technical Problem

Existing cross-chain technology is inefficient and difficult to maintain consistency during transaction processing, making it difficult to implement cross-chain applications.

Method used

Design a multi-chain message table transaction processing method and system. By using the built-in cross-chain transaction management contract in the (n+1)-dimensional relay chain model, the total transaction is broken down into sub-transactions and stored in the multi-chain message table. , ensuring the eventual consistency and atomicity of transactions.

Benefits of technology

It improves the efficiency of cross-chain transaction processing, ensures the safe and efficient execution of transactions, and realizes the implementation of cross-chain applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112882802B_ABST
    Figure CN112882802B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-chain message table transaction processing method and a cross-chain system for cross-chain. The present invention is responsible for splitting the total transaction Tr into sub-transactions Tri through a relay chain transaction contract, and initializing each sub-transaction status si, wherein the relay chain transaction contract maintains a transaction table (multi-chain message table), and each gateway G will query the transaction status of this transaction table. Once the query fails, it will time out and perform a business rollback. After each application chain sub-transaction Tri is successfully executed, the sub-transaction status si on the corresponding relay chain is updated through the gateway. When all sub-transactions are successfully executed in the end, the total transaction is considered successful. As long as one sub-transaction fails, the total transaction will fail. The multi-chain message table transaction processing method and the cross-chain system of the present invention ensure the final consistency of cross-chain transactions through a built-in cross-chain transaction management contract.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of cross-chain blockchain technology, and specifically relates to a multi-chain message table transaction processing method and a cross-chain system for cross-chain. Background Art

[0002] Different blockchain platforms often use different underlying architectures, data structures, network links, and technical interfaces. Each blockchain platform has its own rich applications, data, and users, but due to the differences in underlying architectures, data structures, network links, and technical interfaces, it is often difficult to transfer applications, data, and users between two different platforms. Cross-chain technology plays an extremely critical role as a bridge between different platforms. In order to enable data on different platforms to be interoperable, it is necessary to solve the transaction processing problem of multi-chain intercommunication during the cross-chain process, so as to solve the key problems such as the inability to interconnect and interoperate between blockchains due to the multi-dimensional heterogeneity of the underlying architecture, data structure, link network, interface technology, etc. Usually, in the cross-chain process, three commonly used cross-chain mechanisms can be used: the first is hash locking, the second is the notary mechanism, and the third is the mechanism using the relay chain.

[0003] However, among the three current cross-chain methods, hash locking is a cross-chain method specifically used to transfer digital currency. It locks digital currency on the chain through a blockchain account with a time limit and generates corresponding tokens in another blockchain. It is generally applicable to cross-chain between two blockchains and has poor versatility. The witness mechanism uses a centralized and trusted witness to transfer data in different blockchains. It requires the cross-chain blockchain network and related operators to fully trust the witness, which is prone to cause serious single-point risk problems. The relay chain mechanism relays and transfers data on different chains by building trusted relay nodes between chains, but its structure is extremely complex, the process is cumbersome, the efficiency is extremely low, and it will introduce organizational management issues of the relay chain, making it difficult to implement.

[0004] In short, there are various solutions to achieve cross-chain, but their implementation is extremely difficult. Whether it is hash locking, witness mechanism or relay chain mechanism, the root cause of the difficulty in implementation is that transaction processing cannot be efficient and consistent during the cross-chain process.

[0005] Therefore, there is an urgent need for a cross-chain transaction processing method and system to achieve efficient execution of cross-chain transactions and ensure the final consistency of transactions during the execution process, thereby realizing the implementation and efficient execution of cross-chain applications. Summary of the invention

[0006] Based on the above background and the problems existing in the prior art, the present invention intends to design a multi-chain message table transaction processing method and a cross-chain system for cross-chain, which can ensure the final consistency of cross-chain transactions through a built-in cross-chain transaction management contract under a multi-dimensional (specifically (n+1) dimension in the present invention) relay chain cross-chain model. Another purpose of the present invention is to improve the efficiency of multi-dimensional (specifically (n+1) dimension in the present invention) cross-chain transaction processing through a cross-chain system for multi-chain (specifically (n+1) chains in the present invention) message table transaction processing, while ensuring the atomicity of transaction execution, so that cross-chain transactions can be executed safely and efficiently.

[0007] In order to achieve these objectives and other advantages of the present invention, a multi-chain message table transaction processing method and a cross-chain system for cross-chain are provided.

[0008] A multi-chain message table transaction processing method for cross-chain is applied to a cross-chain network of application chains, gateways, relay chains and network gateways, and the network gateway includes several sub-gateways, including the following steps:

[0009] The first application link receives a call request initiated by the client, generates a general transaction, the general transaction includes the general transaction identity information and the general transaction status, freezes the asset data, and sends the general transaction to the first gateway;

[0010] The first gateway receives and records the total transaction status, sends the total transaction to the first relay chain, and queries the total transaction status in the first relay chain;

[0011] The first relay chain breaks down the total transaction into several sub-transactions and generates corresponding sub-transaction identity information, stores the sub-transactions and their corresponding sub-transaction states and sub-transaction identity information in the database message table of the second relay chain and the multi-chain message table of the first relay chain, respectively, and sends them to the sub-gateway;

[0012] The sub-gateway continuously queries the total transaction status in the first relay chain and sends the sub-transaction to the second application chain via the second relay chain;

[0013] The second application chain executes sub-transactions. If any sub-transaction fails to execute, the overall transaction fails and the corresponding sub-transaction status is modified. If all sub-transactions are executed successfully, the asset data of the chain is frozen and the successful execution result is fed back to the second gateway.

[0014] The second gateway modifies the sub-transaction status and notifies the second relay chain to modify the sub-transaction status;

[0015] The sub-gateway continuously queries the sub-transaction status on the second relay chain and notifies the first relay chain to modify the sub-transaction status;

[0016] The first relay chain, the first gateway, and the sub-gateway modify the total transaction status stored in each of them respectively, and each gateway notifies each application chain to submit the modification.

[0017] As an implementable method, the generating of the total transaction comprises the following specific steps:

[0018] The first gateway receives a call from the client to the application contract to initiate a cross-chain call;

[0019] Pre-freeze asset data on the application contract;

[0020] The cross-chain contract generates a total transaction;

[0021] The asset data is stored in the ledger data of the application contract and the cross-chain contract, and the ledger data of the application contract and the cross-chain contract are stored in the internal ledger of the first application chain.

[0022] As an implementable method, the total transaction state is represented as S, the sub-transaction state is represented as si, the total transaction is represented as Tr, and the sub-transaction is represented as Tri. There are three situations for the total transaction state and the sub-transaction state, as follows:

[0023] S=si=f: indicates that when any of all sub-transactions is in this state, the first application chain is notified to roll back the data, where f indicates that the transaction execution fails;

[0024] S=si=p: Set the timeout clock threshold. When a transaction is in the p state for a long time and exceeds the clock threshold, the transaction state is changed to f and a transaction rollback is initiated. p means that the transaction has not been completed.

[0025] S=si=s: indicates that when all sub-transactions are in this state, the first application chain is notified to submit data, where s indicates that the transaction is successfully executed.

[0026] As an implementable method, based on the three situations of the total transaction status and the sub-transaction status, the first gateway queries in real time from the multi-chain message table whether the total transaction status is S=s, and then the following operations are performed:

[0027] When the total transaction status S=s is queried, the transaction is executed successfully, and the first gateway notifies the first application chain to submit the pre-frozen data;

[0028] When the total transaction status S=f is queried, the transaction execution fails, and the first application chain is notified to roll back the pre-frozen asset data;

[0029] When the total transaction status S=p is queried, the transaction is not completed and the timeout is counted;

[0030] Among them, the memory state of the multi-chain message table of the first gateway is stored in the KV database and kept updated in real time.

[0031] As an implementation method, when the first gateway queries the transaction status in the first relay chain, it searches for the corresponding key-value map in the data map in the data structure of the relay chain ledger, and finds the transaction status through the key-value map.

[0032] As an implementable embodiment, when the first gateway executes the query transaction status timeout, the first gateway sets the total transaction status in the first relay chain to S=f, and notifies the first application chain to roll back; when the sub-transaction status is si=f or si=s, the entries corresponding to the sub-transaction in all gateways are deleted.

[0033] As an implementation method, when the second application chain executes a sub-transaction, after pre-freezing the application contract data on the second application chain, the total transaction status and the sub-transaction status change; when all second application chains execute sub-transactions successfully, the transaction status is updated. The specific steps include:

[0034] The second application chain notifies the second gateway that the sub-transaction is successfully executed;

[0035] The second gateway updates the sub-transaction status si=s in the memory, and notifies the second relay chain to update the sub-transaction status si;

[0036] The second relay chain updates the sub-transaction status si=s;

[0037] The sub-gateway continuously queries all sub-transaction status si on the second relay chain. When any si=f in the query result, the total transaction status At the same time, update the sub-transaction status si=f in the memory message table; if si=f does not exist in the query result but si=p exists, the total transaction status At the same time, update the sub-transaction status si=p in the memory message table; when the query result is all si=s, the total transaction status At the same time, update the sub-transaction status si=s in the memory message table;

[0038] Notify the first relay chain to update the sub-transaction status si in the multi-chain message table;

[0039] After receiving the notification, the first relay chain updates all sub-transaction status si=s in the multi-chain message table, and then updates the total transaction status S=s;

[0040] The first gateway and the sub-gateway are constantly querying the status of the total transaction. After querying the total transaction status S=s, they notify the first application chain and the second application chain respectively. Before notifying the second application chain, the second relay chain is notified first, the pre-frozen asset data is unfrozen, and the asset data is submitted.

[0041] As an implementable method, each gateway notifies each application chain to submit the modification, including the following steps:

[0042] The first gateway notifies the first application chain to submit the modification, the sub-gateway notifies the second relay chain and the second gateway in turn, and the second gateway notifies the second application chain to submit the modification.

[0043] A multi-chain message table transaction cross-chain system for cross-chain, comprising an application chain, a gateway, a relay chain and a network gateway, wherein the network gateway comprises a plurality of sub-gateways, the application chain comprises at least a first application chain and a second application chain, the gateway comprises at least a first gateway and a second gateway, and the relay chain comprises at least a first relay chain and a second relay chain:

[0044] The first application chain is used to receive a call request initiated by a client, generate a total transaction, the total transaction includes total transaction identity information and total transaction status, freeze asset data, and send the total transaction to the first gateway;

[0045] The first gateway is used to receive and record the total transaction status, send the total transaction to the first relay chain, and query the total transaction status in the first relay chain;

[0046] The first relay chain is used to split the total transaction into several sub-transactions and generate corresponding sub-transaction identity information, store the sub-transactions and their corresponding sub-transaction states and sub-transaction identity information in the database message table of the second relay chain and the multi-chain message table of the first relay chain, respectively, and send them to the sub-gateway;

[0047] The sub-gateway is used to continuously query the total transaction status in the first relay chain, send the sub-transaction to the second application chain via the second relay chain and the second gateway, and continuously query the sub-transaction status on the second relay chain and notify the first relay chain to modify the sub-transaction status;

[0048] The second gateway is used to modify the sub-transaction status and notify the second relay chain to modify the sub-transaction status;

[0049] The second relay chain is used to receive the sub-transaction sent by the sub-gateway and modify the sub-transaction status, and the second relay chain includes a database message table for storing the sub-transaction and its corresponding sub-status and identity information;

[0050] The second application chain is used to execute sub-transactions. When any sub-transaction fails to execute, the overall transaction fails to execute and the status of the corresponding sub-transaction is modified. If all sub-transactions are executed successfully, the data of the overall transaction is frozen and the successful execution result is fed back to the second gateway.

[0051] The first relay chain, the first gateway and the sub-gateway respectively modify the total transaction status stored by themselves.

[0052] Other advantages, objectives and features of the present invention will be partially reflected in the following description, and partially understood by those skilled in the art through research and practice of the present invention. The beneficial effects of the present invention at least include: the present invention decomposes the total transaction Tr into sub-transactions Tri through the relay chain RAtr, Implement a multi-dimensional relay chain cross-chain model, and then store the sub-transaction Tri and its corresponding sub-state si and IDtri in the database message table of the relay chain RBi, and store the sub-transaction Tri and its corresponding sub-state si and IDtri in the multi-chain message table of the database in the relay chain RAtr. The database message table of the relay chain RBi and the multi-chain message table of the database of RAtr jointly support the storage amount query of key information in the transaction processing process, and the key information is the transaction and its identity information, status and asset data and other data information. Under the multi-dimensional relay chain cross-chain model, the final consistency of cross-chain transactions can be guaranteed through the built-in cross-chain transaction management contract, and the efficiency of multi-dimensional cross-chain transaction processing can be improved through the cross-chain system used for multi-chain message table transaction processing, while ensuring the atomicity of transaction execution, so that cross-chain transactions can be executed safely and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A flowchart of a multi-chain message table transaction processing method for cross-chain in the present invention;

[0054] Figure 2 This is a 2D relay chain cross-chain model diagram of the present invention and a cross-chain process implementation diagram of its multi-chain transaction table. DETAILED DESCRIPTION

[0055] In order to clearly explain the present invention and make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the following is combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solution in the embodiments of the present invention, so that those skilled in the art can implement it according to the description. The following is a detailed description of the technology of the present invention in combination with the drawings and specific embodiments.

[0056] The multi-dimensionality of the present invention refers to (n+1) dimensions, and the multi-chain specifically refers to (n+1) chains. Among them, the first application chain includes multiple application chains, represented as application chain Atr; the first gateway may include multiple sub-gateways, represented as gateway GAtr; the first relay chain is represented as relay chain RAtr; the sub-gateway is represented as gateway Xi, located in the gateway network, and the gateway network is represented as gateway X, Xi = X1, X2, ... Xn; the second gateway can be multiple gateways, represented as GBi, GBi = GB1, GB2, ... GBn; the second relay chain can be multiple relay chains, represented as RBi, RBi = RB1, RB2, ... RBn; the second application chain can be multiple application chains, represented as application chain ABi, ABi = AB1, AB2, ... ABn; the total transaction is represented as the total transaction Tr, and its corresponding sub-transaction is represented as Tri, The Tri=Tr1, Tr2, ... Trn; the total transaction state is represented by S, and the corresponding sub-transaction sub-state si, si = s1, s2, ..., sn. In the present invention, i = 1, 2, ..., n, where n is a natural number. Specific embodiment 1:

[0058] Figure 1 A flowchart of a multi-chain message table transaction processing method for cross-chain is shown according to an implementation form of the present invention. In a cross-chain network based on an application chain, a gateway and a relay chain, the specific implementation process of the multi-chain message table transaction processing method includes:

[0059] Step 1: Client A initiates a call and sends the call request to the application chain Atr;

[0060] Step 2: The application chain Atr generates a total transaction Tr, and generates the total transaction identity information IDtr for the total transaction Tr, and sets the transaction execution status to pending (unfinished); the steps of generating the total transaction Tr include:

[0061] S2.1: Client A calls the application contract to initiate a cross-chain call;

[0062] S2.2: Pre-freeze the asset data on the application contract;

[0063] S2.3: The cross-chain contract generates the total transaction IDtr;

[0064] Among them, the account data of the application contract and the cross-chain contract are stored in the internal account book of the application chain Atr.

[0065] Step 3: Freeze data inside the application chain Atr;

[0066] Step 4: The application chain Atr sends the total transaction Tr to the gateway GAtr of client A;

[0067] Step 5: Record the status of the total transaction Tr in the memory of the gateway GAtr; wherein, three states of the total transaction Tr and its subtransactions Tri are set:

[0068] ①S=si=f:failed(Transaction execution failed), when any sub-transaction Tri is in this state, no matter how other sub-transactions are executed, the application chain Atr is notified to roll back the data;

[0069] ②S=si=p:pending(transaction is not completed), set the timeout clock threshold t. When the transaction is in pending state for a long time and exceeds the clock threshold t, call the transaction state function to change the transaction state to failed and initiate transaction rollback.

[0070] ③S=si=s: success (transaction successfully executed). When the transaction is in this state, the system notifies the application chain to submit the data. Among them: when all sub-transactions Tri are in this state, the system notifies the application chain Atr to submit the data.

[0071] The steps of each gateway querying the three states in real time and updating the same include:

[0072] S5.1: After delivering the total transaction Tr to the relay chain RAtr, the gateway GAtr will continuously (in real time) query the state S of the total transaction Tr from the multi-chain message table to see whether S=s (success);

[0073] S5.2: When the transaction status S=s is queried, the gateway GAtr will notify the application chain Atr to submit the pre-frozen data;

[0074] S5.3: When the query result is S=f(failed), notify the application chain Atr to roll back the pre-frozen data;

[0075] S4.4: When the transaction status S=p (pending, the transaction is not completed), the clock timer is triggered and the timeout starts.

[0076] The memory state of the multi-chain message table (memory state table) of the gateway GAtr is stored in the KV database (leveldb) and kept updated in real time to prevent transaction loss after the gateway is restarted.

[0077] Among them, when the gateway GAtr times out when executing the query transaction status S, the gateway GAtr sets the status S of the total transaction Tr in the relay chain RAtr to S=f(failed), and notifies the application chain Atr to roll back; when the status of the subtransaction Tri is si=f(failed) or si=s(success), the entries corresponding to the subtransaction Tri in all gateways are deleted.

[0078] Step 6: Gateway GAtr sends the total transaction Tr to the relay chain RAtr;

[0079] Step 7: The gateway GAtr queries the total transaction Tr status in the relay chain RAtr; when the gateway GAtr queries the transaction status S in the relay chain RAtr, it searches the data map in the data structure of the relay chain ledger for the corresponding key map, and finds S through the key map.

[0080] Step 8: The relay chain RAtr breaks down the total transaction Tr into sub-transactions Tri and generates sub-transaction identity information IDtri for transaction Tri. Said Tri = Tr1, Tr2, ... Trn;

[0081] Step 9: Store the sub-transaction Tri and its corresponding sub-state si and IDtri in the database message table of the relay chain RBi respectively, and store the sub-transaction Tri and its corresponding sub-state si and IDtri in the multi-chain message table of the database in the relay chain RAtr, and send it to the sub-gateway Xi in the gateway network X, where Xi is Xi=X1, X2, ...Xn;

[0082] Step 10: Gateway Xi will also continuously query the total transaction Tr status in the relay chain Atr. The total transaction Tr status S is the union of the corresponding status si of all sub-transactions in the multi-chain message table. si=s1,s2,……sn;

[0083] Step 11: Gateway Xi sends sub-transactions Tri to relay chains RBi respectively, where RBi = RB1, RB2, ... RBn;

[0084] Step 12: The relay chain RBi sends the sub-transaction Tri to the gateway GBi, where GBi = GB1, GB2, ... GBn;

[0085] Step 13: Gateway GBi sends subtransaction Tri to application chain ABi, and application chain ABi executes subtransaction Tri; when any ABi fails to execute, the total transaction Tr fails to execute, and the status si=f is modified, S={∪si}=f; wherein, after application chain ABi executes subtransaction Tri (pre-freezes the application contract data on application chain ABi), the total transaction status S and subtransaction status si change; when all application chains ABi successfully execute subtransaction Tri, the specific implementation steps of transaction status update include:

[0086] S13.1: Application chain ABi notifies gateway GBi that subtransaction Tri is executed successfully;

[0087] S13.2: Gateway GBi updates the sub-transaction Tri status si=s in the memory (success transaction is successfully executed), and notifies the relay chain RBi to update the sub-transaction Tri status si;

[0088] S13.3: The relay chain RBi updates the subtransaction Tri status si=s(success);

[0089] S13.4: Gateway Xi continuously queries all sub-transaction Tri status si on the relay chain RBi. When any si=f (failed transaction execution failure) in the query result, then At the same time, update the sub-transaction Tri status si=f(failed) in the memory message table; when the query result does not contain si=f(failed) but contains si=p(pengding transaction is not completed), then At the same time, update the sub-transaction Tri status si=p(pending) in the memory message table; when the query result is all si=s(success), then At the same time, update the sub-transaction Tri status si=s(success) in the memory message table;

[0090] S13.5: Notify the relay chain RAtr to update the sub-transaction Tri status si in the multi-chain message table;

[0091] S13.6: After receiving the notification, the relay chain RAtr updates the status si=s (success) of all sub-transactions Tri in the multi-chain message table, and then updates the status S=s of the total transaction Tr;

[0092] S13.7: Gateway GAtr and gateway Xi are constantly querying the status of the total transaction Tr. After querying S=s, they notify the application chain Atr and application chain ABi respectively. Before notifying the application chain ABi, they first notify the relay chain RBi, unfreeze the pre-frozen data, and submit the data.

[0093] Step 14: Application chain ABi, ABi = AB1, AB2, ... ABn are all executed successfully, freeze their own data, and return the execution success result to the gateway GBi;

[0094] Step 15: Gateway GBi modifies the subtransaction Tri status si=s(success);

[0095] Step 16: Gateway GBi notifies relay chain RBi to modify sub-transaction Tri status si=s(success);

[0096] Step 17: Gateway Xi continuously queries the status si of sub-transaction Tri on relay chain RBi;

[0097] Step 18: Gateway Xi notifies the relay chain RAtr to modify the sub-transaction Tri status si;

[0098] Step 19: The relay chain RAtr modifies the total transaction Tr status si = s (success);

[0099] Step 20: Gateway GAtr and gateway Xi modify the total transaction Tr status S=s(success) in their respective memories;

[0100] Step 21: Each gateway notifies each application chain to submit the modification: the gateway GAtr notifies the application chain Atr to submit the modification; the gateway Xi notifies the relay chain RBi, the relay chain RBi notifies the gateway GBi, and the gateway GBi notifies the application chain ABi to submit the modification. Specific embodiment 2:

[0102] To simplify the present invention, when n=1, the present invention is a two-chain cross-chain network under a two-dimensional relay chain model, and the implementation flow chart is as follows: Figure 2 As shown, the total transaction Tr is transaction 1, and the subtransaction Tri, where i=1, is transaction 2. Since the subtransaction of total transaction 1 is only subtransaction 2, the relay chain A updates the status of total transaction 1 to success, which means that the entire transaction call is successful. Since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Specific embodiment 3:

[0104] This embodiment proposes a cross-chain system for multi-chain message table transaction processing, and its specific implementation composition is as follows: Figure 2 As shown, the specific composition includes:

[0105] Cross-chain call initiation module: used by client A to initiate a cross-chain call and send a call request to the application chain Atr;

[0106] Transaction identity information ID generation and processing module: used to generate transaction IDtr and its sub-transaction IDtri, i=1,2,...,n, n is a natural number;

[0107] Application chain data freezing and thawing module: used to freeze and thaw data within the application chain Atr; used for Abi to freeze its own data;

[0108] Transaction sending processing module: used for application chain Atr to send the total transaction Tr to gateway GAtr; used for sending the sub-transaction Tri and its corresponding sub-state si and IDtri to gateway Xi; used for gateway Xi to send sub-transaction Tri to relay chain RBi respectively; used for relay chain RBi to send sub-transaction Tri to gateway GBi; used for gateway GBi to send sub-transaction Tri to application chain Abi; used for freezing its own data in application chain Abi and returning the execution success result to gateway GBi;

[0109] Transaction and its status and identity information storage module: used to record the total transaction Tr status in the memory of the gateway GAtr; used to relay the total transaction Tr status S and its sub-transaction Tri status si in the message table and multi-chain message table of the relay chain RAtr;

[0110] Transaction status query module: used by the gateway GAtr to query the total transaction Tr status S in the relay chain RAtr; used by the gateway Xi to continuously query the total transaction Tr status S and its sub-transaction Tri status si in the relay chain RAtr;

[0111] Total transaction disassembly module: used for the relay chain RAtr to disassemble the total transaction Tr into sub-transactions Tri, and synchronously notify the transaction identity information ID generation and processing module to generate sub-identity information IDtri, and synchronously notify the multi-chain message table and message table of the transaction and its status and identity information storage module for storage;

[0112] Transaction status modification module: used by the gateway GBi to modify the sub-transaction Tri status si; used by the relay chain RBi to modify the sub-transaction Tri status si; used by the relay chain RAtr to modify the total transaction Tr status S; used by the gateways GAtr and Xi to modify the total transaction Tr status S in their respective memories;

[0113] Transaction message notification module: used for message notification between modules; used by gateway GBi to notify relay chain RBi to modify sub-transaction Tri status si; used by gateway Xi to notify relay chain Atr to modify sub-transaction Tri status si; used by each gateway to notify each application chain to submit the modification. Specific embodiment 4:

[0115] This embodiment proposes another implementation form of a cross-chain system for multi-chain message table transaction processing, which specifically comprises an application chain, a gateway, a relay chain and a network gateway, wherein the network gateway comprises a plurality of sub-gateways, the application chain comprises at least a first application chain and a second application chain, the gateway comprises at least a first gateway and a second gateway, and the relay chain comprises at least a first relay chain and a second relay chain:

[0116] The first application chain is used to receive a call request initiated by a client, generate a total transaction, the total transaction includes total transaction identity information and total transaction status, freeze asset data, and send the total transaction to the first gateway;

[0117] The first gateway is used to receive and record the total transaction status, send the total transaction to the first relay chain, and query the total transaction status in the first relay chain;

[0118] The first relay chain is used to split the total transaction into several sub-transactions and generate corresponding sub-transaction identity information, store the sub-transactions and their corresponding sub-transaction states and sub-transaction identity information in the database message table of the second relay chain and the multi-chain message table of the first relay chain, respectively, and send them to the sub-gateway;

[0119] The sub-gateway is used to continuously query the total transaction status in the first relay chain, send the sub-transaction to the second application chain via the second relay chain and the second gateway, and continuously query the sub-transaction status on the second relay chain and notify the first relay chain to modify the sub-transaction status;

[0120] The second relay chain is used to receive the sub-transaction sent by the sub-gateway and modify the sub-transaction status, and the second relay chain includes a database message table for storing the sub-transaction and its corresponding sub-status and identity information;

[0121] The second gateway is used to modify the sub-transaction status and notify the second relay chain to modify the sub-transaction status; the second application chain is used to execute the sub-transaction. When any sub-transaction fails to execute, the overall transaction fails to execute and the status of the corresponding sub-transaction is modified. If all sub-transactions are successfully executed, their own data is frozen and the execution success result is fed back to the second gateway;

[0122] The first relay chain, the first gateway and the sub-gateway respectively modify the total transaction status stored by themselves.

[0123] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0124] The number of modules and processing scale described here are used to simplify the description of the present invention. The application, modification and variation of the multi-dimensional relay chain cross-chain model and multi-chain message table of the present invention are obvious to those skilled in the art.

[0125] The above description of the embodiments is to facilitate the understanding and application of the present invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to the above embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made to the present invention by those skilled in the art based on the disclosure of the present invention should be within the scope of protection of the present invention.

Claims

1. A multi-chain message table transaction processing method for cross-chain, applied to a cross-chain network of application chains, gateways, relay chains and network gateways, wherein the network gateway includes several sub-gateways, characterized in that: The following steps are involved: The first application link receives a call request initiated by the client, generates a general transaction, the general transaction includes the general transaction identity information and the general transaction status, freezes the asset data, and sends the general transaction to the first gateway; The generating of the total transaction comprises the following specific steps: The first gateway receives a call from the client to the application contract to initiate a cross-chain call; Pre-freeze asset data on the application contract; The cross-chain contract generates a total transaction; The asset data is stored in the ledger data of the application contract and the cross-chain contract, and the ledger data of the application contract and the cross-chain contract are stored in the internal ledger of the first application chain; The total transaction state is represented as S, the sub-transaction state is represented as si, the total transaction is represented as Tr, and the sub-transaction is represented as Tri. There are three situations for the total transaction state and the sub-transaction state, as follows: S=si=f: indicates that when any of all subtransactions is in this state, the first application chain is notified to roll back the data, where f indicates that the transaction execution failed; S=si=p: Set the timeout clock threshold. When a transaction is in the p state for a long time and exceeds the clock threshold, the transaction state is changed to f and a transaction rollback is initiated. p means that the transaction is not completed. S=si=s: indicates that when all sub-transactions are in this state, the first application chain is notified to submit data, where s indicates that the transaction is successfully executed; The first gateway receives and records the total transaction status, sends the total transaction to the first relay chain, and queries the total transaction status in the first relay chain; The first relay chain breaks down the total transaction into several sub-transactions and generates corresponding sub-transaction identity information, stores the sub-transactions and their corresponding sub-transaction states and sub-transaction identity information in the database message table of the second relay chain and the multi-chain message table of the first relay chain, respectively, and sends them to the sub-gateway; The sub-gateway continuously queries the total transaction status in the first relay chain, and sends the sub-transaction to the second application chain via the second relay chain and the second gateway; The second application chain executes sub-transactions. If any sub-transaction fails to execute, the overall transaction fails and the corresponding sub-transaction status is modified. If all sub-transactions are executed successfully, the asset data of the chain is frozen and the successful execution result is fed back to the second gateway. The second gateway modifies the sub-transaction status and notifies the second relay chain to modify the sub-transaction status; The sub-gateway continuously queries the sub-transaction status on the second relay chain and notifies the first relay chain to modify the sub-transaction status; The first relay chain, the first gateway, and the sub-gateway modify the total transaction status stored in each of them respectively, and each gateway notifies each application chain to submit the modification.

2. The multi-chain message table transaction processing method for cross-chain according to claim 1 is characterized in that: Based on the three situations of the total transaction status and sub-transaction status, the first gateway queries the multi-chain message table in real time whether the total transaction status is S=s, and then performs the following operations: When the total transaction status S=s is queried, the transaction is executed successfully, and the first gateway notifies the first application chain to submit the pre-frozen asset data; When the total transaction status S=f is queried, the transaction execution fails, and the first application chain is notified to roll back the pre-frozen asset data; When the total transaction status S=p is queried, the transaction is not completed and the timeout is counted; Among them, the memory state of the multi-chain message table of the first gateway is stored in the KV database and kept updated in real time.

3. The multi-chain message table transaction processing method for cross-chain according to claim 2 is characterized in that: When the first gateway queries the transaction status in the first relay chain, it searches for the corresponding key-value map in the data map in the data structure of the relay chain ledger, and finds the transaction status through the key-value map.

4. The multi-chain message table transaction processing method for cross-chain according to claim 3 is characterized in that: When the first gateway times out when executing the query transaction status, the first gateway sets the total transaction status in the first relay chain to S=f and notifies the first application chain to roll back; when the sub-transaction status is si=f or si=s, the entries corresponding to the sub-transaction in all gateways are deleted.

5. The multi-chain message table transaction processing method for cross-chain according to claim 1 is characterized in that: When the second application chain executes a sub-transaction, after pre-freezing the application contract data on the second application chain, the total transaction status and sub-transaction status change; when all second application chains execute sub-transactions successfully, the transaction status is updated. The specific steps include: The second application chain notifies the second gateway that the sub-transaction is successfully executed; The second gateway updates the sub-transaction status si=s in the memory, and notifies the second relay chain to update the sub-transaction status si; The second relay chain updates the sub-transaction status si=s; The sub-gateway continuously queries all sub-transaction status si on the second relay chain. When any si=f in the query result, the total transaction status S= =f, and update the sub-transaction status si=f in the memory message table at the same time; when si=f does not exist in the query result but si=p exists, the total transaction status S= =p, and update the sub-transaction status si=p in the memory message table at the same time; when the query result is all si=s, the total transaction status S= =s, and update the sub-transaction status si=s in the memory message table at the same time; Notify the first relay chain to update the sub-transaction status si in the multi-chain message table; After receiving the notification, the first relay chain updates all sub-transaction status si=s in the multi-chain message table, and then updates the total transaction status S=s; The first gateway and the sub-gateway are constantly querying the status of the total transaction. After querying the total transaction status S=s, they notify the first application chain and the second application chain respectively. Before notifying the second application chain, they first notify the second relay chain, unfreeze the pre-frozen asset data, and submit the asset data.

6. The multi-chain message table transaction processing method for cross-chain according to claim 1 is characterized in that: Each gateway notifies each application chain to submit the modification, including the following steps: The first gateway notifies the first application chain to submit the modification, the sub-gateway notifies the second relay chain and the second gateway in turn, and the second gateway notifies the second application chain to submit the modification.

7. A multi-chain message table transaction cross-chain system for cross-chain, characterized in that: It includes an application chain, a gateway, a relay chain and a network gateway, wherein the network gateway includes several sub-gateways, the application chain includes at least a first application chain and a second application chain, the gateway includes at least a first gateway and a second gateway, and the relay chain includes at least a first relay chain and a second relay chain: The first application chain is used to receive a call request initiated by a client, generate a general transaction, the general transaction includes the general transaction identity information and the general transaction status, freeze the asset data, and send the general transaction to the first gateway. The specific steps of generating the general transaction include: the first gateway receives the client calling the application contract to initiate a cross-chain call; pre-freeze the asset data on the application contract; the cross-chain contract generates a general transaction; The first gateway is used to receive and record the total transaction status, send the total transaction to the first relay chain, and query the total transaction status in the first relay chain; The first relay chain is used to split the total transaction into several sub-transactions and generate corresponding sub-transaction identity information, store the sub-transactions and their corresponding sub-transaction states and sub-transaction identity information in the database message table of the second relay chain and the multi-chain message table of the first relay chain, respectively, and send them to the sub-gateway; The sub-gateway is used to continuously query the total transaction status in the first relay chain, send the sub-transaction to the second application chain via the second relay chain and the second gateway, and continuously query the sub-transaction status on the second relay chain and notify the first relay chain to modify the sub-transaction status; The second relay chain is used to receive the sub-transaction sent by the sub-gateway and modify the sub-transaction status, and the second relay chain includes a database message table for storing the sub-transaction and its corresponding sub-status and identity information; The second gateway is used to modify the sub-transaction status and notify the second relay chain to modify the sub-transaction status; The second application chain is used to execute sub-transactions. When any sub-transaction fails to execute, the overall transaction fails to execute and the status of the corresponding sub-transaction is modified. If all sub-transactions are executed successfully, the data of the overall transaction is frozen and the successful execution result is fed back to the second gateway. The first relay chain, the first gateway, and the sub-gateway respectively modify the total transaction status stored by themselves; The asset data is stored in the ledger data of the application contract and the cross-chain contract, and the ledger data of the application contract and the cross-chain contract are stored in the internal ledger of the first application chain; The total transaction state is represented as S, the sub-transaction state is represented as si, the total transaction is represented as Tr, and the sub-transaction is represented as Tri. There are three situations for the total transaction state and the sub-transaction state, as follows: S=si=f: indicates that when any of all subtransactions is in this state, the first application chain is notified to roll back the data, where f indicates that the transaction execution failed; S=si=p: Set the timeout clock threshold. When a transaction is in the p state for a long time and exceeds the clock threshold, the transaction state is changed to f and a transaction rollback is initiated. p means that the transaction is not completed. S=si=s: indicates that when all sub-transactions are in this state, the first application chain is notified to submit data, where s indicates that the transaction is successfully executed.