Cross-chain transaction processing method and device, electronic equipment and storage medium

By selecting the shared node as the main node of the target chain in the cross-chain transaction system to perform cross-chain transaction transactions, the transaction accumulation and delay problems caused by the differences in cross-chain transaction processing capabilities are solved, and low-cost and efficient cross-chain transaction processing is achieved.

CN120378107APending Publication Date: 2025-07-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410115811.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-25
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

During cross-chain transactions, the differences in processing capabilities of different blockchains lead to transaction accumulation, delayed confirmation or transaction failure. The existing technology improves throughput and processing speed by increasing the size of the block or optimizing consensus mechanisms, but requires community consensus, which is costly and lacks flexibility and convenience.

Method used

In the cross-chain transaction system, by enabling the sharing strategy, the relay node is selected from the relay chain as the shared node, and after the shared node is campaigned as the master node of the target chain, cross-chain transactions are performed, avoiding complex consensus mechanism adjustments.

Benefits of technology

It realizes low-cost cross-chain transaction expansion, improves the flexibility and convenience of transaction processing, and improves transaction security and consistency through shared nodes on the relay chain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120378107A_ABST
    Figure CN120378107A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a cross-chain transaction processing method and device, electronic equipment and a storage medium. The method is applied to a cross-chain transaction system, and comprises the following steps: when a cross-chain gateway determines to start a sharing strategy according to a received cross-chain event, sending a sharing node creation instruction to a relay gateway; in response to the shared node creation instruction, the relay gateway selects a relay node on a relay chain as a shared node corresponding to a target chain, and the target chain is a service chain indicated by the cross-chain event and used for executing the cross-chain transaction; and after the shared node competes to become the main node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node. According to the embodiment of the invention, the processing efficiency of the cross-chain transaction can be improved, the flexibility and convenience of transaction processing are improved, the cross-chain transaction is processed through the shared node on the relay chain, and the safety of the cross-chain transaction and the consistency of the transaction state are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and particularly to a cross-chain transaction processing method and apparatus, an electronic device, and a computer storage medium. Background Art

[0002] With the development of blockchain technology, blockchain technology has been widely applied in various industries, and each industry can use a blockchain system to store resources. Different industries can provide different services for target objects. To achieve resource transfer between different services, cross-chain technology has emerged. Cross-chain technology can promote inter-chain collaborative work between different blockchain systems.

[0003] When performing cross-chain transactions, there are differences in the processing capabilities of different blockchains, which will trigger congestion problems and a series of related impacts. In particular, the processing capabilities of the blockchains corresponding to cross-chain transactions are particularly critical. When a large number of transaction requests flood in, the transaction processing speed on the chain is affected, increasing the likelihood of cross-chain transaction backlogs, delayed confirmations, or transaction failures.

[0004] In the implementation of the prior art, generally by increasing the block size, optimizing the consensus mechanism, or introducing a second-layer scaling solution, the throughput and processing speed of the chain can be improved. However, changing the block size may require reaching an agreement through community consensus, and different stakeholders may have different opinions on this, thus requiring a large amount of time and cost for negotiation, communication, and reaching a consensus. This increases the cost of cross-chain transactions and reduces the flexibility and convenience of cross-chain transactions. Therefore, how to improve the flexibility and convenience of cross-chain transaction processing is a technical problem that those skilled in the art need to continuously study. Summary of the Invention

[0005] To solve the above technical problems, embodiments of the present application provide a cross-chain transaction processing method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.

[0006] According to one aspect of the embodiments of the present application, a cross-chain transaction processing method is provided, which is applied to a cross-chain transaction system. The cross-chain transaction system includes multiple business chains and a relay chain. The business chains are connected to cross-chain gateways, and the relay chain is connected to relay gateways. The cross-chain gateways are also connected to the relay gateways. The method includes:

[0007] When the cross-chain gateway determines to enable the sharing policy according to the received cross-chain event, it sends a shared node creation instruction to the relay gateway;

[0008] In response to the shared node creation instruction, the relay gateway selects a relay node on the relay chain as the shared node corresponding to the target chain, where the target chain is the business chain indicated by the cross-chain event for performing cross-chain transactions.

[0009] After the shared node is elected as the primary node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node.

[0010] According to one aspect of the application embodiments, a cross-chain transaction processing apparatus is provided, which is applied to a cross-chain transaction system. The cross-chain transaction system includes multiple business chains and a relay chain. The business chains are connected to cross-chain gateways, the relay chain is connected to a relay gateway, and the cross-chain gateways are also connected to the relay gateway. The apparatus includes:

[0011] An instruction sending module, configured to send a shared node creation instruction to the relay gateway when the cross-chain gateway determines to enable a sharing policy according to the received cross-chain event;

[0012] An instruction response module, configured to, in response to the shared node creation instruction, the relay gateway selects a relay node on the relay chain as the shared node corresponding to the target chain, and the target chain is the business chain for executing the cross-chain transaction indicated by the cross-chain event;

[0013] A transaction sending module, configured to, after the shared node is elected as the primary node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node.

[0014] According to one aspect of the application embodiments, an electronic device is provided, including: one or more processors; a storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device is enabled to implement the cross-chain transaction processing method as described above.

[0015] According to one aspect of the application embodiments, a computer-readable storage medium is provided, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor of a computer, the computer is enabled to execute the cross-chain transaction processing method as described above.

[0016] According to one aspect of the application embodiments, a computer program product is further provided, including a computer program, and when the computer program is executed by a processor, the steps in the cross-chain transaction processing method as described above are implemented.

[0017] In the technical solution provided by the embodiments of the present application, in the case of enabling the sharing policy, by selecting a relay node from the relay chain as the shared node, and after the shared node is elected as the primary node corresponding to the target chain, the cross-chain transaction is processed through the shared node, so as to achieve the expansion of the target chain in a low-cost manner. Compared with the prior art, the flexibility and convenience of executing the cross-chain transaction processing in the present application are also higher.

[0018] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit this application. Brief Description of the Drawings

[0019] The drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application. Obviously, the drawings in the following description are only some embodiments of this application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts. In the drawings:

[0020] Figure 1 is a schematic structural diagram of a blockchain system shown in an exemplary embodiment;

[0021] Figure 2 is a schematic diagram of the implementation environment of one-to-one cross-chain transactions in a cross-chain transaction system shown in an exemplary embodiment of this application;

[0022] Figure 3 is a schematic diagram of the connection relationship between blocks in a blockchain;

[0023] Figure 4 is a flowchart of a cross-chain transaction processing method shown in an exemplary embodiment of this application;

[0024] Figure 5 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0025] Figure 6 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0026] Figure 7 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0027] Figure 8 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0028] Figure 9 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0029] Figure 10 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0030] Figure 11 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of this application;

[0031] Figure 12 It is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application;

[0032] Figure 13 It is a flowchart of a cross-chain transaction processing method proposed according to an exemplary application scenario;

[0033] Figure 14 It is a block diagram of a cross-chain transaction processing device shown in an exemplary embodiment of the present application;

[0034] Figure 15 It shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners

[0035] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0036] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit including the function of the module or unit.

[0037] The block diagrams shown in the drawings are only functional entities, and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0038] The flowcharts shown in the drawings are only exemplary illustrations, and do not necessarily include all the contents and operations / steps, nor do they necessarily need to be executed in the described order. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.

[0039] As used in this application, "a plurality of" means two or more. " / or" describes the relationship between associated objects and indicates that there can be three relationships. For example, A / or B can represent: A exists alone, both A and B exist simultaneously, and B exists alone. The character " / " generally indicates an "or" relationship between the associated objects before and after.

[0040] First, it should be noted that the embodiments of this application relate to blockchain technology. Blockchain technology is a brand-new distributed infrastructure and computing method that uses a block-chain data structure to verify and store data, uses a distributed node consensus algorithm to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses smart contracts composed of automated script code to program and operate data. A blockchain refers to an infrastructure that is decentralized and has the characteristics of distributed storage. Specifically, it is a data structure that organizes data blocks in a linked list-like manner according to time sequence, can securely store data with a sequential relationship that can be verified within the system, and uses cryptography to ensure that the data cannot be tampered with or forged. Simply put, a blockchain is a decentralized distributed ledger, and each chain is equivalent to an independent ledger.

[0041] Figure 1 It is a schematic structural diagram of a blockchain system shown in an exemplary embodiment. Figure 1 The blockchain system 100 shown may include node devices 10a, 10b, 10c, and 10d. Among them, the node devices 10a, 10b, 10c, and 10d are all Figure 1 blockchain nodes (simply referred to as nodes) in the blockchain system 100 shown. These nodes can be any form of computing device connected to the blockchain system 100, such as servers, user terminals, etc. Figure 1 The node devices 10a, 10b, 10c, and 10d shown can also be connected through network communication to form the blockchain system 100.

[0042] Figure 1In the architecture of the blockchain system 100 shown, the types of blockchains involved may specifically include: public blockchains (Public Blockchain), private blockchains (Private Blockchain), and consortium blockchains (Consortium Blockchain). The types of blockchains adopted in different blockchain application scenarios may vary, and no restrictions are imposed here. Among them, a public blockchain refers to a blockchain that can be made publicly available, and anyone can join and access it; the blocks on a public blockchain can be viewed by anyone, and anyone can also initiate transactions on the public blockchain and participate in the consensus process of the public blockchain at any time. A private blockchain refers to a blockchain that can be used within a private organization, and the read / write permissions and the permissions to participate in bookkeeping on the blockchain can be formulated according to the rules of the private organization; it is usually used for internal data management, auditing, etc. in enterprises. A consortium blockchain refers to a blockchain where the read / write permissions and the rights to participate in bookkeeping of the consortium members participating in the consortium blockchain can be formulated according to the consortium rules; it is generally used in scenarios such as transactions, settlements, or clearings between institutions.

[0043] Each node in the blockchain system 100 has its corresponding node identifier, and each node in the blockchain system 100 can store the node identifiers of other nodes in the blockchain system 100, so that subsequent blocks generated can be broadcast to other nodes in the blockchain system 100 according to the node identifiers of other nodes. Each node in the blockchain system 100 stores the same blockchain (see the blockchain 10e shown in Figure 1 ), so the blockchain system 100 can also be referred to as a data sharing system.

[0044] As mentioned above, with the development of blockchain technology, blockchain technology has been widely applied in various industries, and each industry can adopt a blockchain system to store resources. Different industries can provide different services for target objects. In order to achieve resource transfer between different services, cross-chain technology has emerged. Cross-chain technology can promote inter-chain collaborative work between different blockchain systems. When conducting cross-chain transactions, there are differences in the processing capabilities of different blockchains, which will trigger congestion problems and a series of related impacts. In particular, the processing capabilities of the blockchains corresponding to cross-chain transactions are particularly crucial. When a large number of transaction requests flood in, the transaction processing speed on the chain is affected, increasing the likelihood of cross-chain transaction backlogs, delayed confirmations, or transaction failures.

[0045] In the implementation of the prior art, the throughput and processing speed of the chain can be increased by increasing the block size, optimizing the consensus mechanism, or introducing a second-layer scaling solution. However, changing the block size may require reaching an agreement through community consensus, and different stakeholders may have different opinions on this, which may consume a large amount of time and effort for negotiation, communication, and reaching a consensus; optimizing the transaction mechanism by sorting transaction priorities and reducing the transaction fee control mechanism may require adjusting the underlying protocol and smart contracts and ensuring compatibility with other components.

[0046] Figure 2 This is a schematic diagram of a simple one-to-one cross-chain process in a cross-chain transaction system. As Figure 2 shown, the user initiates a cross-chain transaction request through any business chain. When the cross-chain gateway corresponding to the business chain detects a cross-chain event on the business chain, it generates a corresponding cross-chain request based on the cross-chain event and sends it to the relay gateway, so as to push the cross-chain corresponding to the cross-chain request to the target chain that executes the cross-chain event through the relay gateway. At the same time, the relay gateway also sends the cross-chain transaction to the relay chain for on-chain processing, and then processes the cross-chain transaction through calling the business contract on the target chain and returns the transaction result to the corresponding cross-chain gateway, so as to return the transaction result to the relay gateway through the cross-chain gateway, and then push the transaction result to the relay chain through the relay gateway to update the transaction status of the corresponding cross-chain transaction on the relay chain.

[0047] Please participate in Figure 3 , Figure 3 This is an exemplary schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction records stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected through the hash value to form a blockchain. In addition, the block may also include information such as the timestamp when the block is generated. A blockchain is essentially a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.

[0048] In an exemplary embodiment, when the cross-chain gateway receives a cross-chain event, the cross-chain gateway determines whether to enable the sharing policy according to the received cross-chain event. When the cross-chain grid determines to enable the sharing policy according to the received cross-chain event, the cross-chain gateway sends a shared node creation instruction to the relay gateway. The relay gateway responds to the shared node creation instruction, selects a relay node from the relay chain as the shared node corresponding to the target chain, where the target chain is the business chain for executing the cross-chain transaction indicated by the cross-chain event. After the shared node is elected as the primary node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node to execute the cross-chain transaction through the shared node, which improves the flexibility and convenience of cross-chain transaction processing, reduces the transaction cost, and executes the cross-chain transaction through the relay node on the relay chain, which improves the security of the cross-chain transaction process.

[0049] It should be noted that the data related to users such as accounts and transaction objects involved in this application, when the method of this application is applied to specific products or technologies, are all obtained with the permission or consent of the users, and the extraction, use and processing of the relevant data comply with the local security standards and the provisions of local laws and regulations.

[0050] See Figure 4 , Figure 4 is a flowchart of a cross-chain transaction processing method shown in an exemplary embodiment of this application. This method can be applied to the implementation environment shown in FIG. 2.

[0051] As Figure 2 In the cross-chain transaction system shown, there are multiple business chains and a relay chain. The business chains are connected to the cross-chain gateway, the relay chain is connected to the relay gateway, and the cross-chain gateway is also connected to the relay gateway.

[0052] As Figure 4 shown, in an exemplary embodiment, the cross-chain transaction processing method may include steps S410 to S430, which are introduced in detail as follows:

[0053] Step S410, when the cross-chain gateway determines to enable the sharing policy according to the received cross-chain event, it sends a shared node creation instruction to the relay gateway.

[0054] It should be noted that the transaction object mentioned in the embodiments of this application refers to an object that can be traded as a commodity on the Internet, including but not limited to at least one of pictures, songs, game props, videos, NFTs, etc. Among them, NFT is a digital asset. Blockchain technology can be used to generate digital vouchers for specific works, artworks, commodities, etc., and on the basis of protecting their digital copyrights, realize digital issuance, purchase, collection, use and trading, etc. Among them, NFTs can be issued based on protocols such as ERC721.

[0055] A smart contract refers to a computer program stored on a blockchain that can automatically execute the terms of the smart contract and has characteristics such as event-driven, value transfer, and automatic execution.

[0056] An account refers to an address used to represent a user's identity and can be used to store the user's assets (e.g., trading objects), similar to a wallet. In a blockchain network, there are usually two types of accounts. One is an EOA (Externally Owned Account), which is an address controlled by a private key. This address can be used to store assets, and users can initiate transactions for the assets in the account based on the private key. The other is a smart contract account, which is a special smart contract. The smart contract address can be used to store assets, and the controller of the account can initiate transactions for the assets stored in the account.

[0057] In order to transfer multiple trading objects in a single transaction, an association request for multiple trading objects can be initiated in the blockchain network. After receiving the association request, the blockchain node can obtain the smart contract account and associate each of the multiple trading objects with the smart contract account to associate the multiple trading objects. Among them, the association request can be initiated by the user or automatically initiated by a related program when it detects that the conditions are met.

[0058] Among them, an association request can be initiated for each trading object, and each association request contains the identification information of a trading object to associate the corresponding trading object with the smart contract account according to the association request; or, an association request can also be initiated for multiple trading objects, and the association request contains the identification information of multiple trading objects to associate the multiple trading objects with the smart contract account according to the association request. Among them, the identification information of the trading object refers to the information that can uniquely identify the trading object. For example, for an NFT, its identification information can be the tokenId (token identification number).

[0059] The specific method of associating the trading object with the smart contract account can be flexibly set according to actual needs. In an exemplary example, the identification information of the trading object can be written into the smart contract account; or, in another exemplary example, the trading object can be transferred from the account to which the trading object belongs to the smart contract account. Specifically, please refer to the subsequent records and will not be elaborated here.

[0060] Exemplarily, before performing the association, the blockchain node may also authenticate the association request to determine whether the initiator of the association request has the permission to associate the transaction object. If the permission is available, the blockchain node responds to the association request to associate the transaction object with the smart contract account. If the permission is not available, the blockchain node rejects the association request. Among them, it may be determined that the initiator of the association request has the permission to associate the transaction object when the initiator of the association request matches the account to which the transaction object belongs, or when the initiator of the association request has the authorization of the account to which the transaction object belongs. It should be noted that the specific method for verifying whether the initiator of the association request has the permission can be flexibly set according to actual needs. In an exemplary example, the association request may include signature data generated based on a private key. The blockchain node may search for the public key corresponding to the account to which the transaction object belongs and verify the signature data according to the public key. If the verification is successful, it indicates that the initiator of the association request has the permission; if the verification fails, it indicates that the initiator of the association request does not have the permission.

[0061] As mentioned above, in the cross-chain transaction system, the client initiates a cross-chain transaction operation on the business chain. When the cross-chain gateway corresponding to the business chain detects a cross-chain event caused by the cross-chain transaction operation on the business chain, the cross-chain gateway corresponding to the business chain will, after detecting the cross-chain event, send a corresponding cross-chain request to the relay gateway in the cross-chain transaction system. After the relay gateway receives the cross-chain request, it will forward the cross-chain request to the cross-chain gateway corresponding to the business chain that executes the cross-chain transaction.

[0062] Exemplarily, the cross-chain gateway corresponding to the business chain that executes the cross-chain transaction receives the cross-chain request. The cross-chain gateway will determine whether to start the sharing policy according to the cross-chain event corresponding to the received cross-chain request. Among them, the cross-chain request includes the cross-chain event. If the cross-chain gateway determines that it is necessary to start the sharing policy according to the cross-chain event, the cross-chain gateway sends a shared node creation instruction to the relay gateway. The creation of the shared node can be used to assist the business chain that executes the cross-chain transaction to execute the cross-chain transaction.

[0063] Exemplarily, in some realizable embodiments, after the cross-chain gateway receives the cross-chain event, it directly triggers the enabling of the sharing policy. That is to say, when the cross-chain gateway receives the cross-chain event pushed by the relay gateway, it sends a shared node creation instruction to the relay gateway to select a relay node from the relay chain as the shared node through the relay gateway.

[0064] Exemplarily, the cross-chain event includes a transaction to be processed, as well as the account, target transaction object, smart contract, association identifier, etc. corresponding to the transaction to be processed.

[0065] Step S420: In response to the shared node creation instruction, the relay gateway selects a relay node on the relay chain as the shared node corresponding to the target chain, where the target chain is the business chain for executing cross-chain transactions indicated by the cross-chain event.

[0066] As described above, in the cross-chain transaction system, when the cross-chain gateway corresponding to the business chain executing the cross-chain transaction determines to enable the sharing policy according to the received cross-chain time, it will send a shared node creation instruction to the relay gateway. Subsequently, in response to the shared node creation instruction, the relay gateway will select a relay node from the corresponding relay chain as the shared node corresponding to the target chain for executing the cross-chain transaction. Moreover, the number of shared nodes can be one or multiple, and in this embodiment, the number of created shared nodes is not limited.

[0067] In addition, in some exemplary embodiments, the corresponding shared nodes can be selected from the relay chain according to the consensus algorithm adopted by the relay chain. For example, if the TBFT consensus algorithm is adopted on the relay chain, to balance the load on the relay chain, a node can be randomly selected from the relay chain as the shared node.

[0068] It should be noted that the TBFT consensus algorithm is an algorithm based on Byzantine fault tolerance and supports a fault tolerance rule of 3f + 1. Due to the particularity of the main node's block packaging, if a slave node discovers inconsistency when verifying a proposal, it will generate and broadcast a special vote (NilBlockHash). If NilBlockHash meets the 3f + 1 rule, the block is considered invalid, and a master node replacement operation is performed to generate a new block. This type of random function transaction exists in the transaction pools of each node. If TBFT fails to reach an agreement and switches a node to be the master node, then the next node will also repackage this transaction into the proposal and broadcast it to other slave nodes for consensus. Eventually, when each node becomes the master node, it may package this type of random function transaction into the proposal and broadcast it to the slave nodes for consensus, resulting in the inability to reach a consensus.

[0069] Exemplarily, in response to the shared node creation instruction sent by the cross-chain gateway, the relay gateway selects a corresponding node from the relay chain as the shared node of the target chain for executing the cross-chain transaction. Among them, the performance parameters, permission parameters, etc. corresponding to the nodes on the relay chain can be used as the basis for selecting the shared node.

[0070] Step S430: After the shared node competes to become the master node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node.

[0071] Exemplarily, by selecting corresponding relay nodes in the relay chain as the shared nodes of the target chain for executing cross-chain transactions, the shared nodes can then initiate a proposal to run for the master node on the target chain corresponding to the executed cross-chain transactions. After the proposal to run for the master node initiated passes, the cross-chain gateway will send the cross-chain transactions to the shared nodes to execute the cross-chain transactions through the shared nodes, thereby alleviating the high load on the target chain for executing cross-chain transactions and solving the problem of transaction jams caused by excessive cross-chain transactions.

[0072] Exemplarily, the relay gateway responds to the shared node creation instruction and randomly selects one or more relay nodes from the relay chain as the shared nodes of the target chain, or selects idle relay nodes from the relay chain as the shared nodes of the target chain, or selects preset relay nodes as the shared nodes of the target chain, or selects one or more relay nodes from the relay chain based on the stable performance image of each node on the relay chain as the shared nodes of the target chain. Here, the present embodiment does not limit the selection method of the shared nodes.

[0073] Exemplarily, when a large number of transaction requests flood into the target chain, the transaction processing speed on the chain will be affected, which will further affect the accumulation, delay, and even failure of transactions on the target chain. Then, after the cross-chain gateway determines to start the sharing strategy based on the received cross-chain event, it sends a shared node creation instruction to the corresponding relay gateway. The relay gateway receives the shared node creation instruction and responds to the shared node creation instruction. Then, the relay gateway selects relay nodes from the relay chain as the shared nodes of the target chain for executing cross-chain transactions. Thus, after the shared nodes become the master nodes corresponding to the target chain, the cross-chain gateway will send the cross-chain transactions to be processed to the shared nodes, enabling the shared nodes to execute the cross-chain transactions to be processed. Correspondingly, after the shared nodes are elected as the master nodes corresponding to the target chain, the shared nodes will continuously produce blocks to increase the transaction processing capacity of the shared nodes.

[0074] In Figure 4 In the present embodiment shown, in the cross-chain transaction system, when the cross-chain gateway determines to enable the sharing strategy based on the received cross-chain time, it sends a shared node creation instruction to the relay gateway to expand the target chain for executing transaction tasks by selecting shared nodes through the relay gateway. The relay gateway responds to the creation instruction of the shared nodes and selects relay nodes from the relay chain as the shared nodes corresponding to the target chain, thereby avoiding complex processes such as increasing the block size of the target chain or optimizing the consensus mechanism. Then, after the shared nodes on the relay chain are elected as the master nodes corresponding to the target chain, the cross-chain gateway can send the cross-chain transactions to the shared nodes to execute the cross-chain transaction process. It can be seen that the operation method based on shared nodes in this application is simpler and requires less resources, and can improve transaction processing efficiency.

[0075] In an exemplary embodiment, please refer to Figure 5 , Figure 5 which is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to Figure 2 the implementation environment shown in Figure 2 and can be executed by the cross-chain gateway in the implementation environment shown in

[0076] As Figure 5 shown, this method includes step S500, as well as step S510 and step S520, which are introduced in detail as follows:

[0077] Step S510: Compare the number of transactions to be processed with a preset quantity threshold, and compare the queuing duration of the transactions to be processed with a preset duration threshold.

[0078] Exemplarily, during the cross-chain transaction process, the cross-chain gateway corresponding to the target chain executing the cross-chain transaction parses according to the received cross-chain event, determines the number of transactions to be processed on the target chain and the queuing duration of the transactions to be processed according to the parsing result. Further, the cross-chain gateway compares the number of transactions to be processed with a preset quantity threshold, and compares the queuing duration of the transactions to be processed with a preset duration threshold. If the number of transactions to be processed is greater than the preset quantity threshold, or the queuing duration of the transactions to be processed is greater than the preset duration threshold, the cross-chain gateway corresponding to the target chain executing the cross-chain transaction determines to enable the sharing strategy.

[0079] Exemplarily, in some implementable embodiments, the queuing duration of the transactions to be processed can be determined by the queuing duration of the transaction with the earliest timestamp in the queue of transactions to be processed. Exemplarily, the cross-chain gateway determines the transaction to be processed with the earliest timestamp in the cross-chain transaction event according to the timestamps corresponding to the received cross-chain transactions, calculates the queuing duration corresponding to this transaction based on the timestamp corresponding to this transaction and the time node of the current moment, and then obtains the queuing duration of the transactions to be processed.

[0080] Exemplarily, in some implementable embodiments, the queuing duration of the transactions to be processed can be determined by the average value, median, mode, etc. of the queuing durations of the transactions to be processed in the cross-chain transaction event. Exemplarily, the cross-chain gateway uses the average value of the queuing durations of the transactions to be processed in the received cross-chain transaction event as the queuing duration of the transactions to be processed, and then compares the average value of the queuing durations of the transactions to be processed with the preset queuing duration threshold.

[0081] Step S520: If the number of transactions to be processed is greater than the quantity threshold, or the queuing duration of the transactions to be processed is greater than the duration threshold, the cross-chain gateway determines to enable the sharing strategy.

[0082] Exemplarily, if the cross-chain gateway corresponding to the target chain for executing the transaction to be processed detects that the number of transactions to be processed at the current moment is greater than the preset threshold of the number of transactions to be processed, it indicates that the resources on the target chain for executing the transaction to be processed are tense and the processing capacity is low, and the transaction to be processed cannot be effectively processed. Then, the cross-chain gateway determines to activate the sharing strategy. In some realizable embodiments, if the cross-chain gateway corresponding to the target chain for executing the cross-chain transaction detects that the queuing duration of the transaction to be processed at the current moment is greater than the preset threshold of the queuing duration of the transaction to be processed, it indicates that the resources on the target chain for executing the transaction to be processed are tense and the processing capacity is low, and the transaction to be processed cannot be effectively processed. Then, the cross-chain gateway determines to activate the sharing strategy.

[0083] Exemplarily, if the cross-chain gateway corresponding to the target chain for executing the transaction to be processed detects that the number of transactions to be processed at the current moment is greater than the preset threshold of the number of transactions to be processed, and the queuing duration of the transaction to be processed is also greater than the preset queuing duration threshold, it indicates that the resources on the target chain for executing the transaction to be processed are precise, the processing capacity does not match the resources required for the transaction to be processed, resulting in the blockage of the transaction to be processed. Then, the cross-chain gateway determines to enable the sharing strategy.

[0084] In Figure 5 In the present embodiment shown, the cross-chain gateway parses the received cross-chain event, compares the number of transactions to be processed in the cross-chain event with the preset quantity threshold, and compares the queuing duration of the transaction to be processed with the preset duration threshold. Then, according to the comparison result, it determines whether to enable the sharing strategy to better meet the current cross-chain transaction requirements, avoid resource shortage and resource waste, and make the processing process of the cross-chain transaction more flexible.

[0085] In an exemplary embodiment, refer to Figure 6 , Figure 6 is the flowchart of the cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to Figure 3 the implementation environment shown, which can be executed by the cross-chain gateway in the Figure 1 shown implementation environment.

[0086] As Figure 6 shown, this method further includes step S500 and step S510, as well as steps S610 to S630, which are introduced in detail as follows:

[0087] Step S610, if the cross-chain gateway determines not to enable the sharing strategy according to the cross-chain event, then it detects whether the continuous block production quantity of the set primary node in the target chain is the default value;

[0088] Continuing from the above embodiments, the cross-chain gateway parses the received cross-chain events, determines the number of transactions to be processed on the target chain and the queuing duration of the transactions to be processed based on the parsing results. Further, the cross-chain gateway compares the number of transactions to be processed with a preset quantity threshold, and compares the queuing duration of the transactions to be processed with a preset duration threshold. If the number of transactions to be processed is not greater than the preset quantity threshold, or the queuing duration of the transactions to be processed is not greater than the preset duration threshold, the cross-chain gateway corresponding to the target chain for executing the cross-chain transaction determines to enable the sharing strategy.

[0089] Exemplarily, in some implementable embodiments, the cross-chain gateway corresponding to the target chain for executing the cross-chain transaction parses the received cross-chain transaction events. If the cross-chain gateway determines the number of transactions to be processed and the queuing duration of the transactions to be processed based on the parsing results, where if the number of transactions to be processed detected by the cross-chain gateway is not greater than the preset transaction quantity threshold, the cross-chain gateway determines not to enable the sharing strategy; or if the queuing duration of the transactions to be processed detected by the cross-chain gateway is not greater than the preset transaction queuing duration, the cross-chain gateway determines not to enable the sharing strategy; or if the number of transactions to be processed detected by the cross-chain gateway is not greater than the preset transaction quantity threshold and the queuing duration of the transactions to be processed is not greater than the preset queuing duration threshold, the cross-chain gateway determines not to enable the sharing strategy.

[0090] Exemplarily, after the cross-chain gateway determines not to enable the sharing strategy, it is necessary to detect whether the continuous block production quantity of the primary node set in the target chain for executing the cross-chain transaction is the default value. Specifically, the primary node in the target blockchain is the main execution node for executing the cross-chain transaction. Among them, the processing ability of the primary node for transactions mainly depends on the block production ability of the primary node. On the one hand, the block production ability of the primary node can be reflected in the continuous block production quantity of the primary node. When the cross-chain gateway determines not to enable the sharing strategy based on the cross-chain events, it indicates that the current number of transactions to be processed does not exceed the preset quantity threshold, or the current queuing duration of the transactions to be processed does not exceed the preset queuing duration, which indicates that the current target chain has the ability to independently process the transactions to be processed, and then it is necessary to determine whether the continuous block production quantity of the primary node set in the current target chain is the default value.

[0091] Among them, the primary node set in the current target chain can be determined by random selection. That is to say, one or more nodes are randomly selected from the current target chain as the primary nodes for executing the transactions to be processed. After the one or more nodes are elected as the primary nodes on the target chain, the primary nodes propose a proposal for continuous block production on the target chain. When the proposal for continuous block production passes, the primary nodes perform continuous block production, and then the cross-chain gateway sends the transactions to be processed to the primary nodes to execute the transactions to be processed through the primary nodes.

[0092] Exemplarily, in some realizable embodiments, the primary node set in the current target chain can also be determined by the performance stability of the nodes in the current target chain, that is, one or more nodes can be selected as the primary nodes for executing the pending transactions according to the performance stability of each node participating in consensus in the target chain.

[0093] It should be noted that the block generation ability of a blockchain refers to the process of packaging new transactions into a block and adding it to the blockchain. This process needs to be verified to ensure the security and reliability of the blockchain network. In a blockchain, each block must be verified before it can be added to the chain. This verification process is completed through computer algorithms, which is called "proof of work". In addition to proof of work, there are other blockchain verification mechanisms, such as proof of stake and proof of authority. The purpose of these mechanisms is to ensure the security and reliability of the blockchain network.

[0094] In a blockchain, each block contains a certain number of transaction records, and these transaction records are the block generation data. These data will be encrypted and packaged into a block, and then broadcast to other nodes through the network for verification and storage. Each node will verify whether this block conforms to the rules, and if it does, it will add it to its own blockchain.

[0095] To ensure the integrity and security of data, the blockchain uses the method of hash pointers for linking. Each block contains a hash pointer to the previous block, thus forming an immutable chain structure. If one wants to tamper with the data in a certain block, then it is necessary to recalculate the hash pointers of all subsequent blocks, which is very difficult.

[0096] In short, the block generation ability of the blockchain is one of the key factors to ensure the security and reliability of the blockchain network. By verifying the block generation process, the blockchain network can ensure that each block is valid, thereby preventing malicious attacks and fraud. At the same time, the block generation and verification processes are also the core mechanisms of the blockchain network, which ensure the decentralized and distributed characteristics of the blockchain.

[0097] Step S620, if it is yes, directly send the cross-chain transaction to the current primary node in the target chain;

[0098] Exemplarily, if it is detected that the number of consecutive blocks produced by the designated primary node in the target chain is the default block production number, the cross-chain gateway directly sends the cross-chain transaction to the current primary node in the target chain, so as to execute the cross-chain transaction through the current primary node in the target blockchain. Among them, before the current primary node in the target chain executes the cross-chain transaction, the current primary node in the blockchain needs to propose a consecutive block production proposal in the blockchain, where the number of consecutive blocks produced is the default value, and the size of the default value can be determined based on the number of currently pending transactions, or can be determined according to the consensus mechanism corresponding to the current target chain; after the consensus nodes on the current target chain pass the proposal of the consecutive proposal of the primary node, the primary node makes consecutive proposals up to the default value, and then the cross-chain gateway pushes the pending cross-chain transaction to the primary node.

[0099] Step S630, if the answer is no, then after changing the number of consecutive blocks produced by the designated primary node in the target chain to the default value, the cross-chain transaction is sent to the current primary node in the target chain, so as to execute the cross-chain transaction through the current primary node.

[0100] Exemplarily, if it is detected that the number of consecutive blocks produced by the designated primary node in the target chain is not the default block production number, the designated primary node in the target chain will initiate a proposal to modify the number of consecutive blocks produced by the primary node to the default value, and after the consensus nodes on the target chain pass the proposal to modify the number of consecutive blocks produced by the primary node to the default value, the current primary node on the target chain makes the default value of consecutive block production, and then the cross-chain gateway pushes the cross-chain transaction to the current primary node on the target chain.

[0101] In Figure 6 the illustrated embodiment, when the cross-chain gateway determines not to enable the sharing policy according to the cross-chain event, it indicates that the number of currently pending cross-chain transactions is not large, and the target chain has the ability to complete independently. Therefore, it is necessary to modify the number of consecutive blocks produced by the current primary node in the target chain to the default value to avoid resource waste and improve the efficiency of cross-chain transactions.

[0102] It improves the flexibility and convenience of transactions, reduces transaction costs, and moreover, realizes transactions through smart contracts, improving the security of transactions.

[0103] Further, in an exemplary embodiment, refer to Figure 7 , Figure 7 which is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to Figure 2 the illustrated implementation environment, which can be executed by Figure 2 the blockchain node 120 in the illustrated implementation environment.

[0104] As Figure 7As shown, the method includes steps S710 - S720, and steps S610 - S620. Among them, the detailed introduction of steps S710 - S720 is as follows:

[0105] Step S710: When the cross - chain gateway receives the transaction result returned by the current primary node, it sends the transaction result to the relay gateway.

[0106] Step S720: After the relay gateway receives the transaction result, the relay gateway sends the transaction result to the relay chain to update the transaction status of the cross - chain transaction based on the relay nodes on the relay chain.

[0107] When the cross - chain gateway sends a cross - chain transaction to the current primary node on the target chain, the primary node parses and executes the cross - chain transaction. To improve the reliability of the transaction, a target transaction object is set. Only when a transaction request for the target transaction object is initiated, will multiple transaction objects be transferred to the object transfer - in account together. Among them, which specific transaction object among the multiple transaction objects is selected as the target transaction object can be flexibly set according to actual needs. The target transaction object can be selected by the user or by the blockchain node.

[0108] In an exemplary example, the dependent transaction object can be selected as the target transaction object according to the dependency between multiple transaction objects. For example, in a game scenario, game equipment depends on the game character. Therefore, the game character can be used as the target transaction object, so that the game character and the game equipment can be traded together. Another example is that the clothes of a teddy bear depend on the teddy bear. Therefore, the teddy bear can be used as the target transaction object. Another example is that video subtitles depend on the video. Therefore, the video can be used as the target transaction object.

[0109] Therefore, after the current primary node on the cross - chain gateway receives a transaction request for any transaction pair in the cross - chain transaction, it can call the corresponding transaction contract and find the transaction - initiating account corresponding to the transaction request.

[0110] The current primary node on the target chain returns the transaction result corresponding to the cross - chain transaction to the cross - chain gateway. Then the cross - chain gateway sends the received transaction result to the relay gateway. After the relay gateway receives the transaction result, the relay gateway sends the transaction result to the relay chain, thereby updating the status of the cross - chain transaction through the relay nodes on the relay chain.

[0111] Exemplarily, the cross-chain transaction request may include signature data generated based on the private key corresponding to the transaction initiating account. The public key corresponding to the controller of the smart contract account can be obtained, and the signature data can be verified based on this public key. If the verification is successful, it indicates that the transaction initiating account matches the controller of the smart contract account; if the verification fails, it indicates that the transaction initiating account does not match the controller of the smart contract account. Alternatively, the transaction initiating account can also be directly compared with the smart contract account. If the two are the same, it indicates that the transaction initiating account matches the controller of the smart contract account; if the two are different, it indicates that the transaction initiating account does not match the controller of the smart contract account.

[0112] If the transaction initiating account matches the controller of the smart contract account and any transaction object corresponding to the transaction request matches the target transaction object (i.e., any transaction object is the target transaction object), it indicates that the transaction initiating account has the permission to call the smart contract corresponding to the smart contract account to transfer the transaction object. And since multiple transaction objects need to be transferred, the smart contract corresponding to the smart contract account is called to transfer the ownership of the multiple transaction objects to the object transfer-in account corresponding to the transaction request.

[0113] In Figure 7 In the illustrated embodiment, the current primary node on the target chain returns the transaction result obtained after processing the cross-chain transaction to the cross-chain gateway, so as to send the transaction result to the relay gateway through the cross-chain gateway, and update the transaction result to the relay chain through the relay gateway, thereby ensuring the accuracy, security, and synchronization of the cross-chain transaction. To achieve real-time status synchronization between the relay chain and the target chain, maintain consistency between the two chains, and avoid potential risks brought by data inconsistency.

[0114] In an exemplary embodiment, referring to Figure 8 , Figure 8 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to Figure 2 the illustrated implementation environment, which can be executed by the cross-chain gateway in the Figure 2 illustrated implementation environment.

[0115] As Figure 8 shown, this method includes step S420, and steps S810 and S820. Among them, steps S810 and S820 are introduced in detail as follows:

[0116] Step S810, the cross-chain gateway verifies whether the shared node is eligible to participate in the consensus process on the target chain according to the interface parameters of the shared node. If so, a consensus instruction is sent to the shared node.

[0117] Specifically, when the cross-chain gateway determines to enable the sharing strategy based on the received cross-chain event, it sends a shared node creation instruction to the relay gateway. The relay gateway responds to the shared node creation instruction, and the relay gateway selects the relay node on the relay chain as the shared node corresponding to the target chain; the cross-chain gateway obtains the interface parameters corresponding to the shared node, where the main function of the blockchain node interface is to connect and manage the blockchain network. That is to say, it can be determined whether the shared node is qualified to participate in the consensus process on the target chain based on the interface parameters corresponding to the shared node. If it is determined that the consensus node is qualified to participate in the consensus process on the target blockchain, a consensus indication is sent to the shared node.

[0118] For example, the interface of blockchain nodes is an important means to achieve interaction and management between nodes. It ensures the normal operation and security of the blockchain network. The interface can receive and send transaction data to achieve information interaction between nodes. In the cross-chain transaction system, shared nodes will participate in transaction verification and recording, so the role of the interface is very important. Therefore, the cross-chain gateway verifies the interface parameters of the shared node selected by the relay gateway to verify whether the consensus node is qualified to participate in the consensus process on the target chain. If the verification is passed, a consensus indication is sent to the consensus node.

[0119] Step S820: In response to the consensus indication, the shared node initiates a request to become a consensus node in the target chain. When the request is passed by the nodes in the target chain, a proposal to run for the master node in the target chain is initiated. After the proposal is passed, the shared node becomes the corresponding master node of the target chain.

[0120] After receiving the consensus indication, the consensus node responds to the consensus indication and then initiates a request to become a consensus node in the target chain. The request is pushed to each node on the target chain. After being voted through by each node on the target chain, the shared node then initiates a proposal to run for the master node in the target chain and broadcasts the proposal to each node on the target chain. After each node on the target chain votes through, the shared node is determined to become the master node corresponding to the target chain, thereby executing cross-chain transactions through the shared node.

[0121] exist Figure 8 In the embodiment shown, the cross-chain gateway verifies whether the shared node is qualified to participate in the consensus process on the target chain, passes the verification on the shared node, and competes to become the master node in the target chain. In this implementation, a node is selected as a shared node in the relay chain and introduced into the target chain to assist the target chain in completing transaction verification, state synchronization, consensus execution, and state update operations. This measure is intended to ensure the accuracy and security of cross-chain transactions and significantly improve the efficiency of cross-chain transactions.

[0122] Further, in an exemplary embodiment, refer to Figure 9 , Figure 9 which is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to the implementation environment shown in FIG. 2, and can be executed by a blockchain node on the target chain in the implementation environment shown by Figure 2 .

[0123] As Figure 9 shown, this method includes step S910 and step S920, which are introduced in detail as follows:

[0124] Step S910: After receiving a request initiated by a shared node, a node in the target chain verifies whether the shared node has the qualification for consensus. If so, it initiates a vote indicating consent; otherwise, it initiates a vote indicating denial.

[0125] When a node in the target chain receives a request from a shared node on the relay chain to become a consensus node in the target chain, the node in the target blockchain verifies whether the shared node has the qualification for consensus. If it is determined according to the verification result that the shared node has the qualification for consensus, it initiates a vote indicating consent; otherwise, if it is determined according to the verification result that the shared node does not have the qualification for consensus, it initiates a vote indicating denial.

[0126] Among them, in a blockchain, determining whether a node has the qualification to participate in consensus is usually determined by the following factors:

[0127] Node type: Blockchain nodes are usually divided into full nodes, light nodes, mining nodes, etc. Among them, full nodes can store blockchain data completely and participate in the consensus process; light nodes only store part of the data and are usually only used for transaction verification and network routing; mining nodes are specifically responsible for packing transactions, generating blocks, and obtaining rewards on the blockchain. Therefore, different types of nodes have different qualifications to participate in consensus.

[0128] Node authentication: In order to ensure the authenticity and credibility of node identities, blockchain networks usually adopt various authentication mechanisms, such as digital signatures, certificate issuance, etc. Only nodes that pass authentication are allowed to join the network and participate in the consensus process.

[0129] Node performance: The performance of a node includes aspects such as computing power, storage space, network bandwidth, etc. If the performance of a node is insufficient to meet the requirements of the consensus process, it may lead to problems such as data synchronization lag and transaction processing speed decline. Therefore, a node needs to have a certain performance to participate in the consensus process.

[0130] Node reputation: In a blockchain network, the reputation of a node is usually determined by factors such as its historical behavior and transaction records. If the reputation of a node is low, it may be excluded from the consensus process by other nodes.

[0131] Consensus mechanism: Different consensus mechanisms have different requirements for nodes to participate in consensus. For example, in the PoW-based consensus mechanism, only mining nodes with a certain computing power are eligible to participate in the consensus process; while in the PoS-based consensus mechanism, nodes holding a certain amount of currency are eligible to participate in the consensus process.

[0132] In summary, determining whether a node is eligible to participate in consensus requires considering multiple factors, including node type, authentication status, performance, reputation, and consensus mechanism, etc. Only nodes that meet the requirements can be allowed to join the network and participate in the blockchain consensus process.

[0133] That is to say, if the nodes in the target chain verify whether the shared node is eligible to participate in the consensus process on the target chain based on at least one of the node type, node authentication, node performance, and consensus mechanism of the shared node. If the verification passes, a vote representing consent is initiated; otherwise, if the verification fails, a vote representing denial is initiated.

[0134] Step S920, if the number of votes representing consent meets the preset consensus condition, it is determined that the request has passed the vote by the nodes in the target chain.

[0135] Exemplarily, if among the votes initiated by the nodes on the target chain, the number of votes representing consent meets the preset consensus condition, it is determined that the request for the consensus node to become a consensus node on the target chain has passed the vote by the nodes in the target chain; where the preset consensus condition can be the threshold of the number of votes representing consent, and the preset consensus condition can also be the ratio of the votes representing consent to all nodes on the target chain.

[0136] In this embodiment, by voting through the nodes on the target chain that the shared node has consensus eligibility, a cross-chain transaction can be sent to the shared node, thereby not only ensuring the security of the cross-chain transaction but also avoiding potential risks caused by inconsistent consensus mechanisms.

[0137] Further, in an exemplary embodiment, refer to Figure 10 , Figure 10 which is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to the implementation environment shown in FIG. 2, and it can be executed by the blockchain nodes on the target chain in the Figure 2 shown implementation environment.

[0138] As Figure 10 shown, this method further includes step S1010 and step S1020, and this method is specifically implemented between the shared node on the relay chain and the target chain, and is introduced in detail as follows:

[0139] Step S1010, the shared node obtains the default value of the continuous block production quantity of the primary node set in the target chain;

[0140] Step S1020, generate a target value greater than the default value, and initiate a proposal indicating that the continuous block production quantity is the target value.

[0141] Following the above, after the cross-chain gateway determines to enable the sharing policy according to the received cross-chain event, it sends a shared node creation instruction to the relay gateway, so as to select a relay node from the relay chain as the shared node corresponding to the target chain through the relay gateway. After the shared node is elected as the primary node of the target chain, the shared node obtains the default value of the continuous block production quantity set for the primary node in the target chain.

[0142] Exemplarily, during the cross-chain transaction process, the cross-chain gateway corresponding to the target chain executing the cross-chain transaction parses according to the received cross-chain event, determines the number of cross-chain transaction data to be processed and the queuing duration of the transactions to be processed in the target chain according to the parsing result. Further, the cross-chain gateway compares the number of transactions to be processed with a preset quantity threshold, and compares the queuing duration of the transactions to be processed with a preset duration threshold. If the number of transactions to be processed is greater than the preset quantity threshold, or the queuing duration of the transactions to be processed is greater than the preset duration threshold, the cross-chain gateway corresponding to the target chain executing the cross-chain transaction determines to enable the sharing policy. That is to say, when the cross-chain gateway determines to enable the sharing policy, at least one of the number of transactions to be processed at the current moment and the number of transactions to be processed reaches above the preset limit. At this time, the resources of the target chain are tense and cannot meet the execution of a large number of transactions to be processed. Therefore, it is necessary to enable a shared node to assist the target chain in processing cross-chain transactions. Since the number of transactions to be processed is large, it is necessary to increase the resources of the primary node for processing transactions.

[0143] Therefore, in step S1020, after obtaining the default value of the continuous block production quantity of the primary node set in the target chain, it is necessary to modify the default value of the continuous block production quantity of the primary node to a target value greater than the default value. The size of the target value can be determined according to the cross-chain transactions to be processed. That is to say, the size of the target value can be determined according to the number of transactions to be processed and the queuing duration of the transactions to be processed. Specifically, the larger the number of transactions to be processed or the queuing duration of the transactions to be processed, the larger the target value of the continuous block production quantity of the primary node of the target chain. On the contrary, the smaller the target value of the continuous block production quantity of the primary node of the target chain.

[0144] Exemplarily, after determining the target value of the continuous block production quantity of the master node set in the target chain, it is necessary to initiate a proposal on the target chain representing that the continuous block production quantity of the master node in the target chain is the target value, and broadcast the proposal to the consensus nodes on the target chain. After the shared nodes on the target chain receive the proposal representing that the continuous block production quantity is the target value, the consensus nodes on the target chain initiate a vote on whether to agree to modify the continuous block production quantity of the master node on the target chain to the target quantity. If the votes representing agreement meet the preset consensus conditions, it is determined that the proposal to modify the continuous block production quantity of the master node on the target chain to the target quantity passes.

[0145] In Figure 10 In the illustrated embodiment, after the shared node on the relay chain is elected as the master node on the target chain, the continuous block production quantity of the master node on the target quantity is modified to a larger target value, so that the block production ability of the shared node is stronger, the block size of the shared node is expanded, the processing efficiency of cross-chain transactions is improved, and the cost is reduced.

[0146] Further, in an exemplary embodiment, refer to Figure 11 , Figure 11 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to the implementation environment shown in FIG. 2, and it can be executed by Figure 2 the blockchain node on the target chain in the shown implementation environment.

[0147] As Figure 11 shown, before the cross-chain gateway sends the cross-chain transaction to the shared node, the above cross-chain transaction processing method further includes step S1110 and step S1120, which are introduced in detail as follows:

[0148] Step S1110, the cross-chain gateway detects the continuous block production quantity corresponding to the shared node;

[0149] Step S1120, if the continuous block production quantity reaches the target block production quantity, the cross-chain transaction is sent to the shared node.

[0150] Specifically, a relay node is selected from the relay chain as the shared node corresponding to the target chain. Before the shared node runs for the master node of the target chain, the cross-chain gateway needs to verify whether the shared node has the qualification to participate in the consensus on the target chain, including verifying one or more aspects of the node type, node identity authentication, node performance, node reputation, and consensus mechanism corresponding to the consensus node. When the verification result indicates that the shared node has the qualification to participate in the consensus on the target chain, the shared node can be used as the master node corresponding to the target chain to push the cross-chain transaction to be processed.

[0151] In addition, in some feasible embodiments, after the shared node runs to become the master node on the target chain, since the number of cross-chain transactions to be processed at the current moment exceeds the preset limit, it is necessary to increase the throughput and processing speed of the master node that processes the cross-chain transactions, which will inevitably require increasing the transaction processing resources corresponding to the master node of the target chain. The master node can be used to continuously generate blocks to improve the processing speed of the master node for transaction tasks. Therefore, the shared node as the master node of the target chain will perform continuous block generation tasks to achieve the target number of continuous block generation. During the period when the shared node is continuously generating blocks, the cross-chain gateway will monitor the number of continuous block generation corresponding to the shared node. If the cross-chain gateway detects that the number of continuous block generation of the shared node reaches the target number of block generation, it is determined that the shared node has achieved capacity expansion and has reached the ability to execute pending transactions, and the cross-chain transaction is sent to the shared node.

[0152] In addition, in some feasible embodiments, when the shared node selected on the relay chain is used as the master node of the target chain to execute a cross-chain transaction, when the cross-chain gateway determines that the sharing strategy is no longer enabled based on the received cross-chain event, the remaining unprocessed cross-chain transactions are sent to the nodes on the target chain to execute the remaining unprocessed cross-chain transactions through the nodes on the target chain.

[0153] Exemplarily, during the execution of a cross-chain transaction, the cross-chain gateway corresponding to the target chain executing the cross-chain transaction parses the received cross-chain event, and determines the number of pending transactions and the queuing time of pending transactions on the target chain based on the parsing results. Further, the cross-chain gateway compares the number of pending transactions with a preset number threshold, and compares the queuing time of pending transactions with a preset time threshold. If the number of pending transactions is not greater than the preset number threshold, or the queuing time of pending transactions is not greater than the preset time threshold, the cross-chain gateway corresponding to the target chain executing the cross-chain transaction determines not to enable the sharing strategy.

[0154] Further, if the cross-chain gateway determines not to enable the sharing strategy, a corresponding master node is selected from the target chain, wherein the number of master nodes may be one or more. In some embodiments, the selection of the master node may be determined by a consensus mechanism on the target chain. If one or more nodes on the target chain can be randomly selected as master nodes based on the consensus mechanism corresponding to the target chain, then after determining the master node on the target chain, the master node initiates a proposal to modify the number of continuous blocks corresponding to the master node of the target chain to a default value, and broadcasts the proposal to the consensus nodes on the target chain. The consensus nodes on the target chain vote on the received proposal. If the number of consensus nodes on the target chain that agree with the proposal is greater than a preset limit, the number of continuous blocks corresponding to the master node of the target chain is modified to a default value, wherein the default value may be determined based on the consensus mechanism corresponding to the target chain, the computing resources and storage resources corresponding to the target chain, etc.

[0155] Exemplarily, during the process of executing a cross-chain transaction with a relay node on the relay chain as a shared node, if the cross-chain gateway determines not to enable the sharing policy, the remaining cross-chain transactions are directly sent to the primary node on the target chain to execute the remaining cross-chain transactions through the primary node on the target chain.

[0156] Exemplarily, by randomly selecting a blockchain node on the target chain as the corresponding primary node, a proposal is initiated by the primary node to modify the continuous block production quantity of the current primary node from the target value to the default value, and after being voted and passed by the consensus nodes on the target chain, the current primary node on the blockchain performs continuous block production according to the default value.

[0157] In Figure 11 the illustrated implementation, the processing method of cross-chain transactions can be dynamically adjusted according to the actual situation. When the trading volume is large, the processing capacity of the primary node can be utilized to improve the processing efficiency and avoid chain congestion. When the trading volume is small, the system can return to a more conventional processing method to better adapt to the current trading requirements.

[0158] Further, in an exemplary embodiment, referring to Figure 12 , Figure 12 is a flowchart of a cross-chain transaction processing method shown in another exemplary embodiment of the present application. This method can be applied to Figure 2 the illustrated implementation environment, which can be executed by the blockchain node 120 in Figure 2 the illustrated implementation environment.

[0159] As Figure 12 shown, this method includes step S410 - step S420, and step S1010, where the detailed introduction of step S1210 - step S1220 is as follows:

[0160] Step S1210, after the shared node completes the cross-chain transaction, the shared node broadcasts the transaction result corresponding to the cross-chain transaction to each consensus node on the target chain;

[0161] Step S1220, after the transaction result is verified by each consensus node, the shared node updates the transaction status of the cross-chain transaction on the relay chain based on the verified transaction result.

[0162] To ensure the integrity of the cross-chain transaction process, when processing cross-chain transactions through shared nodes on the relay chain, and after the shared nodes complete the cross-chain transactions, the shared nodes will send the transaction results corresponding to the cross-chain transactions to each consensus node on the target chain in the form of broadcasting. After receiving the transaction results, each consensus node verifies the transaction results. After each consensus node on the target chain verifies the transaction results, the shared nodes selected through the relay chain update the transaction status corresponding to the cross-chain transactions with the transaction results.

[0163] Exemplarily, after the shared nodes complete the cross-chain transactions, the shared nodes package and send the transaction results and cross-chain transactions to each consensus node on the target chain. Each consensus node on the target chain verifies the transaction results generated by the consensus node according to the corresponding cross-chain transactions. Exemplarily, each consensus node on the target chain can calculate the transaction results corresponding to the cross-chain transactions once and compare the transaction results obtained by itself with the transaction results generated by the consensus node.

[0164] Exemplarily, after the shared nodes complete the cross-chain transactions, the shared nodes send the transaction results corresponding to the cross-chain transactions to each consensus node on the target chain in the form of broadcasting. Each consensus node on the target chain votes on whether to agree with the received transaction results. If the number of votes in favor among the consensus nodes exceeds the preset quantity threshold, or the ratio of the votes in favor in all the consensus nodes on the target chain exceeds the ratio threshold, it is considered that the transaction results pass the verification.

[0165] Furthermore, to record the status of cross-chain transactions on the relay chain, after the results corresponding to the cross-chain transactions pass the verification of the consensus nodes on the target chain, the shared nodes, which are the primary nodes on the target chain, update the transaction results corresponding to the cross-chain transactions to the relay chain. Exemplarily, the transaction results can be associated with the corresponding cross-chain transactions, or the transaction results can be associated with the corresponding transaction accounts.

[0166] Exemplarily, determining the type of smart contract to which the target transaction object in the cross-chain transaction belongs refers to the type of smart contract corresponding to the smart contract used to issue the target transaction object. The set smart contract type is used to judge whether the smart contract is compliant. It can be a smart contract corresponding to a standard NFT protocol, and the standard NFT protocol includes but is not limited to the ERG721 protocol, etc.

[0167] After obtaining the type of smart contract to which the target transaction object belongs, the type of smart contract can be compared with the set type of smart contract. If the two match, a smart contract account is created, and the account to which the target transaction object belongs is set as the controlling party of the smart contract account.

[0168] In this embodiment, after the cross-chain transaction is completed at the shared node, the transaction result verified by the consensus node on the target chain is updated to the relay chain through the shared node, so as to realize real-time status synchronization between the relay chain and the target chain, maintain the consistency between the two chains, and avoid potential risks brought by data inconsistency.

[0169] Figure 13 It is a flowchart of a cross-chain transaction processing method proposed according to an exemplary application scenario. As Figure 13 shown, it is applied to a cross-chain transaction system. The cross-chain transaction system includes multiple business chains and a relay chain. The business chains are connected to cross-chain gateways, the relay chain is connected to a relay gateway, and the cross-chain gateways are also connected to the relay gateway.

[0170] The user initiates a cross-chain event through any one of the multiple business chains;

[0171] The cross-chain event is sent to the relay gateway, and the relay gateway sends the cross-chain event to the corresponding cross-chain gateway;

[0172] The cross-chain gateway determines whether to enable the sharing policy according to the received cross-chain event;

[0173] If the cross-chain gateway determines to enable the sharing policy according to the received cross-chain event, it sends a shared node creation instruction to the relay gateway;

[0174] In response to the shared node creation instruction, the relay gateway selects a relay node on the relay chain as the shared node corresponding to the target chain;

[0175] The cross-chain gateway verifies whether the shared node is eligible to participate in the consensus process on the target chain according to the interface parameters of the shared node,

[0176] If the judgment is yes, it sends a consensus instruction to the shared node;

[0177] The shared node responds to the consensus instruction, initiates a request to become a consensus node in the target chain. When the request is passed through voting in the target chain, it initiates a proposal to run for the main node in the target chain. After the proposal is passed, the shared node becomes the corresponding main node of the target chain;

[0178] After the shared node runs for and becomes the corresponding main node of the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node;

[0179] After the shared node completes the cross-chain transaction, the shared node sends the transaction result corresponding to the cross-chain transaction to the consensus nodes on the target chain in a broadcast form;

[0180] After the transaction result is verified by the consensus nodes, the shared node updates the transaction status of the cross-chain transaction based on the verified transaction result.

[0181] If the cross-chain gateway determines not to enable the sharing policy based on the cross-chain event, it detects whether the number of consecutive blocks produced by the set primary node in the target chain is the default value;

[0182] If it is, it directly sends the cross-chain transaction to the current primary node in the target chain;

[0183] If it is not, after changing the number of consecutive blocks produced by the set primary node in the target chain to the default value, it then sends the cross-chain transaction to the current primary node in the target chain to execute the cross-chain transaction through the current primary node;

[0184] When the cross-chain gateway receives the transaction result returned by the current primary node, it sends the transaction result to the relay gateway;

[0185] After the relay gateway receives the transaction result, the relay gateway sends the transaction result to the relay chain to update the transaction status of the cross-chain transaction based on the relay nodes on the relay chain.

[0186] As can be seen from the above, in this embodiment, when it is determined to enable the sharing policy upon receiving the cross-chain event, relay nodes are selected from the relay chain as sharing nodes. Then, after the sharing nodes are elected as the primary nodes corresponding to the target chain, continuous block production is achieved through the sharing nodes to expand the capacity of the target chain. Furthermore, cross-chain transactions are processed through the sharing nodes. Compared with increasing the block size of the target chain, the operation solution of using the sharing nodes on the relay chain within the cross-chain transaction system as the primary nodes of the target chain in this application is simpler, consumes less time cost, can improve the processing efficiency of cross-chain transactions, enhance the flexibility and convenience of transactions, and reduce transaction costs.

[0187] It should be noted that Figure 13 Details of the content of each step in the illustrated process have been described in detail in the foregoing embodiments, and this embodiment will not elaborate on these details again.

[0188] Figure 14 It is a block diagram of a cross-chain transaction processing device shown in an exemplary embodiment of the present application. This device is applied to a cross-chain transaction system. The cross-chain transaction system includes multiple business chains and a relay chain. The business chains are connected to the cross-chain gateway, the relay chain is connected to the relay gateway, and the cross-chain gateway is also connected to the relay gateway.

[0189] As Figure 14 shown, this device includes an instruction sending module 1410, an instruction response module 1420, and a transaction sending module 1430.

[0190] The instruction sending module 1410 is configured to send a sharing node creation instruction to the relay gateway when the cross-chain gateway determines to enable the sharing policy based on the received cross-chain event;

[0191] The instruction response module 1420 is configured to, in response to a shared node creation instruction, relay the gateway to select a relay node on the relay chain as the shared node corresponding to the target chain, where the target chain is the business chain for executing cross-chain transactions indicated by the cross-chain event;

[0192] The transaction sending module 1430 is configured to, after the shared node is elected as the primary node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node.

[0193] In another exemplary embodiment, the apparatus further includes a first determination module, and the first determination module is configured to determine to enable the sharing policy if the number of transactions to be processed is greater than a preset number threshold, or the queuing duration of the transactions to be processed is greater than a preset duration threshold.

[0194] In another exemplary embodiment, the apparatus further includes a detection module, and the detection module is configured to perform the following steps:

[0195] If the cross-chain gateway determines not to enable the sharing policy according to the cross-chain event, it is detected whether the continuous block production number of the set primary node in the target chain is the default value;

[0196] If not, after changing the continuous block production number of the set primary node in the target chain to the default value, the cross-chain transaction is sent to the current primary node in the target chain to execute the cross-chain transaction through the current primary node.

[0197] In another exemplary embodiment, the apparatus further includes a first transaction result update module, and the first transaction result update module is configured to perform the following steps:

[0198] When the cross-chain gateway receives the transaction result returned by the current primary node, it sends the transaction result to the relay gateway;

[0199] After the relay gateway receives the transaction result, the relay gateway sends the transaction result to the relay chain to update the transaction status of the cross-chain transaction based on the relay nodes on the relay chain.

[0200] In another exemplary embodiment, the apparatus further includes a verification module and a launching module. The verification module is configured to verify whether the shared node is eligible to participate in the consensus process on the target chain according to the interface parameters of the shared node. If so, a consensus indication is sent to the shared node;

[0201] The launching module is configured to, in response to the consensus indication, the shared node launches a request to become a consensus node in the target chain. When the request is voted through by the nodes in the target chain, a proposal to run for the primary node in the target chain is launched, and the shared node becomes the primary node corresponding to the target chain after the proposal is passed.

[0202] In another exemplary embodiment, the initiating module is further configured to perform the following steps:

[0203] After receiving a request initiated by a shared node, a node in the target chain verifies whether the shared node has the qualification for consensus. If so, it initiates a vote indicating consent; otherwise, it initiates a vote indicating denial.

[0204] If the number of votes indicating consent meets the preset consensus condition, it is determined that the request has passed the vote by the nodes in the target chain.

[0205] In another exemplary embodiment, the device further includes an acquisition module and a generation module. The acquisition module is configured to acquire the default value of the continuous block production quantity of the primary node set in the target chain for the shared node;

[0206] The generation module is configured to generate a target value greater than the default value and initiate a proposal indicating that the continuous block production quantity is the target value.

[0207] In another exemplary embodiment, the device further includes a detection module. The detection module is configured to perform the following steps:

[0208] The cross-chain gateway detects the continuous block production quantity corresponding to the shared node;

[0209] If the continuous block production quantity reaches the target block production quantity, the cross-chain transaction is sent to the shared node.

[0210] In another exemplary embodiment, the device further includes a second update module. The second update module is configured to perform the following steps:

[0211] After the shared node completes the cross-chain transaction, the shared node sends the transaction result corresponding to the cross-chain transaction to the consensus nodes on the target chain in a broadcast manner;

[0212] After the transaction result passes the verification of the consensus nodes, the shared node updates the transaction status of the cross-chain transaction based on the verified transaction result.

[0213] It should be noted that the cross-chain transaction processing device provided in the above embodiment and the cross-chain transaction processing method provided in the above embodiment belong to the same concept. The specific manners in which each module and unit perform operations have been described in detail in the method embodiment and will not be repeated here. In practical applications, the cross-chain transaction processing device provided in the above embodiment can, according to needs, allocate the above functions to different functional modules, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above. This is not limited here either.

[0214] Embodiments of the present application also provide an electronic device, including: one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the cross-chain transaction processing method provided in each of the above embodiments.

[0215] Figure 15 FIG. shows a schematic structural diagram of a computer system of an electronic device suitable for implementing embodiments of the present application. It should be noted that, Figure 15 The computer system 1500 of the electronic device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.

[0216] As Figure 15 shown, the computer system 1500 includes a central processing unit (CPU) 1501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1502 or the program loaded from the storage section 1508 into the random access memory (RAM) 1503, such as executing the method in the above embodiments. In the RAM 1503, various programs and data required for system operation are also stored. The CPU 1501, ROM 1502, and RAM 1503 are connected to each other via a bus 1504. The input / output (I / O) interface 1505 is also connected to the bus 1504.

[0217] The following components are connected to the I / O interface 1505: an input section 1506 including a keyboard, a mouse, etc.; an output section 1507 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1508 including a hard disk, etc.; and a communication section 1509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1509 performs communication processing via a network such as the Internet. A drive 1510 is also connected to the I / O interface 1505 as needed. A removable medium 1511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1510 as needed so that a computer program read from it can be installed into the storage section 1508 as needed.

[0218] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1509, and / or installed from the removable medium 1511. When the computer program is executed by the central processing unit (CPU) 1501, various functions defined in the system of the present application are executed.

[0219] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can push, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program included on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0220] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutively represented blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0221] The units involved in the embodiments described in the present application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not constitute a limitation to the unit itself in some cases.

[0222] Another aspect of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the cross-chain transaction processing method as described above. The computer-readable storage medium can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device.

[0223] Another aspect of the present application also provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the cross-chain transaction processing method provided in the above various embodiments.

[0224] The above content is only a preferred exemplary embodiment of the present application and is not used to limit the implementation of the present application. Those of ordinary skill in the art can easily make corresponding adaptations or modifications according to the main concept and spirit of the present application. Therefore, the protection scope of the present application should be subject to the protection scope required by the claims.

Claims

1. A cross-chain transaction processing method, characterized in that, Applied to a cross-chain transaction system, the cross-chain transaction system includes multiple business chains and relay chains, the business chain is connected to a cross-chain gateway, the relay chain is connected to a relay gateway, and the cross-chain gateway is also connected to the relay gateway, the method includes: When the cross-chain gateway determines to enable the sharing strategy according to the received cross-chain event, it sends a shared node creation instruction to the relay gateway; In response to the shared node creation instruction, the relay gateway selects a relay node on the relay chain as a shared node corresponding to a target chain, where the target chain is a business chain indicated by the cross-chain event for executing a cross-chain transaction; After the shared node runs for the master node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and executes the cross-chain transaction through the shared node.

2. The method according to claim 1, characterized in that, The cross-chain event includes the number of pending transactions and the queue duration of pending transactions, and the method further includes: If the number of pending transactions is greater than a preset number threshold, or the waiting time of the pending transactions is greater than a preset time threshold, the cross-chain gateway determines to enable the sharing strategy.

3. The method according to claim 1 or 2, characterized in that, The method further comprises: If the cross-chain gateway determines not to enable the sharing strategy according to the cross-chain event, it detects whether the number of consecutive blocks produced by the master node set in the target chain is the default value; If not, after changing the number of consecutive blocks produced by the master node set in the target chain to the default value, the cross-chain transaction is sent to the current master node in the target chain to execute the cross-chain transaction through the current master node.

4. The method according to claim 3, characterized in that The method further comprises: When the cross-chain gateway receives the transaction result returned by the current master node, it sends the transaction result to the relay gateway; After the relay gateway receives the transaction result, the relay gateway sends the transaction result to the relay chain to update the transaction status of the cross-chain transaction based on the relay node on the relay chain.

5. The method according to claim 1, wherein The method further comprises: The cross-chain gateway verifies whether the shared node is qualified to participate in the consensus process on the target chain according to the interface parameters of the shared node, and if so, sends a consensus indication to the shared node; The shared node, in response to the consensus indication, initiates a request to become a consensus node in the target chain. When the request is passed by voting of the nodes in the target chain, a proposal to run for the master node in the target chain is initiated. After the proposal is passed, the shared node becomes the master node corresponding to the target chain.

6. The method according to claim 5, characterized in that The method further comprises: After receiving the request initiated by the shared node, the node in the target chain verifies whether the shared node has the consensus qualification, and if so, initiates a vote representing approval, otherwise initiates a vote representing denial; If the number of votes representing agreement meets the preset consensus condition, it is determined that the request is passed by the nodes in the target chain.

7. The method according to claim 5, characterized in that, The method further comprises: The shared node obtains a default value of the number of consecutive blocks produced by the master node set in the target chain; Generate a target value greater than the default value, and initiate the proposal representing the number of consecutive blocks being the target value.

8. The method according to claim 1, characterized in that, Before the cross-chain gateway sends the cross-chain transaction to the shared node, the method further includes: The cross-chain gateway detects the number of consecutive blocks produced by the shared node; If the number of consecutive blocks produced reaches the target number of blocks produced, the cross-chain transaction is sent to the shared node.

9. The method according to claim 1, characterized in that, The method further includes: After the shared node completes the cross-chain transaction, the shared node broadcasts the transaction result corresponding to the cross-chain transaction to the consensus nodes on the target chain; After the transaction result is verified by the consensus nodes, the shared node updates the transaction status of the cross-chain transaction on the relay chain based on the verified transaction result.

10. A cross-chain transaction processing device, characterized in that, Applied to a cross-chain transaction system, the cross-chain transaction system includes multiple business chains and a relay chain, the business chains are connected to cross-chain gateways, the relay chain is connected to a relay gateway, and the cross-chain gateway is also connected to the relay gateway. The device includes: An instruction sending module, configured to send a shared node creation instruction to the relay gateway when the cross-chain gateway determines to enable the sharing policy according to the received cross-chain event; An instruction response module, configured to, in response to the shared node creation instruction, the relay gateway selects a relay node on the relay chain as the shared node corresponding to the target chain, and the target chain is the business chain indicated by the cross-chain event for executing the cross-chain transaction; A transaction sending module, configured to, after the shared node is elected as the primary node corresponding to the target chain, the cross-chain gateway sends the cross-chain transaction to the shared node, and the cross-chain transaction is executed through the shared node.

11. An electronic device, characterized in that, Includes: One or more processors; A storage device for storing one or more programs, which when executed by the one or more processors, cause the electronic device to implement the cross-chain transaction processing method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, A computer-readable instruction is stored thereon, which when executed by a processor of a computer, causes the computer to execute the cross-chain transaction processing method according to any one of claims 1 to 9.