Blockchain transaction processing method, device, equipment and storage medium based on multi-chain

By introducing multi -chain structures in the blockchain network, node equipment determines the parallel chain and performing processing operations according to the transaction request, and solves the efficiency and scalability of single -chain blockchain when processing high -frequency and cross -chain transactions. More efficient transaction processing and stronger applicability.

CN114255020BActive Publication Date: 2025-01-24ONE CONNECT SMART TECH CO LTD SHENZHEN
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111560522.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2025-01-24
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

Single-chain blockchains have limitations in realizing decentralization, energy consumption, throughput capabilities and scalability, and it is difficult to effectively handle high-frequency transactions and cross-chain transactions.

Method used

By introducing a multi -chain structure in the blockchain network, after receiving the transaction processing request, node equipment determines the parallel chain according to the account address of the transferor and the transferor, performs transaction processing operations, and uses real -time monitoring and compensation The transaction mechanism ensures the accuracy of cross -chain transactions.

Benefits of technology

It achieves the parallel execution of multi-chain blockchains, shortens transaction processing time, improves transaction processing efficiency and throughput, and enhances the flexibility and applicability of the blockchain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114255020B_ABST
    Figure CN114255020B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of blockchain, and proposes a blockchain transaction processing method, device, equipment and storage medium based on multiple chains. The method includes: receiving a transaction processing request; determining the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferor is located according to the preset number of parallel chains, the transferor account address and the transferee account address; determining the processing measures taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee and the chain identifier corresponding to the node device itself; and executing the transaction processing operation corresponding to the determined processing measures. The present application configures multiple chain information in the genesis block and broadcasts it to each node device. Each node device finds out the neighbor nodes on each chain to realize a blockchain running on multiple chains. Different processing processes of the same transaction can be executed in parallel on different parallel chains, which shortens the transaction processing time, improves the transaction processing efficiency, and improves the throughput of the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and specifically relates to a multi-chain-based blockchain transaction processing method, device, equipment and storage medium. Background Art

[0002] In related technologies, blockchain usually runs in the form of a single chain, combining a consensus mechanism to achieve a consistent state change consensus on the chain. However, in order to achieve a consistent state change consensus on the chain, the blockchain must pay a certain price in exchange for the certainty of the state, or in exchange for the degree of dispersion (or decentralization) of consensus achieved in some open systems.

[0003] Therefore, in all blockchain designs with single-chain ledger structures, due to the influence of factors such as network, consensus, and computing power, the degree of decentralization, energy consumption, throughput, and scalability of the blockchain are all subject to varying degrees of restrictions. Summary of the invention

[0004] The present application proposes a multi-chain-based blockchain transaction processing method, device, equipment and storage medium, which realizes a blockchain running on multiple chains. Different processing processes of the same transaction can be executed in parallel on different parallel chains, shortening the transaction processing time, improving the transaction processing efficiency, and improving the throughput rate of the blockchain.

[0005] The first embodiment of the present application proposes a multi-chain-based blockchain transaction processing method, which is applied to a node device in a blockchain network including multiple parallel chains, including:

[0006] Receive a transaction processing request, wherein the transaction processing request includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time;

[0007] According to the preset number of parallel chains, the transferor's account address and the transferee's account address, respectively determine the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located;

[0008] Determine a processing measure to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself;

[0009] Execute the transaction processing operation corresponding to the determined processing measure on the transaction processing request.

[0010] In some embodiments of the present application, before receiving the transaction processing request, the method further includes:

[0011] Generate a genesis block, and store multi-chain configuration information in the genesis block, wherein the multi-chain configuration information includes configuration information of each of the parallel chains, and the configuration information of each of the parallel chains includes at least a chain identifier of the parallel chain;

[0012] Broadcast the multi-chain configuration information to each other node device in the blockchain network.

[0013] In some embodiments of the present application, the method further comprises:

[0014] Send a neighbor search request to the node device directly connected to the current node device;

[0015] Receive the neighbor node identifier and the corresponding parallel chain identifier returned by each directly connected node device;

[0016] The received neighbor node identifier and the corresponding chain identifier are stored in its own neighbor list.

[0017] In some embodiments of the present application, the determining, according to the preset number of parallel chains, the transferor account address, and the transferee account address, respectively, the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located, includes:

[0018] Using the transferor's account address to perform a remainder operation on the preset number of parallel chains, the remainder obtained is used as the chain identifier corresponding to the parallel chain where the transferor is located;

[0019] The transferee account address is used to perform a remainder operation on the preset number of parallel chains, and the remainder obtained is used as the chain identifier corresponding to the parallel chain where the transferee is located.

[0020] In some embodiments of the present application, determining the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself includes:

[0021] Determine whether the chain identifier corresponding to the transferor is the same as the chain identifier corresponding to the transferee;

[0022] If yes, determine whether the chain identifiers corresponding to the transferor and the transferee are the same as the chain identifier of the parallel chain to which the node device itself belongs;

[0023] If yes, determining that the processing measures taken for the transaction processing request include a transfer-out operation and a transfer-in operation;

[0024] If it is determined that the chain identifiers corresponding to the transferor and the transferee are the same and different from the chain identifier corresponding to the node device itself, it is determined that the processing measure to be taken for the transaction processing request is to discard the transaction processing request.

[0025] In some embodiments of the present application, the method further comprises:

[0026] If the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee, determining whether the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee;

[0027] If the chain identifier corresponding to the self is the chain identifier corresponding to the transferor, determining that the processing measure taken for the transaction processing request is transfer-out processing;

[0028] If the chain identifier corresponding to the self is the chain identifier corresponding to the transfer-in party, determining that the processing measure taken for the transaction processing request is transfer-in processing;

[0029] If the chain identifier corresponding to itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, it is determined that the processing measure taken for the transaction processing request is to discard the transaction processing request.

[0030] In some embodiments of the present application, after executing the transaction processing operation corresponding to the determined processing measure on the transaction processing request, the method further includes:

[0031] The transaction result is packaged into a new block, and the new block is stored on the parallel chain to which the node device belongs.

[0032] The embodiment of the second aspect of the present application provides a multi-chain-based blockchain transaction processing device, which is applied to a node device in a blockchain network including multiple parallel chains, including:

[0033] A receiving module, configured to receive a transaction processing request, wherein the transaction processing request includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time;

[0034] A determination module, configured to determine the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located, respectively, according to the preset number of parallel chains, the transferor account address, and the transferee account address; determine the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself;

[0035] The transaction execution module is used to execute the transaction processing operation corresponding to the determined processing measure on the transaction processing request.

[0036] An embodiment of the third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0037] An embodiment of the fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect above.

[0038] The technical solution provided in the embodiments of the present application has at least the following technical effects or advantages:

[0039] The embodiment of the present application configures multi-chain information in the genesis block, broadcasts the multi-chain configuration information to each node device in the blockchain system, and each node device finds out the neighbor nodes on each chain, so that a blockchain running with multiple chains can be realized. The blockchain running with multiple chains can process both single-chain transactions and cross-chain transactions involving multiple chains, which improves the flexibility of blockchain in processing transactions, helps to improve the popularity of blockchain, and increases the application scenarios applicable to blockchain. And through multi-chain operation, different processing processes of the same transaction can be executed in parallel on different parallel chains, shortening the processing time of the transaction, improving the processing efficiency of the blockchain for transactions, and greatly improving the throughput of the blockchain. Further, for cross-chain transactions, the parallel chain that performs the transfer-out processing also monitors the parallel chain that performs the transfer-in processing in real time to obtain the execution status of the transfer-in processing. After determining that the transfer-in processing fails, the transfer-out account address is compensated by initiating a compensation transaction, ensuring the accuracy of the cross-chain transaction, and avoiding the loss of interests to users due to the asynchrony of processing operations between different parallel chains.

[0040] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] By reading the detailed description of the preferred embodiment below, various other advantages and benefits will become clear to those of ordinary skill in the art. The accompanying drawings are only used for the purpose of illustrating the preferred embodiment and are not considered to be limitations of the present application. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings.

[0042] In the attached picture:

[0043] Figure 1A schematic diagram of a genesis block provided by an embodiment of the present application is shown;

[0044] Figure 2 A schematic diagram showing connections between multiple node devices in a blockchain network including three parallel chains provided in an embodiment of the present application is shown;

[0045] Figure 3 A flowchart of a multi-chain-based blockchain transaction processing method provided in an embodiment of the present application is shown;

[0046] Figure 4 A schematic diagram of the structure of a multi-chain blockchain transaction processing device provided in an embodiment of the present application is shown;

[0047] Figure 5 A schematic diagram of the structure of a computer device provided by an embodiment of the present application is shown;

[0048] Figure 6 A schematic diagram of a storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] It can be understood that the terms "first", "second", etc. used in the present application can be used in this article to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element.

[0051] Some embodiments of the present application provide a multi-chain-based blockchain transaction processing method, which is applied to a node device in a blockchain network including multiple parallel chains. When the node device in the blockchain network generates a genesis block of a blockchain, it stores multi-chain configuration information in the genesis block, and the multi-chain configuration information includes configuration information of each chain, and the configuration information of each chain includes at least a chain identifier of each chain.

[0052] For example, assuming that the blockchain includes three chains, chain1, chain2, and chain3, the multi-chain configuration information stored in the genesis block may include chain1: id-123, chain2: id-456, chain3: id-567.

[0053] In the embodiment of the present application, there can be two or more parallel chains in the blockchain system. The present application does not limit the number of parallel chains in the blockchain. In actual applications, the number of parallel chains can be determined according to demand. It is only necessary to store the configuration information corresponding to each chain in the genesis block.

[0054] In the embodiment of the present application, each node device can only assume the role of one of the chains when it is started, and can only serve as a node on one of the parallel chains. When the node device is started, the node ID of the node device is bound to the chain ID corresponding to the parallel chain to which the node device belongs through configuration. The blocks packaged and generated by the node device can only be stored on the blockchain corresponding to the chain to which the node device belongs.

[0055] like Figure 1 As shown in the figure, the genesis block stores the chain identifiers of chain1, chain2 and chain3. As the business is processed, each chain will generate its own blockchain, such as Figure 1 The blockchain corresponding to chain1 includes one block, chain1-Block1; the blockchain corresponding to chain2 includes three blocks, chain2-Block1, chain2-Block2 and chain2-Block3; the blockchain corresponding to chain3 includes two blocks, chain3-Block1 and chain3-Block2.

[0056] In this blockchain system, the node device that generates the genesis block will broadcast the multi-chain configuration information stored in the genesis block to each node device in the blockchain system. Therefore, each node device knows that there are multiple parallel chains in the current network.

[0057] In the blockchain system, different node devices communicate with each other through a point-to-point protocol, which can be a TCP (Transmission Control Protocol) protocol. The node device searches for its neighbor nodes through the point-to-point protocol and records the neighbor nodes found in its own neighbor table (NeighborTable). In order to ensure the orderly and smooth operation of multiple parallel chains in the blockchain system, each node device needs to find at least one node in each chain when searching for neighbor nodes.

[0058] Since the process of searching for neighbor nodes for each node device is the same, the embodiment of the present application only takes the first node device as an example to illustrate the search process. The first node device can be any node device in the blockchain system. Specifically, the first node device sends a neighbor search request to each second node device, and the second node device is a node device directly connected to the first node device. The second node device returns the node identifier of the neighbor node recorded in its own neighbor list and the chain identifier to which it belongs to to the first node device. After the first node device receives the node identifier and chain identifier of the neighbor node returned by each second node device, for multiple repeated node identifiers, only one is retained and the other duplicates are eliminated. Each remaining node identifier and the corresponding chain identifier are stored in its own neighbor list, and the node identifier of the neighbor node with which a connection relationship has been established is marked with a connection identifier.

[0059] Since the second node device also obtains the node identification of the neighboring node from the node device to which it is directly connected, and all the node devices in the blockchain system are directly or indirectly interconnected, the above method can ensure that the first node device can obtain the node identification of the node device on each chain.

[0060] In order to facilitate understanding of the above process of searching for neighboring nodes, the following is a detailed description in the form of examples with reference to the accompanying drawings. Figure 2 As shown in the figure, the bidirectional arrows between different node devices indicate that a point-to-point communication connection is established between the two node devices. Node1: Chain1 represents the node device Node1 on Chain1. Taking Node1: Chain1 as an example, Node1: Chain1 is directly connected to Node2: Chain2, Node4: Chain1 and Node3: Chain3. Node1: Chain1 sends neighbor search requests to Node2: Chain2, Node4: Chain1 and Node3: Chain3 respectively. Node2: Chain2, Node4: Chain1 and Node3: Chain3 all send the node identifier and corresponding chain identifier in their neighbor list to Node1: Chain1. Finally, the neighbor list recorded by Node1: Chain1 is:

[0061] Chain1:Node4(connected),Node6

[0062] Chain2:Node2(connected),Node5,

[0063] CHain3:Node3(connected),Node7.

[0064] Among them, connected means directly connected to Node1:Chain1.

[0065] Since network resources are limited, the number of neighbor nodes directly connected to a node device is usually less than the number of neighbor nodes recorded in the neighbor list. Since more candidate neighbor nodes are recorded in the neighbor list, when the connection between the node device and a directly connected neighbor node is interrupted due to network instability or neighbor node failure, the node device can select a candidate neighbor node from multiple neighbor nodes that are not connected in its neighbor list, and send a connection request to the candidate neighbor node to establish a communication connection with the candidate neighbor node. After establishing a communication connection with the candidate neighbor node, a connection identifier is also marked for the node identifier corresponding to the candidate neighbor node in the neighbor list.

[0066] After establishing a blockchain system containing multiple parallel chains in the above manner, transactions are processed based on the blockchain system. Figure 3 , specifically including the following steps:

[0067] Step 101: The node device receives a transaction processing request, which includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time.

[0068] When a user needs to conduct a transaction, a transaction processing request is sent to any node device in the blockchain system. The node device receives the transaction processing request sent by the user and parses the transaction identifier, transferor account address, transferee account address, transaction amount, transaction signature, public key, and transaction expiration time from the transaction processing request. Among them, the transaction signature can be a transaction hash value obtained by performing a hash operation on the transaction information such as the transaction identifier, transferor account address, transferee account address, transaction amount, and transaction expiration time, and then encrypting the transaction hash value using the private key to obtain the ciphertext.

[0069] For example, suppose a node device receives a transaction processing request corresponding to a transaction Tx0001. Transaction Tx0001 contains the following information:

[0070] {"params":{"from":"addressFrom","to":"addressTo","account":100},

[0071] "signature":"sdfosdg","pubkey":"sdfsdgtt","expireTimestamp":2021 / 08 / 23 14:51:39}

[0072] Among them, "addressFrom" is the transferor's account address, "addressTo" is the transferee's account address, "account":100 is the transaction amount, "sdfosdg" is the transaction signature, "sdfsdgtt" is the public key, and "expireTimestamp":2021 / 08 / 23 14:51:39 is the transaction expiration time.

[0073] After receiving the transaction processing request, the node device first determines whether the transaction corresponding to the transaction processing request is a valid transaction based on the transaction signature.

[0074] Specifically, the node device uses the public key included in the transaction processing request to decrypt the transaction signature and obtain a transaction hash value. A transaction hash value is generated by performing a hash operation on the transaction information included in the transaction processing request, such as the transaction identifier, the transferor account address, the transferee account address, the transaction amount, and the transaction expiration time. The currently generated transaction hash value is compared to see if it is the same as the transaction hash value decrypted from the transaction signature. If the two are the same, it is determined that the transaction corresponding to the transaction processing request is a valid transaction. Otherwise, it is determined that the transaction corresponding to the transaction processing request is an invalid transaction.

[0075] If it is determined to be a valid transaction, the node device forwards the transaction processing request to the adjacent nodes directly connected to it (excluding the adjacent nodes that forwarded the transaction processing request to the current node), and determines whether the current node device can process the transaction through the following step 102. If it is determined to be an invalid transaction, the transaction processing request is discarded.

[0076] Step 102: The node device determines the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferor is located according to the transferor account address, the transferee account address and the preset number of parallel chains.

[0077] The node device uses the transferor's account address to perform a modulus operation on the preset number of parallel chains, and uses the remainder obtained as the chain identifier corresponding to the parallel chain where the transferor is located. The transferee's account address is used to perform a modulus operation on the preset number of parallel chains, and uses the remainder obtained as the chain identifier corresponding to the parallel chain where the transferee is located.

[0078] Step 103: The node device determines the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to itself.

[0079] The node device determines whether the chain identifier corresponding to the transferor is the same as the chain identifier corresponding to the transferee. If the chain identifier corresponding to the transferor is determined to be the same as the chain identifier corresponding to the transferee, it indicates that the transaction can be processed only by the parallel chain corresponding to the chain identifier, and it is a single-chain transaction. In this case, the node device determines whether the chain identifier corresponding to the transferor and the transferee is the same as the chain identifier of the parallel chain to which it belongs. If so, it is determined that the node device can process the transaction processing request, and the processing measures taken for the transaction processing request include transfer-out operations and transfer-in operations. If not, it is determined that the node device cannot process the transaction processing request, and the processing measures taken for the transaction processing request are to discard the transaction processing request.

[0080] If it is determined that the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee, it indicates that the transaction needs to be processed by two different parallel chains in coordination, and the transaction belongs to a cross-chain transaction. In this case, the node device determines whether the chain identifier of the parallel chain to which it belongs is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee. If it is determined that the chain identifier corresponding to itself is the chain identifier corresponding to the transferor, it is determined that the node device can process the transaction processing request, and the processing measure is the transfer-out processing of transferring the transaction amount from the transferor's account address. If it is determined that the chain identifier corresponding to itself is the chain identifier corresponding to the transferee, it is determined that the node device can process the transaction processing request, and the processing measure is the transfer-in processing of adding the transaction amount to the transferee's account address. If it is determined that the chain identifier corresponding to itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, it is determined that the node device cannot process the transaction processing request, and the processing measure is to discard the transaction processing request.

[0081] For example, suppose the node device calculates the transferor's account address addressFrom% preset parallel chain number chainNum, and the resulting chain identifier is id-123, that is, the transferor belongs to chain1. The transferee's account address addressTo% preset parallel chain number chainNum is calculated, and the resulting chain identifier is id-456, that is, the transferee belongs to chain2. If the chain identifier corresponding to the node device itself is id-456, it is determined that the node device can perform the process of increasing the transaction amount in the transferee's account address addressTo.

[0082] Step 104: The node device executes the transaction processing operation corresponding to the determined processing measure on the transaction processing request.

[0083] If the processing measure determined in step 103 is discarding, the node device discards the transaction processing request and does not perform any other processing on it except forwarding the broadcast.

[0084] If it is determined in step 103 that the transaction is a single-chain transaction, and the determined processing measures include transfer-out processing and transfer-in processing, the node device first determines whether the transaction processing request has expired. Specifically, the node device obtains the timestamp of the last block from the local chain, and determines whether the transaction expiration time included in the transaction processing request is earlier than the timestamp of the last block. If so, it is determined that the transaction has expired, and the transaction processing request is discarded and no further processing is performed.

[0085] If it is determined that the transaction has not expired, the transaction amount included in the transaction processing request is subtracted from the transfer-out account address included in the transaction processing request, and the transaction amount is added to the transfer-in account address. After the node device completes the processing, it packages the transaction result into a new block and stores the new block on the local chain. The local chain of the node device is the blockchain corresponding to the parallel chain to which the node device, the transferor, and the transferee belong.

[0086] After on-chain storage, the node device also sends the new block to each other node device belonging to the same parallel chain in the blockchain system, so that each other node device stores the new block on-chain in its respective local chain.

[0087] If it is determined in step 103 that the transaction is a cross-chain transaction, and the determined processing measures include transfer-out processing, the node device also first determines whether the transaction processing request has expired in the manner described above, and the specific judgment process is not repeated here. If it is determined that it has not expired, the transaction amount included in the transaction processing request is subtracted from the transfer-out account address included in the transaction processing request. After the node device processes the transfer-out processing, it packs a new block and stores the new block on the local chain. Among them, the local chain of the node device is the blockchain corresponding to the parallel chain to which the node device and the transferor belong.

[0088] After on-chain storage, the node device also sends the new block to each other node device belonging to the same parallel chain in the blockchain system, so that each other node device stores the new block on-chain in its respective local chain.

[0089] If it is determined in step 103 that the transaction is a cross-chain transaction, and the determined processing measures include transfer-in processing, the node device also first determines whether the transaction processing request has expired in the manner described above, and the specific judgment process is not repeated here. If it is determined that it has not expired, the transaction amount included in the transaction processing request is added to the transfer-in account address included in the transaction processing request. After the node device processes the transfer-in processing, it packages a new block and stores the new block on the local chain. Among them, the local chain of the node device is the blockchain corresponding to the parallel chain to which the node device and the transfer-in party belong.

[0090] After on-chain storage, the node device also sends the new block to each other node device belonging to the same parallel chain in the blockchain system, so that each other node device stores the new block on-chain in its respective local chain.

[0091] In the above cross-chain transaction application scenario, there may be a situation where the parallel chain responsible for executing the outgoing transfer process has completed the outgoing transfer process, while the parallel chain responsible for executing the incoming transfer process fails to execute the incoming transfer process. In this case, it is necessary to perform a compensation operation on the outgoing account address to re-transfer the transferred transaction amount to the outgoing account address.

[0092] In order to deal with the above situation, in an embodiment of the present application, if the processing measure determined in step 103 is a transfer-out process, the node device, while executing the transfer-out operation in the above manner, also needs to monitor the parallel chain executing the transfer-in operation in real time to determine whether the transfer-in operation is successfully executed.

[0093] Specifically. The node device determines the node identifier corresponding to the chain identifier from its own neighbor list according to the chain identifier corresponding to the transferee. If there is a node identifier marked with a connection identifier among the node identifiers corresponding to the chain identifier, the node device periodically sends a monitoring request to the neighbor node device corresponding to the node identifier marked with a connection identifier, and the monitoring request carries the transaction identifier corresponding to the transaction processing request. If there is no node identifier marked with a connection identifier among the node identifiers corresponding to the chain identifier of the transferee in the neighbor list, the node device first randomly selects a node identifier from the node identifiers corresponding to the chain identifier of the transferee, establishes a communication connection with the neighbor node device corresponding to the selected node identifier, and then periodically sends a monitoring request to the neighbor node device. After receiving the monitoring request, the neighbor node device searches the local chain for the block corresponding to the transaction identifier according to the transaction identifier included in the monitoring request.

[0094] Since there are cases of block rollback in the blockchain, this is because the consensus in the blockchain is delayed. Ethereum usually needs 15-20 blocks to confirm that it is 99.9999999% successful. The number of safe blocks for each parallel chain can be set according to the consensus strategy of each parallel chain, which can be 6, 10, 15 or 20, etc.

[0095] The neighbor node device can calculate the total number of current blocks minus the number of security blocks corresponding to the parallel chain where the neighbor node device is located to obtain a difference. In the local chain, the block before the difference is searched to see whether the block corresponding to the transaction identifier is included. If included, it is determined that the transfer-in process is successful, and a transfer-in success notification is sent to the current node device that performs the transfer-out process. If not included, it is determined that the transfer-in process fails, and a transfer-in failure notification is sent to the current node device.

[0096] After receiving the transfer failure notification returned by the neighbor node device, the current node device sends a transaction failure message to the user. The transaction failure message is used to prompt the user to re-initiate a compensation transaction request corresponding to the transaction. The compensation transaction request includes a transaction signature, a public key, and a transaction identifier corresponding to the above transaction processing request.

[0097] For example, offset transactions include the following:

[0098] {"params":{"from":"addressFrom","compensate_tx":"Tx0001"},"signature": "sdfosdg","pubkey":"sdfsdgtt"}

[0099] Among them, addressFrom is the transfer account address, Tx0001 is the transaction identifier, sdfosdg is the transaction signature, and sdfsdgtt is the public key.

[0100] After receiving the compensation transaction request, the node device first determines whether the compensation transaction request is valid based on the transaction signature included in the compensation transaction request. The specific determination process is the same as the process of determining whether the transaction processing request is valid in step 101, which will not be repeated here.

[0101] If the compensation transaction request is determined to be valid, the compensation transaction request is forwarded to the adjacent nodes directly connected thereto (excluding the adjacent nodes that forwarded the transaction processing request to the current node) so that other node devices can synchronously process the compensation transaction request.

[0102] Then the node device uses the transferor account address included in the compensation transaction request to perform a remainder operation on the preset number of parallel chains, and uses the remainder obtained as the chain identifier corresponding to the parallel chain where the transferor is located. According to the transaction identifier included in the compensation transaction request, the block corresponding to the transaction identifier is searched in the local chain. The transfer-in account address and transaction amount are obtained from the found block, and the transfer-in account address is used to perform a remainder operation on the preset number of parallel chains, and the remainder obtained is used as the chain identifier corresponding to the parallel chain where the transfer-in party is located. According to the chain identifier corresponding to the transfer-in party, the neighbor node device corresponding to the chain identifier that establishes a communication connection is determined from the neighbor list. Determine from the neighbor node device whether the transfer-in operation corresponding to the transaction identifier has failed in accordance with the monitoring method described above. After determining that the transfer-in operation has failed, the transaction amount corresponding to the transaction identifier is increased in the transfer-out account address.

[0103] After processing the supplementary transaction, the node device packs a new block and stores the new block on the local chain. The local chain of the node device is the blockchain corresponding to the parallel chain to which the node device and the transferor belong.

[0104] After on-chain storage, the node device also sends the new block to each other node device belonging to the same parallel chain in the blockchain system, so that each other node device stores the new block on-chain in its respective local chain.

[0105] The embodiment of the present application configures multi-chain information in the genesis block, broadcasts the multi-chain configuration information to each node device in the blockchain system, and each node device finds out the neighbor nodes on each chain, so that a blockchain running with multiple chains can be realized. The blockchain running with multiple chains can process both single-chain transactions and cross-chain transactions involving multiple chains, which improves the flexibility of blockchain in processing transactions, helps to improve the popularity of blockchain, and increases the application scenarios applicable to blockchain. And through multi-chain operation, different processing processes of the same transaction can be executed in parallel on different parallel chains, shortening the processing time of the transaction, improving the processing efficiency of the blockchain for transactions, and greatly improving the throughput of the blockchain. Further, for cross-chain transactions, the parallel chain that performs the transfer-out processing also monitors the parallel chain that performs the transfer-in processing in real time to obtain the execution status of the transfer-in processing. After determining that the transfer-in processing fails, the transfer-out account address is compensated by initiating a compensation transaction, ensuring the accuracy of the cross-chain transaction, and avoiding the loss of interests to users due to the asynchrony of processing operations between different parallel chains.

[0106] The embodiment of the present application provides a multi-chain based blockchain transaction processing device, which is used to execute the multi-chain based blockchain transaction processing method described in any of the above embodiments, such as Figure 4 As shown, the device comprises:

[0107] The receiving module 401 is used to receive a transaction processing request, which includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time;

[0108] The determination module 402 is used to determine the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferor is located according to the preset number of parallel chains, the transferor account address and the transferee account address; determine the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee and the chain identifier corresponding to the node device itself;

[0109] The transaction execution module 403 is used to execute the transaction processing operation corresponding to the determined processing measure on the transaction processing request.

[0110] The device also includes: a genesis block generation module, which is used to generate a genesis block and store multi-chain configuration information in the genesis block, wherein the multi-chain configuration information includes configuration information of each parallel chain, and the configuration information of each parallel chain includes at least a chain identifier of the parallel chain; and broadcast the multi-chain configuration information to each other node device in the blockchain network.

[0111] The device also includes: a neighbor search module, which is used to send a neighbor search request to a node device directly connected to the current node device; receive a neighbor node identifier and a corresponding parallel chain identifier returned by each directly connected node device; and store the received neighbor node identifier and the corresponding chain identifier in its own neighbor list.

[0112] The determination module 402 is used to perform a modulo operation on the preset number of parallel chains using the transferor's account address, and use the obtained remainder as the chain identifier corresponding to the parallel chain where the transferor is located; and perform a modulo operation on the preset number of parallel chains using the transferee's account address, and use the obtained remainder as the chain identifier corresponding to the parallel chain where the transferee is located.

[0113] Determination module 402 is used to determine whether the chain identifier corresponding to the transferor is the same as the chain identifier corresponding to the transferee; if so, determine whether the chain identifiers corresponding to the transferor and the transferee are the same as the chain identifier of the parallel chain to which the node device itself belongs; if so, determine that the processing measures taken for the transaction processing request include a transfer-out operation and a transfer-in operation; if it is determined that the chain identifiers corresponding to the transferor and the transferee are the same, and different from the chain identifier corresponding to the node device itself, determine that the processing measures taken for the transaction processing request are to discard the transaction processing request.

[0114] Determination module 402 is used to determine whether the chain identifier corresponding to the transferor is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee if the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee; if the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferor, determine that the processing measure taken for the transaction processing request is transfer-out processing; if the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferee, determine that the processing measure taken for the transaction processing request is transfer-in processing; if the chain identifier corresponding to the node device itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, determine that the processing measure taken for the transaction processing request is to discard the transaction processing request.

[0115] The device also includes: a packaging module, which is used to package the transaction results into a new block and store the new block on the parallel chain to which the node device belongs.

[0116] The embodiment of the present application configures multi-chain information in the genesis block, broadcasts the multi-chain configuration information to each node device in the blockchain system, and each node device finds out the neighbor nodes on each chain, so that a blockchain running with multiple chains can be realized. The blockchain running with multiple chains can process both single-chain transactions and cross-chain transactions involving multiple chains, which improves the flexibility of blockchain in processing transactions, helps to improve the popularity of blockchain, and increases the application scenarios applicable to blockchain. And through multi-chain operation, different processing processes of the same transaction can be executed in parallel on different parallel chains, shortening the processing time of the transaction, improving the processing efficiency of the blockchain for transactions, and greatly improving the throughput of the blockchain. Further, for cross-chain transactions, the parallel chain that performs the transfer-out processing also monitors the parallel chain that performs the transfer-in processing in real time to obtain the execution status of the transfer-in processing. After determining that the transfer-in processing fails, the transfer-out account address is compensated by initiating a compensation transaction, ensuring the accuracy of the cross-chain transaction, and avoiding the loss of interests to users due to the asynchrony of processing operations between different parallel chains.

[0117] The present application embodiment provides a computer device. Figure 5As shown, the computer device includes a processor, a storage medium, a memory and a network interface connected by a device bus. Among them, the storage medium of the computer device stores an operating device, a database and a computer-readable instruction. The database may store a control information sequence. When the computer-readable instruction is executed by the processor, the processor can implement a blockchain transaction processing method based on multiple chains. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instruction is executed by the processor, the processor can execute a blockchain transaction processing method based on multiple chains. The network interface of the computer device is used to connect and communicate with the terminal. Those skilled in the art can understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0118] The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: receiving a transaction processing request, the transaction processing request includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time; determining the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located according to the preset number of parallel chains, the transferor account address, and the transferee account address; determining the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself; and executing the transaction processing operation corresponding to the determined processing measures on the transaction processing request.

[0119] When the processor executes the computer program, the following steps are implemented: generating a genesis block, storing multi-chain configuration information in the genesis block, the multi-chain configuration information including configuration information of each parallel chain, the configuration information of each parallel chain including at least the chain identifier of the parallel chain; broadcasting the multi-chain configuration information to each other node device in the blockchain network.

[0120] When the processor executes the computer program, the following steps are implemented: sending a neighbor search request to a node device directly connected to the current node device; receiving a neighbor node identifier and a corresponding parallel chain identifier returned by each directly connected node device; and storing the received neighbor node identifier and the corresponding chain identifier in its own neighbor list.

[0121] When the processor executes the computer program, the following steps are implemented: using the transferor's account address to perform a modulo operation on the preset number of parallel chains, and using the obtained remainder as the chain identifier corresponding to the parallel chain where the transferor is located; using the transferee's account address to perform a modulo operation on the preset number of parallel chains, and using the obtained remainder as the chain identifier corresponding to the parallel chain where the transferee is located.

[0122] The processor implements the following steps when executing the computer program: determining whether the chain identifier corresponding to the transferor is the same as the chain identifier corresponding to the transferee; if so, determining whether the chain identifiers corresponding to the transferor and the transferee are the same as the chain identifier of the parallel chain to which the node device itself belongs; if so, determining that the processing measures taken for the transaction processing request include a transfer-out operation and a transfer-in operation; if it is determined that the chain identifiers corresponding to the transferor and the transferee are the same, and are different from the chain identifier corresponding to the node device itself, determining that the processing measures taken for the transaction processing request are to discard the transaction processing request.

[0123] The processor implements the following steps when executing the computer program: if the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee, determine whether the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee; if the chain identifier corresponding to itself is the chain identifier corresponding to the transferor, determine that the processing measure taken for the transaction processing request is transfer-out processing; if the chain identifier corresponding to itself is the chain identifier corresponding to the transferee, determine that the processing measure taken for the transaction processing request is transfer-in processing; if the chain identifier corresponding to itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, determine that the processing measure taken for the transaction processing request is to discard the transaction processing request.

[0124] When the processor executes the computer program, the following steps are implemented: the transaction results are packaged into a new block, and the new block is stored on the parallel chain to which the node device belongs.

[0125] The present application also provides a storage medium storing computer-readable instructions, such as Figure 6 As shown, when the computer-readable instructions are executed by one or more processors, the one or more processors perform the following steps: receiving a transaction processing request, the transaction processing request includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time; determining the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located according to the preset number of parallel chains, the transferor account address, and the transferee account address; determining the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself; and executing the transaction processing operation corresponding to the determined processing measure on the transaction processing request.

[0126] The processor may also perform the following steps: generate a genesis block, store multi-chain configuration information in the genesis block, the multi-chain configuration information including configuration information of each parallel chain, the configuration information of each parallel chain including at least the chain identifier of the parallel chain; broadcast the multi-chain configuration information to each other node device in the blockchain network.

[0127] The processor can also perform the following steps: sending a neighbor search request to a node device directly connected to the current node device; receiving a neighbor node identifier and a corresponding parallel chain identifier returned by each directly connected node device; and storing the received neighbor node identifier and the corresponding chain identifier in its own neighbor list.

[0128] The processor can also perform the following steps: using the transferor's account address to perform a modulo operation on the preset number of parallel chains, and using the obtained remainder as the chain identifier corresponding to the parallel chain where the transferor is located; using the transferee's account address to perform a modulo operation on the preset number of parallel chains, and using the obtained remainder as the chain identifier corresponding to the parallel chain where the transferee is located.

[0129] The processor may also perform the following steps: determining whether the chain identifier corresponding to the transferor is the same as the chain identifier corresponding to the transferee; if so, determining whether the chain identifiers corresponding to the transferor and the transferee are the same as the chain identifier of the parallel chain to which the node device itself belongs; if so, determining that the processing measures taken for the transaction processing request include a transfer-out operation and a transfer-in operation; if it is determined that the chain identifiers corresponding to the transferor and the transferee are the same, and are different from the chain identifier corresponding to the node device itself, determining that the processing measures taken for the transaction processing request are to discard the transaction processing request.

[0130] The processor may also perform the following steps: if the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee, then determine whether the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee; if the chain identifier corresponding to itself is the chain identifier corresponding to the transferor, then determine that the processing measure taken for the transaction processing request is transfer-out processing; if the chain identifier corresponding to itself is the chain identifier corresponding to the transferee, then determine that the processing measure taken for the transaction processing request is transfer-in processing; if the chain identifier corresponding to itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, then determine that the processing measure taken for the transaction processing request is to discard the transaction processing request.

[0131] The processor may also perform the following steps: packaging the transaction results into a new block, and storing the new block on the parallel chain to which the node device belongs.

[0132] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0133] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0134] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A multi-chain blockchain transaction processing method, characterized in that: Node devices used in blockchain networks that include multiple parallel chains include: Receive a transaction processing request, wherein the transaction processing request includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time; According to the preset number of parallel chains, the transferor's account address and the transferee's account address, respectively determine the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located; Determine a processing measure to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself; Executing the transaction processing operation corresponding to the determined processing measure on the transaction processing request; The determining of the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself includes: If the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee, determining whether the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee; If the chain identifier corresponding to the self is the chain identifier corresponding to the transferor, determining that the processing measure taken for the transaction processing request is transfer-out processing; If the chain identifier corresponding to the self is the chain identifier corresponding to the transfer-in party, determining that the processing measure taken for the transaction processing request is transfer-in processing; If the chain identifier corresponding to itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, it is determined that the processing measure taken for the transaction processing request is to discard the transaction processing request.

2. The method according to claim 1, characterized in that Before receiving the transaction processing request, the method further includes: Generate a genesis block, and store multi-chain configuration information in the genesis block, wherein the multi-chain configuration information includes configuration information of each of the parallel chains, and the configuration information of each of the parallel chains includes at least a chain identifier of the parallel chain; Broadcast the multi-chain configuration information to each other node device in the blockchain network.

3. The method according to claim 2, characterized in that The method further comprises: Send a neighbor search request to the node device directly connected to the current node device; Receive the neighbor node identifier and the corresponding parallel chain identifier returned by each directly connected node device; The received neighbor node identifier and the corresponding chain identifier are stored in its own neighbor list.

4. The method according to any one of claims 1 to 3, characterized in that: The determining, according to the preset number of parallel chains, the transferor account address, and the transferee account address, respectively, the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferee is located, comprises: Using the transferor's account address to perform a remainder operation on the preset number of parallel chains, the remainder obtained is used as the chain identifier corresponding to the parallel chain where the transferor is located; The transferee account address is used to perform a remainder operation on the preset number of parallel chains, and the remainder obtained is used as the chain identifier corresponding to the parallel chain where the transferee is located.

5. The method according to any one of claims 1 to 3, characterized in that: The determining, according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself, a processing measure to be taken for the transaction processing request includes: Determine whether the chain identifier corresponding to the transferor is the same as the chain identifier corresponding to the transferee; If yes, determine whether the chain identifiers corresponding to the transferor and the transferee are the same as the chain identifier of the parallel chain to which the node device itself belongs; If yes, determining that the processing measures taken for the transaction processing request include a transfer-out operation and a transfer-in operation; If it is determined that the chain identifiers corresponding to the transferor and the transferee are the same and different from the chain identifier corresponding to the node device itself, it is determined that the processing measure to be taken for the transaction processing request is to discard the transaction processing request.

6. The method according to any one of claims 1 to 3, characterized in that: After executing the transaction processing operation corresponding to the determined processing measure on the transaction processing request, the method further includes: The transaction result is packaged into a new block, and the new block is stored on the parallel chain to which the node device belongs.

7. A multi-chain blockchain transaction processing device, characterized in that: Node devices used in blockchain networks that include multiple parallel chains include: A receiving module, configured to receive a transaction processing request, wherein the transaction processing request includes a transaction identifier, a transferor account address, a transferee account address, a transaction amount, a transaction signature, a public key, and a transaction expiration time; A determination module, used to determine the chain identifier of the parallel chain where the transferor is located and the chain identifier of the parallel chain where the transferor is located according to the preset number of parallel chains, the transferor account address and the transferee account address; determine the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee and the chain identifier corresponding to the node device itself; A transaction execution module, configured to execute a transaction processing operation corresponding to the determined processing measure on the transaction processing request; The determining of the processing measures to be taken for the transaction processing request according to the chain identifier corresponding to the transferor, the chain identifier corresponding to the transferee, and the chain identifier corresponding to the node device itself includes: If the chain identifier corresponding to the transferor is different from the chain identifier corresponding to the transferee, determining whether the chain identifier corresponding to the node device itself is the chain identifier corresponding to the transferor or the chain identifier corresponding to the transferee; If the chain identifier corresponding to the self is the chain identifier corresponding to the transferor, determining that the processing measure taken for the transaction processing request is transfer-out processing; If the chain identifier corresponding to the self is the chain identifier corresponding to the transfer-in party, determining that the processing measure taken for the transaction processing request is transfer-in processing; If the chain identifier corresponding to itself is neither the chain identifier corresponding to the transferor nor the chain identifier corresponding to the transferee, it is determined that the processing measure taken for the transaction processing request is to discard the transaction processing request.

8. A computer device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 6.

9. A storage medium storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Blockchain-based data processing method, device and blockchain node network

    CN108305056A

  • Transfer flow based on a block chain main chain and multiple parallel sub-chains

    CN109493050A