Cross-chain transaction method and device of block chain, medium and electronic equipment
By using smart contracts to create transactions compliant with target chain rules, the method addresses inefficiencies and trust issues in cross-chain transactions, improving security and efficiency by reducing relay system complexity and reliance.
Patent Information
- Application Number
- CN202410051469.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-12
- Publication Date
- 2025-07-15
AI Technical Summary
The transaction efficiency is low when interacting with external networks in data. The existing cross-chain transaction methods have trust problems, performance bottlenecks, complexity, compatibility and security risks, making it difficult to meet the needs of large-scale cross-chain transactions.
By embedding the target chain software development toolkit (SDK) in the smart contract, the smart contract can construct cross-chain transactions that comply with the target chain rules, reduce the functions of the relay system, rely on the consensus mechanism of the initiating chain and the target chain to verify the reliability of cross-chain transactions, and reduce the complexity and trust dependence of the relay system.
It improves the transaction efficiency of the blockchain network, enhances the security and controllability of cross-chain transactions, reduces the operation costs, reduces the complexity and risks of the relay system, and achieves more efficient and secure cross-chain operations.
Smart Images

Figure CN120317873A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of blockchain, and particularly relates to a cross-chain transaction method for blockchain, a cross-chain transaction device for blockchain, a computer-readable medium, an electronic device, and a computer program product. Background Art
[0002] Blockchain is a digital ledger with a block-chain data structure shared through transparent and trusted rules in a peer-to-peer network environment. Blockchain has the characteristics of anti-counterfeiting, anti-tampering, and traceability. Transaction services implemented through blockchain usually have high requirements for data security. In the blockchain network, security authentication can be easily performed using a consensus mechanism. However, when data is exchanged between the blockchain network and an external network, a complex authentication process is required, which also leads to the problem of low transaction efficiency. Summary of the Invention
[0003] This application provides a cross-chain transaction method for blockchain, a cross-chain transaction device for blockchain, a computer-readable medium, an electronic device, and a computer program product, aiming to improve the transaction efficiency of the blockchain network.
[0004] According to one aspect of the embodiments of this application, a cross-chain transaction method for blockchain is provided. The method includes: obtaining a first cross-chain transaction that conforms to the business rules of the initiating chain, where the first cross-chain transaction is used to indicate the business of performing a cross-chain transaction with a target chain on the initiating chain, the initiating chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction; creating a second cross-chain transaction that conforms to the business rules of the target chain according to the first cross-chain transaction, and transmitting the second cross-chain transaction to the target chain, where the second cross-chain transaction is used to indicate the business of performing a cross-chain transaction with the initiating chain on the target chain; performing the first cross-chain transaction on the initiating chain according to the business rules of the initiating chain, and performing the second cross-chain transaction on the target chain according to the business rules of the target chain.
[0005] According to one aspect of the embodiments of this application, a cross-chain transaction device for blockchain is provided. The device includes:
[0006] An obtaining module, configured to obtain a first cross-chain transaction that conforms to the business rules of the initiating chain, where the first cross-chain transaction is used to indicate the business of performing a cross-chain transaction with a target chain on the initiating chain, the initiating chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction;
[0007] A transmission module, configured to create a second cross-chain transaction that complies with the business rules of the target chain according to the first cross-chain transaction, and transmit the second cross-chain transaction to the target chain, where the second cross-chain transaction is used to indicate the execution of a cross-chain transaction with the initiating chain on the target chain;
[0008] An execution module, configured to execute the first cross-chain transaction on the initiating chain according to the business rules of the initiating chain, and execute the second cross-chain transaction on the target chain according to the business rules of the target chain.
[0009] In some embodiments of the present application, based on the above technical solution, the transmission module may further include:
[0010] A parsing module, configured to parse the first cross-chain transaction to obtain the communication address of the target chain and the transaction content carried in the first cross-chain transaction;
[0011] A verification module, configured to perform a legality verification on the first cross-chain transaction according to the communication address of the target chain, where the legality verification is used to verify whether the initiating chain supports a cross-chain transaction with the target chain;
[0012] A creation module, configured to, when the verification result of the legality verification passes, create a second cross-chain transaction that complies with the business rules of the target chain on the initiating chain according to the transaction content.
[0013] In some embodiments of the present application, based on the above technical solution, the creation module may be further configured to: call a target chain transaction construction contract deployed on the initiating chain, where the target chain transaction construction contract is a smart contract for creating a blockchain transaction that complies with the business rules of the target chain; input the transaction content into the target chain transaction construction contract to obtain a second cross-chain transaction created by the target chain transaction construction contract that complies with the business rules of the target chain.
[0014] In some embodiments of the present application, based on the above technical solution, the transmission module may further include:
[0015] A first event creation module, configured to create a first cross-chain event on the initiating chain according to the communication address of the target chain, where the first cross-chain event is used to trigger the transmission of information from the initiating chain to the target chain;
[0016] A first serialization module, configured to perform a serialization process on the second cross-chain transaction to obtain serialized data of the second cross-chain transaction;
[0017] A first data writing module, configured to write the serialized data of the second cross-chain transaction into the first cross-chain event;
[0018] The first transaction transmission module is configured to transmit the serialized data of the second cross-chain transaction to the target chain according to the first cross-chain event.
[0019] In some embodiments of the present application, based on the above technical solutions, the transaction transmission module may further include:
[0020] The relay node acquisition module is configured to acquire relay nodes corresponding to the initiating chain and the target chain, and the relay nodes are blockchain nodes capable of respectively performing data communication with the initiating chain and the target chain;
[0021] The task establishment module is configured to establish an event detection task for the initiating chain on the relay node, and the event detection task is used to detect cross-chain events created on the initiating chain;
[0022] The event parsing module is configured to, when the event detection task detects the first cross-chain event created on the initiating chain, parse the first cross-chain event to obtain the communication address of the target chain carried in the first cross-chain event and the serialized data of the second cross-chain transaction;
[0023] The data transmission module is configured to transmit the serialized data of the second cross-chain transaction to the target chain according to the communication address of the target chain.
[0024] In some embodiments of the present application, based on the above technical solutions, the relay node acquisition module may be further configured to: acquire a first node list corresponding to the initiating chain, where the first node list is used to record and maintain the blockchain nodes of the blockchain network of the initiating chain; acquire a second node list corresponding to the target chain, where the second node list is used to record and maintain the blockchain nodes of the blockchain network of the target chain; acquire the intersection of the first node list and the second node list, and select relay nodes corresponding to the initiating chain and the target chain from the intersection.
[0025] In some embodiments of the present application, based on the above technical solutions, the transmission module may further include:
[0026] The first status configuration module is configured to configure the first cross-chain event as a pending status, and the pending status is used to indicate that the cross-chain transaction is in an unfinished transaction state on the initiating chain.
[0027] In some embodiments of the present application, based on the above technical solutions, the apparatus further includes:
[0028] A third transaction transmission module, configured to create a third cross-chain transaction that complies with the business rules of the initiating chain according to the second cross-chain transaction, and transmit the third cross-chain transaction to the initiating chain, where the third cross-chain transaction is used to indicate the execution result of the second cross-chain transaction;
[0029] A third transaction execution module, configured to execute the third cross-chain transaction on the initiating chain according to the business rules of the initiating chain.
[0030] In some embodiments of the present application, based on the above technical solution, the third transaction transmission module may further include:
[0031] A second event creation module, configured to create a second cross-chain event on the target chain according to the communication address of the initiating chain, where the second cross-chain event is used to trigger the transmission of information from the target chain to the initiating chain;
[0032] A second serialization module, configured to perform serialization processing on the third cross-chain transaction to obtain serialized data of the third cross-chain transaction;
[0033] A second data writing module, configured to write the serialized data of the third cross-chain transaction into the second cross-chain event;
[0034] A second transaction transmission module, configured to transmit the serialized data of the third cross-chain transaction to the target chain according to the second cross-chain event.
[0035] In some embodiments of the present application, based on the above technical solution, the third transaction transmission module may further include:
[0036] A second status configuration module, configured to configure the second cross-chain event as a cancellation status, where the cancellation status is used to indicate that the cross-chain transaction is in a completed transaction state on the target chain.
[0037] In some embodiments of the present application, based on the above technical solution, the third transaction execution module is further configured to: configure the first cross-chain event as a completed status, where the completed status is used to indicate that the cross-chain transaction is in a completed transaction state on the initiating chain.
[0038] According to one aspect of the embodiments of the present application, there is provided a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the cross-chain transaction method of the blockchain as in the above technical solution.
[0039] According to one aspect of the embodiments of the present application, there is provided an electronic device, which includes: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the executable instructions to implement the cross-chain transaction method of the blockchain in the above technical solution.
[0040] According to one aspect of the embodiments of the present application, there is provided a computer program product, including a computer program, which implements the cross-chain transaction method of the blockchain in the above technical solution when executed by a processor.
[0041] In the technical solution provided by the embodiments of the present application, by obtaining a first cross-chain transaction that complies with the business rules of the originating chain, a second cross-chain transaction that complies with the business rules of the target chain can be created according to the first cross-chain transaction, and the second cross-chain transaction is transmitted to the target chain; then the first cross-chain transaction is executed on the originating chain according to the business rules of the originating chain, and the second cross-chain transaction is executed on the target chain according to the business rules of the target chain. The embodiments of the present application can create a first cross-chain transaction and a second cross-chain transaction that can be executed on the originating chain and the target chain respectively for the same transaction content, and only need to transmit and interact transaction information between the originating chain and the target chain, without complex cross-chain transaction authentication, so the transaction efficiency of the blockchain network can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings according to these drawings without creative efforts.
[0043] Figure 1 The schematic diagram of the system architecture of the blockchain system implemented by using the technical solution in the embodiments of the present application is shown.
[0044] Figure 2 The composition structure of the blockchain maintained on the blockchain network is shown.
[0045] Figure 3 The technical implementation architecture diagram of the cross-chain technology in one embodiment of the present application is shown.
[0046] Figure 4 The flowchart of the cross-chain transaction method in one embodiment of the present application is shown.
[0047] Figure 5 The interaction flowchart of receiving and initiating the processing of cross-chain transaction services by the originating chain in an application scenario of the embodiments of the present application is shown.
[0048] Figure 6 The figure shows an interaction flowchart of the embodiments of the present application for receiving and responding to cross-chain transaction services by a target chain in an application scenario.
[0049] Figure 7 The figure schematically shows a structural block diagram of a cross-chain transaction device of a blockchain provided by the embodiments of the present application.
[0050] Figure 8 The figure schematically shows a computer system structural block diagram of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners
[0051] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.
[0052] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be used. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present application.
[0053] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, 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, a 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 that includes the function of the module or unit.
[0054] 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 in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0055] The flowcharts shown in the accompanying drawings are only illustrative and not necessarily include all content and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.
[0056] In the specific implementation of this application, it involves relevant data such as public keys, private keys, subject identifiers used by users to register on the blockchain system, and transaction information recorded through the blockchain system. When each embodiment of this application is applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards in relevant countries and regions.
[0057] The following explains the technical terms in the related technologies of this application.
[0058] A blockchain is a digital ledger with a block-chain data structure that is anti-counterfeiting, anti-tampering, and traceable, constructed through transparent and trusted rules in a peer-to-peer network environment. The block-chain data structure stores transaction processing that occurs over a period of time in units of blocks and connects the blocks in chronological order into a chain using cryptographic algorithms. The ledger is distributed to all member nodes in the network, and in the sequential chain of blocks linked by the hash cryptographic algorithm, the historical records of asset transactions that occur between peer nodes in the network are permanently recorded. All confirmed and authenticated transactions are linked from the beginning of the chain to the latest block, hence the name blockchain. A blockchain can serve as a single source of truth, and members in the blockchain network can only view transactions related to them.
[0059] Blockchains are generally classified into three types: public blockchains, private blockchains, and consortium blockchains. Among them, public blockchains have the highest degree of decentralization. Nodes / participants joining a public blockchain can all read the data on the chain, publish transactions, and compete for the right to record new blocks; moreover, each node / participant can freely join and exit the public blockchain. In contrast, for private blockchains, the accounting rights are controlled by a certain organization or institution, and the data reading rights are also controlled by that organization or institution. There are few participants and they cannot join the private blockchain at will. They need to be reviewed by the organization or institution. Consortium blockchains, also known as community blockchains, refer to blockchains whose consensus process is controlled by preselected nodes. They are a mixture of public and private blockchains and can achieve "partial decentralization". Each node on the chain usually corresponds to a corresponding entity organization or institution; participants join the network through authorization and form an interest-related alliance to jointly maintain the operation of the blockchain. Through the consortium blockchain, new participants can join the existing blockchain and share data without having to build it from scratch. Whether it is a public blockchain, a private blockchain, or a consortium blockchain, they may all provide the function of smart contracts.
[0060] Smart contracts, also known as chain codes or application codes, are computer protocols designed to spread, verify, or execute contracts in an information-based manner. They are programs deployed in the nodes of a blockchain network, carrying the business logic for executing transactions and running in an isolated operating environment (such as a container or virtual machine). The contract programs automatically executed by each node in the blockchain system can operate on the data stored on the chain and are an important way for business entities to interact with the blockchain and utilize the blockchain to implement business logic. The purpose of smart contracts is to provide a security method superior to traditional contracts and reduce other transaction costs related to contracts. It allows for trusted transactions without a third party, and these transactions are traceable and irreversible. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system and can be defined in the form of code.
[0061] Figure 1 The system architecture diagram of the blockchain system implemented by the technical solution in the embodiment of the present application is shown.
[0062] As Figure 1 shown, the blockchain system includes a client 101, a server 102, a smart contract engine 103, and a blockchain network 104.
[0063] The client 101 can be various electronic devices such as smartphones, tablets, laptops, desktop computers, smart wearable devices, smart in-vehicle devices, smart payment terminals, etc., and can provide a user interface for asset management to users. Specifically, it can provide functions such as user registration / cancellation, organization management, expense management, historical query, notification, etc. The user interface provided by the client can be a web page, a hosted program running on a host program, an independently installed and running application program, and so on.
[0064] The server 102 can be an independent physical server, a server cluster composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms. The server 102 is used to provide background services for the client 101, and integrally invokes basic smart contracts to complete functions such as payment, application for account movement, distributed approval, account movement, auditing, reporting, etc.
[0065] The smart contract engine 103 provides the orchestration ability of various smart contracts, and completes function orchestration by being triggered by external authorization or automatically triggered by associated smart contracts. The smart contract engine 103 can provide a smart contract template library related to business applications such as on-chain storage, consensus authentication, and transaction query of blockchain transactions for the blockchain system; multiple participating parties can select smart contract templates to form integrated applications.
[0066] The blockchain network 104 includes multiple blockchain nodes, and the blockchain nodes can be terminal devices or servers participating in blockchain transactions. Each blockchain node can receive input information during normal operation and maintain shared data within the blockchain network based on the received input information. To ensure information interconnection, there can be information connections between each blockchain node, and each blockchain node can transmit information through the information connection. For example, when any blockchain node in the blockchain network receives input information and broadcasts the input information in the blockchain network, other node devices in the blockchain network can obtain the input information according to the consensus algorithm and store the input information as shared data.
[0067] For each blockchain node in a blockchain network, there is a corresponding node identifier, and each blockchain node in the blockchain network can store the node identifiers of other nodes in the same blockchain network, so that subsequently, according to the node identifiers of other blockchain nodes, the generated blocks can be broadcast to other nodes in the blockchain network. A node identifier list can be maintained in the blockchain node, and the node name and the node identifier are stored in the node identifier list correspondingly. Among them, the node identifier can be an IP (Internet Protocol) address and any other information that can be used to identify the node.
[0068] Figure 2 shows the composition structure of the blockchain maintained on the blockchain network. As Figure 2 shown, the blockchain consists of multiple sequentially connected blocks. Whenever new data needs to be written into the blockchain, this data will be aggregated into a newly generated block, and the newly generated block will be linked to the end of the blockchain. Through the consensus algorithm, it can be ensured that the newly added blocks on each node device are exactly the same. The data of the current block is recorded in the block body of each block, and at the same time, the hash value of the previous block connected to it is saved in its block header. If the transaction data in the previous block changes, then the hash value of the current block will also change accordingly. Therefore, the data uploaded to the blockchain network is difficult to be tampered with, which can improve the reliability of shared data.
[0069] Due to the isolation and closure of the blockchain, as well as the high degree of heterogeneity between chains, the data circulation and value transfer between blockchains have become technical bottlenecks hindering the wide application of blockchain technology. The cross-chain technology emerges as the times require, aiming to solve the cross-chain operation problems such as assets and data between different blockchains, and is an important technical means to achieve the interconnection of blockchains, improve the interoperability and scalability of blockchains.
[0070] Cross-chain technology enables different blockchain networks to interact securely technically, thus integrating scattered digital resources into a single blockchain network. Cross-chain technology helps to develop more blockchain applications, allowing the transfer of digital assets between different blockchain networks without having to re-develop blockchain applications. Cross-chain technology can solve problems faced by many emerging applications, such as enabling cable-free settlement between different networks, supporting smart contracts between different networks, transmitting information and digital assets between networks, etc. Technically speaking, cross-chain technology enables nodes on various blockchains to operate and communicate securely. It constructs an entropy network relative to the public chain, which will become the "bridge" between individual blockchains. It can ensure that different nodes in each network can interact reliably, thus ensuring the secure flow of digital resources between networks. Cross-chain technology can also be used to connect external data on the blockchain to smart contracts, thus giving smart contracts more power to handle complex and diverse business logics. Cross-chain technology can also facilitate the realization of a decentralized trading market, making cross-border transactions between different cryptocurrencies easier.
[0071] Cross-chain technology is a very important area in the development of blockchain networks, because it makes closed-source blockchain networks more interactive, helps blockchain applications to evolve more securely into decentralized applications, and can also be used to support larger-scale decentralized applications, completing the transmission across networks and external resources faster. In short, cross-chain technology will make blockchain applications more prevalent, and be able to carry more complex business logics, realizing more flexible and innovative decentralized applications.
[0072] In the related technology of this application, all transaction construction and transaction forwarding in cross-chain technology rely on the relay system to achieve. The relay system is a system that acts as a bridge or link between different blockchains, allowing data, assets or transactions to be transmitted and interacted between different blockchains. Suppose a cross-chain transaction is executed on Chain A and the asset or data is transmitted to Chain B. This process generally includes the following steps:
[0073] (1) Chain A relay processes the request: The cross-chain request initiator creates a cross-chain transaction request on Chain A. The relay node of Chain A will receive and process this request, thus constructing a new transaction that contains the asset or data to cross to Chain B.
[0074] (2) Chain A relay initiates a request to Chain B: The relay system of Chain A sends the constructed cross-chain transaction to Chain B, requesting the execution of the cross-chain operation.
[0075] (3) B-chain Relay Processing Request: The relay system on the B-chain receives requests from the A-chain and verifies their validity. If the verification passes, it triggers corresponding operations, such as unlocking assets or executing required transactions.
[0076] (4) B-chain Relay Sending Response to A-chain: After the relay system on the B-chain executes the required operations, it sends the execution result or response back to the A-chain. This usually includes the status of the transaction and any relevant data.
[0077] (5) A-chain Relay Processing Response: The relay system on the A-chain receives the response from the B-chain and conveys it to the original initiator of the cross-chain request. This can include the status of the cross-chain transaction, execution result, or other information.
[0078] In the above cross-chain transaction process, the relay system plays a crucial role in ensuring the reliability and validity of transactions. The relay system is used to assist the interaction between different chains and ensure the smooth execution of cross-chain operations.
[0079] Based on the above introduction of the cross-chain transaction process, it can be seen that there are generally the following defects in the cross-chain technology implemented based on the relay system.
[0080] (1) Trust Issue: Relay systems need to be trusted because they can become single points of failure. If the relay system is dishonest or under attack, the reliability and security of cross-chain transactions may be threatened.
[0081] (2) Performance Bottleneck: The performance of the relay system may be limited, especially under high load. This may lead to transaction delays or system congestion.
[0082] (3) Complexity: Managing relay systems for multiple chains may become complex, requiring coordination of protocols and rules between different chains. This may increase the development and maintenance costs.
[0083] (4) Compatibility with Different Chains: Different blockchains may have different rules and functions, and the relay system needs to adapt to various different chains, which may lead to difficulties in implementation and maintenance.
[0084] (5) Security Risks: The relay system may be attacked, such as by DDoS attacks or malicious node attacks, thus threatening the security of the entire cross-chain system.
[0085] (6) Scalability Issues: With the continuous development of the blockchain ecosystem, existing cross-chain technologies may face scalability challenges and it is difficult to meet the demands of large-scale cross-chain transactions.
[0086] In view of the problems existing in the above related technologies, an embodiment of the present application provides a more decentralized, highly controllable and secure cross-chain interaction method, which realizes cross-chain at the smart contract level, improves the control and security of cross-chain transactions for users. At the same time, it relies on the consensus mechanisms of the initiating chain and the target chain to verify the reliability of cross-chain transactions, reducing the risks that may be introduced by relay nodes.
[0087] The embodiment of the present application is to solve the trust and security problems in cross-chain interaction to improve the credibility and reliability of cross-chain operations. The core idea is to embed the software development kit (SDK) of the target chain in the smart contract, so that the smart contract can construct cross-chain transactions that conform to the rules of the target chain. In this way, the function of the relay system is weakened. The relay system only needs to detect and forward messages and does not need to participate in transaction construction and verification, thereby reducing the complexity and trust dependence of the relay system.
[0088] The embodiment of the present application can be applied to various cross-chain scenarios, supporting homogeneous chains, heterogeneous chains, supporting cross any chain, multiple chains. It provides a more powerful solution for cross-chain operations by weakening the relay, improving security, controllability and reliability.
[0089] Figure 3 The technical implementation architecture diagram of the cross-chain technology in an embodiment of the present application is shown. As Figure 3 shown, the technical implementation of this cross-chain technology can be divided into a smart contract layer 301, a relay layer 302 and a target chain layer 303.
[0090] The smart contract layer 301 is mainly used to integrate the SDK of the target chain in the smart contract, so that the smart contract has the ability to construct cross-chain transactions that conform to the rules of the target chain. The smart contract can construct cross-chain transactions according to the rules and conditions of the target chain, including asset transfer, data transfer, etc. Users can construct and manage cross-chain operations according to their own needs, and use the closedness and consistency of the smart contract to ensure the security, credibility and controllability of cross-chain data, without relying on the relay system. In the smart contract layer 301, technologies such as zero-knowledge proof can also be used to enhance privacy protection and verify the validity of transactions, while reducing the risk of information disclosure and preventing the leakage of private keys.
[0091] The relay layer 302 is mainly responsible for detecting the cross-chain transactions constructed in the smart contract and forwarding them to the target chain. The relay layer 302 can also verify the forwarding status and judge whether the cross-chain transaction is successfully forwarded.
[0092] The target chain layer 303 receives cross-chain transactions transmitted from the relay layer 302 and executes all cross-chain operations, such as unlocking assets or verifying data. The target chain layer 303 is responsible for verifying the validity of cross-chain transactions, executing corresponding operations, and sending the execution results or responses back to the original chain, including transaction status and related data. The target chain layer 303 ensures the smooth execution of cross-chain operations on the target chain, thereby achieving cross-chain interaction. Privacy protection technologies such as zero-knowledge proofs can also be introduced to ensure the privacy of cross-chain transactions and further enhance the credibility and reliability of cross-chain transactions.
[0093] Figure 4 The flowchart of a cross-chain transaction method in an embodiment of the present application is shown. This cross-chain transaction method can be executed by Figure 1 the blockchain node shown. As Figure 4 shown, this cross-chain transaction method may include the following steps S410 to S430.
[0094] S410: Obtain a first cross-chain transaction that complies with the business rules of the initiating chain. The first cross-chain transaction is used to indicate the business of executing a cross-chain transaction with the target chain on the initiating chain. The initiating chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction.
[0095] S420: Create a second cross-chain transaction that complies with the business rules of the target chain according to the first cross-chain transaction, and transmit the second cross-chain transaction to the target chain. The second cross-chain transaction is used to indicate the business of executing a cross-chain transaction with the initiating chain on the target chain.
[0096] S430: Execute the first cross-chain transaction on the initiating chain according to the business rules of the initiating chain, and execute the second cross-chain transaction on the target chain according to the business rules of the target chain.
[0097] The embodiment of the present application can create a first cross-chain transaction and a second cross-chain transaction that can be executed on the initiating chain and the target chain respectively for the same transaction content. Only the transmission and interaction of transaction information are required between the initiating chain and the target chain, without complex cross-chain transaction authentication. Therefore, the transaction efficiency of the blockchain network can be improved.
[0098] The following makes a detailed description of each method step of the cross-chain transaction method in the embodiment of the present application in combination with specific application scenarios.
[0099] In step S410, obtain a first cross-chain transaction that complies with the business rules of the initiating chain. The first cross-chain transaction is used to indicate the business of executing a cross-chain transaction with the target chain on the initiating chain. The initiating chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction.
[0100] The business rules of a blockchain refer to the rule conditions that need to be met for processing blockchain transactions on the blockchain network. For example, they can include specifications for the content format of blockchain transactions, rules for generating blockchain transactions, rules for consensus authentication of blockchain transactions, rules for encryption verification and data transmission of transaction data, rules for storing blockchain transactions on the chain, and so on. To ensure the security of blockchain transactions, different blockchains generally have different business rules. The business rules of a blockchain can usually be specified in a smart contract.
[0101] A cross-chain transaction refers to a situation where at least two transaction parties in the transaction content belong to different blockchains. For example, in a transfer transaction where an asset transfer is initiated from asset account A to asset account B, asset account A is an account opened on the first blockchain, and asset account B is an account opened on the second blockchain. This transfer transaction needs to execute transactions on two different blockchains, so it can be called a cross-chain transaction. The first blockchain that initiates the asset transfer is the initiating chain for the cross-chain transaction, and the second blockchain that receives the asset transfer is the target chain for the cross-chain transaction.
[0102] In an embodiment of the present application, a user can submit a cross-chain transaction request to the initiating chain through a client. In the blockchain network for maintaining the initiating chain, the blockchain node can parse the cross-chain transaction request to obtain the first cross-chain transaction carried in the cross-chain transaction request.
[0103] In step S420, a second cross-chain transaction that complies with the business rules of the target chain is created according to the first cross-chain transaction, and the second cross-chain transaction is transmitted to the target chain. The second cross-chain transaction is used to indicate the business of performing a cross-chain transaction with the initiating chain on the target chain.
[0104] In an embodiment of the present application, the method for creating a second cross-chain transaction that complies with the business rules of the target chain according to the first cross-chain transaction may include: parsing the first cross-chain transaction to obtain the communication address of the target chain and the transaction content carried in the first cross-chain transaction; performing a legality check on the first cross-chain transaction according to the communication address of the target chain, where the legality check is used to verify whether the initiating chain supports cross-chain transactions with the target chain; when the verification result of the legality check passes, creating a second cross-chain transaction that complies with the business rules of the target chain on the initiating chain according to the transaction content.
[0105] The first cross-chain transaction complies with the business rules of the originating chain. Therefore, the blockchain nodes maintaining the originating chain can directly call the business smart contract of the originating chain to parse and process the first cross-chain transaction through the business smart contract, and obtain the communication address of the target chain and the transaction content carried in the first cross-chain transaction. Among them, the communication address of the target chain can be, for example, the unified communication address provided by the target chain externally, or it can be the communication address of any blockchain node maintaining the target chain. The communication address of the target chain can be used for data communication with the target chain. The transaction content refers to the specific transaction information that the cross-chain transaction needs to execute. For example, if this cross-chain transaction is a transfer initiated from asset account A to asset account B, then the corresponding transaction content may include the account address of asset account A, the account address of asset account B, the type and quantity of assets to be transferred.
[0106] After obtaining the communication address of the target chain, the legality verification of the first cross-chain transaction can be performed based on this communication address. The legality verification is mainly used to verify whether the originating chain and the target chain have the permission for cross-chain transactions. In an embodiment of the present application, cross-chain transaction mutual authorization can be pre-conducted between different blockchains. For example, the target chain can provide authorization to the originating chain with a software development kit (SDK) integrating its own business rules, so that the originating chain can write the business rule SDK of the target chain into the smart contract used to construct cross-chain transactions. Correspondingly, the originating chain can also provide authorization to the target chain with an SDK integrating the business rules of the originating chain, so that the target chain can write the business rule SDK of the originating chain into the smart contract used to construct cross-chain transactions.
[0107] In an embodiment of the present application, the blockchain can maintain an authorization list for cross-chain transactions. Whenever it obtains the authorization of the business rule SDK of another blockchain, it can write the communication address of this blockchain into the authorization list. When receiving a new cross-chain transaction request, the legality verification of this cross-chain transaction can be performed by querying the authorization list, so as to determine whether the current originating chain has the permission to conduct cross-chain transactions with the target chain.
[0108] In an embodiment of the present application, creating a second cross-chain transaction that complies with the business rules of the target chain on the originating chain according to the transaction content can further include: calling the target chain transaction construction contract deployed on the originating chain. The target chain transaction construction contract is a smart contract used to create blockchain transactions that comply with the business rules of the target chain; inputting the transaction content into the target chain transaction construction contract to obtain the second cross-chain transaction created by the target chain transaction construction contract and that complies with the business rules of the target chain.
[0109] In an embodiment of the present application, the initiating chain may create a corresponding blockchain transaction construction contract for each blockchain in the authorization list, and a business rule SDK of the blockchain is integrated in the blockchain transaction construction contract. In this way, when the initiating chain needs to execute a cross-chain transaction, it can call the corresponding blockchain transaction construction contract, so that the initiating chain can directly create a cross-chain transaction that conforms to the business rules of other blockchains.
[0110] In an embodiment of the present application, the method for transmitting the second cross-chain transaction to the target chain may include: creating a first cross-chain event on the initiating chain according to the communication address of the target chain, where the first cross-chain event is used to trigger the transmission of information from the initiating chain to the target chain; performing serialization processing on the second cross-chain transaction to obtain serialized data of the second cross-chain transaction; writing the serialized data of the second cross-chain transaction into the first cross-chain event; and transmitting the serialized data of the second cross-chain transaction to the target chain according to the first cross-chain event.
[0111] On the initiating chain, an event list for recording cross-chain transactions may be maintained. When a new first cross-chain transaction is generated, a corresponding first cross-chain event may be created in the event list. At the same time, the corresponding created second cross-chain transaction may be converted into serialized data convenient for data transmission and storage, and then the serialized data of the second cross-chain transaction is written into the first cross-chain event. On this basis, the first cross-chain event becomes a request event for transmitting the second cross-chain transaction to the target chain.
[0112] In an embodiment of the present application, the initiating chain may configure the first cross-chain event waiting to be processed to a pending state, and the pending state is used to indicate that the cross-chain transaction is in an unfinished transaction state on the initiating chain.
[0113] By configuring a processing state for the cross-chain event, it is convenient for blockchain nodes to view the processing progress of the cross-chain event, and avoid problems such as duplicate processing or omission of transactions.
[0114] In an embodiment of the present application, transmitting the serialized data of the second cross-chain transaction to the target chain according to the first cross-chain event includes: obtaining a relay node corresponding to the initiating chain and the target chain, where the relay node is a blockchain node capable of respectively performing data communication with the initiating chain and the target chain; establishing an event detection task for the initiating chain on the relay node, where the event detection task is used to detect cross-chain events created on the initiating chain; when the event detection task detects the first cross-chain event created on the initiating chain, parsing the first cross-chain event to obtain the communication address of the target chain and the serialized data of the second cross-chain transaction carried in the first cross-chain event; and transmitting the serialized data of the second cross-chain transaction to the target chain according to the communication address of the target chain.
[0115] In the embodiments of the present application, a relay node processes message transmission regarding cross-chain events between different blockchains. The relay node can detect whether new cross-chain events occur on each blockchain in real time by establishing event detection tasks for each blockchain, and can also detect the processing status of each cross-chain event.
[0116] For example, when a first cross-chain event occurs on the initiating chain and the processing status of the first cross-chain event is configured as a pending status, the relay node can determine that the first cross-chain event is an event waiting to be processed, and thus can trigger the parsing of the first cross-chain event to obtain the communication address of the target chain carried in the first cross-chain event and the serialized data of the second cross-chain transaction. Then, the relay node can transmit the serialized data of the second cross-chain transaction to the target chain according to the communication address of the template chain.
[0117] It can be seen that the relay node in the embodiments of the present application only needs to process the detection task of cross-chain events and the transmission task of serialized data, and does not need to perform rule authentication and verification related to cross-chain transactions. The reliability verification of cross-chain transactions is ensured by the blockchains of the initiating chain and the target chain itself, reducing the risk of data tampering or relay malicious behavior and improving the security of the entire cross-chain transaction. Moreover, the relay node no longer needs a large amount of resources to construct and verify transactions, which can reduce the complexity and workload of the relay node and lower the operation cost of cross-chain transactions.
[0118] Since the complexity and trust requirements for the relay node are reduced, any ordinary blockchain node that maintains the blockchain can be selected as the relay node in the embodiments of the present application.
[0119] In an embodiment of the present application, obtaining the relay node corresponding to the initiating chain and the target chain may further include: obtaining a first node list corresponding to the initiating chain, where the first node list is used to record the blockchain nodes that maintain the blockchain network of the initiating chain; obtaining a second node list corresponding to the target chain, where the second node list is used to record the blockchain nodes that maintain the blockchain network of the target chain; obtaining the intersection of the first node list and the second node list, and selecting the relay node corresponding to the initiating chain and the target chain from the intersection.
[0120] In the embodiments of the present application, by taking the intersection of the node lists of the initiating chain and the target chain, the common blockchain nodes that maintain both the initiating chain and the target chain can be obtained, and then the relay node corresponding to the initiating chain and the target chain can be selected from the common blockchain nodes. Using the common blockchain nodes as relay nodes can eliminate the operation of the relay node authenticating its identity to the blockchain and reduce the cumbersome process of the relay node communicating across networks with blockchain nodes in different blockchain networks. Therefore, it can improve the processing efficiency of cross-chain transactions while ensuring the security of cross-chain transactions.
[0121] In step S430, a first cross-chain transaction is executed on the initiating chain according to the initiating chain business rules, and a second cross-chain transaction is executed on the target chain according to the target chain business rules.
[0122] Based on the introduction of the above embodiments, for a cross-chain transaction service, two blockchain transactions corresponding to different business rules can be created. The first cross-chain transaction that complies with the initiating chain business rules can be directly executed on the initiating chain, while the second cross-chain transaction that complies with the target chain business rules will be transmitted to the target chain and executed by the target chain. When both the first cross-chain transaction and the second cross-chain transaction are completed, the cross-chain transaction service can be determined to be completed.
[0123] For example, a cross-chain transaction service is to transfer a certain amount of digital assets from asset account A on the initiating chain to asset account B on the target chain. By implementing the solution in the above embodiments of the present application, a first cross-chain transaction to transfer digital assets from asset account A can be executed on the initiating chain, and at the same time, a second cross-chain transaction to transfer digital assets to asset account B can be executed on the target chain.
[0124] In an embodiment of the present application, after the second cross-chain transaction is executed on the target chain according to the target chain business rules, a third cross-chain transaction that complies with the initiating chain business rules can be created according to the second cross-chain transaction, and the third cross-chain transaction is transmitted to the initiating chain. The third cross-chain transaction is used to indicate the execution result of the second cross-chain transaction; then the third cross-chain transaction is executed on the initiating chain according to the initiating chain business rules.
[0125] By creating a third cross-chain transaction on the target chain in the embodiment of the present application, the execution result of the cross-chain transaction service can be returned to the initiating chain, so that the initiating chain ends the processing flow of the cross-chain transaction service.
[0126] In an embodiment of the present application, the method of transmitting the third cross-chain transaction to the initiating chain may further include: creating a second cross-chain event on the target chain according to the communication address of the initiating chain, where the second cross-chain event is used to trigger the transmission of information from the target chain to the initiating chain; serializing the third cross-chain transaction to obtain serialized data of the third cross-chain transaction; writing the serialized data of the third cross-chain transaction into the second cross-chain event; and transmitting the serialized data of the third cross-chain transaction to the target chain according to the second cross-chain event.
[0127] Similarly to the initiating chain, an event list for recording cross-chain transactions can be maintained on the target chain. When the target link receives the second cross-chain transaction transmitted by the initiating chain through the relay node, a corresponding second cross-chain event can be created in the event list. At the same time, the created third cross-chain transaction can be converted into serialized data convenient for data transmission and storage, and then the serialized data of the third cross-chain transaction can be written into the first cross-chain event. On this basis, the second cross-chain event becomes a request event for transmitting the third cross-chain transaction to the target chain.
[0128] In an embodiment of the present application, after creating the second cross-chain event on the target chain according to the communication address of the initiating chain, the second cross-chain event can be configured to a cancel state, and the cancel state is used to indicate that the cross-chain transaction is in a completed transaction state on the target chain.
[0129] In an embodiment of the present application, after executing the third cross-chain transaction on the initiating chain according to the business rules of the initiating chain, the first cross-chain event can be configured to a done state, and the done state is used to indicate that the cross-chain transaction is in a completed transaction state on the initiating chain.
[0130] By maintaining corresponding cross-chain events on the initiating chain and the target chain respectively in the embodiments of the present application, and updating the processing status of the cross-chain events according to the processing progress of the cross-chain transactions, it is possible to provide guiding information for message transmission to the relay node. On the one hand, it can avoid repeated processing of cross-chain transaction services, and on the other hand, it can improve the information transmission efficiency of cross-chain transactions.
[0131] The cross-chain transaction solution provided by the embodiments of the present application will be described in detail below in combination with specific application scenarios.
[0132] Figure 5 The interaction flowchart shows that in an application scenario of the embodiments of the present application, the initiating chain receives and initiates the processing of cross-chain transaction services. As Figure 5 shown, the interaction process includes the following steps S501 to S508.
[0133] S501: The client constructs the first cross-chain transaction a that conforms to the business rules of the initiating chain.
[0134] Taking the cross-blockchain transfer transaction as an example, the client can provide relevant transfer details, such as the address of the target chain B and the transfer amount.
[0135] S502: The client sends the first cross-chain transaction a to the initiating chain A.
[0136] S503: The initiating chain A checks whether it supports initiating a cross-chain request from the initiating chain A to the target chain B through a legality check.
[0137] S504: When the check result is that the verification passes, call the cross-chain management smart contract, generate the first cross-chain event, and configure its status to the pending state.
[0138] S505: Call the cross-chain transaction construction contract deployed on the initiating chain A corresponding to the target chain B to create the second cross-chain transaction b that complies with the business rules of the target chain.
[0139] S506: Convert the second cross-chain transaction b into serialized data and write it into the first cross-chain event.
[0140] S507: Call the business smart contract of the initiating chain A, execute the first cross-chain transaction a according to the business rules of the initiating chain, and store the first cross-chain transaction a on the initiating chain A.
[0141] S508: The initiating chain A returns the execution result of the first cross-chain transaction a to the client.
[0142] The relay node can detect the cross-chain events recorded on the initiating chain A in real time and trigger the response processing flow when detecting newly generated cross-chain events.
[0143] Figure 6 Shows the interaction flow chart of the cross-chain transaction business received and responded to by the target chain in an application scenario of the embodiment of the present application. As Figure 6 shown, the interaction flow can include the following steps S601 to S607.
[0144] S601: The relay node parses the first cross-chain event to obtain the communication address of the target chain B and the second cross-chain transaction b.
[0145] S602: The relay node sends the second cross-chain transaction b to the target chain according to the communication address of the target chain B.
[0146] S603: The target chain B calls the cross-chain management smart contract and checks whether it supports the cross-chain transaction business initiated by the initiating chain A through legal verification.
[0147] S604: When the check result is that the verification passes, call the cross-chain management smart contract, generate the second cross-chain event, and configure its status to the cancel state.
[0148] S605: The target chain B calls the business smart contract to execute the second cross-chain transaction b and stores the second cross-chain transaction b on the target chain B.
[0149] S606: Call the cross-chain transaction construction contract deployed on the target chain B corresponding to the initiating chain A to create the third cross-chain transaction c that complies with the business rules of the initiating chain.
[0150] S607: Convert the third cross-chain transaction c into serialized data and write it into the second cross-chain event.
[0151] When the relay node detects the second cross-chain event recorded on the target chain B, it can trigger the process of returning the cross-chain transaction processing result to the initiating chain A. After receiving the third cross-chain transaction c transmitted by the relay node, the initiating chain A can continue to call the cross-chain management contract to update the processing status of the corresponding first cross-chain event to the completed state (done), and then can send a notification message to the relay node to end the cross-chain transaction business process.
[0152] Based on the introduction of the above embodiments and application scenarios, it can be seen that the embodiments of the present application push cross-chain operations towards a more decentralized, efficient, and secure direction, reduce the importance of the relay system, and strengthen the role of smart contracts in cross-chain interactions. These advantages can provide more opportunities and flexibility for the development and application of the cross-chain ecosystem.
[0153] The cross-chain transaction solution provided by the embodiments of the present application has the following characteristics.
[0154] (1) Weak relay: By allowing the relay system to only undertake the tasks of detection and message forwarding without involving the construction of transactions, the complexity and trust requirements of the relay system can be reduced. In actual production, this means that the relay system will no longer need to construct cross-chain transactions, reducing the errors or risks that the relay system may introduce, and improving the robustness of the entire cross-chain system. Since the functions of the relay nodes are weakened, the transaction construction and verification rights can be handed over to smart contracts, which helps to improve weak relay and reduce trust dependence.
[0155] (2) Smart contract-guided cross-chain transaction construction: By embedding the SDK of the target chain in the smart contract, the smart contract can construct cross-chain transactions that meet the target requirements, rather than relying on the relay system, which enhances the security and controllability of cross-chain transactions. Allowing the smart contract to construct cross-chain transactions locally can ensure the integrity and security of data, reduce the participation of the relay system, and improve credibility. Embedding the SDK of the target chain in the smart contract allows the smart contract to have greater control when constructing cross-chain transactions, enabling it to manage cross-chain transactions more precisely.
[0156] (3) The reliability verification of cross-chain operations is ensured by the blockchain: In cross-chain transactions, the validity and reliability of transactions are verified by the blockchain consensus mechanisms of the initiating chain and the target chain, rather than relying solely on the relay system. This means that the legality of transactions will be verified by the designed blockchain itself, which is crucial for data and asset transmission in cross-chain transactions.
[0157] (4) Improve cross-chain operation efficiency: Since the function of the relay is weakened, the process of transaction construction and verification is more efficient because complex relay logic is no longer required, which can accelerate the execution of cross-chain operations.
[0158] (5) Reduce costs: By reducing the complexity and workload of the relay system / nodes, the operating costs of cross-chain transactions can be reduced because relay nodes no longer require a large amount of resources to construct and verify transactions.
[0159] (6) Enhance security: Since the reliability verification of cross-chain transactions is guaranteed by the blockchains of the initiating chain and the target chain itself, the risk of data tampering or relay malicious behavior is reduced, improving the security of the entire cross-chain transaction. By moving the construction and verification of cross-chain transactions to the smart contract level, the security of cross-chain transactions can be increased and the risk of data tampering can be reduced.
[0160] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that these steps must be executed in that specific order, or that all the steps shown must be executed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution, etc.
[0161] The following introduces the device embodiments of this application, which can be used to execute the cross-chain transaction method of the blockchain in the above embodiments of this application. Figure 7 The structural block diagram of the cross-chain transaction device of the blockchain provided by the embodiments of this application is schematically shown. As Figure 7 shown, the cross-chain transaction device 700 of the blockchain includes:
[0162] An acquisition module 710, configured to acquire a first cross-chain transaction that conforms to the business rules of the initiating chain, where the first cross-chain transaction is used to indicate the business of performing a cross-chain transaction with the target chain on the initiating chain, the initiating chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction;
[0163] A transmission module 720, configured to create a second cross-chain transaction that conforms to the business rules of the target chain according to the first cross-chain transaction, and transmit the second cross-chain transaction to the target chain, where the second cross-chain transaction is used to indicate the business of performing a cross-chain transaction with the initiating chain on the target chain;
[0164] An execution module 730, configured to execute the first cross-chain transaction on the initiating chain according to the business rules of the initiating chain, and execute the second cross-chain transaction on the target chain according to the business rules of the target chain.
[0165] In some embodiments of the present application, based on the above technical solutions, the transmission module 720 may further include:
[0166] A parsing module, configured to parse the first cross-chain transaction to obtain the communication address of the target chain and the transaction content carried in the first cross-chain transaction;
[0167] A verification module, configured to perform a legality verification on the first cross-chain transaction according to the communication address of the target chain, where the legality verification is used to verify whether the initiating chain supports cross-chain transactions with the target chain;
[0168] A creation module, configured to, when the verification result of the legality verification passes, create a second cross-chain transaction that conforms to the business rules of the target chain on the initiating chain according to the transaction content.
[0169] In some embodiments of the present application, based on the above technical solutions, the creation module may be further configured to: call a target chain transaction construction contract deployed on the initiating chain, where the target chain transaction construction contract is a smart contract for creating blockchain transactions that conform to the business rules of the target chain; input the transaction content into the target chain transaction construction contract to obtain a second cross-chain transaction created by the target chain transaction construction contract that conforms to the business rules of the target chain.
[0170] In some embodiments of the present application, based on the above technical solutions, the transmission module 720 may further include:
[0171] A first event creation module, configured to create a first cross-chain event on the initiating chain according to the communication address of the target chain, where the first cross-chain event is used to trigger the transmission of information from the initiating chain to the target chain;
[0172] A first serialization module, configured to perform serialization processing on the second cross-chain transaction to obtain serialized data of the second cross-chain transaction;
[0173] A first data writing module, configured to write the serialized data of the second cross-chain transaction into the first cross-chain event;
[0174] A first transaction transmission module, configured to transmit the serialized data of the second cross-chain transaction to the target chain according to the first cross-chain event.
[0175] In some embodiments of the present application, based on the above technical solutions, the transaction transmission module may further include:
[0176] A relay node acquisition module, configured to acquire relay nodes corresponding to the initiating chain and the target chain, where the relay nodes are blockchain nodes capable of respectively performing data communication with the initiating chain and the target chain;
[0177] A task establishment module, configured to establish an event detection task for the initiating chain on the relay node, where the event detection task is used to detect cross-chain events created on the initiating chain;
[0178] An event parsing module, configured to, when the event detection task detects the first cross-chain event created on the initiating chain, parse the first cross-chain event to obtain the communication address of the target chain carried in the first cross-chain event and the serialized data of the second cross-chain transaction;
[0179] A data transmission module, configured to transmit the serialized data of the second cross-chain transaction to the target chain according to the communication address of the target chain.
[0180] In some embodiments of the present application, based on the above technical solution, the relay node acquisition module may be further configured to: acquire a first node list corresponding to the initiating chain, where the first node list is used to record and maintain the blockchain nodes of the blockchain network of the initiating chain; acquire a second node list corresponding to the target chain, where the second node list is used to record and maintain the blockchain nodes of the blockchain network of the target chain; acquire the intersection of the first node list and the second node list, and select relay nodes corresponding to the initiating chain and the target chain from the intersection.
[0181] In some embodiments of the present application, based on the above technical solution, the transmission module 720 may further include:
[0182] A first status configuration module, configured to configure the first cross-chain event to a pending status, where the pending status is used to indicate that the cross-chain transaction is in an unfinished transaction state on the initiating chain.
[0183] In some embodiments of the present application, based on the above technical solution, the cross-chain transaction device 700 of the blockchain further includes:
[0184] A third transaction transmission module, configured to create a third cross-chain transaction that complies with the business rules of the initiating chain according to the second cross-chain transaction, and transmit the third cross-chain transaction to the initiating chain, where the third cross-chain transaction is used to indicate the execution result of the second cross-chain transaction;
[0185] A third transaction execution module, configured to execute the third cross-chain transaction on the initiating chain according to the business rules of the initiating chain.
[0186] In some embodiments of the present application, based on the above technical solutions, the third transaction transmission module may further include:
[0187] A second event creation module, configured to create a second cross-chain event on the target chain according to the communication address of the initiating chain, where the second cross-chain event is used to trigger the transmission of information from the target chain to the initiating chain;
[0188] A second serialization module, configured to perform serialization processing on the third cross-chain transaction to obtain serialized data of the third cross-chain transaction;
[0189] A second data writing module, configured to write the serialized data of the third cross-chain transaction into the second cross-chain event;
[0190] A second transaction transmission module, configured to transmit the serialized data of the third cross-chain transaction to the target chain according to the second cross-chain event.
[0191] In some embodiments of the present application, based on the above technical solutions, the third transaction transmission module may further include:
[0192] A second status configuration module, configured to configure the second cross-chain event as a cancellation status, where the cancellation status is used to indicate that the cross-chain transaction is in a completed transaction state on the target chain.
[0193] In some embodiments of the present application, based on the above technical solutions, the third transaction execution module is further configured to: configure the first cross-chain event as a completed status, where the completed status is used to indicate that the cross-chain transaction is in a completed transaction state on the initiating chain.
[0194] The specific details of the cross-chain transaction device of the blockchain provided in each embodiment of the present application have been described in detail in the corresponding method embodiments, and will not be repeated here.
[0195] Figure 8 Schematically shows a block diagram of a computer system of an electronic device for implementing the embodiments of the present application.
[0196] It should be noted that Figure 8 The computer system 800 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.
[0197] Such as Figure 8As shown, the computer system 800 includes a central processing unit 801 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 802 (ROM) or the program loaded from the storage section 808 into the random access memory 803 (RAM). In the random access memory 803, various programs and data required for system operation are also stored. The central processing unit 801, the read-only memory 802, and the random access memory 803 are connected to each other via a bus 804. An input / output interface 805 (Input / Output interface, i.e., I / O interface) is also connected to the bus 804.
[0198] The following components are connected to the input / output interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a local area network card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read from it can be installed into the storage section 808 as needed.
[0199] In particular, according to the embodiments of the present application, the processes described in each method flowchart can be implemented as computer software programs. For example, the embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit 801, various functions defined in the system of the present application are executed.
[0200] 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. The computer-readable storage medium can be, for example, but not limited to, 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 can 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, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. 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. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0201] 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. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above 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 can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can 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, and 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.
[0202] It should be noted that although several modules or units of a device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0203] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
[0204] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present application.
[0205] It should be understood that the present application is not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. A cross-chain transaction method for a blockchain, characterized in that, Including: Obtain a first cross-chain transaction that complies with the business rules of the originating chain. The first cross-chain transaction is used to indicate the business of performing a cross-chain transaction with a target chain on the originating chain. The originating chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction; Create a second cross-chain transaction that complies with the business rules of the target chain according to the first cross-chain transaction, and transmit the second cross-chain transaction to the target chain. The second cross-chain transaction is used to indicate the business of performing a cross-chain transaction with the originating chain on the target chain; Execute the first cross-chain transaction on the originating chain according to the business rules of the originating chain, and execute the second cross-chain transaction on the target chain according to the business rules of the target chain.
2. The cross-chain transaction method of the blockchain according to claim 1, characterized in that, Creating a second cross-chain transaction that complies with the business rules of the target chain according to the first cross-chain transaction includes: Parse the first cross-chain transaction to obtain the communication address of the target chain and the transaction content carried in the first cross-chain transaction; Perform a legality check on the first cross-chain transaction according to the communication address of the target chain. The legality check is used to verify whether the originating chain supports cross-chain transactions with the target chain; When the verification result of the legality check passes, create a second cross-chain transaction that complies with the business rules of the target chain on the originating chain according to the transaction content.
3. The cross-chain transaction method of the blockchain according to claim 2, wherein, Creating a second cross-chain transaction that complies with the business rules of the target chain on the originating chain according to the transaction content includes: Invoke a target chain transaction construction contract deployed on the originating chain. The target chain transaction construction contract is a smart contract for creating blockchain transactions that comply with the business rules of the target chain; Input the transaction content into the target chain transaction construction contract to obtain a second cross-chain transaction created by the target chain transaction construction contract that complies with the business rules of the target chain.
4. The cross-chain transaction method of the blockchain according to claim 1, characterized in that, Transmitting the second cross-chain transaction to the target chain includes: Create a first cross-chain event on the originating chain according to the communication address of the target chain. The first cross-chain event is used to trigger the transmission of information from the originating chain to the target chain; Perform serialization processing on the second cross-chain transaction to obtain the serialized data of the second cross-chain transaction; Write the serialized data of the second cross-chain transaction into the first cross-chain event; Transmit the serialized data of the second cross-chain transaction to the target chain according to the first cross-chain event.
5. The cross-chain transaction method of the blockchain according to claim 4, wherein Transmitting the serialized data of the second cross-chain transaction to the target chain according to the first cross-chain event includes: Obtain a relay node corresponding to the originating chain and the target chain. The relay node is a blockchain node that can communicate with the originating chain and the target chain respectively; Establish an event detection task for the originating chain on the relay node. The event detection task is used to detect cross-chain events created on the originating chain; When the event detection task detects the first cross-chain event created on the originating chain, parse the first cross-chain event to obtain the communication address of the target chain and the serialized data of the second cross-chain transaction carried in the first cross-chain event; Transmit the serialized data of the second cross-chain transaction to the target chain according to the communication address of the target chain.
6. The cross-chain transaction method of the blockchain according to claim 5, characterized in that, Obtain relay nodes corresponding to the source chain and the target chain, including: Obtain a first node list corresponding to the source chain, where the first node list is used to record and maintain the blockchain nodes of the blockchain network of the source chain; Obtain a second node list corresponding to the target chain, where the second node list is used to record and maintain the blockchain nodes of the blockchain network of the target chain; Obtain the intersection of the first node list and the second node list, and select relay nodes corresponding to the source chain and the target chain from the intersection.
7. The cross-chain transaction method of the blockchain according to claim 4, characterized in that, After creating a first cross-chain event on the source chain according to the communication address of the target chain, the method further includes: Configure the first cross-chain event to a pending state, where the pending state is used to indicate that the cross-chain transaction is in an unfinished state on the source chain.
8. The cross-chain transaction method of the blockchain according to any one of claims 1 to 7, characterized in that After executing the second cross-chain transaction on the target chain according to the target chain business rules, the method further includes: Create a third cross-chain transaction that complies with the source chain business rules according to the second cross-chain transaction, and transmit the third cross-chain transaction to the source chain, where the third cross-chain transaction is used to indicate the execution result of the second cross-chain transaction; Execute the third cross-chain transaction on the source chain according to the source chain business rules.
9. The cross-chain transaction method of the blockchain according to claim 8, wherein, Transmit the third cross-chain transaction to the source chain, including: Create a second cross-chain event on the target chain according to the communication address of the source chain, where the second cross-chain event is used to trigger the transmission of information from the target chain to the source chain; Perform serialization processing on the third cross-chain transaction to obtain the serialized data of the third cross-chain transaction; Write the serialized data of the third cross-chain transaction into the second cross-chain event; Transmit the serialized data of the third cross-chain transaction to the target chain according to the second cross-chain event.
10. The cross-chain transaction method of the blockchain according to claim 9, wherein, After creating a second cross-chain event on the target chain according to the communication address of the source chain, the method further includes: Configure the second cross-chain event to a cancelled state, where the cancelled state is used to indicate that the cross-chain transaction is in a completed state on the target chain.
11. The cross-chain transaction method of the blockchain according to claim 8, wherein After executing the third cross-chain transaction on the source chain according to the source chain business rules, the method further includes: Configure the first cross-chain event to a completed state, where the completed state is used to indicate that the cross-chain transaction is in a completed state on the source chain.
12. A cross-chain transaction device for a blockchain, characterized in that, Includes: An acquisition module configured to acquire a first cross-chain transaction that complies with the source chain business rules, where the first cross-chain transaction is used to indicate the business of executing a cross-chain transaction with a target chain on the source chain, the source chain is the blockchain that initiates the cross-chain transaction, and the target chain is the blockchain that responds to the cross-chain transaction; A transmission module, configured to create a second cross-chain transaction that complies with the business rules of the target chain according to the first cross-chain transaction, and transmit the second cross-chain transaction to the target chain, where the second cross-chain transaction is used to indicate the execution of a cross-chain transaction with the initiating chain on the target chain; An execution module, configured to execute the first cross-chain transaction on the initiating chain according to the business rules of the initiating chain, and execute the second cross-chain transaction on the target chain according to the business rules of the target chain.
13. A computer-readable medium, characterized in that, A computer program is stored on the computer-readable medium, and when the computer program is executed by a processor, the cross-chain transaction method of the blockchain described in any one of claims 1 to 11 is implemented.
14. An electronic device, characterized in that, Comprising: A processor; And A memory for storing executable instructions of the processor; Wherein, the processor is configured to execute the executable instructions to implement the cross-chain transaction method of the blockchain described in any one of claims 1 to 11.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the cross-chain transaction method of the blockchain described in any one of claims 1 to 11 is implemented.