Resource processing method and device based on block chain network, and computer equipment
Connecting to the blockchain network through a cross-chain gateway, receiving resource processing events and sending requests to the decentralized platform, solving the problem of cross-chain transfer of digital resources and achieving efficient and low-cost cross-chain transfer effect.
Patent Information
- Application Number
- CN202310731162.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-19
- Publication Date
- 2024-12-20
AI Technical Summary
The existing technology cannot realize cross-chain transfer of digital resources and cannot meet users' cross-chain transfer needs.
Connect to different blockchain networks through cross-chain gateways, receive resource processing events, and send resource conversion requests to the decentralized resource processing platform to realize cross-chain transfer of digital resources.
Cross-chain transfer of digital resources has been realized, transfer costs have been reduced, and efficiency and user experience have been improved.
Smart Images

Figure CN119168633A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource processing method, device and computer equipment based on a blockchain network. Background Art
[0002] With the continuous development of blockchain technology, the transfer of digital resources has become a very important issue. At present, in the scenario of digital resource transfer, only the transfer of digital resources on the same blockchain network is supported, which cannot meet the user's cross-chain transfer needs. Therefore, how to achieve cross-chain digital resource transfer has become a current research hotspot. Summary of the invention
[0003] The embodiments of the present application provide a resource processing method, device and computer equipment based on a blockchain network, which can realize cross-chain transfer of digital resources.
[0004] On the one hand, an embodiment of the present application provides a resource processing method based on a blockchain network, the method comprising:
[0005] Receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate: transferring a first digital resource amount in a first account in the first blockchain network to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network;
[0006] Based on the first resource processing event, a resource conversion request is sent to the decentralized resource processing platform in the second blockchain network, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0007] After the second digital resource amount is transferred to the second account, a second resource processing event is sent to the first node through the cross-chain gateway, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0008] On the one hand, an embodiment of the present application provides a resource processing method based on a blockchain network, the method comprising:
[0009] In response to the resource transfer request, determining a first digital resource amount to be transferred in a first account in the first blockchain network, and locking the first digital resource amount;
[0010] After locking the first digital resource amount, generating a first resource processing event; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network;
[0011] Sending the first resource processing event to a second node in the second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the third party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0012] receiving a second resource processing event sent by the second node through the cross-chain gateway, where the second resource processing event is sent after the second digital resource amount is transferred to the second account;
[0013] In response to the second resource processing event, the first digital resource amount is unlocked, and the unlocked first digital resource amount is transferred to the contract account of the third-party object in the first blockchain network.
[0014] On the one hand, an embodiment of the present application provides a resource processing device based on a blockchain network, the device comprising:
[0015] A receiving unit, configured to receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate that a first digital resource amount in a first account in the first blockchain network is transferred to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network;
[0016] A sending unit, configured to send a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from a third-party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0017] The sending unit is also used to send a second resource processing event to the first node through the cross-chain gateway after transferring the second digital resource amount to the second account, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0018] On the one hand, an embodiment of the present application provides a resource processing device based on a blockchain network, the device comprising:
[0019] A locking unit, configured to determine, in response to a resource transfer request, a first digital resource amount to be transferred in a first account in a first blockchain network, and lock the first digital resource amount;
[0020] A generating unit, configured to generate a first resource processing event after locking the first digital resource amount; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network;
[0021] A sending unit, configured to send the first resource processing event to a second node in a second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from a third-party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0022] A receiving unit, configured to receive a second resource processing event sent by the second node through the cross-chain gateway, wherein the second resource processing event is sent after the second digital resource amount is transferred to the second account;
[0023] An unlocking unit is used to respond to the second resource processing event, unlock the first digital resource amount, and transfer the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0024] On the one hand, an embodiment of the present application provides a computer device, the computer device includes an input interface, an output interface, and the computer device further includes:
[0025] a processor adapted to implement one or more instructions; and,
[0026] A computer storage medium storing one or more instructions, wherein the one or more instructions are suitable for being loaded by the processor and executing the following steps on the second node side in the second blockchain network:
[0027] Receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate: transferring a first digital resource amount in a first account in the first blockchain network to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network;
[0028] Based on the first resource processing event, a resource conversion request is sent to the decentralized resource processing platform in the second blockchain network, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0029] After the second digital resource amount is transferred to the second account, a second resource processing event is sent to the first node through the cross-chain gateway, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0030] The one or more instructions are also suitable for being loaded by the processor and executing the following steps on the first node side in the first blockchain network:
[0031] In response to the resource transfer request, determining a first digital resource amount to be transferred in a first account in the first blockchain network, and locking the first digital resource amount;
[0032] After locking the first digital resource amount, generating a first resource processing event; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network;
[0033] Sending the first resource processing event to a second node in the second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the third party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0034] receiving a second resource processing event sent by the second node through the cross-chain gateway, where the second resource processing event is sent after the second digital resource amount is transferred to the second account;
[0035] In response to the second resource processing event, the first digital resource amount is unlocked, and the unlocked first digital resource amount is transferred to the contract account of the third-party object in the first blockchain network.
[0036] On the one hand, an embodiment of the present application provides a computer storage medium, which stores one or more instructions, and the one or more instructions are suitable for being loaded by the processor and executed by the blockchain network-based resource processing method on the second node side in the above-mentioned second blockchain network or the blockchain network-based resource processing method on the first node side in the above-mentioned first blockchain network.
[0037] On the one hand, an embodiment of the present application provides a computer storage medium, which stores one or more first instructions, and the one or more instructions are suitable for being loaded by a processor and executed by the blockchain network-based resource processing method on the second node side in the above-mentioned second blockchain network or the blockchain network-based resource processing method on the first node side in the above-mentioned first blockchain network.
[0038] On the one hand, an embodiment of the present application provides a computer program product, which includes one or more instructions, and the one or more instructions are stored in a computer storage medium, and the processor of the computer device executes the blockchain network-based resource processing method on the second node side in the above-mentioned second blockchain network or the blockchain network-based resource processing method on the first node side in the above-mentioned first blockchain network by calling the one or more instructions.
[0039] In an embodiment of the present application, a second node in the second blockchain network may receive a first resource processing event sent by a first node in the first blockchain network through a cross-chain gateway, where the first resource processing event is used to indicate: transferring a first digital resource amount in a first account in the first blockchain network to a second account in the second blockchain network; wherein the first resource processing event is generated after locking the first digital resource amount in the first blockchain network; and based on the first resource processing event, a resource conversion request may be sent to a decentralized resource processing platform in the second blockchain network, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount; after transferring the second digital resource amount to the second account, a second resource processing event may be sent to the first node through the cross-chain gateway, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third party object in the first blockchain network. Through the above method, different blockchain networks can be connected through the cross-chain gateway, making the cross-chain transfer of digital resources possible. The cross-chain gateway can monitor the resource processing events generated in the blockchain network and forward the generated resource processing events to another blockchain network, so that the blockchain network can realize the cross-chain transfer of digital resources based on the instructions of the resource processing events. In addition, the cross-chain gateway can transfer digital resources from one blockchain network to the blockchain network where the decentralized resource processing platform is located, and then add these digital resources to the decentralized resource processing platform for the transfer of digital resources. Compared with the centralized resource processing platform, it can effectively reduce the cost of cross-chain transfer and improve the efficiency of cross-chain transfer of digital resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1a is a schematic diagram of a data sharing system provided in an embodiment of the present application;
[0042] Figure 1b It is a structural schematic diagram of a block composition provided in an embodiment of the present application;
[0043] Figure 1c This is a flow chart of generating a new block provided by an embodiment of the present application;
[0044] Figure 1d It is a schematic diagram of the architecture of a resource processing system provided in an embodiment of the present application;
[0045] Figure 1e It is a schematic diagram of a cross-chain gateway synchronization block header provided in an embodiment of the present application;
[0046] Figure 1f is a schematic diagram of the architecture of another resource processing system provided in an embodiment of the present application;
[0047] Figure 2 It is a flowchart of a resource processing method based on a blockchain network provided in an embodiment of the present application;
[0048] Figure 3 It is a flowchart of another resource processing method based on a blockchain network provided in an embodiment of the present application;
[0049] Figure 4a is a schematic diagram of a detection block certainty provided by an embodiment of the present application;
[0050] Figure 4b is a schematic diagram of another detection block certainty provided by an embodiment of the present application;
[0051] Figure 4c It is a schematic diagram of a flow chart of validating a first resource processing event provided by an embodiment of the present application;
[0052] Figure 4d is a schematic diagram of a Merkle tree provided in an embodiment of the present application;
[0053] Figure 5 This is a flowchart of another resource processing method based on a blockchain network provided in an embodiment of the present application;
[0054] Figure 6 It is a structural diagram of a resource processing device based on a blockchain network provided in an embodiment of the present application;
[0055] Figure 7 It is a structural schematic diagram of another resource processing device based on a blockchain network provided in an embodiment of the present application;
[0056] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0058] The embodiments of the present application involve a blockchain network. The following is a brief introduction to the relevant terms and concepts of the blockchain network:
[0059] The blockchain network 10 refers to a network for sharing data between nodes. The blockchain network may include multiple nodes 101, wherein the multiple nodes 101 may include various types of nodes such as consensus nodes, full nodes, and light nodes (such as SPV (Simplified Payment Verification) nodes). A full node may refer to a node that maintains a complete blockchain in the blockchain network, and a light node may refer to a node that maintains a block header in the blockchain. A light node can be understood as a node that does not have a complete blockchain. Each node 101 can receive input information when performing normal work, and maintain the shared data (i.e., blockchain) in the blockchain network based on the received input information.
[0060] Different nodes in the blockchain network can store the same blockchain, which includes a series of blocks that are connected to each other in the order of their generation. The node here can refer to the node that maintains the complete blockchain in the blockchain network, such as the full node and consensus node mentioned above. Figure 1a As shown in the block 1, block M-1, etc., M is a positive integer greater than 1; once a new block is added to the blockchain, it will not be removed, and the block records the record data submitted by the nodes in the blockchain network. In order to ensure the information exchange within the blockchain network, there can be an information connection between each node, and peer-to-peer (P2P) communication can be achieved between any two nodes. Specifically, P2P communication can be carried out through a wired communication link or a wireless communication link. For example, when any node in the blockchain network receives input information, other nodes obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes in the blockchain network are consistent.
[0061] The client 102 can access the blockchain network and communicate with nodes in the blockchain network, for example, sending a resource transfer request to a node, etc. The terminal where the client 102 is located can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a car-mounted smart terminal, etc., which is not limited in the embodiments of the present application.
[0062] It should be noted that Figure 1a The number of nodes shown in the figure is only for illustration. Any number of nodes may be deployed according to actual needs. The node may refer to any form of computing device accessing the network, such as a server or a terminal, which may join and become a node.
[0063] Among them, for each node in the blockchain network, there is a node identifier corresponding to it, and each node in the blockchain network can store the node identifiers of other nodes in the blockchain network, so that the generated blocks can be broadcast to other nodes in the blockchain network according to the node identifiers of other nodes. Each node can maintain a node identifier list as shown in the following table, and the node name and node identifier are stored in the node identifier list accordingly. Among them, the node identifier can be an Internet Protocol (IP) address and any other information that can be used to identify the node. The table only uses the IP address as an example for illustration.
[0064] Node Name Node ID Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N 119.123.789.258
[0065] Each node in the blockchain network stores the same blockchain. The blockchain consists of multiple blocks, see Figure 1b The blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores input information feature values, version numbers, timestamps, and difficulty values, and the block body stores input information. The next block of the genesis block uses the genesis block as its parent block. The next block also includes a block header and a block body. The block header stores the input information feature values of the current block (or Merkle root hash value, merkle_root, etc.), the block header feature values of the parent block (or prev_hash, etc.), version numbers, timestamps, and difficulty values, and so on. This ensures that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, thereby ensuring the security of the input information in the block.
[0066] Among them, when generating each block in the blockchain, see Figure 1c When the node where the blockchain is located receives the input information, it verifies the input information. After the verification is completed, the input information is stored in the memory pool and the hash tree used to record the input information is updated. After that, the update timestamp is updated to the time when the input information is received, and different random numbers are tried to calculate the eigenvalue multiple times so that the calculated eigenvalue can satisfy the following formula:
[0067] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET
[0068] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.
[0069] In this way, when the random number that satisfies the above formula is calculated, the information can be stored accordingly, the block header and block body can be generated, and the current block can be obtained. Subsequently, the node where the blockchain is located sends the newly generated block to other nodes in the blockchain network according to the node identification of other nodes in the blockchain network. Other nodes verify the newly generated block and add the newly generated block to the blockchain stored in them after the verification is completed.
[0070] Among them, smart contracts can be run on the nodes of the blockchain network. Smart contracts are a type of tamper-proof, automatically executed computer program running on the blockchain. Smart contracts are code implementations that are executed when certain conditions are met. Developers can define the contract logic through programming languages and publish it to the blockchain (smart contract registration). According to the logic of the contract terms, they call keys or other events to trigger execution and complete the contract logic. At the same time, they also provide functions for upgrading and canceling smart contracts.
[0071] Cross-chain technology: Cross-chain technology is a technology that connects different blockchain networks and can help different blockchain networks exchange information to provide a better cross-chain resource processing experience.
[0072] Cross-chain gateway: Cross-chain gateway is a technology used to connect different blockchain networks. The cross-chain gateway can connect two different blockchain networks, making cross-chain processing of digital resources possible.
[0073] Based on the above introduction to the blockchain network, the present application embodiment proposes a resource processing solution based on the blockchain network and a corresponding resource processing system to achieve cross-chain transfer of digital resources. Figure 1d, is a schematic diagram of the architecture of a resource processing system provided in an embodiment of the present application; the resource processing system includes a first blockchain network, a second blockchain network, and a cross-chain gateway for information exchange between the first blockchain network and the second blockchain network. Among them, the first blockchain network and the second blockchain network may include multiple nodes, and any two nodes in the two blockchain networks can exchange information through the cross-chain gateway. Here, the first node in the first blockchain network and the second node in the second blockchain network are used as examples for relevant explanation. The first node is one of the nodes in the first blockchain network, and the second node is one of the nodes in the second blockchain network. That is, the first node and the second node can exchange information through the cross-chain gateway. A decentralized resource processing platform can be deployed in the first blockchain network and the second blockchain network to realize the cross-chain transfer of digital resources using the decentralized resource processing platform.
[0074] Among them, the object can communicate with the first node in the first blockchain network or the second node in the second blockchain network through the client. For example, when the object has a resource transfer demand, and the resource transfer demand is to transfer the first digital resource in the first account in the first blockchain network to the second account in the second blockchain network, the object can send a resource transfer request to the first node in the first blockchain network through the client, and the resource transfer request is used to request the cross-chain transfer of digital resources.
[0075] Among them, the cross-chain gateway can monitor the resource processing events generated in the blockchain network, and can forward the resource processing events to another blockchain network to achieve the intercommunication of resource processing events. For example, after the first node in the first blockchain network receives a resource transfer request, it can generate a first resource processing event based on the resource transfer request, and the cross-chain gateway can monitor the first resource processing event and forward the first resource processing event to the second node in the second blockchain network.
[0076] Among them, the cross-chain gateway can synchronize the latest block headers of blockchains in different blockchain networks and forward this information to other blockchain networks. For example, see Figure 1e As shown, the cross-chain gateway can connect the first blockchain network and the second blockchain network. The cross-chain gateway can synchronize the latest block header in the first blockchain network and forward this information to the second blockchain network. At the same time, the cross-chain gateway can also synchronize the latest block header of the second blockchain network and forward this information to the first blockchain network. In this way, both parties have the latest block header information of the other party. In one embodiment, the cross-chain gateway can verify the continuity and certainty of the block by synchronizing the block header to ensure the authenticity and security of resource processing events executed on different blockchain networks.
[0077] Among them, the decentralized resource processing platform is a decentralized resource processing platform, and the decentralized resource processing platform can use smart contracts to handle various resource processing events. The decentralized resource processing platform can allow objects to convert between digital resources of different resource types, and transfer the converted digital resources to the account to be transferred. For example, after the second node receives the first resource processing event, the second node can send a resource conversion request to the decentralized resource processing platform in the second blockchain network, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the third-party object in the contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount.
[0078] The decentralized resource processing platform allows users to transfer between different digital resources without going through the centralized resource processing platform. Instead, they can directly deposit digital resources into smart contracts and then extract digital resources from them to transfer to the required accounts. That is, resource processing events are automatically executed by code rather than by human intervention. Compared with the centralized resource processing platform, the decentralized resource processing platform can have higher security and reliability. In addition, the decentralized resource processing platform uses the automatic market maker (AMM) algorithm, which means that the conversion rate between various resource types is determined by supply and demand, rather than by the centralized resource processing platform. This automated resource processing method is more efficient and fairer because all resource processing events initiated by all objects are processed on the same resource processing platform, and no object can intervene or manipulate.
[0079] The decentralized resource processing platform can also be used as a liquidity provider. A third party can store digital resources in a smart contract to provide the decentralized resource processing platform with the liquidity of digital resources. At this time, the third party can also be called a liquidity injector. For example, a decentralized data processing platform can provide a decentralized digital resource pool to provide the liquidity of digital resources and increase the resource transfer options of the object. The object can transfer digital resources of any resource type on the decentralized data processing platform, whether it is a digital resource of a known resource type or a relatively novel digital resource, without worrying about liquidity and security issues. In addition, the automatic transfer of digital resources can be achieved through smart contracts, making the transfer of digital resources simpler, faster and more convenient.
[0080] Among them, the third-party object may refer to: an object that can provide digital resources adapted to the second blockchain network, except for the object to which the first account belongs and the object to which the second account belongs. For example, the third object may be a cross-chain gateway, or a decentralized resource processing platform that exists in both the first blockchain network and the second blockchain network, etc. In one embodiment, after the third-party object provides digital resources to the decentralized resource processing platform and enhances the liquidity of the decentralized resource processing platform, the third object may obtain certain resource feedback, and the amount and type of the resources fed back are not specifically limited here.
[0081] In the embodiment of the present application, in order to realize the cross-chain transfer of digital resources, the embodiment of the present application is based on Figure 1d The resource processing system shown provides a resource processing solution. In a specific implementation, the resource processing solution can be Figure 1d The resource processing scheme is executed by the second node in the second blockchain network. The general principle of the resource processing scheme is as follows: the second node in the second blockchain network receives the first resource processing event sent by the first node in the first blockchain network through the cross-chain gateway. The first resource processing event can be used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network; wherein the first resource processing event is generated after locking the first digital resource amount in the first blockchain network to ensure that the first digital resource amount is not consumed during the resource processing process, so as to improve the security and reliability of resource transfer.
[0082] After receiving the first resource processing event, the second node in the second blockchain network may send a resource conversion request to the decentralized resource processing platform in the second blockchain network, so that the decentralized resource processing platform, after determining the second digital resource amount required to convert the first digital resource amount, transfers the second digital resource amount from the third-party object's contract account in the second blockchain network to the second account. After transferring the second digital resource amount to the second account, the second node in the second blockchain network may send a second resource processing event to the first node through the cross-chain gateway, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the third-party object's contract account in the first blockchain network.
[0083] Through the above method, different blockchain networks can be connected through a cross-chain gateway, making the cross-chain transfer of digital resources possible. The cross-chain gateway can monitor the resource processing events generated in the blockchain network and forward the generated resource processing events to another blockchain network, so that the blockchain network can realize the cross-chain transfer of digital resources based on the instructions of the resource processing events. That is, various digital resources can be transferred to other blockchain networks for resource processing through the cross-chain gateway to effectively improve the availability and convenience of digital resources, thereby improving the efficiency and experience of the cross-chain transfer of digital resources of the object. In addition, based on the characteristics of the decentralized resource processing platform, it can be known that using the decentralized resource processing platform as a resource processing platform can not only realize the cross-chain transfer of digital resources, but also provide the liquidity of digital resources. By providing liquidity, the decentralized resource processing platform can make cross-chain transfer simpler, faster and more convenient. The cross-chain transfer function of digital resources based on the decentralized resource processing platform can improve the availability and convenience of the object, thereby effectively improving the efficiency and experience of the cross-chain transfer of the digital resources of the object. In addition, the cross-chain gateway can transfer digital resources from one blockchain network to the blockchain network where the decentralized resource processing platform is located, and then add these digital resources to the decentralized resource processing platform for the transfer of digital resources. Compared with the centralized resource processing platform, it can effectively reduce the cost of cross-chain transfer, while also improving the liquidity of the decentralized data processing platform and increasing the cross-chain transfer options of objects.
[0084] In one embodiment, various smart contracts required to complete the resource processing solution can be deployed in the blockchain network, for example, see Figure 1f As shown, a cross-chain contract and a resource contract can be deployed in the first blockchain network, and a cross-chain contract and a resource contract can also be deployed in the second blockchain network to complete the resource processing solution through the automatic execution of these smart contracts. For example, the resource processing solution mentioned above can be executed by the second node in the second blockchain network by calling the cross-chain contract in the second blockchain network, that is, in addition to the above-mentioned second node as the execution subject to execute the resource processing solution, the cross-chain contract in the second blockchain network can also be used as the execution subject to execute the resource processing solution.
[0085] Among them, the cross-chain contract in the second blockchain network can also include: the amount of digital resources held by the third-party object in the second blockchain network; then the decentralized resource processing platform in the second blockchain network can transfer the amount of digital resources held by the third-party object in the cross-chain contract in the second blockchain network to the contract account of the third-party object in the second blockchain network, and further, the decentralized resource processing platform can transfer the second digital resource amount from the corresponding contract account to the second account. In summary, the decentralized data processing platform can use smart contracts to process the transfer of digital resources, and smart contracts are a type of automatically executed contract, which can effectively ensure the efficiency, security and fairness of digital resource transfer.
[0086] Among them, the resource transfer request initiated by the object through the client can be received through the resource contract in the first blockchain network. After the resource contract receives the resource transfer request, it can respond to the resource transfer request to lock the first digital resource amount in the first account into the cross-chain contract in the first blockchain network through the resource contract.
[0087] It can be seen that in the embodiments of the present application, the cross-chain transfer of digital resources can be realized by calling the smart contract, and the automation of the cross-chain transfer of digital resources can be realized, which can make the cross-chain transfer more convenient and efficient; and the smart contract allows the cross-chain transfer of trusted digital resources without a third party, making the cross-chain transfer of digital resources safer and fairer.
[0088] Based on the above description of the resource processing system based on blockchain network and the resource processing solution based on blockchain network, the embodiment of the present application proposes a resource processing method based on blockchain network. Figure 2 , the resource processing method based on the blockchain network may include the following steps S201-S206:
[0089] S201, a first node in a first blockchain network determines a first digital resource amount to be transferred in a first account in the first blockchain network in response to a resource transfer request, and locks the first digital resource amount.
[0090] The resource transfer request requests: transfer the first digital resource in the first account in the first blockchain network to the second account in the second blockchain network. The resource transfer request specifies the amount of digital resources to be transferred, i.e., the first digital resource amount; it also specifies the transferor and transferee of the digital resources, i.e., the first account is the transferor of the digital resources, and the second account is the transferee of the digital resources.
[0091] It should be understood that the first account may refer to any account in the first blockchain, and the second account may refer to any account in the second blockchain, wherein the resource types of digital resources in the first account and the second account are different, for example, the digital resources of the first account are digital resources of the first type, and the digital resources of the second account are digital resources of the second type.
[0092] The first account and the second account may belong to the same object, that is, the first account and the second account are accounts set up by the same object in different blockchain networks; or the first account and the second account may belong to different objects, that is, the first account and the second account are accounts set up by different objects in different blockchain networks. The object here can refer to any user.
[0093] For example, if the application scenario is that the first object needs to convert the digital resources in the account in the first blockchain network into digital resources compatible with the second blockchain network, and store the converted digital resources in its own account in the second blockchain network, then in this application scenario, the first account and the second account mentioned above can be understood as accounts set up by the same object on different blockchain networks, that is, the first account is the account of the first object in the first blockchain network, and the second account is the account of the first object in the second blockchain network. For another example, if the application scenario is that the first object uses the digital resources in the account in the first blockchain network to purchase the goods of the second object, and needs to transfer the digital resources equivalent to the goods to the account of the second object in the second blockchain network, then in this application scenario, the first account and the second account mentioned above can be understood as accounts set up by different objects on different blockchain networks, that is, the first account is the account of the first object in the first blockchain network, and the second account is the account of the second object in the second blockchain network.
[0094] In a specific implementation, when an object has a resource transfer requirement to transfer a first digital resource amount in a first account in a first blockchain network to a second account in a second blockchain network, the object can initiate a resource transfer request to a first node in the first blockchain network through a client to realize a cross-chain transfer of digital resources. When the first node receives the resource transfer request, it can respond to the resource transfer request and perform subsequent operations. As mentioned above, the resource transfer request indicates the amount of digital resources to be transferred. After the first node obtains the resource transfer request, it can determine the first digital resource amount to be transferred from the resource transfer request, and after determining the first digital resource amount, the first digital resource amount can be locked. Among them, the locked digital resource amount is prohibited from use, that is, before the resource transfer process is completed, the locked first digital resource amount cannot continue to be used, so that the security and reliability of resource transfer are guaranteed.
[0095] S202: After locking the first digital resource amount, the first node in the first blockchain network generates a first resource processing event.
[0096] Among them, the first resource processing event can be used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network.
[0097] It is understandable that in order to ensure the security and reliability of the cross-chain transfer of digital resources, the first resource processing event can be generated after the first digital resource amount is locked to avoid the first digital resource amount in the first account being used during the cross-chain transfer of digital resources, thereby affecting the normal execution of the cross-chain transfer.
[0098] S203, the first node in the first blockchain network sends the first resource processing event to the second node in the second blockchain network through the cross-chain gateway.
[0099] It should be understood that here, the first digital resource amount in the first account in the first blockchain network is transferred to the second account in the second blockchain network. The first blockchain network needs to exchange information with the second blockchain network, and the first resource processing event used to indicate the cross-chain transfer of digital resources needs to be sent to the second blockchain network, so that the cross-chain transfer of digital resources can be completed in the second blockchain network.
[0100] As mentioned above, the cross-chain gateway can be interconnected with the first blockchain network and the second blockchain network, that is, when the first blockchain network and the second blockchain network need to communicate information, the cross-chain gateway can be used to achieve information communication between the two blockchain networks. Then, the first node in the first blockchain network can send the first resource processing event to the second node in the second blockchain network through the cross-chain gateway.
[0101] In a specific implementation, the cross-chain gateway has the ability to monitor resource processing events. When a resource processing event is generated in a blockchain network, the cross-chain gateway can monitor the corresponding resource processing event and forward the monitored resource processing event to another blockchain network. Based on this, when the cross-chain gateway monitors that a first node in a first blockchain network generates a first resource processing event, the first resource processing event can be obtained from the first node, and the obtained first resource processing event can be forwarded to a second node in a second blockchain network.
[0102] S204, the second node in the second blockchain network sends a resource conversion request to the decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount.
[0103] As mentioned above, the decentralized resource processing platform can provide a digital resource pool to allow the conversion of digital resources of different resource types and transfer the converted digital resources to the account to be transferred. After receiving the first resource processing event, the second node can send a resource conversion request to the decentralized resource processing platform based on the first resource processing event to use the decentralized resource processing platform to realize the cross-chain transfer of digital resources.
[0104] Among them, the above-mentioned digital resource pool can be understood as a contract account of a third-party object in the second blockchain network. The contract account stores resources of the resource type corresponding to the second account. In order to realize the cross-chain transfer of digital resources, the decentralized resource processing platform can first determine the second digital resource amount required to convert the first digital resource amount. After determining the second digital resource amount, the second digital resource amount can be obtained from the contract account in the second blockchain network, and the obtained second digital resource amount can be transferred to the second account, thereby realizing the transfer of the first digital resource amount in the first account to the second digital resource amount in the second account.
[0105] S205, after transferring the second digital resource amount into the second account, the second node in the second blockchain network sends a second resource processing event to the first node through the cross-chain gateway.
[0106] Among them, the second resource processing event can be used to indicate: unlocking the first digital resource amount, and transferring the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0107] In a specific implementation, after the second digital resource amount is transferred to the second account, the second node in the second blockchain network can generate a second resource processing event; and the cross-chain gateway has the monitoring capability of monitoring resource processing events, then the cross-chain gateway monitors the generation of the second resource processing event. Then, when the cross-chain gateway monitors the generation of the second resource processing event by the second node in the second blockchain network, the second resource processing event can be obtained from the second node, and the obtained second resource processing event can be forwarded to the first node in the first blockchain network.
[0108] It is understandable that when a digital resource is transferred across chains, the second digital resource amount is transferred from the third-party object's contract account in the second blockchain network to the second account, that is, when a cross-chain transfer is performed, the digital resources in the third-party object's contract account are used. In order to ensure that the total amount of digital resources of the third-party object remains unchanged, the transferred second digital resource amount needs to be filled. Considering that the digital resources stored in different blockchain networks are of different resource types, the third-party object can deploy corresponding contract accounts in both the first blockchain network and the second blockchain network, so that the digital resources transferred across chains can be transferred to the contract accounts in the corresponding blockchain networks.
[0109] As mentioned above, if the first digital resource amount is locked in the first blockchain network, the first digital resource amount in the first blockchain network can be unlocked, and the unlocked first digital resource amount can be transferred to the contract account of the third-party object in the first blockchain network, thereby realizing the cross-chain transfer of the first amount of resources from the first account to the second account.
[0110] S206, the first node in the first blockchain network responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0111] In the embodiment of the present application, different blockchain networks can be connected through a cross-chain gateway, making the cross-chain transfer of digital resources possible, and various digital resources can be transferred to other blockchain networks for resource processing to effectively improve the availability and convenience of digital resources, thereby improving the efficiency and experience of cross-chain transfer of digital resources of objects. In addition, based on the characteristics of the decentralized resource processing platform, it can be known that using the decentralized resource processing platform as a resource processing platform can not only realize the cross-chain transfer of digital resources, but also make cross-chain transfer simpler, faster and more convenient. The cross-chain transfer function of digital resources based on the decentralized resource processing platform can improve the availability and convenience of objects, thereby effectively improving the efficiency and experience of cross-chain transfer of digital resources of objects. In addition, the cross-chain gateway can transfer digital resources from one blockchain network to the blockchain network where the decentralized resource processing platform is located, and then add these digital resources to the decentralized resource processing platform for the transfer of digital resources. Compared with the centralized resource processing platform, it can effectively reduce the cost of cross-chain transfer and increase the cross-chain transfer options of objects.
[0112] Based on the relevant description of the above method embodiment, the present application embodiment also proposes a resource processing method based on a blockchain network. Figure 3 , the resource processing method based on the blockchain network may include the following steps S301-S309:
[0113] S301, a first node in a first blockchain network determines a first digital resource amount to be transferred in a first account in the first blockchain network in response to a resource transfer request, and locks the first digital resource amount.
[0114] The specific implementation of this step may refer to the description in the above step S201, which will not be repeated here.
[0115] In one embodiment, the resource processing method based on the blockchain network proposed in this application can be executed by calling the smart contract deployed on the blockchain network. It should be understood that the smart contract in this application contains the execution logic for completing a resource transfer, that is, the smart contract execution steps S301-S309 can be called. Among them, the first blockchain network can be deployed with a cross-chain contract and a resource contract, and the second blockchain network can also be deployed with a cross-chain contract and a resource contract; for the convenience of description, the cross-chain contract and the resource contract in the first blockchain network can be referred to as the first cross-chain contract and the first resource contract, respectively, and the cross-chain contract and the resource contract in the second blockchain network can be referred to as the second cross-chain contract and the second resource contract, respectively.
[0116] Among them, the resource processing method can be jointly executed by the first node in the first blockchain network by calling the cross-chain contract in the first blockchain network (the first cross-chain contract), and the second node in the second blockchain network by calling the cross-chain contract in the second blockchain network (the second cross-chain contract). That is, steps S301-S303 and steps S308-S309 can be executed by the first cross-chain contract, and steps S304-S305 and step S307 can be executed by the second cross-chain contract. Based on the characteristics of smart contracts, it can be known that smart contracts can be used to automatically execute the entire resource transfer process, that is, the automation of resource processing can be realized without manual operation, making resource processing more efficient and fair.
[0117] In one embodiment, the resource transfer request may be received through a resource contract (first resource contract) in the first blockchain network. After determining the amount of the first digital resource to be transferred in the first account in the first blockchain network, the first digital resource amount in the first account may be locked into a cross-chain contract (first cross-chain contract) in the first blockchain network through the resource contract.
[0118] S302: After locking the first digital resource amount, the first node in the first blockchain network generates a first resource processing event.
[0119] Among them, the first resource processing event can be used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network.
[0120] In one embodiment, in order to ensure that the first resource processing event is sent by the first node, that is, to ensure the security of the first resource processing event, the first node can sign the first resource processing event to send the signature information of the first resource processing event to the second node through the cross-chain gateway, so that the second node can perform signature verification on the first resource processing event based on the signature information. The signature verification can be understood as event validity verification of the first resource processing event.
[0121] The first node may sign the first resource processing event using the target private key to obtain signature information; and the process of the first node signing the first resource processing event using the target private key to obtain signature information may include any of the following methods:
[0122] Signature information generation method 1: The first node can directly use the target private key to sign the first resource processing event, and use the signature result as the signature information.
[0123] Signature information generation method 2: First, the first node can perform a hash operation on the first resource processing event to obtain a corresponding hash result; then, the first node can use the target private key to sign the hash result, and use the signed result as signature information.
[0124] Among them, this application does not limit the target private key used for the signature. For example, the target private key can be the private key corresponding to a signature algorithm such as SHA-1 (Secure Hash Algorithm 1) or SM2 (a signature algorithm for public key cryptography based on elliptic curve cryptography).
[0125] S303, the first node in the first blockchain network sends the first resource processing event to the second node in the second blockchain network through the cross-chain gateway.
[0126] In a specific implementation, the first node may package the first resource processing event into a block. For the convenience of description, the block here may be referred to as the first block; after obtaining the first block, the first node may also add the first block to the blockchain in the first blockchain network. After successfully adding the first block, the first node may send the first resource processing event to the cross-chain gateway, so that the cross-chain gateway may forward the first resource processing event to the second node in the second blockchain network. In one embodiment, the cross-chain gateway may directly forward the first resource processing event to the second node in the second blockchain network. In another embodiment, the cross-chain gateway may forward the first resource processing event to the second node in the second blockchain network after the cross-chain gateway determines that the first block where the first resource processing event is located has block certainty.
[0127] In one embodiment, after successfully adding the first block, the first node may also synchronize the block header of the first block to the second node in the second blockchain network through the cross-chain gateway. In this case, the cross-chain gateway may detect the block certainty of the first block based on the block header of the first block. In another embodiment, after successfully adding the first block, the first node may also synchronize the first block to the second node in the second blockchain network through the cross-chain gateway. In this case, the cross-chain gateway may detect the block certainty of the first block based on the first block.
[0128] Among them, the block certainty of a block means that in the blockchain network, after a certain period of time and number of confirmations, a block is considered irreversible, that is, it is determined to be final. This process is called "block confirmation". When it is determined that a block on the blockchain network has block certainty, it can be considered that the block is irreversible, that is, it is determined to be final. Then, after the cross-chain gateway determines that the first block where the first resource processing event is located has block certainty, it forwards the first resource processing event to the second node, which can effectively ensure the security and non-tampering of the first resource processing event.
[0129] In a blockchain network, a block is considered to have block finality if it meets the following conditions:
[0130] The block has been added to the blockchain network, that is, it has been broadcast to other nodes in the blockchain network and recognized by other nodes. Recognition here can be understood as the consensus of the block through the blockchain network, where the consensus operation can be achieved through the consensus nodes in the blockchain network.
[0131] The block has been confirmed a certain number of times in the blockchain network, and the number of confirmations can be preset. For example, taking the first block as an example, after the first block is added to the blockchain in the first blockchain network, if a new block is added to the blockchain where the first block is located, the new block can be used to confirm the first block. Adding a new block to the blockchain can be understood as a confirmation of the first block, and the successful addition of the first block to the blockchain can also be understood as a confirmation of the first block. It should be understood that, assuming the number of confirmations is N, it means that the first block has been confirmed by N blocks, and N is a positive integer. For example, assuming the number of confirmations is 6, it means that after the first block is added to the blockchain in the first blockchain network, 5 new blocks are added to the blockchain where the first block is located, or it has been confirmed by 6 blocks, which indicates that the first block has block certainty.
[0132] The number of confirmations depends on the value of the resource processing event and the security of the blockchain network. Generally, it takes more than 6 confirmations to confirm the security of a resource processing event. When transferring digital resources across chains, the object can set the corresponding number of confirmations and choose the appropriate confirmation method to ensure the security of the cross-chain transfer of digital resources.
[0133] Based on the above description of the block determinism of the block, it can be known that the cross-chain gateway verifies the block determinism of the first block where the first resource processing event is located as follows. It should be understood that after the first block is added to the blockchain in the first blockchain network, if a new block is added to the blockchain where the first block is located, the new block can be used to confirm the first block.
[0134] In a specific implementation, the cross-chain gateway may count the number of blocks in the first blockchain network used to confirm the first block, so as to detect the block certainty of the first block based on the counted number. Specifically, if the counted number is greater than or equal to a preset number, it can be determined that the first block has block certainty; if the counted number is less than the preset number, it can be determined that the first block does not have block certainty.
[0135] The preset number can be preset, and its specific value is not limited. For example, the preset number can be 6, 8, etc. The value corresponding to the preset number can be the difference between the number of confirmations mentioned above and 1. For example, assuming that the preset number is 5 (that is, the number of confirmations is 6), when the counted number is 5, it can be determined that the first block has certainty. For example, see Figure 4a As shown, assuming that the number counted after the first block (ie, the number of newly added blocks) is 5, it can be determined that the first block has block certainty.
[0136] In one embodiment, the preset number can be set based on one or more characteristic parameters such as the value of the resource processing event and the security of the blockchain network. For example, the preset number can be positively correlated with the value of the resource processing event. If the value of a resource processing event is higher, the preset number can be larger, and if the value of a resource processing event is lower, the preset number can be smaller. For another example, the preset number can be negatively correlated with the security of the blockchain network. If the security of the blockchain network is higher, the preset number can be smaller, and if the security of the blockchain network is lower, the preset number can be larger.
[0137] It is understandable that each time the first node generates a resource processing event, the cross-chain gateway can monitor the corresponding resource processing event and synchronize the block or block header of the resource processing event to the second blockchain network. During the synchronization process, the cross-chain gateway can also obtain the corresponding block or block header. Then the cross-chain gateway can count the number of blocks used to confirm the first block in the first blockchain network in the obtained block or block header. Considering that the cross-chain gateway can synchronize block headers or blocks, the following specifically describes the statistical operations under different synchronization situations.
[0138] (1) When the cross-chain gateway synchronizes the block header
[0139] The specific implementation of counting the number of blocks used to confirm the first block in the first blockchain network may be: the cross-chain gateway may first filter out the block headers on the blockchain where the first block is located from the block headers synchronized by the first node through the cross-chain gateway; then, the cross-chain gateway may count the number of blocks used to confirm the first block in the first blockchain network from the filtered block headers. The specific implementation may be any of the following methods:
[0140] Method 1: The cross-chain gateway can determine the block header synchronized after the block header of the first block from the screened block headers according to the synchronization time of each block header; and the number of determined block headers can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0141] That is, the block headers located after the synchronization time of the block header of the first block can be determined based on the synchronization time of each block header. If the number of block headers located after the block header of the first block is greater than or equal to a preset number, it can be determined that the first block has block certainty.
[0142] For example, assuming that the preset number is 5, if the number of block headers whose synchronization time is after the synchronization time of the block header of the first block is 5, it can be determined that the first block has block certainty; if the number of block headers whose synchronization time is after the synchronization time of the block header of the first block is 4, it can be determined that the first block does not have block certainty.
[0143] Method 2: The cross-chain gateway can determine the number of blocks used to confirm the first block based on the difference between the number in the block header of the latest synchronized block and the number in the block header of the first block. The number can be a numerical value indicating the block height. For example, the difference between the number of the latest synchronized block header and the number in the block header of the first block can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0144] That is to say, the blocks located after the block header number of the first block can be determined based on the numbers of the block headers. If the difference between the number of the latest synchronized block header and the number of the block header of the first block is greater than or equal to a value corresponding to a preset number, it can be determined that the first block has block certainty.
[0145] For example, assuming that the preset number is 5, and the number of the latest synchronized block header is 10, and the number of the block header of the first block is 5, it can be determined that the first block has block certainty, and if the number of the latest synchronized block is 8 and the number of the block header of the first block is 5, it can be determined that the first block does not have block certainty.
[0146] (2) When the cross-chain gateway synchronizes blocks
[0147] The specific implementation of counting the number of blocks used to confirm the first block in the first blockchain network may be: the cross-chain gateway may first filter out blocks located on the blockchain where the first block is located from the blocks synchronized by the first node through the cross-chain gateway; then, the cross-chain gateway may count the number of blocks used to confirm the first block in the first blockchain network from the filtered blocks. The specific implementation may be any of the following methods:
[0148] Method 1: The cross-chain gateway can determine the block synchronized after the first block from the screened blocks according to the synchronization time of each block; and the number of determined blocks can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0149] That is, the blocks located after the synchronization time of the first block can be determined based on the synchronization time of each block, and if the number of blocks located after the first block is greater than or equal to a preset number, it can be determined that the first block has block certainty.
[0150] In a second method, the cross-chain gateway can determine the number of blocks used to confirm the first block based on the difference between the number of the most recently synchronized block in the same blockchain as the first block and the number of the first block. For example, the difference between the number of the most recently synchronized block and the number of the first block can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0151] That is to say, the blocks located after the number of the first block can be determined based on the numbers of each block. If the difference between the number of the latest synchronized block and the number of the first block is greater than or equal to the value corresponding to the preset number, it can be determined that the first block has block certainty.
[0152] In one embodiment, usually, only one block is generated in the blockchain network at the same time, but it is also possible that two or more blocks are generated at the same time. In this case, the blockchain will be crossed, that is, the original blockchain can be forked into two blockchains. For example, see Figure 4b As shown, after the first block, block 51 and block 52 are generated at the same time, that is, after the first block, the original blockchain is forked into two blockchains, such as the blockchain of branch 1 and the blockchain of branch 2.
[0153] It is understandable that if two or more blocks are generated at the same time, two or more blocks will be considered finalized at the same time during the block confirmation process of the first block. In this fork situation, the cross-chain gateway can select one of the newly added blocks as the finalized block and regard the other blocks as invalid, that is, the other blocks cannot pass the block finality test. In subsequent confirmations, the block is also confirmed on this branch. For example, see Figure 4b As shown, after the first block, two blocks (block 51 and block 52) are generated at the same time. When performing block confirmation, only block 51 or block 51 can be selected as the confirmation block. If block 51 is selected as the confirmation block, subsequent block confirmation needs to be performed on branch 1 until the number of newly added blocks reaches a preset number, so that the first block can be determined to have block certainty. If block 52 is selected as the confirmation block, subsequent block confirmation needs to be performed on branch 2 until the number of newly added blocks reaches a preset number, so that the first block can be determined to have block certainty.
[0154] As mentioned above, in order to successfully add the first block to the blockchain in the first blockchain network, the first node needs to obtain the consensus of the first blockchain network. In one embodiment, the process of consensus on the first block can be described as follows:
[0155] The first node may send the first block to the consensus nodes in the first blockchain network, so that the consensus nodes in the first blockchain network reach a consensus on the first block; wherein the total number of consensus nodes may be one or more; and after receiving the first block sent by the first node, each consensus node in the first blockchain network may reach a consensus on the first block and return the corresponding consensus result to the first node. The consensus result of any consensus node is used to indicate support for the first block, or non-support for the first block.
[0156] After the first node receives the consensus results returned by each consensus node, the first node can detect whether the number of consensus nodes supporting the first block in the first blockchain network meets the preset conditions based on the consensus results, so as to determine whether the first block has passed the consensus of the first blockchain network. Specifically, if the first node detects that the number of consensus nodes supporting the first block in the first blockchain network meets the preset conditions in the consensus results, it can be determined that the first block has passed the consensus of the first blockchain network; if the first node detects that the number of consensus nodes supporting the first block in the first blockchain network does not meet the preset conditions in the consensus results, it can be determined that the first block has not passed the consensus of the first blockchain network.
[0157] The preset conditions may include: the number of consensus nodes supporting the first block in the first blockchain network reaches a specified number. The specific value of the specified number is not limited. For example, the specified number may be set to 2 / 3, 1 / 2, etc. of the total number of consensus nodes. For example, assuming that the specified number is set to 2 / 3 of the total number of consensus nodes, and the total number of consensus nodes is 9, the specified number is 6; in this case, if the first node detects that the number of consensus nodes supporting the first block reaches 6, it can be determined that the first block has passed the consensus of the first blockchain network.
[0158] When the consensus node returns the consensus result to the first node, it may directly return the consensus result to the first node. Alternatively, to improve data security, the consensus node may also sign the consensus result and return the signed consensus result to the first node. Here, the signed consensus result may be referred to as a node signature.
[0159] S304: The second node in the second blockchain network performs validity verification on the first resource processing event under at least one verification dimension.
[0160] To ensure the security of cross-chain processing of digital resources, after receiving the first resource processing event, the second node can verify the validity of the first resource processing event, and perform subsequent operations if the validity verification passes.
[0161] Among them, at least one verification dimension may include at least one of the following: block certainty verification dimension, block continuity verification dimension, block validity verification dimension, event validity verification dimension, and event existence verification dimension. The block certainty verification dimension is used to verify whether the first block has block certainty on the blockchain in the first blockchain network, the block continuity verification dimension is used to verify whether the first block has block continuity on the blockchain in the first blockchain network, the block validity verification dimension is used to verify whether the first block is valid on the blockchain in the first blockchain network, the event validity verification dimension is used to verify whether the first resource processing event is valid, and the event existence verification dimension is used to verify whether the first resource processing event actually exists.
[0162] In a specific implementation, when the validity verification of the first resource processing event is performed under multiple verification dimensions, the validity verification under each verification dimension can be processed in parallel or in series. In the case of serial processing, the validity verification under multiple verification dimensions can correspond to a specific verification order; for example, the verification order can be as follows: Figure 4c As shown, or, the validity verification under each verification dimension can be performed in sequence according to other verification orders, which is not specifically limited. Among them, the verification order can be pre-set; if it is not set, a verification order can also be randomly generated to perform validity verification under multiple verification dimensions based on the randomly generated verification order.
[0163] The following describes in detail the process of verifying the validity of the first resource processing event under various verification dimensions.
[0164] (1) In the case where at least one verification dimension includes a block deterministic verification dimension, the specific implementation of step S304 may be described as follows:
[0165] As mentioned above, when a block has block determinism, it can indicate that the block is irreversible, that is, the resource processing event corresponding to the block is confirmed and defaulted, and the resource processing event cannot be changed. Therefore, by verifying the validity of the first resource processing event under the block determinism verification dimension, the security and non-tamperability of the first resource processing event can be effectively guaranteed.
[0166] From the above description of block determinism, it can be seen that under the block determinism verification dimension, the second node can count the number of blocks in the first blockchain network used to confirm the first block, so as to verify the validity of the first resource processing event under the block determinism verification dimension based on the counted number.
[0167] Specifically, if the counted number is greater than or equal to the preset number, it can be determined that the first block where the first resource processing event is located has block certainty, so at this time it can be determined that the first resource processing event has passed the validity verification under the block certainty verification dimension; if the counted number is less than the preset number, it can be determined that the first block where the first resource processing event is located does not have block certainty, so at this time it can be determined that the first resource processing event has not passed the validity verification under the block certainty verification dimension. Among them, the preset number can be pre-set, and its specific value is not limited. For example, the preset number can be 6, 8, and other values.
[0168] It should be understood that after the first block is added to the blockchain in the first blockchain network, if a new block is added to the blockchain where the first block is located, the new block can be used to confirm the first block. Every time the first node sends a resource processing event through the cross-chain gateway, it will synchronize the block header or block of the block where the corresponding resource processing event is located through the cross-chain gateway. The following specifically describes the statistical operations under different synchronization situations.
[0169] 1. When the cross-chain gateway synchronizes the block header
[0170] Based on this, it can be known that under the block deterministic verification dimension, the specific implementation of counting the number of blocks used to confirm the first block in the first blockchain network can be: under the block deterministic verification dimension, the second node can first filter out the block headers on the blockchain where the first block is located from the block headers synchronized by the first node through the cross-chain gateway; then, the second node can count the number of blocks used to confirm the first block in the first blockchain network from the filtered block headers. The specific implementation can be any of the following methods:
[0171] Method 1: The second node can determine the block header synchronized after the block header of the first block from the screened block headers according to the synchronization time of each block header; and the number of determined block headers can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0172] Method 2: The second node can determine the number of blocks used to confirm the first block based on the difference between the number in the block header of the latest synchronized block and the number in the block header of the first block. The number can be a numerical value indicating the block height. For example, the difference between the number of the latest synchronized block header and the number in the block header of the first block can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0173] 2. When the cross-chain gateway synchronizes blocks
[0174] The specific implementation of counting the number of blocks used to confirm the first block in the first blockchain network may be: under the block deterministic verification dimension, the second node may first filter out blocks located on the blockchain where the first block is located from the blocks synchronized by the first node through the cross-chain gateway; then, the second node may count the number of blocks used to confirm the first block in the first blockchain network from the filtered blocks. The specific implementation may be any of the following methods:
[0175] Method 1: The second node can determine the block synchronized after the first block from the screened blocks according to the synchronization time of each block; and the number of determined blocks can be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0176] In a second method, the second node may determine the number of blocks used to confirm the first block based on the difference between the number of the most recently synchronized block in the same blockchain as the first block and the number of the first block. For example, the difference between the number of the most recently synchronized block and the number of the first block may be counted as the number of blocks used to confirm the first block in the first blockchain network.
[0177] As mentioned above, two or more blocks may be generated at the same time. In this case, during the block confirmation process of the first block, two or more blocks may be considered finalized at the same time. In this fork situation, the second node can select one of the newly added blocks as the finalized block and regard the other blocks as invalid, that is, the other blocks cannot pass the block determinism verification.
[0178] It should be noted that the verification principle of the second node regarding validity verification under the block determinism dimension is similar to the principle of the cross-chain gateway performing block determinism verification on the first block. The specific description can refer to the above-mentioned related description and will not be repeated here.
[0179] In summary, the block determinism verification is performed on the first resource processing event, that is, whether the first block where the first resource processing event is located has final determinism is verified.
[0180] (2) In the case where at least one verification dimension includes a block continuity verification dimension, the specific implementation of step S304 may be described as follows:
[0181] It should be understood that the block header of each block except the first block in any blockchain includes the parent block hash value, and the parent block hash value in the block header of any block refers to: the value obtained by hashing the block header of the last block on the corresponding blockchain before adding any block to the blockchain.
[0182] Based on this, it can be known that the specific implementation of step S304 can be: under the block continuity verification dimension, first, the second node can determine the target block header synchronized by the first node through the cross-chain gateway; the target block header can refer to: the block header of the previous block adjacent to the first block on the blockchain where the first block is located; and further determine the block hash value of the target block header, and obtain the parent block hash value in the block header of the first block, so as to verify the validity of the first resource processing event under the block continuity verification dimension based on the block hash value of the target block header and the obtained parent block hash value.
[0183] Specifically, if the block hash value of the target block header is consistent with the obtained parent block hash value, it can indicate that the target block header and the first block header are continuous, and it can also be explained that the first block where the first resource processing event is located has block continuity. Therefore, it can be determined here that the first resource processing event has passed the validity verification under the block continuity verification dimension; if the block hash value of the target block header is inconsistent with the obtained parent block hash value, it can be indicated that the target block header and the first block header are not continuous, and it can also be explained that the first block where the first resource processing event is located does not have block continuity. Therefore, it can be determined here that the first resource processing event has not passed the validity verification under the block continuity verification dimension.
[0184] The specific implementation of determining the block hash value of the target block header mentioned above may be: performing hash calculation on the target block header, and using the result of the hash calculation as the block hash value of the target block header. Alternatively, if the target block header contains the hash value of its own block header (i.e., the block hash value of the target block header), the corresponding block hash value may be obtained from the target block header.
[0185] In summary, the block continuity verification is performed on the first resource processing event, that is, whether the parent block hash value in the block header of the first block where the first resource processing event is located is consistent with the block hash value of the previous block.
[0186] (3) In the case where at least one verification dimension includes a block validity verification dimension, the specific implementation of step S304 may be described as follows:
[0187] It should be understood that the first block is added to the blockchain in the first blockchain network after passing the consensus of the first blockchain network; wherein, if the number of consensus nodes supporting the first block in the first blockchain network meets the preset conditions, the first block passes the consensus of the first blockchain network. The consensus of the first block can refer to the above description.
[0188] Based on this, the specific implementation of step S304 can be: under the block validity verification dimension, the second node can obtain the number of signatures of the node signature carried by the first block, and the node signature is signed by the consensus node supporting the first block. After obtaining the number of signatures, the first resource processing event can be verified for validity under the block continuity verification dimension based on the number of signatures and the number of signatures required for the first block to pass the consensus. Among them, the number of signatures required for the first block to pass the consensus can be the specified number indicated in the preset condition.
[0189] Specifically, if the number of signatures obtained is greater than or equal to the number of signatures required for the first block to pass consensus, it can be indicated that the first block where the first resource processing event is located has block validity, so at this time it can be determined that the first resource processing event has passed the validity verification under the block validity verification dimension; if the number of signatures obtained is less than the number of signatures required for the first block to pass consensus, it can be indicated that the first block where the first resource processing event is located does not have block validity, so at this time it can be determined that the first resource processing event has not passed the validity verification under the block validity verification dimension.
[0190] In summary, the first resource processing event is subjected to block validity verification, that is, it is verified whether the first block where the first resource processing event is located has the number of signatures required for the first block to pass consensus.
[0191] (4) In the case where at least one verification dimension includes an event validity verification dimension, the specific implementation of step S304 may be described as follows:
[0192] As mentioned above, to ensure the security of data, the first node can sign the first resource processing event to obtain the corresponding signature information. In one embodiment, when the first node sends the first resource processing event to the second node through the cross-chain gateway, the first node can also send the signature information to the second node through the cross-chain gateway, so that the second node can verify the validity of the first resource processing event based on the signature information.
[0193] In a specific implementation, under the event validity verification dimension, the second node can obtain the signature information of the first resource processing event; wherein the signature information is obtained by the first node signing the resource processing event using the target private key. After obtaining the signature information, the second node can also obtain the target public key corresponding to the target private key to verify the validity of the signature information using the target public key.
[0194] If the signature information passes the validity verification, it can indicate that the first resource processing event has event validity, so at this time the second node can determine that the first resource processing event has passed the validity verification under the event validity verification dimension; if the signature information does not pass the validity verification, it can indicate that the first resource processing event does not have event validity, so at this time the second node can determine that the first resource processing event has not passed the validity verification under the event validity verification dimension.
[0195] It should be noted that, based on the different ways of generating signature information for the first resource processing event, there are also differences in the ways of validating the signature information (or understanding it as signature verification). As mentioned above, the ways of generating signature information may include the signature information generation method 1 and the signature information generation method 2 in the above step S302.
[0196] In one embodiment, if the method for generating signature information is signature information generation method 1, the implementation process of using the target public key to verify the validity of the signature information can be: first, the target public key can be used to decrypt the signature information to obtain a decryption result; then, the decryption result and the first resource processing event are checked for consistency. If the decryption result and the first resource processing event pass the consistency check, it can be determined that the signature information has passed the validity verification; if the decryption result and the first resource processing event do not pass the consistency check, it can be determined that the signature information has not passed the validity verification.
[0197] Among them, performing a consistency check on the decoding result and the first resource processing event is to determine whether the decoding result and the first resource processing event are consistent; if it is determined that the decoding result and the first resource processing event are consistent, it can be determined that the decoding result and the first resource processing event have passed the consistency check; and if it is determined that the decoding result and the first resource processing event are inconsistent, it can be determined that the decoding result and the first resource processing event have not passed the consistency check.
[0198] In another embodiment, if the method for generating the signature information is signature information generation method 2, the implementation process of using the target public key to verify the validity of the signature information can be: first, the target public key can be used to decrypt the signature information to obtain a decryption result; and, the first resource processing event can be hashed to obtain a hash result. The hash calculation here is the same as the hash algorithm used in the hash calculation when signing. Then, the decryption result and the hash result can be checked for consistency; if the decryption result and the hash result pass the consistency check, it can be determined that the signature information has passed the validity verification; if the decryption result and the hash result do not pass the consistency check, it can be determined that the signature information has not passed the validity verification.
[0199] Among them, the principle of consistency check between the decryption result and the hash result is the same as the principle of consistency check between the decryption result and the first resource processing event, that is, consistency check between the decryption result and the hash result is to determine whether the decryption result and the hash result are consistent. When it is determined that the decryption result and the hash result are consistent, it can be determined that the decryption result and the hash result pass the consistency check; when it is determined that the decryption result and the hash result are inconsistent, it can be determined that the decryption result and the hash result do not pass the consistency check.
[0200] In summary, the validity of the first resource processing event is verified, that is, whether the signature information corresponding to the first resource processing event is correct.
[0201] (5) In the case where at least one verification dimension includes an event existence verification dimension, the specific implementation of step S304 may be described as follows.
[0202] As mentioned above, the cross-chain gateway can synchronize the block header or directly synchronize the entire block. In the case of synchronizing the block header, the validity can be verified based on the information in the block header under the event existence verification dimension. In the case of synchronizing the block, the validity can be verified based on the information in the block under the event existence verification dimension. The following is a description of the validity verification in these two cases.
[0203] Case 1: When the cross-chain gateway is a synchronous block
[0204] It can be understood that the block is generated by packaging resource processing events, and the block contains specific information about the resource processing events. In order to determine whether the first resource processing event has event existence, the first resource processing event can be directly found from the first block. If the first resource processing event can be found in the first block, it means that the first resource processing event has event existence. Therefore, it can be determined that the first resource processing event has passed the validity verification under the event existence verification dimension. If the first resource processing event cannot be found in the first block, it means that the first resource processing event does not have event existence. Therefore, it can be determined that the first resource processing event has not passed the validity verification under the event existence verification dimension.
[0205] Case 2: When the cross-chain gateway is synchronizing block headers
[0206] It should be noted that the validity verification under the dimension of event existence involves the Merkle tree, which is a hash tree that can be used to verify the event existence (or event authenticity) of resource processing events in the block. The Merkle tree can verify the event existence of resource processing events by combining the hash values of resource processing events layer by layer to eventually form a root hash value, and then compare this root hash value with the Merkle root hash value in the block header.
[0207] Based on this, it can be known that when at least one verification dimension includes an event existence verification dimension, the specific implementation of step S304 may include the following steps S31-S34:
[0208] S31, under the event existence verification dimension, the second node can send a query request to the target node in the first blockchain network through the cross-chain gateway to request the target node to find the block where the first resource processing event is located on the internal blockchain, and use the hash values of the resource processing events in each block between the first block and the found block on the corresponding blockchain to build a Merkle tree, and return each hash value used to calculate the root hash value of the constructed Merkle tree.
[0209] It can be understood that, because the cross-chain gateway synchronizes the block header, and the block header does not contain specific information about the resource processing event, in order to verify the event existence of the first resource processing event, a query request for the block where the first resource processing event is located can be sent to the target node to determine the block where the first resource processing event is located. The target node may refer to a node that maintains the corresponding completed blockchain in the first blockchain network. For example, the target node may be the first node in the first blockchain network or other nodes in the first blockchain network. After the target node determines the block where the first resource processing event is located, it is necessary to further use the hash values of the resource processing events in each block between the first block and the found block on the corresponding blockchain to construct a Merkle tree, so that the hash values required for event existence verification of the first resource processing event can be determined from the Merkle tree, and after the target node determines these hash values, these hash values can be returned to the second node, so that the second node can perform event existence verification based on the returned hash values.
[0210] The process of the target node constructing a Merkle tree using the hash values of resource processing events in each block between the first block and the found block on the corresponding blockchain can be as follows: steps s1-s4:
[0211] s1, compiles the hash values of resource processing events in each block into a list;
[0212] s2: If the number of resource processing events in the list is odd, copy the last resource processing event to make the number of resource processing events in the list even.
[0213] s3, hash the hash values of every two resource processing events in the list, generate a new hash value, and add the hash value to the new list.
[0214] s4, repeat step s3 until there is only one hash value left in the new list, which is the root hash value of the Merkle tree.
[0215] For example, Figure 4d The tree structure of the constructed Merkle tree is shown in Figure 1. Figure 4d The data in the box represents resource processing events, such as L1, L2, L3 and L4 are resource processing events found on the blockchain; the data in the circle represents hash values, such as H1, H2, H3 and H4 correspond to the hash values of L1, L2, L3 and L4 respectively, H12 represents the hash value of H1 and H2, H34 represents the hash value of H3 and H4, H represents the hash value of H12 and H34, and H is the root hash value of the Merkle tree.
[0216] S32, the second node calculates the root hash value of the Merkle tree according to the hash values returned by the target node, and obtains the Merkle root hash value in the block header of the first block.
[0217] It should be noted that, in addition to returning the hash values used to calculate the root hash value of the constructed Merkle tree, the target node can also return the hierarchical relationship corresponding to each hash value when the Merkle tree is constructed, and the hierarchical relationship indicates the calculation relationship between each hash value when the Merkle tree is constructed. The Merkle tree can be calculated again based on each hash value and the hash value of the first resource processing event according to the hierarchical relationship to obtain the root hash value of the Merkle tree.
[0218] In one embodiment, the hash values returned by the target node for calculating the root hash value of the constructed Merkle tree may include: all hash values used to construct the Merkle tree. In this case, the Merkle tree may be recalculated and constructed based on the hash values of the first resource processing event according to the hierarchical relationship to obtain the root hash value of the Merkle tree, which is the hash value corresponding to the root node of the Merkle tree.
[0219] In another embodiment, the hash value returned by the target node may only include: the hash value required in the operation process from the hash value corresponding to the first resource processing event to the root hash value of the Merkle tree. It can be understood that the hash value corresponding to each parent node in the Merkle tree is calculated by the hash values corresponding to the two child nodes. It is only necessary to select from the Merkle tree all the hash values involved in the calculation from the hash value corresponding to the first resource processing event to the root hash value of the Merkle tree, which can prove whether the hash value corresponding to the first resource processing event exists in the Merkle tree.
[0220] In this case, the specific implementation of calculating the root hash value of the Merkle tree based on the hash values returned by the target node can be: according to the hierarchical relationship, the Merkle tree is calculated again based on the hash values and the hash value of the first resource processing event to obtain the root hash value of the Merkle tree, which is the hash value corresponding to the root node of the Merkle tree.
[0221] For example, Figure 4d The tree structure shown is a Merkle tree constructed based on the hash values of resource processing events in each block between the first block and the found block on the blockchain. Assuming that the first resource processing event is L4, based on Figure 4dIt can be seen from the Merkle tree shown that the hash values required to calculate the root hash value H from the hash value H4 corresponding to the first resource processing event include H3 and H12, so the hash value returned by the target node may include H3 and H12. After the second node receives these two hash values, the root hash value of the Merkle tree can be calculated based on the hash value of the first resource processing event and these two hash values according to the hierarchical relationship of each hash value. Exemplarily, the second node can first calculate the hash value of the first resource processing event, and then hash the hash value of the first resource processing event with H3 to obtain a hash value, and then hash the hash value with H12 to obtain a hash value, which is also the root hash value of the Merkle tree.
[0222] In this case, it is not necessary to return the hash values corresponding to all resource processing events in the blockchain, only the hash values of some resource processing events need to be returned. Since the number of returned hash values is reduced, the number of hash operations will also be reduced when the root hash value of the Merkle tree is calculated using these returned hash values. Therefore, for the second node, less storage space and computing resources may be required, which can greatly reduce the storage requirements and network bandwidth of the node, making it easier to use on mobile devices, and can also improve the efficiency and scalability of the entire blockchain system. In other words, in the embodiment of the present application, the security of the entire blockchain system can be improved by synchronizing the block header, and it can also help nodes detect and exclude malicious resource processing events and blocks.
[0223] As mentioned above, a Merkle root hash value may be stored in the block header of the first block. The Merkle root hash value is also obtained by constructing a Merkle tree based on the hash value of an event processed by the first node using resources on the internal blockchain when the first block is added to the first blockchain network, and is recorded in the first block header. The Merkle root hash value is also the root hash value of the Merkle tree constructed by the first node.
[0224] Based on this, it can be known that the second node can verify the validity of the first resource processing event under the event existence verification dimension based on the calculated root hash value and the Merkle root hash value in the block header of the first block; specifically, the second node can compare the calculated root hash value with the Merkle root hash value in the block header of the first block to determine whether the first resource processing event exists in the first blockchain network based on the comparison result, and then determine whether the first resource processing event passes the validity verification under the event existence verification dimension based on the existence of the first resource processing event. The determination rules are as follows: steps S33 and S34.
[0225] S33: If the calculated root hash value is the same as the acquired Merkle root hash value, it can be determined that the first resource processing event passes the validity verification under the event existence verification dimension.
[0226] It can be understood that if the calculated root hash value is the same as the obtained Merkle root hash value, it can be indicated that the first resource processing event exists in the first blockchain network, which means that the first resource processing event has event existence; therefore, at this time, it can be determined that the first resource processing event has passed the validity verification under the event existence verification dimension.
[0227] S34: If the calculated root hash value is different from the acquired Merkle root hash value, it can be determined that the first resource processing event has failed validity verification under the event existence verification dimension.
[0228] It can be understood that if the calculated root hash value is different from the obtained Merkle root hash value, it can indicate that the first resource processing event does not exist in the first blockchain network, which means that the first resource processing event does not have event existence; therefore, at this time, it can be determined that the first resource processing event has not passed the validity verification under the event existence verification dimension.
[0229] In summary, the existence of the first resource processing event is verified, that is, whether the hash of the first resource processing event exists in the Merkle tree corresponding to the resource processing event is verified. When the Merkle tree is used to verify the existence of an event, the existence (authenticity) of a resource processing event can be quickly verified without verifying each resource processing event. If the number of resource processing events is large, the cost of verifying each resource processing event will be very high. When the Merkle tree is used to verify the existence of an event, it can be quickly determined whether the resource processing event exists in the block by comparing the Merkle root hash value. It can be seen that the Merkle tree is a hash tree used to verify the existence of resource processing events in a block. By using the Merkle tree to verify the existence of an event, the time and cost of verifying resource processing events can be greatly reduced, and the efficiency and security of resource processing events can be improved.
[0230] S305: If the first resource processing event passes the validity verification under each verification dimension, the second node in the second blockchain network sends a resource conversion request to the decentralized resource processing platform in the second blockchain network based on the first resource processing event.
[0231] Among them, the resource conversion request can be used to request to transfer the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network.
[0232] S306, the decentralized resource processing platform responds to the resource conversion request, and after determining the amount of second digital resources required to convert the first digital resource amount, transfers the second digital resource amount from the contract account of the third-party object in the second blockchain network to the second account.
[0233] In one embodiment, the resource conversion request may carry resource indication information, and the resource indication information is used to indicate the second digital resource amount required to convert the first digital resource amount, that is, the decentralized resource processing platform can directly determine the second digital resource amount from the resource indication information carried by the resource conversion request. Furthermore, the resource indication information carried by the resource conversion request may be generated by the second node, or may be carried by the first resource processing event; when the resource indication information is carried by the first resource processing event, the resource indication information may be generated by the client, or may be generated by the first node, and there is no limitation on this.
[0234] In another embodiment, the resource indication information carried in the resource conversion request can be used to indicate the first digital resource amount, and the conversion rate between the first digital resource and the second digital resource is set in the decentralized resource processing platform. After the decentralized resource processing platform determines the first digital resource amount from the resource indication information carried in the resource conversion request, it can determine the second digital resource amount required for the first digital resource amount based on the conversion rate. In a possible implementation, the conversion rate indicates that the first digital resource amount of the unit amount can be converted into the second digital resource amount of the target amount, and the product result between the first digital resource amount and the conversion rate can be used as the second digital resource amount required for the first digital resource amount. For example, assuming that the first digital resource amount is 1000 and the conversion rate is 0.8, the second digital resource amount is 800; for another example, assuming that the first digital resource amount is 1000 and the conversion rate is 1.5, the second digital resource amount is 1500.
[0235] As mentioned above, the resource processing method proposed in the embodiment of the present application can be executed by the second node in the second blockchain network by calling the cross-chain contract in the second blockchain network (i.e., the second cross-chain contract); wherein, the cross-chain contract in the second blockchain network can also include: the amount of digital resources held by the third-party object in the second blockchain network. Based on this, it can be seen that the process of transferring the second digital resource amount by the decentralized resource processing platform in the second blockchain network can include:
[0236] The decentralized resource processing platform can transfer the amount of digital resources held by a third-party object in the cross-chain contract in the second blockchain network to the contract account of the third-party object in the second blockchain network, and wait until the amount of digital resources in the corresponding contract account is greater than or equal to the second amount of digital resources before transferring the second amount of digital resources from the corresponding contract account to the second account.
[0237] It should be noted that if the amount of digital resources held by the third-party object is originally greater than or equal to the second amount of digital resources, it can be understood that the subsequent transfer operation is directly executed without waiting for the operation; if the amount of digital resources held by the third-party object is not greater than the second amount of digital resources, it is necessary to wait for a period of time until the amount of digital resources in the contract account is greater than or equal to the second amount of digital resources before executing the subsequent transfer operation. During the waiting time, the third-party object can match the amount of digital resources. For example, the matching operation can refer to the third-party object borrowing digital resources from other accounts, and when the third-party object has remaining digital resources, it will return the borrowed digital resources. It can also be matched in other ways, which is not limited to this.
[0238] S307, after transferring the second digital resource amount into the second account, the second node in the second blockchain network sends a second resource processing event to the first node through the cross-chain gateway.
[0239] In a specific implementation, the second node may package the second resource processing event into a block. For the convenience of description, the block here may be referred to as the second block; after obtaining the second block, the second node may also add the second block to the blockchain in the second blockchain network. After successfully adding the second block, the second node may send the second resource processing event to the cross-chain gateway so that the cross-chain gateway may forward the second resource processing event to the first node in the first blockchain network. In one embodiment, the cross-chain gateway may directly forward the second resource processing event to the first node in the first blockchain network. In another embodiment, the cross-chain gateway may forward the second resource processing event to the first node in the first blockchain network after the cross-chain gateway determines that the second block in which the second resource processing event is located has block certainty.
[0240] In one embodiment, after successfully adding the second block, the second node may also synchronize the block header of the second block to the first node in the first blockchain network through the cross-chain gateway. In this case, the cross-chain gateway may detect the block certainty of the second block based on the block header of the second block. In another embodiment, after successfully adding the second block, the second node may also synchronize the second block to the first node in the first blockchain network through the cross-chain gateway. In this case, the cross-chain gateway may detect the block certainty of the second block based on the second block.
[0241] Among them, the principle of the cross-chain gateway detecting the block certainty of the second block is the same as the principle of the cross-chain network detecting the block certainty of the first block. Therefore, the block certainty of the second block will not be specifically elaborated here. The specific implementation process can refer to the above description of the block certainty of the first block.
[0242] S308: The first node in the first blockchain network performs validity verification on the second resource processing event under at least one verification dimension.
[0243] The at least one verification dimension may include at least one of the following: a block certainty verification dimension, a block continuity verification dimension, a block validity verification dimension, an event validity verification dimension, and an event existence verification dimension. The following specifically describes the validity verification under each verification dimension.
[0244] (1) In the case where at least one verification dimension includes a block deterministic verification dimension, the specific implementation of step S308 may be:
[0245] In a specific implementation, under the block deterministic verification dimension, the first node can count the number of blocks in the second blockchain network used to confirm the second block; if the counted number is greater than or equal to the preset number, it is determined that the second resource processing event has passed the validity verification under the block deterministic verification dimension; if the counted number is less than the preset number, it is determined that the second resource processing event has not passed the validity verification under the block deterministic verification dimension. The preset number here may be the same as or different from the preset number for the aforementioned validity verification of the first resource processing event.
[0246] It should be understood that after the second block is added to the blockchain in the second blockchain network, if a new block is added to the blockchain where the second block is located, the new block is used to confirm the second block; every time the second node sends a resource processing event through the cross-chain gateway, the block header of the block where the corresponding resource processing event is located will be synchronized through the cross-chain gateway.
[0247] Based on this, it can be known that under the block deterministic verification dimension, the number of blocks used to confirm the second block in the second blockchain network is counted, including: under the block deterministic verification dimension, the first node filters out the block headers located on the blockchain where the second block is located from the block headers synchronized by the second node through the cross-chain gateway; according to the synchronization time of each block header, the block header synchronized after the block header of the second block is determined from the filtered block headers; the number of determined block headers is counted as the number of blocks used to confirm the second block in the second blockchain network.
[0248] (2) In the case where at least one verification dimension includes a block continuity verification dimension, the specific implementation of step S308 may be:
[0249] It should be understood that the block header of each block except the first block in any blockchain includes the parent block hash value, and the parent block hash value in the block header of any block refers to: the value obtained by hashing the block header of the last block on the corresponding blockchain before adding any block to the blockchain.
[0250] In a specific implementation, under the block continuity verification dimension, the first node can determine the target block header synchronized by the second node through the cross-chain gateway; the target block header refers to: the block header of the previous block adjacent to the second block on the blockchain where the second block is located; determine the block hash value of the target block header, and obtain the parent block hash value in the block header of the second block; if the block hash value of the target block header is consistent with the obtained parent block hash value, it is determined that the second resource processing event has passed the validity verification under the block continuity verification dimension; if the block hash value of the target block header is inconsistent with the obtained parent block hash value, it is determined that the second resource processing event has not passed the validity verification under the block continuity verification dimension.
[0251] (3) In the case where at least one verification dimension includes a block validity verification dimension, the specific implementation of step S308 may be:
[0252] It should be understood that the second block is added to the blockchain in the second blockchain network after passing the consensus of the second blockchain network; wherein, if the number of consensus nodes supporting the second block in the second blockchain network meets the preset conditions, the second block passes the consensus of the second blockchain network. The principle of consensus on the second block is similar to the principle of consensus on the first block mentioned above, and will not be repeated here.
[0253] In a specific implementation, under the block validity verification dimension, the first node can obtain the number of signatures of the node signature carried by the second block, and the node signature is obtained by signing the consensus node supporting the second block; if the number of signatures obtained is greater than or equal to the number of signatures required for the second block to pass the consensus, it is determined that the second resource processing event has passed the validity verification under the block validity verification dimension; if the number of signatures obtained is less than the number of signatures required for the second block to pass the consensus, it is determined that the second resource processing event has not passed the validity verification under the block validity verification dimension. Among them, the number of signatures required for the second block to pass the consensus here can be the same as or different from the number of signatures required for the first block to pass the consensus mentioned above.
[0254] (4) In the case where at least one verification dimension includes an event validity verification dimension, the specific implementation of step S308 may be:
[0255] In a specific implementation, under the event validity verification dimension, the first node can obtain the signature information of the second resource processing event, and the signature information is obtained by the second node using the target private key to sign the resource processing event; wherein, the target private key used by the second node here may be the same as or different from the target private key used by the first node mentioned above. Further, the target public key corresponding to the target private key can be obtained, and the target public key can be used to verify the validity of the signature information; if the signature information passes the validity verification, it is determined that the second resource processing event passes the validity verification under the event validity verification dimension; if the signature information does not pass the validity verification, it is determined that the second resource processing event does not pass the validity verification under the event validity verification dimension.
[0256] (5) In the case where at least one verification dimension includes an event existence verification dimension, the specific implementation of step S308 may be:
[0257] In a specific implementation, under the dimension of event existence verification, the first node can send a query request to the target node in the second blockchain network through the cross-chain gateway to request the target node to find the block where the second resource processing event is located on the internal blockchain, and use the hash values of the resource processing events in each block between the first block and the found block on the corresponding blockchain to build a Merkle tree, and return each hash value used to calculate the root hash value of the constructed Merkle tree; then, the root hash value of the Merkle tree can be calculated based on the hash values returned by the target node, and the Merkle root hash value in the block header of the second block can be obtained.
[0258] If the calculated root hash value and the obtained Merkle root hash value are the same, it is determined that the second resource processing event has passed the validity verification under the event existence verification dimension; if the calculated root hash value and the obtained Merkle root hash value are different, it is determined that the second resource processing event has not passed the validity verification under the event existence verification dimension.
[0259] It should be noted that the principle of the first node verifying the validity of the second resource processing event is the same as the principle of the second node verifying the validity of the first resource processing event. Therefore, the validity verification of the second resource processing event will not be elaborated here. The specific implementation can refer to the above process of validating the validity of the first resource processing event.
[0260] S309: If the second resource processing event passes the validity verification under each verification dimension, the first node in the first blockchain network responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0261] It can be understood that if the second resource processing event passes the validity verification under each verification dimension, it can be determined that the second resource processing event is valid, and the first node can respond to the second resource processing event to unlock the first digital resource amount locked in the first blockchain network, and transfer the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network to ensure that the total amount of digital resources of the third-party object remains unchanged.
[0262] To better understand the resource processing method based on blockchain network proposed in the embodiment of the present application, the following combination Figure 5 Further explanation of the resource processing method. The following takes the cross-chain contract as the execution subject as an example to further explain the resource processing method. For the convenience of description, the resource contract and the cross-chain contract deployed in the first blockchain network can be referred to as resource contract A (i.e., the first resource contract) and cross-chain contract A (i.e., the first cross-chain contract), respectively, and the resource contract and the cross-chain contract deployed in the second blockchain network can be referred to as resource contract B (i.e., the second resource contract) and cross-chain contract B (i.e., the second cross-chain contract), respectively. The process of cross-chain transfer of digital resources is as follows:
[0263] S1, the object initiates a resource transfer request to resource contract A.
[0264] S2, lock the first digital resource amount into the cross-chain contract A through the resource contract A. This means that the object cannot continue to use the locked first digital resource amount before the resource transfer is completed, so that the security of the transaction is guaranteed.
[0265] S3, after the first digital resource amount is locked, the cross-chain contract A generates the first resource processing event,
[0266] S4, the cross-chain gateway can monitor the first resource processing events. These events can be communicated and exchanged between different blockchain networks, making the blockchain ecosystem more interconnected and seamless.
[0267] S5, when the cross-chain gateway determines that the first block where the first resource processing event is located is finally confirmed, the cross-chain gateway can forward the first resource processing event to the cross-chain contract B. This process takes a certain amount of time, but it can effectively improve the security of digital resources by sacrificing efficiency.
[0268] S6, cross-chain contract B verifies the validity of the first resource processing event. If the first resource processing event passes the validity verification, cross-chain contract B sends a resource conversion request to the decentralized resource processing platform, which ensures the security of cross-chain asset transfer.
[0269] S7, the decentralized resource processing platform transfers the digital resources in the cross-chain contract B to the contract account corresponding to the decentralized resource processing platform, so that the decentralized resource processing platform obtains the second digital resource amount from the contract account and transfers it to the second account. When the second digital resource amount in the contract account is insufficient during this process, it takes a certain amount of time to wait, but through the matchmaking of the decentralized resource processing platform, the object is often converted to more second digital resources. Among them, the contract account here can be the contract account of the third-party object in the second blockchain network.
[0270] S8, after transferring the second digital resource amount to the second account, the cross-chain contract B generates a second resource processing event,
[0271] S9, the cross-chain gateway monitors the second resource processing event.
[0272] S10, after the cross-chain gateway detects that the second block where the second resource processing event is located has block certainty, the cross-chain gateway forwards the second resource processing event to cross-chain contract A.
[0273] S11, cross-chain contract A verifies the validity of the second resource processing event. If the second resource processing event passes the validity verification, cross-chain contract A unlocks the first digital resource amount and transfers the first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0274] Through the above operation process, the cross-chain transfer of the first digital resource from the first blockchain network to the second blockchain network can be realized. After the cross-chain transfer is completed, the object can query the first account in the first blockchain network in the resource contract A, and query the remaining digital resource in the second account in the second blockchain network in the resource contract B; this process can help the object view the status of the digital resource transfer.
[0275] In an embodiment of the present application, digital resources can be transferred from one blockchain network to the blockchain network where the decentralized resource processing platform is located through a cross-chain gateway, and then these digital resources are added to the decentralized resource processing platform for resource transfer, thereby providing a better cross-chain transfer experience of digital resources. In addition, combined with the characteristics of the decentralized resource processing platform, the cross-chain transfer function of digital resources using the decentralized resource processing platform can also improve the availability and convenience of the object, thereby improving the resource processing efficiency and experience of the object. Using the decentralized resource processing platform as a resource processing platform can not only realize the cross-chain transfer of digital resources, but also provide liquidity. By providing liquidity, the decentralized resource processing platform can make the cross-chain transfer of digital resources simpler, faster and more convenient.
[0276] In the embodiments of the present application, a more efficient, safer, more reliable and more flexible cross-chain transfer method of digital resources can be provided through cross-chain technology and smart contracts. Various blockchain networks can be connected through a cross-chain gateway to transfer various digital resources to the blockchain network where the decentralized resource processing platform is located, and then the digital resources are transferred on the decentralized resource processing platform, which greatly reduces the cost of cross-chain transfer, while also improving the liquidity of the decentralized resource processing platform and increasing the user's digital resource transfer options. In addition, by executing the resource processing method through smart contracts, the automation of digital resources in cross-chain transfer can be effectively improved to effectively improve the efficiency and fairness of cross-chain transfer.
[0277] Based on the description of the above-mentioned resource processing method embodiment based on blockchain network, the embodiment of the present application provides a resource processing device based on blockchain network. Among them, the resource processing device based on blockchain network can be a computer program (including program code) running in the second node in the second blockchain network, and the resource processing device based on blockchain network can execute Figure 2-Figure 3 Some of the steps in the method are shown. Figure 6 , the resource processing device based on the blockchain network can run the following units:
[0278] A receiving unit 601 is used to receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate: transferring a first digital resource amount in a first account in the first blockchain network to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network;
[0279] A sending unit 602 is used to send a resource conversion request to the decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0280] The sending unit 602 is also used to send a second resource processing event to the first node through the cross-chain gateway after transferring the second digital resource amount to the second account, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0281] In one embodiment, the device further includes a verification unit 603. After receiving a first resource processing event sent by a first node in the first blockchain network through a cross-chain gateway, the verification unit 603 may be specifically used to:
[0282] Performing validity verification on the first resource processing event under at least one verification dimension;
[0283] If the first resource processing event passes the validity verification under each verification dimension, the step of sending a resource conversion request to the resource processing platform in the second blockchain network based on the first resource processing event is triggered.
[0284] In one embodiment, the first node packages the first resource processing event into a first block, and after determining that the first block is added to the blockchain in the first blockchain network, sends the first resource processing event through a cross-chain gateway;
[0285] The at least one verification dimension includes at least one of the following: a block certainty verification dimension, a block continuity verification dimension, a block validity verification dimension, an event validity verification dimension, and an event existence verification dimension.
[0286] In one implementation, the at least one verification dimension includes a block deterministic verification dimension; when the verification unit 603 is used to verify the validity of the first resource processing event under the at least one verification dimension, it can be specifically used to:
[0287] Under the block deterministic verification dimension, counting the number of blocks in the first blockchain network used to confirm the first block;
[0288] If the counted number is greater than or equal to the preset number, it is determined that the first resource processing event passes the validity verification under the block deterministic verification dimension;
[0289] If the counted number is less than the preset number, it is determined that the first resource processing event has failed the validity verification under the block deterministic verification dimension.
[0290] In one embodiment, after the first block is added to the blockchain in the first blockchain network, if a new block is added to the blockchain where the first block is located, the new block is used to confirm the first block; each time the first node sends a resource processing event through the cross-chain gateway, the block header of the block where the corresponding resource processing event is located is synchronized through the cross-chain gateway; the verification unit 603, when used to count the number of blocks used to confirm the first block in the first blockchain network under the block deterministic verification dimension, can be specifically used to:
[0291] Under the block deterministic verification dimension, filter out the block header located on the blockchain where the first block is located from the block header synchronized by the first node through the cross-chain gateway;
[0292] According to the synchronization time of each block header, determine the block header synchronized after the block header of the first block from the filtered block headers;
[0293] The number of determined block headers is counted as the number of blocks in the first blockchain network used to confirm the first block.
[0294] In one embodiment, the at least one verification dimension includes a block continuity verification dimension; the block header of each block except the first block in any blockchain includes a parent block hash value, and the parent block hash value in the block header of any block refers to: before adding any block to the blockchain, the value obtained by performing a hash operation on the block header of the last block on the corresponding blockchain; when the verification unit 603 is used to verify the validity of the first resource processing event under at least one verification dimension, it can be specifically used to:
[0295] Under the block continuity verification dimension, determining a target block header synchronized by the first node through the cross-chain gateway; the target block header refers to: a block header of a previous block adjacent to the first block on the blockchain where the first block is located;
[0296] Determine a block hash value of the target block header, and obtain a parent block hash value in the block header of the first block;
[0297] If the block hash value of the target block header is consistent with the obtained parent block hash value, determining that the first resource processing event passes the validity verification under the block continuity verification dimension;
[0298] If the block hash value of the target block header is inconsistent with the acquired parent block hash value, it is determined that the first resource processing event has failed the validity verification under the block continuity verification dimension.
[0299] In one embodiment, the at least one verification dimension includes a block validity verification dimension; the first block is added to the blockchain in the first blockchain network after passing the consensus of the first blockchain network; wherein, if the number of consensus nodes supporting the first block in the first blockchain network meets a preset condition, the first block passes the consensus of the first blockchain network; when the verification unit 603 is used to verify the validity of the first resource processing event under at least one verification dimension, it can be specifically used to:
[0300] Under the block validity verification dimension, obtaining the number of signatures of the node signatures carried by the first block, where the node signatures are signed by the consensus nodes supporting the first block;
[0301] If the number of acquired signatures is greater than or equal to the number of signatures required for the first block to pass consensus, it is determined that the first resource processing event passes the validity verification under the block validity verification dimension;
[0302] If the number of acquired signatures is less than the number of signatures required for the first block to pass consensus, it is determined that the first resource processing event has failed validity verification under the block validity verification dimension.
[0303] In one implementation, the at least one verification dimension includes an event validity verification dimension; when the verification unit 603 is used to verify the validity of the first resource processing event under the at least one verification dimension, it can be specifically used to:
[0304] Under the event validity verification dimension, acquiring signature information of the first resource processing event, where the signature information is obtained by the first node signing the resource processing event using a target private key;
[0305] Obtaining a target public key corresponding to the target private key, and using the target public key to verify the validity of the signature information;
[0306] If the signature information passes the validity verification, determining that the first resource processing event passes the validity verification under the event validity verification dimension;
[0307] If the signature information fails to pass the validity verification, it is determined that the first resource processing event fails to pass the validity verification under the event validity verification dimension.
[0308] In one implementation, the at least one verification dimension includes an event existence verification dimension; when the verification unit 603 is used to verify the validity of the first resource processing event under the at least one verification dimension, it can be specifically used to:
[0309] Under the event existence verification dimension, a query request is sent to a target node in the first blockchain network through the cross-chain gateway to request the target node to find the block where the first resource processing event is located on the internal blockchain, and a Merkle tree is constructed using the hash values of the resource processing events in each block between the first block and the found block on the corresponding blockchain, and each hash value used to calculate the root hash value of the constructed Merkle tree is returned;
[0310] Calculate the root hash value of the Merkle tree according to each hash value returned by the target node, and obtain the Merkle root hash value in the block header of the first block;
[0311] If the calculated root hash value is the same as the obtained Merkle root hash value, it is determined that the first resource processing event passes the validity verification under the event existence verification dimension;
[0312] If the calculated root hash value is different from the obtained Merkle root hash value, it is determined that the first resource processing event has failed the validity verification under the event existence verification dimension.
[0313] In one implementation, when the sending unit 602 is used to send the second resource processing event to the first node through the cross-chain gateway, it can be specifically used to:
[0314] Packaging the second resource processing event into a second block, and adding the second block to the blockchain in the second blockchain network;
[0315] After successfully adding the second block, the second resource processing event is sent to the cross-chain gateway, so that the cross-chain gateway forwards the second resource processing event to the first node after determining that the second block where the second resource processing event is located has block certainty.
[0316] In one implementation, after successfully adding the second block, the sending unit 602 may further be configured to:
[0317] Synchronize the block header of the second block to the first node in the first blockchain network through the cross-chain gateway;
[0318] The cross-chain gateway detects the block certainty of the second block based on the block header of the second block.
[0319] In one embodiment, the method is executed by a second node in a second blockchain network by calling a cross-chain contract in the second blockchain network; wherein the cross-chain contract in the second blockchain network also includes: the amount of digital resources held by the third-party object in the second blockchain network; the process of transferring the second amount of digital resources by the decentralized resource processing platform in the second blockchain network includes: transferring the amount of digital resources held by the third-party object in the cross-chain contract in the second blockchain network to the contract account of the third-party object in the second blockchain network, and waiting for the amount of digital resources in the corresponding contract account to be greater than or equal to the second amount of digital resources, and then transferring the second amount of digital resources from the corresponding contract account to the second account.
[0320] According to one embodiment of the present application, Figure 2-Figure 3 Some of the steps involved in the method shown can be performed by Figure 6 The resource processing device based on the blockchain network is executed by each unit in the resource processing device shown. For example, Figure 2 The steps S204-S205 shown in FIG. 1 can be performed by Figure 6 The sending unit 602 shown in is executed; for example, Figure 3 The step S304 shown in FIG. 1 can be performed by Figure 6 The verification unit 603 shown in FIG. 1 is executed, and both step S305 and step S307 can be performed by Figure 6 The sending unit 602 shown in FIG.
[0321] According to another embodiment of the present application, Figure 6 The various units in the resource processing device based on the blockchain network shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the resource processing device based on the blockchain network may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0322] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2-Figure 3 A computer program (including program code) of some steps involved in the corresponding method shown in , to construct Figure 6 The resource processing device based on blockchain network shown in , and the relevant steps to implement the resource processing method based on blockchain network of the embodiment of the present application. The computer program can be recorded on, for example, a computer-readable recording medium, and loaded into the above-mentioned computing device through the computer-readable recording medium, and run therein.
[0323] Based on the description of the above-mentioned resource processing method embodiment based on blockchain network, the embodiment of the present application also provides another resource processing device based on blockchain network. Among them, the resource processing device based on blockchain network can be a computer program (including program code) running in the first node in the first blockchain network, and the resource processing device based on blockchain network can execute Figure 2-Figure 3Some of the steps in the method are shown. Figure 7 , the resource processing device based on the blockchain network can run the following units:
[0324] A locking unit 701 is used to determine, in response to a resource transfer request, a first digital resource amount to be transferred in a first account in a first blockchain network, and lock the first digital resource amount;
[0325] A generating unit 702 is used to generate a first resource processing event after locking the first digital resource amount; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network;
[0326] A sending unit 703 is used to send the first resource processing event to a second node in the second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0327] A receiving unit 704 is configured to receive a second resource processing event sent by the second node through the cross-chain gateway, where the second resource processing event is sent after the second digital resource amount is transferred to the second account;
[0328] The unlocking unit 705 is used to respond to the second resource processing event, unlock the first digital resource amount, and transfer the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0329] In one embodiment, the device further includes a verification unit 706. After receiving the second resource processing event sent by the second node through the cross-chain gateway, the verification unit 706 may be specifically used to:
[0330] Performing validity verification on the second resource processing event under at least one verification dimension;
[0331] If the second resource processing event passes the validity verification in each verification dimension, the step of responding to the second resource processing event and unlocking the first digital resource amount is triggered.
[0332] In one implementation, when the sending unit 703 is used to send the first resource processing event to the second node in the second blockchain network through the cross-chain gateway, it can be specifically used to:
[0333] Packaging the first resource processing event into a first block, and adding the first block to the blockchain in the first blockchain network;
[0334] After successfully adding the first block, the first resource processing event is sent to the cross-chain gateway, so that after the cross-chain gateway determines that the first block where the first resource processing event is located has block certainty, the first resource processing event is forwarded to the second node in the second blockchain network.
[0335] In one implementation, after successfully adding the first block, the sending unit 703 may further be used to:
[0336] Synchronize the block header of the first block to the second node in the second blockchain network through the cross-chain gateway;
[0337] The cross-chain gateway detects the block certainty of the first block based on the block header of the first block.
[0338] In one implementation, the resource transfer request is received through a resource contract; when the locking unit 701 is used to lock the first digital resource amount, it can be specifically used to:
[0339] Through the resource contract, the first digital resource amount in the first account is locked into the cross-chain contract in the first blockchain network.
[0340] According to one embodiment of the present application, Figure 2-Figure 3 Some of the steps involved in the method shown can be performed by Figure 7 The resource processing device based on the blockchain network is executed by each unit in the resource processing device shown. For example, Figure 2 The step S201 shown in FIG. 1 can be performed by Figure 7 The locking unit 701 shown in FIG. 1 is used to perform step S202. Figure 7 The generation unit 702 shown in FIG. 1 is executed, and step S203 can be performed by Figure 7 The sending unit 703 shown in FIG. 1 is executed, and step S206 can be performed by Figure 7 The unlocking unit 705 shown in is executed; for example, Figure 3 The step S301 shown in FIG. Figure 7 The locking unit 701 shown in FIG. 1 is executed, and step S302 can be performed by Figure 7 The generation unit 702 shown in FIG. 1 is executed, and step S303 can be performed by Figure 7 The sending unit 703 shown in FIG. 1 is executed, and step S308 can be performed by Figure 7 The verification unit 706 shown in FIG. 1 is executed, and step S309 can be performed by Figure 7 The unlocking unit 705 shown in FIG.
[0341] According to another embodiment of the present application, Figure 7 The various units in the resource processing device based on the blockchain network shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the resource processing device based on the blockchain network may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0342] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2-Figure 3 A computer program (including program code) of some steps involved in the corresponding method shown in , to construct Figure 7 The resource processing device based on blockchain network shown in , and the relevant steps to implement the resource processing method based on blockchain network of the embodiment of the present application. The computer program can be recorded on, for example, a computer-readable recording medium, and loaded into the above-mentioned computing device through the computer-readable recording medium, and run therein.
[0343] Based on the description of the resource processing method embodiment based on the blockchain network, the embodiment of the present application also provides a computer device, which can be the first node in the first blockchain network mentioned above, or the second node in the second blockchain network mentioned above. Figure 8 The computer device may at least include a processor 801, an input interface 802, an output interface 803, and a computer storage medium 804. The processor 801, the input interface 802, the output interface 803, and the computer storage medium 804 in the computer device may be connected via a bus or other means.
[0344] The computer storage medium 804 is a memory device in a computer device for storing programs and data. It is understandable that the computer storage medium 804 here can include both the built-in storage medium of the computer device and the extended storage medium supported by the computer device. The computer storage medium 804 provides a storage space, which stores the operating system of the computer device. In addition, one or more instructions suitable for being loaded and executed by the processor 801 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory; optionally, it can also be at least one computer storage medium away from the aforementioned processor, the processor can be called a central processing unit (CPU), which is the core and control center of the computer device, suitable for implementing one or more instructions, specifically loading and executing one or more instructions to achieve the corresponding method flow or function.
[0345] In a feasible embodiment, the processor 801 may load and execute one or more instructions stored in a computer storage medium to implement corresponding steps of the method in the above-mentioned embodiment of the resource processing method based on the blockchain network;
[0346] In a specific implementation, when the computer device is the second node in the second blockchain network mentioned above, one or more instructions in the computer storage medium are loaded by the processor 801 and perform the following operations:
[0347] Receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate: transferring a first digital resource amount in a first account in the first blockchain network to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network;
[0348] Based on the first resource processing event, a resource conversion request is sent to the decentralized resource processing platform in the second blockchain network, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0349] After the second digital resource amount is transferred to the second account, a second resource processing event is sent to the first node through the cross-chain gateway, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
[0350] In one embodiment, after receiving a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, the one or more instructions are loaded by the processor 801 and further executed:
[0351] Performing validity verification on the first resource processing event under at least one verification dimension;
[0352] If the first resource processing event passes the validity verification under each verification dimension, the step of sending a resource conversion request to the resource processing platform in the second blockchain network based on the first resource processing event is triggered.
[0353] In one embodiment, the first node packages the first resource processing event into a first block, and after determining that the first block is added to the blockchain in the first blockchain network, sends the first resource processing event through a cross-chain gateway;
[0354] The at least one verification dimension includes at least one of the following: a block certainty verification dimension, a block continuity verification dimension, a block validity verification dimension, an event validity verification dimension, and an event existence verification dimension.
[0355] In one implementation, the at least one verification dimension includes a block deterministic verification dimension; under the at least one verification dimension, when the validity of the first resource processing event is verified, the one or more instructions are loaded and specifically executed by the processor 801:
[0356] Under the block deterministic verification dimension, counting the number of blocks in the first blockchain network used to confirm the first block;
[0357] If the counted number is greater than or equal to the preset number, it is determined that the first resource processing event passes the validity verification under the block deterministic verification dimension;
[0358] If the counted number is less than the preset number, it is determined that the first resource processing event has failed the validity verification under the block deterministic verification dimension.
[0359] In one embodiment, after the first block is added to the blockchain in the first blockchain network, if a new block is added to the blockchain where the first block is located, the new block is used to confirm the first block; each time the first node sends a resource processing event through the cross-chain gateway, the block header of the block where the corresponding resource processing event is located is synchronized through the cross-chain gateway; under the block deterministic verification dimension, when counting the number of blocks in the first blockchain network used to confirm the first block, the one or more instructions are loaded and specifically executed by the processor 801:
[0360] Under the block deterministic verification dimension, filter out the block header located on the blockchain where the first block is located from the block header synchronized by the first node through the cross-chain gateway;
[0361] According to the synchronization time of each block header, determine the block header synchronized after the block header of the first block from the filtered block headers;
[0362] The number of determined block headers is counted as the number of blocks in the first blockchain network used to confirm the first block.
[0363] In one embodiment, the at least one verification dimension includes a block continuity verification dimension; the block header of each block except the first block in any blockchain includes a parent block hash value, and the parent block hash value in the block header of any block refers to: before adding any block to the blockchain, the value obtained by performing a hash operation on the block header of the last block on the corresponding blockchain; under at least one verification dimension, when the validity of the first resource processing event is verified, the one or more instructions are loaded and specifically executed by the processor 801:
[0364] Under the block continuity verification dimension, determining a target block header synchronized by the first node through the cross-chain gateway; the target block header refers to: a block header of a previous block adjacent to the first block on the blockchain where the first block is located;
[0365] Determine a block hash value of the target block header, and obtain a parent block hash value in the block header of the first block;
[0366] If the block hash value of the target block header is consistent with the obtained parent block hash value, determining that the first resource processing event passes the validity verification under the block continuity verification dimension;
[0367] If the block hash value of the target block header is inconsistent with the acquired parent block hash value, it is determined that the first resource processing event has failed the validity verification under the block continuity verification dimension.
[0368] In one embodiment, the at least one verification dimension includes a block validity verification dimension; the first block is added to the blockchain in the first blockchain network after passing the consensus of the first blockchain network; wherein, if the number of consensus nodes supporting the first block in the first blockchain network meets a preset condition, the first block passes the consensus of the first blockchain network; under at least one verification dimension, when the validity of the first resource processing event is verified, the one or more instructions are loaded and specifically executed by the processor 801:
[0369] Under the block validity verification dimension, obtaining the number of signatures of the node signatures carried by the first block, where the node signatures are signed by the consensus nodes supporting the first block;
[0370] If the number of acquired signatures is greater than or equal to the number of signatures required for the first block to pass consensus, it is determined that the first resource processing event passes the validity verification under the block validity verification dimension;
[0371] If the number of acquired signatures is less than the number of signatures required for the first block to pass consensus, it is determined that the first resource processing event has failed validity verification under the block validity verification dimension.
[0372] In one implementation, the at least one verification dimension includes an event validity verification dimension; when used to verify the validity of the first resource processing event under the at least one verification dimension, the one or more instructions are loaded and specifically executed by the processor 801:
[0373] Under the event validity verification dimension, acquiring signature information of the first resource processing event, where the signature information is obtained by the first node signing the resource processing event using a target private key;
[0374] Obtaining a target public key corresponding to the target private key, and using the target public key to verify the validity of the signature information;
[0375] If the signature information passes the validity verification, determining that the first resource processing event passes the validity verification under the event validity verification dimension;
[0376] If the signature information fails to pass the validity verification, it is determined that the first resource processing event fails to pass the validity verification under the event validity verification dimension.
[0377] In one implementation, the at least one verification dimension includes an event existence verification dimension; under the at least one verification dimension, when the validity of the first resource processing event is verified, the one or more instructions are loaded and specifically executed by the processor 801:
[0378] Under the event existence verification dimension, a query request is sent to a target node in the first blockchain network through the cross-chain gateway to request the target node to find the block where the first resource processing event is located on the internal blockchain, and a Merkle tree is constructed using the hash values of the resource processing events in each block between the first block and the found block on the corresponding blockchain, and each hash value used to calculate the root hash value of the constructed Merkle tree is returned;
[0379] Calculate the root hash value of the Merkle tree according to each hash value returned by the target node, and obtain the Merkle root hash value in the block header of the first block;
[0380] If the calculated root hash value is the same as the obtained Merkle root hash value, it is determined that the first resource processing event passes the validity verification under the event existence verification dimension;
[0381] If the calculated root hash value is different from the obtained Merkle root hash value, it is determined that the first resource processing event has failed the validity verification under the event existence verification dimension.
[0382] In one embodiment, when sending the second resource processing event to the first node through the cross-chain gateway, the one or more instructions are loaded and specifically executed by the processor 801:
[0383] Packaging the second resource processing event into a second block, and adding the second block to the blockchain in the second blockchain network;
[0384] After successfully adding the second block, the second resource processing event is sent to the cross-chain gateway, so that the cross-chain gateway forwards the second resource processing event to the first node after determining that the second block where the second resource processing event is located has block certainty.
[0385] In one embodiment, after successfully adding the second block, the one or more instructions are loaded by the processor 801 and further executed:
[0386] Synchronize the block header of the second block to the first node in the first blockchain network through the cross-chain gateway;
[0387] The cross-chain gateway detects the block certainty of the second block based on the block header of the second block.
[0388] In one embodiment, the method is executed by a second node in a second blockchain network by calling a cross-chain contract in the second blockchain network; wherein the cross-chain contract in the second blockchain network also includes: the amount of digital resources held by the third-party object in the second blockchain network; the process of transferring the second amount of digital resources by the decentralized resource processing platform in the second blockchain network includes: transferring the amount of digital resources held by the third-party object in the cross-chain contract in the second blockchain network to the contract account of the third-party object in the second blockchain network, and waiting for the amount of digital resources in the corresponding contract account to be greater than or equal to the second amount of digital resources, and then transferring the second amount of digital resources from the corresponding contract account to the second account.
[0389] In a specific implementation, when the computer device is the first node in the first blockchain network mentioned above, one or more instructions in the computer storage medium are loaded by the processor 801 and perform the following operations:
[0390] In response to the resource transfer request, determining a first digital resource amount to be transferred in a first account in the first blockchain network, and locking the first digital resource amount;
[0391] After locking the first digital resource amount, generating a first resource processing event; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network;
[0392] Sending the first resource processing event to a second node in the second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the third party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount;
[0393] receiving a second resource processing event sent by the second node through the cross-chain gateway, where the second resource processing event is sent after the second digital resource amount is transferred to the second account;
[0394] In response to the second resource processing event, the first digital resource amount is unlocked, and the unlocked first digital resource amount is transferred to the contract account of the third-party object in the first blockchain network.
[0395] In one embodiment, after receiving the second resource processing event sent by the second node through the cross-chain gateway, the one or more instructions are loaded by the processor 801 and further executed:
[0396] Performing validity verification on the second resource processing event under at least one verification dimension;
[0397] If the second resource processing event passes the validity verification in each verification dimension, the step of responding to the second resource processing event and unlocking the first digital resource amount is triggered.
[0398] In one embodiment, when the first resource processing event is sent to the second node in the second blockchain network through the cross-chain gateway, the one or more instructions are loaded and specifically executed by the processor 801:
[0399] Packaging the first resource processing event into a first block, and adding the first block to the blockchain in the first blockchain network;
[0400] After successfully adding the first block, the first resource processing event is sent to the cross-chain gateway, so that after the cross-chain gateway determines that the first block where the first resource processing event is located has block certainty, the first resource processing event is forwarded to the second node in the second blockchain network.
[0401] In one embodiment, after successfully adding the first block, the one or more instructions are loaded by the processor 801 and further executed:
[0402] Synchronize the block header of the first block to the second node in the second blockchain network through the cross-chain gateway;
[0403] The cross-chain gateway detects the block certainty of the first block based on the block header of the first block.
[0404] In one implementation, the resource transfer request is received through a resource contract; when the first digital resource amount is locked, the one or more instructions are loaded and specifically executed by the processor 801:
[0405] Through the resource contract, the first digital resource amount in the first account is locked into the cross-chain contract in the first blockchain network.
[0406] It should be noted that the embodiment of the present application provides a computer program product, which includes one or more instructions, and the one or more instructions are stored in a computer storage medium. The processor of the computer device executes the above-mentioned resource processing method embodiment based on the blockchain network by calling the one or more instructions. Figure 2 or Figure 3 The steps performed in
[0407] What is disclosed above is only a preferred embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present application are still within the scope of the invention.
Claims
1. A resource processing method based on a blockchain network, characterized in that: The method comprises: Receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate: transferring a first digital resource amount in a first account in the first blockchain network to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network; Based on the first resource processing event, a resource conversion request is sent to the decentralized resource processing platform in the second blockchain network, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the contract account of the third party object in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount; After the second digital resource amount is transferred to the second account, a second resource processing event is sent to the first node through the cross-chain gateway, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
2. The method according to claim 1, characterized in that After receiving the first resource processing event sent by the first node in the first blockchain network through the cross-chain gateway, the method further includes: Performing validity verification on the first resource processing event under at least one verification dimension; If the first resource processing event passes the validity verification under each verification dimension, the step of sending a resource conversion request to the resource processing platform in the second blockchain network based on the first resource processing event is triggered.
3. The method according to claim 2, characterized in that The first node packages the first resource processing event into a first block, and after determining that the first block is added to the blockchain in the first blockchain network, sends the first resource processing event through a cross-chain gateway; The at least one verification dimension includes at least one of the following: a block certainty verification dimension, a block continuity verification dimension, a block validity verification dimension, an event validity verification dimension, and an event existence verification dimension.
4. The method according to claim 3, characterized in that The at least one verification dimension comprises a block deterministic verification dimension; The performing validity verification on the first resource processing event under at least one verification dimension includes: Under the block deterministic verification dimension, counting the number of blocks in the first blockchain network used to confirm the first block; If the counted number is greater than or equal to the preset number, it is determined that the first resource processing event passes the validity verification under the block deterministic verification dimension; If the counted number is less than the preset number, it is determined that the first resource processing event has failed the validity verification under the block deterministic verification dimension.
5. The method according to claim 4, characterized in that After the first block is added to the blockchain in the first blockchain network, if a new block is added to the blockchain where the first block is located, the new block is used to confirm the first block; Every time the first node sends a resource processing event through the cross-chain gateway, it synchronizes the block header of the block where the corresponding resource processing event is located through the cross-chain gateway; Wherein, under the block deterministic verification dimension, counting the number of blocks in the first blockchain network used to confirm the first block includes: Under the block deterministic verification dimension, filter out the block header located on the blockchain where the first block is located from the block header synchronized by the first node through the cross-chain gateway; According to the synchronization time of each block header, determine the block header synchronized after the block header of the first block from the filtered block headers; The number of determined block headers is counted as the number of blocks in the first blockchain network used to confirm the first block.
6. The method according to claim 3, characterized in that The at least one verification dimension includes a block continuity verification dimension; the block header of each block except the first block in any blockchain includes a parent block hash value, and the parent block hash value in the block header of any block refers to: before adding any block to the blockchain, the value obtained by performing a hash operation on the block header of the last block on the corresponding blockchain; The performing validity verification on the first resource processing event under at least one verification dimension includes: Under the block continuity verification dimension, determining a target block header synchronized by the first node through the cross-chain gateway; the target block header refers to: a block header of a previous block adjacent to the first block on the blockchain where the first block is located; Determine a block hash value of the target block header, and obtain a parent block hash value in the block header of the first block; If the block hash value of the target block header is consistent with the obtained parent block hash value, determining that the first resource processing event passes the validity verification under the block continuity verification dimension; If the block hash value of the target block header is inconsistent with the acquired parent block hash value, it is determined that the first resource processing event has failed the validity verification under the block continuity verification dimension.
7. The method according to claim 3, characterized in that The at least one verification dimension includes a block validity verification dimension; the first block is added to the blockchain in the first blockchain network after passing the consensus of the first blockchain network; wherein, if the number of consensus nodes supporting the first block in the first blockchain network meets a preset condition, the first block passes the consensus of the first blockchain network; The performing validity verification on the first resource processing event under at least one verification dimension includes: Under the block validity verification dimension, obtaining the number of signatures of the node signatures carried by the first block, where the node signatures are signed by the consensus nodes supporting the first block; If the number of acquired signatures is greater than or equal to the number of signatures required for the first block to pass consensus, it is determined that the first resource processing event passes the validity verification under the block validity verification dimension; If the number of acquired signatures is less than the number of signatures required for the first block to pass consensus, it is determined that the first resource processing event has failed validity verification under the block validity verification dimension.
8. The method according to claim 3, characterized in that The at least one verification dimension includes an event validity verification dimension; The performing validity verification on the first resource processing event under at least one verification dimension includes: Under the event validity verification dimension, acquiring signature information of the first resource processing event, where the signature information is obtained by the first node signing the resource processing event using a target private key; Obtaining a target public key corresponding to the target private key, and using the target public key to verify the validity of the signature information; If the signature information passes the validity verification, determining that the first resource processing event passes the validity verification under the event validity verification dimension; If the signature information fails to pass the validity verification, it is determined that the first resource processing event fails to pass the validity verification under the event validity verification dimension.
9. The method according to claim 3, characterized in that: The at least one verification dimension includes an event existence verification dimension; The performing validity verification on the first resource processing event under at least one verification dimension includes: Under the event existence verification dimension, a query request is sent to a target node in the first blockchain network through the cross-chain gateway to request the target node to find the block where the first resource processing event is located on the internal blockchain, and a Merkle tree is constructed using the hash values of the resource processing events in each block between the first block and the found block on the corresponding blockchain, and each hash value used to calculate the root hash value of the constructed Merkle tree is returned; Calculate the root hash value of the Merkle tree according to each hash value returned by the target node, and obtain the Merkle root hash value in the block header of the first block; If the calculated root hash value is the same as the obtained Merkle root hash value, it is determined that the first resource processing event passes the validity verification under the event existence verification dimension; If the calculated root hash value is different from the obtained Merkle root hash value, it is determined that the first resource processing event has failed the validity verification under the event existence verification dimension.
10. The method according to claim 1, characterized in that The sending a second resource processing event to the first node through the cross-chain gateway includes: Packaging the second resource processing event into a second block, and adding the second block to the blockchain in the second blockchain network; After successfully adding the second block, the second resource processing event is sent to the cross-chain gateway, so that the cross-chain gateway forwards the second resource processing event to the first node after determining that the second block where the second resource processing event is located has block certainty.
11. The method according to claim 10, characterized in that After successfully adding the second block, the method further includes: Synchronize the block header of the second block to the first node in the first blockchain network through the cross-chain gateway; The cross-chain gateway detects the block certainty of the second block based on the block header of the second block.
12. The method according to claim 1, characterized in that The method is executed by a second node in a second blockchain network by calling a cross-chain contract in the second blockchain network; The cross-chain contract in the second blockchain network also includes: the amount of digital resources held by the third-party object in the second blockchain network; The process of transferring the second digital resource amount by the decentralized resource processing platform in the second blockchain network includes: transferring the digital resource amount held by the third-party object in the cross-chain contract in the second blockchain network to the contract account of the third-party object in the second blockchain network, and waiting for the digital resource amount in the corresponding contract account to be greater than or equal to the second digital resource amount, and then transferring the second digital resource amount from the corresponding contract account to the second account.
13. A resource processing method based on a blockchain network, characterized in that: The method comprises: In response to the resource transfer request, determining a first digital resource amount to be transferred in a first account in the first blockchain network, and locking the first digital resource amount; After locking the first digital resource amount, generating a first resource processing event; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network; Sending the first resource processing event to a second node in the second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from the third party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount; receiving a second resource processing event sent by the second node through the cross-chain gateway, where the second resource processing event is sent after the second digital resource amount is transferred to the second account; In response to the second resource processing event, the first digital resource amount is unlocked, and the unlocked first digital resource amount is transferred to the contract account of the third-party object in the first blockchain network.
14. The method according to claim 13, characterized in that After receiving the second resource processing event sent by the second node through the cross-chain gateway, the method further includes: Performing validity verification on the second resource processing event under at least one verification dimension; If the second resource processing event passes the validity verification in each verification dimension, the step of responding to the second resource processing event and unlocking the first digital resource amount is triggered.
15. The method according to claim 13, characterized in that The sending the first resource processing event to the second node in the second blockchain network through the cross-chain gateway includes: Packaging the first resource processing event into a first block, and adding the first block to the blockchain in the first blockchain network; After successfully adding the first block, the first resource processing event is sent to the cross-chain gateway, so that after the cross-chain gateway determines that the first block where the first resource processing event is located has block certainty, the first resource processing event is forwarded to the second node in the second blockchain network.
16. The method according to claim 15, characterized in that After successfully adding the first block, the method further includes: Synchronize the block header of the first block to the second node in the second blockchain network through the cross-chain gateway; The cross-chain gateway detects the block certainty of the first block based on the block header of the first block.
17. The method according to claim 13, characterized in that The resource transfer request is received via a resource contract; The locking of the first digital resource amount includes: locking the first digital resource amount in the first account into a cross-chain contract in the first blockchain network through the resource contract.
18. A resource processing device based on a blockchain network, characterized in that: The device comprises: A receiving unit, configured to receive a first resource processing event sent by a first node in a first blockchain network through a cross-chain gateway, wherein the first resource processing event is used to indicate that a first digital resource amount in a first account in the first blockchain network is transferred to a second account in a second blockchain network; wherein the first resource processing event is generated after the first digital resource amount is locked in the first blockchain network; A sending unit, configured to send a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from a third-party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount; The sending unit is also used to send a second resource processing event to the first node through the cross-chain gateway after transferring the second digital resource amount to the second account, so that the first node responds to the second resource processing event, unlocks the first digital resource amount, and transfers the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
19. A resource processing device based on a blockchain network, characterized in that: The device comprises: A locking unit, configured to determine, in response to a resource transfer request, a first digital resource amount to be transferred in a first account in a first blockchain network, and lock the first digital resource amount; A generating unit, configured to generate a first resource processing event after locking the first digital resource amount; the first resource processing event is used to indicate: transferring the first digital resource amount in the first account in the first blockchain network to the second account in the second blockchain network; A sending unit, configured to send the first resource processing event to a second node in a second blockchain network through a cross-chain gateway, so that the second node sends a resource conversion request to a decentralized resource processing platform in the second blockchain network based on the first resource processing event, so that the corresponding decentralized resource processing platform transfers the second digital resource amount from a third-party object's contract account in the second blockchain network to the second account after determining the second digital resource amount required to convert the first digital resource amount; A receiving unit, configured to receive a second resource processing event sent by the second node through the cross-chain gateway, wherein the second resource processing event is sent after the second digital resource amount is transferred to the second account; An unlocking unit is used to respond to the second resource processing event, unlock the first digital resource amount, and transfer the unlocked first digital resource amount to the contract account of the third-party object in the first blockchain network.
20. A computer device, comprising an input interface, an output interface, a processor and a storage medium, wherein the processor is used to obtain one or more instructions stored in the computer storage medium to execute the method as described in any one of claims 1-12 or 13-17.
