Block chain system cross-fragment transaction method and device based on UTXO

By setting public addresses in the blockchain system and converting cross-shash transactions into multiple transactions, and independently agreeing on each shard, the problem of low cross-shash transaction efficiency after blockchain sharding is solved, and the improvement of the System performance and transaction processing efficiency.

CN118941385APending Publication Date: 2024-11-12THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410920186.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

After blockchain sharding, cross-shash transaction efficiency is low and communication costs are high, resulting in system performance not improving or even degrading. Especially when transactions in the UTXO model involve multiple shards, consensus and transaction efficiency are affected.

Method used

In the blockchain system, by setting a public address in each shard, cross-shash transactions are converted into multiple transactions, including input in-chip transactions, inter-chip transactions and output in-chip transactions, and in each shard Independent consensus is established between them, reducing dependence on other shards, and improving consensus efficiency.

Benefits of technology

Through transaction conversion and independent consensus, the processing efficiency of cross-shash transactions of the blockchain system is improved, the number of transaction transmissions is reduced, and the system performance is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118941385A_ABST
    Figure CN118941385A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a cross-fragment transaction method and device for a block chain system based on UTXO, and relates to the technical field of block chains. The method comprises the steps that a first node of a first fragment of a block chain system receives a transaction request and executes transaction conversion, and the transaction request is converted into multiple sub-transactions, namely, an input on-chip transaction, an inter-chip transaction and an output on-chip transaction; and the first node further initiates a proposal, carries out on-chip consensus on all or part of input on-chip transactions in the first fragment, and sends inter-chip transactions and outputs the on-chip transactions, so that the inter-chip transactions carry out on-chip consensus among the main nodes of the fragments, and the output on-chip transactions carry out on-chip consensus in the fragment where the transaction output is located. According to the embodiment of the invention, one cross-fragment transaction is converted into multiple transactions through transaction conversion, and meanwhile, the common address is set in each fragment, so that consensus is synchronously carried out in different fragments, and the consensus efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of blockchain technology, and in particular to a cross-shard transaction method, device, electronic device, and readable medium in a UTXO-based blockchain system. Background Art

[0002] In the current conventional blockchain architecture, the replica state machine model is generally used, that is, the transaction and status data stored in each node are consistent. The performance of this architecture has certain limitations, including that global consensus takes a long time, affecting transaction processing efficiency; each node stores data, increasing the demand for storage resources, etc.

[0003] The basic idea of ​​blockchain sharding is to divide the nodes in the blockchain network into several relatively independent shards. Different transactions are executed in the shards, and the number of nodes in the shards is small, which can improve the efficiency of consensus. In theory, the overall performance will be greatly improved. However, after sharding, it is difficult to limit a transaction to a single shard. Cross-shard transactions involving multiple shards introduce multiple cross-shard communications, which increases the communication cost; and each shard often needs to conduct consensus and transactions in sequence, which affects the efficiency of consensus and transactions. For example, in the UTXO model (Unspent Transaction Output), a transaction can include multiple transaction inputs and transaction outputs, which may involve multiple shards, so cross-shard communication is required. If the number of cross-shards involved in the transaction is too large, the cost of shard communication may offset the performance improvement brought by sharding; at the same time, transactions in different shards are carried out in sequence, and some shard consensus needs to rely on the execution results of other shards, which will not improve transaction efficiency. Therefore, sharding brings increased system complexity but does not bring better performance. In extreme cases, when most transactions involve multiple shards, sharding may even degrade system performance, thereby reducing transaction efficiency during the transaction process. Summary of the invention

[0004] The embodiments of the present disclosure provide a UTXO-based blockchain system cross-shard transaction method, device, electronic device and readable medium, which can improve the processing efficiency of cross-shard transactions in the blockchain system.

[0005] To achieve the above technical objectives, the embodiments of the present disclosure adopt the following technical solutions:

[0006] In a first aspect, an embodiment of the present disclosure provides a cross-shard transaction method of a blockchain system based on UTXO, wherein the blockchain system includes at least two shards, each shard includes a master node, the master node of each shard performs inter-shard consensus, and the nodes in each shard perform intra-shard consensus, and the method includes:

[0007] A first node of a first shard of a blockchain system receives a transaction request, wherein the transaction request includes a transaction input and a transaction output indexed to a UTXO, and the first shard is a shard in the blockchain system where all or part of the transaction input is located;

[0008] The first node performs transaction conversion, converting the transaction request into multiple sub-transactions, including: input intra-slice transactions, inter-slice transactions, and output intra-slice transactions, wherein the input intra-slice transaction is a transaction between the transaction input and the first public address of the slice where it is located, the output intra-slice transaction is a transaction between the transaction output and the second public address of the slice where it is located, and the inter-slice transaction is a transaction between the first public address and the second public address;

[0009] The first node initiates a proposal to conduct intra-shard consensus on all or part of the input intra-shard transactions in the first shard, and sends inter-shard transactions and output intra-shard transactions so that the inter-shard transactions can be consensused between the master nodes of each shard, and the output intra-shard transactions can be consensused in the shard where the transaction output is located.

[0010] In some possible implementations, the sender of the transaction request is a user of the first shard or a node of another shard.

[0011] In some possible implementations, before executing the transaction conversion, the method further includes:

[0012] The first node determines whether the first shard is the shard where all or part of the transaction input is located;

[0013] If not, the transaction request is forwarded to the shard where the transaction input is located or a transaction failure notification is sent to the sender of the transaction request.

[0014] In some possible implementations, when the first node determines that the first shard is the shard where all transaction inputs are located, the first node further determines whether the first shard is the shard where all transaction outputs are located;

[0015] If yes, an intra-shard consensus is performed on the first shard to complete the transaction; if no, the shard where the transaction output is located is determined and the transaction conversion is performed.

[0016] In some possible implementations, when the first node determines that the first shard is the shard where the partial transaction input is located, the first node further determines the shard where the transaction output is located and performs the transaction conversion.

[0017] In some possible implementations, when the first node determines that the first shard is the shard where the partial transaction input is located, the method further includes:

[0018] Determine the second shard where the remaining portion of the transaction input is located;

[0019] The input intra-shard transaction includes a second intra-shard transaction, wherein the second intra-shard transaction is a transaction between the transaction input included in the second shard and the public address of the second shard;

[0020] The first node sends the second intra-shard transaction so that the second intra-shard transaction can be consensus-based in the second shard.

[0021] In some possible implementations, the receipt or forwarding of transaction requests, the sending of notifications of transaction failures, the sending of inter-chip transactions, the sending of output intra-chip transactions, and the sending of second intra-chip transactions are implemented using one or more of private channels, inter-chip consensus, and inter-chip network channels.

[0022] In some possible implementations, if the output on-chip transaction completes the on-chip consensus, the transaction is successful.

[0023] In some possible implementations, if the output intra-chip transaction fails to reach an intra-chip consensus, and the input intra-chip transaction and / or inter-chip transaction completes the consensus, a backwash transaction is constructed for the input intra-chip transaction and / or inter-chip transaction that has completed the consensus.

[0024] In a second aspect, an embodiment of the present disclosure provides a cross-shard transaction device of a blockchain system based on UTXO, wherein the blockchain system includes at least two shards, each shard includes a master node, the master node of each shard performs inter-shard consensus, and the nodes in each shard perform intra-shard consensus, and the device is arranged at the first node of the first shard of the blockchain system, and includes:

[0025] A transceiver module is configured to receive a transaction request, wherein the transaction request includes a transaction input and a transaction output indexed to the UTXO, and the first shard is a shard in the blockchain system where all or part of the transaction input is located;

[0026] A transaction conversion module is configured to perform transaction conversion, converting a transaction request into multiple sub-transactions, including: an input intra-chip transaction, an inter-chip transaction, and an output intra-chip transaction, wherein an input intra-chip transaction is a transaction between a transaction input and a first public address of the shard where the transaction is located, an output intra-chip transaction is a transaction between a transaction output and a second public address of the shard where the transaction is located, and an inter-chip transaction is a transaction between a first public address and a second public address;

[0027] The transaction execution module is configured to initiate a proposal to conduct on-shard consensus on all or part of the input on-shard transactions in the first shard;

[0028] The transceiver module is further configured to send inter-shard transactions and output intra-shard transactions, so that the inter-shard transactions can be subject to inter-shard consensus among the master nodes of each shard, and the output intra-shard transactions can be subject to intra-shard consensus in the shard where the transaction output is located.

[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the cross-shard transaction method of the UTXO-based blockchain system as in the first aspect.

[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the cross-shard transaction method of a blockchain system based on UTXO as in the first aspect.

[0031] The technical solution of the first aspect provided by the embodiment of the present disclosure brings at least the following beneficial effects: the first node of the first shard of the blockchain system receives a transaction request and performs transaction conversion, converting the transaction request into multiple sub-transactions, including: input intra-shard transactions, inter-shard transactions, and output intra-shard transactions; for the multiple transactions after the transaction conversion, the first node initiates a proposal, performs intra-shard consensus on all or part of the input intra-shard transactions in the first shard, and sends inter-shard transactions and output intra-shard transactions, so that the inter-shard transactions are inter-shard consensus between the master nodes of each shard, and the output intra-shard transactions are performed in the shard where the transaction output is located. The embodiment of the present disclosure converts a cross-shard transaction into multiple transactions through transaction conversion, and transmits the multiple transactions at one time, so as to achieve synchronous consensus in different shards; at the same time, since public addresses are set in each shard, the transaction of one shard does not need to rely on the execution results of other shards, thereby improving the consensus efficiency, and does not need to be transmitted to other shards in sequence after consensus in one shard, reducing the number of transaction transmissions.

[0032] It should be noted that the technical effects brought about by any implementation method in the second to fourth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here.

[0033] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments of the present disclosure are briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, and are not intended to limit the present disclosure.

[0035] Figure 1 A schematic diagram of a blockchain sharding consensus system according to some embodiments of the present disclosure is shown;

[0036] Figure 2 A schematic diagram of the on-chip structure of a blockchain sharding consensus system according to some embodiments of the present disclosure is shown;

[0037] Figure 3 A schematic diagram of an inter-slice block structure according to some embodiments of the present disclosure is shown;

[0038] Figure 4 A schematic diagram of transaction conversion of cross-shard transactions in a blockchain system according to some embodiments of the present disclosure is shown;

[0039] Figure 5 A flow chart of a transaction method for cross-shard transactions in a blockchain system according to some embodiments of the present disclosure is shown;

[0040] Figure 6 A schematic diagram of transaction backwash of cross-shard transactions in a blockchain system according to some embodiments of the present disclosure is shown;

[0041] Figure 7 A schematic diagram showing the main steps of a cross-shard transaction method of a blockchain system according to some embodiments of the present disclosure is shown;

[0042] Figure 8 A schematic diagram showing the main steps of a blockchain system sharding consensus method according to at least one embodiment of the present disclosure is shown;

[0043] Fig. 9 A schematic diagram of main modules of a cross-shard transaction device according to at least one embodiment of the present disclosure is shown;

[0044] Fig.10 A schematic diagram of an electronic device according to at least one embodiment of the present disclosure is shown;

[0045] Fig.11 A schematic diagram of a readable storage medium according to at least one embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0047] Note that the examples to be introduced below are only specific examples, and are not intended to limit the embodiments of the present disclosure to the specific shapes, hardware, connection relationships, operations, values, conditions, data, sequences, etc. shown and described. Those skilled in the art can apply the concepts of the present disclosure to construct more embodiments not mentioned in the present description by reading the present description.

[0048] The terms used in the present disclosure are those common terms currently widely used in the art in consideration of the functions of the present disclosure, but these terms may vary according to the intention of a person of ordinary skill in the art, precedents, or new technologies in the art. In addition, specific terms may be selected by the applicant, and in this case, their detailed meanings will be described in the detailed description of the present disclosure. Therefore, the terms used in the specification should not be understood as simple names, but rather as an overall description based on the meaning of the terms and the present disclosure.

[0049] In order to better understand the embodiments of the present disclosure, relevant terms involved in the present disclosure are first defined and explained.

[0050] Blockchain: refers to a chain data structure that combines data blocks in a sequential manner in chronological order, and a distributed ledger that is cryptographically guaranteed to be tamper-proof and unforgeable. Its essence is a decentralized database. The blockchain referred to in the embodiments of the present disclosure includes public chains, consortium chains, private chains, permission chains, etc.

[0051] UTXO (Unspent Transaction Output): refers to unspent transaction output. In the UTXO model, transactions are not based on account balances, but are recorded and transferred through transaction outputs and inputs. UTXO is a data structure containing transaction data and corresponding execution code, and all UTXO entries constitute the "ledger".

[0052] VRF (Verifiable Random Function): is a cryptographic primitive that combines the characteristics of randomness and verifiability. VRF allows a user with a private key to generate a random number, and other users can use the corresponding public key to verify that the random number is indeed generated by the private key, and the specific value of the random number cannot be predicted.

[0053] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of the disclosed embodiment are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0054] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0055] The blockchain architecture generally adopts a replica state machine model, and the transaction and status data stored in each node are consistent. This architecture has low consensus efficiency, which affects transaction efficiency and increases the consumption of system resources. If the nodes in the blockchain network are sharded, the number of consensus nodes can be reduced in theory, the consensus efficiency can be improved, and the system performance can be improved. However, the actual transactions are very complex. Generally, UTXO transactions may involve multiple transaction inputs and multiple transaction outputs. Each transaction input and transaction output may belong to one shard or multiple shards. If it belongs to one shard, the shard can complete the transaction through intra-shard consensus, which will improve the transaction efficiency; if it belongs to multiple shards, it is often necessary to conduct consensus on the next shard based on the execution result of one shard, which will affect the transaction efficiency, and the transmission of each consensus result will also increase the cost of cross-shard communication, affecting the system performance.

[0056] Therefore, the embodiments of the present disclosure provide a UTXO-based blockchain system cross-shard transaction method, device, electronic device and readable medium, which can improve the processing efficiency of cross-shard transactions in the blockchain system.

[0057] Figure 1 A schematic diagram of a blockchain sharding consensus system 100 according to some embodiments of the present disclosure is shown. The system 100 supports transaction operations such as transfers, and does not involve shards with contract status, that is, UTXO-type digital currencies do not have contract status and only support operations such as transfers. It should be noted that, generally speaking, when it comes to contract status, transaction splitting cannot be performed. The sharding consensus system 100 (also known as the blockchain system) includes a sharding coordination module 110 and multiple shards (e.g. Figure 1In the example, there are shards A 120, B 130, C 140 and D 150), each of which includes 4 nodes. Nodes are the basic components of the blockchain system, which can run consensus algorithms and store information such as transactions and blocks. In the embodiments of the present disclosure, the nodes in each shard can perform intra-shard consensus within the shard, and the consensus algorithm used is not limited. The consensus algorithms of each shard can be the same or different; the block generation speed of each shard can also be the same or different. The embodiment of the present disclosure is only used as an example, and 4 shards and 4 nodes under each shard are schematically listed; the actual number of shards and the number of nodes in each shard are not limited, and the number of nodes in each shard can also be different. Each node can be connected through a private channel. It can be understood that the private channel connection can adopt various network communication protocols, such as TCP connection; for security reasons, IPSec dedicated lines can also be used.

[0058] The sharding consensus system 100 includes multiple users, and the users interact with the system by accessing any node of the sharding consensus system 100. Each user has his or her transaction address (or public key) to conduct transactions. For the UTXO model:

[0059] ----Input transaction input: it is the transaction output (Output) indexed to the previous transaction

[0060] ----Output transaction output: UTXO structure, including transaction address and amount.

[0061] The shard consensus system 100 includes both the shards of nodes and the shards of transaction addresses corresponding to different users when the shards are initialized. For example, the initial number of users in each shard can be determined first, that is, each shard has a fixed number of users as users (transaction addresses) in the initial stage, that is, transactions of users (transaction addresses) in the shard are intra-shard transactions. Users can send transaction requests to any node at the same time, and the node will detect the transaction request after receiving it. Taking a transaction with a single transaction input and a single transaction output as an example, if the node detects that the transaction input of the transaction request is not in the shard, it will be forwarded to the corresponding shard; if the transaction input and transaction output are both in the shard, it is a transaction in the shard; if the transaction input is in the shard, but the transaction output is not in the shard, it is a cross-shard transaction. Therefore, after sharding, a single shard can process transactions related to the transaction address of the shard, among which for cross-shard transactions, transaction conversion needs to be performed first.

[0062] During the transaction conversion process, it is necessary to set one or more public addresses in each shard (the public address referred to in this disclosure is the unified address of the shard, that is, each user in the shard uses the unified public address to complete the transaction. When there is only one public address, all transaction addresses that need to conduct cross-shard transactions in all shards are traded with the public address. When there are multiple public addresses, the transaction addresses of the shard can be grouped, and each group corresponds to a different public address; or transactions at different times can correspond to different public addresses, or other methods in the field that can achieve group correspondence can be used for grouping), and the public address is used as the intermediate address to complete the transaction, and is traded with the transaction input or transaction output. The public address setting of each shard is very flexible, which can be the address of the shard master node (leader) or any one or more public addresses specified in the shard. If the address of the shard master node is used as the public address, it is no longer necessary to specify it separately, and consensus is completed in the blockchain system, especially when the shard is adjusted, it can be changed together with the master node. Therefore, it is more convenient to use the address of the shard master node as the public address. If the public address is one or more public addresses determined within the shard, it can be maintained by the inter-shard ledger, thus achieving independent decoupling from the master node within the shard, and the setting of the public address will be more flexible.

[0063] As mentioned above, transactions can be divided into two types according to the differences in transaction inputs and transaction outputs during the transaction process:

[0064] ----Transactions in this shard, that is, transaction inputs and transaction outputs are all in this shard. At this time, users or nodes in other shards (if users send transaction requests to nodes in other shards, other shard nodes can forward them to nodes in this shard) send transaction requests to any node in this shard, and the transaction request can be agreed upon within this shard.

[0065] ----Cross-shard transactions, that is, transactions that include non-shard transaction addresses in the transaction input and / or transaction output. At this time, the transaction needs to be converted, that is, the transaction request is converted into multiple sub-transactions, including: input intra-shard transactions, inter-shard transactions, and output intra-shard transactions, where the input intra-shard transactions are transactions between each transaction input and the first public address of the shard where it is located, the output intra-shard transactions are transactions between each transaction output and the second public address of the shard where it is located, and the inter-shard transactions are transactions between the first public address and the second public address. It can be understood that a transaction can include multiple transaction inputs and multiple transaction outputs, and each transaction input and each transaction output can be in different shards. Therefore, the first public address involved in the present disclosure includes the public addresses of the shards where each transaction input is located, and the second public address also includes the public addresses of the shards where each transaction output is located, that is, the first and second are not used as restrictions on their quantity.

[0066] The shard coordination module 110 includes a VRF module 111, an inter-shard consensus algorithm 112, a shard management module 113, and a shard network routing 114. Figure 1 In the example of the blockchain system, there are four shards in total, and each shard contains four nodes. The shards in the blockchain system can be allocated by the VRF module 111 of the shard coordination module 110, and the number of nodes in each shard is not limited. The initialization function of the VRF module 111 may include:

[0067] ----Initialize node sharding. Use VRF module 111 to randomly shard transaction addresses and nodes in the blockchain system, and verify the results of random sharding. For public chains with a large number of nodes and no trust relationship between each other, it is necessary to randomly shard and verify its randomness; for permission chains, the number of nodes is small and each node is trustworthy to a certain extent, it is also possible not to use VRF module 111 for random sharding, and instead choose to pre-configure sharding.

[0068] ----Initialize the transaction address. Use the VRF module 111 to shard the transaction addresses corresponding to different users, that is, determine which shard the transaction addresses corresponding to different users belong to and in which shard intra-shard transactions can be performed.

[0069] ----Randomly select the master node. All nodes in the blockchain system support both the inter-chip consensus algorithm 112 and the intra-chip consensus algorithm 162 ( Figure 2 ), that is, the functions of all nodes are consistent. Therefore, all nodes may serve as the master node within a shard and the master node between shards. The VRF module 111 can be used to randomly select the master node in each shard as the master node for intra-shard consensus. The master node within each shard participates in the inter-shard consensus; when a transaction is written to the inter-shard consensus ledger composed of the master nodes, the other master nodes can receive it. The VRF module 111 can also be used to randomly select the master node for inter-shard consensus from the master nodes of each shard. The communication between the master nodes of the shards can adopt the inter-shard consensus method or the inter-shard network channel (such as P2P network, etc.).

[0070] ----Determine the public address. The VRF module 111 is used to determine one or more public addresses from the transaction addresses corresponding to each shard. The public address may be the address of the master node of each shard.

[0071] The generation and update of the master node of the inter-chip consensus is determined by the specific consensus algorithm. The present disclosure does not limit the specific consensus algorithms of the intra-chip consensus and the inter-chip consensus (for example, the BFT (Byzantine Fault Tolerance) consensus algorithm, the CFT (Crash Fault Tolerance) consensus algorithm, etc. can be used), nor does it limit the intra-chip consensus algorithm 162 and the inter-chip consensus algorithm 112 to be consistent. In the embodiment of the present disclosure, it is preferred that the inter-chip consensus adopts a rotating master node, while the intra-chip consensus uses a fixed master node, because the intra-chip consensus requires the master node to synchronize transactions to the inter-chip in real time. If its master node is not fixed, a faster synchronization frequency is required, so a fixed master node can reduce the synchronization frequency requirement. However, it can be understood that if the synchronization frequency is high, the master node of the intra-chip consensus can also be adjusted or changed.

[0072] After the VRF module 111 completes the initialization function, it generally does not make overall changes to the shards, nor does it provide an operation for a node to directly switch from one shard to another and perform data migration at the same time. The adjustment of node shards is achieved through the addition and exit of nodes, that is, it supports the addition and exit of nodes and indirectly completes the switching between shards. For example, if a node exits the shard and joins a new shard, for the two shards, it is just the exit and addition of a node, and there will be no association between the two shards.

[0073] Therefore, when a new transaction address is added to the blockchain system, the shard coordination module 110 can assign the new transaction address to an existing shard; when a new node is added to the blockchain system, the shard coordination module 110 assigns the new node to an existing shard. After the new node determines its shard ownership, it synchronizes the intra-shard blocks of the shard to perform subsequent intra-shard consensus.

[0074] The shard management module 113 is used to manage the sharding of the blockchain sharding consensus system 100, for example, including the nodes included in each shard, the transaction address, and the current master node of each shard. When the sharding situation changes, it will update the changes in time and synchronize with other shards. For example, when the master node of a shard is adjusted, the latest sharding information of the shard is updated in time and synchronized to the sharding network routing 114. The sharding management module 113 can also include the management of public addresses, supporting operations such as registration and update of each shard. If the account book supports smart contracts, it can also be managed using smart contracts on the inter-shard account book that have been consensused between shards. The sharding network routing 114 communicates between the master nodes of each shard to complete the inter-shard consensus.

[0075] Figure 2Taking shard A 120 as an example, a schematic diagram of the intra-chip structure of the blockchain shard consensus system according to some embodiments of the present disclosure is shown. The shard exemplarily includes 4 nodes, namely node A-1 121, node A-1 122, node A-1 123 and node A-1 124. Each node is a replica state machine model, that is, the node function and storage data are the same. Each node includes a transaction pool model and a storage module, wherein the transaction pool model includes two parts, which are responsible for intra-chip transaction processing 121-1 and inter-chip transaction conversion 121-2 respectively; the storage module also includes two parts, namely intra-chip data storage 121-3 and inter-chip data storage 121-4.

[0076] In addition to the transaction pool model and storage module, the node further abstracts the intra-chip coordination module A 125 (i.e., each node includes the intra-chip coordination module A 125), including an inter-chip coordination module 161 for synchronizing relevant inter-chip information with the shard network routing 114, an intra-chip consensus algorithm 162, a shard master node information module 163 that supports the storage and update of the latest master node information, and a transaction monitoring module 164 responsible for monitoring transaction requests within the shard.

[0077] Figure 3 A schematic diagram of an inter-shard block structure 300 according to some embodiments of the present disclosure is shown. The intra-shard block formed after the intra-shard consensus is a conventional block structure of the blockchain system, which will not be described in detail here. The inter-shard block structure 300 includes a block header 310 and a block body 320. The block body further includes a cross-shard transaction list 321 and a latest block hash list 322 in the shard. For sharding technology, it improves throughput by dividing the network into multiple smaller shards. Since the number of nodes in each shard is small, an attacker may control a shard at a lower cost, and the security will also be damaged to a certain extent. That is to say, due to sharding, the number of nodes in each shard is small, and the security is not very high. For example, a shard has only 4 nodes, and breaking through more than 3 nodes can completely occupy the shard. After breaking through, the shard transaction record can be forged from scratch. Therefore, the results of the blocks in the shard need to be confirmed between the shards and other shards, which can improve the security of the transaction. If all records of intra-shard blocks are saved between shards, the storage space requirement is high. Therefore, this can be achieved by saving the hash values ​​of the intra-shard blocks of each shard to form the latest block hash list 322 in the shard. The list provides a unified proof of each shard between shards, and provides data support for the data verification within the shard that may be required. Therefore, the hash values ​​of the intra-shard blocks of each shard can be inter-shard consensus between the master nodes of each shard, and the hash value that completes the inter-shard consensus will be written into the inter-shard block if the inter-shard consensus is successful.

[0078] In addition, it is understandable that for the inter-shard blocks formed after the inter-shard consensus, since the block generation speed of each shard and the block generation speed of the inter-shard blocks may be different during the shard consensus process of the blockchain system, the number of hash values ​​of each shard included in the latest block hash list 322 in the shard may be different.

[0079] Figure 4 A transaction conversion diagram of cross-shard transactions in a blockchain system according to some embodiments of the present disclosure is shown. A node in shard A receives a transaction request, which is a transaction request for transferring the transaction addresses of two users U1 and U2 in shard A to the transaction addresses of two users U3 and U4 in shard B. Since the transaction input and transaction output of the transaction request belong to different shards, the transaction request is a cross-shard transaction A-1. Cross-shard transactions need to be converted through transactions, with different shards conducting intra-shard consensus, and the master nodes of each shard conducting inter-shard consensus. For the cross-shard transaction A-1, it forms two intra-shard transactions a-1 (i.e., input intra-shard transaction), b-1 (i.e., output intra-shard transaction) and one inter-shard transaction A-2, where the input intra-shard transaction a-1 is a transaction in which the transaction address (transaction input) of users U1 and U2 is transferred to the first public address of shard A (for example, it can be the transaction address of the master node N1 of shard A), and the inter-shard transaction A-2 is a transaction in which the first public address of shard A is transferred to the second public address of shard B (for example, it can be the transaction address of the master node N2 of shard B), and the b-1 transaction is a transaction in which the second public address of shard B is transferred to the transaction address (transaction output) of users U3 and U4.

[0080] After completing the above transaction conversion, the inter-shard transaction A-2 completes the consistency between the shards through the inter-shard consensus, and the two intra-shard transactions a-1 and b-1 can be respectively carried out through the intra-shard consensus to complete the consistency within the shard. It should be noted that the intra-shard transaction b-1 after the transaction conversion can be sent to Shard B through the inter-shard consensus or inter-shard network channel, or it can be sent from the node in Shard A to the node in Shard B through the private channel between the nodes. Inter-shard transaction A-2 can be sent to the master node N1 of Shard A through a private channel. When sent through a private channel or an inter-shard network channel, the three converted transactions can be consensused in parallel, which greatly improves the efficiency of consensus.

[0081] To ensure the atomicity of cross-shard transactions, if the intra-shard transaction b-1 completes the intra-shard consensus, the transaction is successful.

[0082] From this, it can be seen that the intra-shard consensus includes two situations: one is that the transaction input and transaction output of the transaction request are all from this shard (both are the transaction addresses of this shard), then the intra-shard consensus can be directly performed to complete the transaction; the other is that the transaction input or transaction output of the transaction request is not in this shard, so the transaction conversion is performed. In the converted transaction, the receiving or sending party is the public address of this shard, and the other party is the transaction address of this shard. Therefore, the nodes of each shard can use the intra-shard consensus algorithm of this shard to perform intra-shard consensus among the nodes of this shard for the transaction request received that only includes the transaction address and public address corresponding to this shard, and write the transaction request that completes the intra-shard consensus into the intra-shard block if the intra-shard consensus is successful.

[0083] Inter-shard consensus only includes one situation, namely, the converted inter-shard transaction. The transaction request of this inter-shard transaction includes the public addresses corresponding to two or more shards. The inter-shard consensus algorithm is used between the master nodes of each shard to conduct inter-shard consensus. If the inter-shard consensus is successful, the transaction request that completes the inter-shard consensus will be written into the inter-shard block.

[0084] Figure 5 A flow chart of a transaction method 500 for cross-shard transactions in a blockchain system according to some embodiments of the present disclosure is shown. Before performing the transaction method 500, the system is first initialized, that is, sharding is performed using the VRF module 111 (other methods may also be used for sharding, such as pre-configuring the sharding situation in the case of a permission chain), and the nodes of each shard are determined; the sharding information and the master node information in each shard are synchronized; the initial number of users, that is, the initial determination of the number of users in the shard and the transaction address corresponding to the user; if the public address is not the address corresponding to the master node, the public address of each shard needs to be further determined. After completing the initialization, users can conduct transactions through this blockchain system. The specific transaction steps are as follows:

[0085] Step S501, taking the first node (e.g., node A-1121) of the first shard of the blockchain system (e.g., shard A 120) as an example, receives a transaction request, which includes a transaction input and a transaction output indexed to UTXO (hereinafter referred to as "UTXO transaction input" and "UTXO transaction output"). The sender of the transaction request can be a user or a node of another shard. If the transaction request comes from a node of another shard, it is generally because the node of another shard has received a transaction request, and after judgment, the transaction input of the transaction request does not belong to the user of its own shard. Therefore, it is sent to the first node of the first shard through a private channel or inter-shard consensus or inter-shard network channel. It is understandable that if the nodes of other shards know which shard the transaction input of the UTXO belongs to, they can directly transfer to the corresponding shard through the private channel; if due to network delays and other reasons, the nodes of other shards do not know which shard the transaction input of the UTXO belongs to, they can be synchronized to each shard through inter-shard consensus or inter-shard network channels, and each shard checks whether the transaction input of the UTXO is included, and the shard where the transaction input of the UTXO is located executes subsequent transactions. In this embodiment, the first node of the first shard executes the subsequent steps.

[0086] Step S502, the first node determines whether the first shard is the shard where all or part of the UTXO transaction input is located. Generally speaking, if the transaction request comes from the nodes of other shards, since the nodes of other shards have already made a judgment, the first shard is generally the shard where all or part of the UTXO transaction input is located. It is understandable that due to network communication reasons, the nodes of other shards may also have sending errors. Therefore, the first node can also first determine whether the first shard is the shard where the transaction input is located for the transaction request sent by the nodes of other shards, and when the judgment is no, it can be forwarded to the shard where the transaction input is located or send a notification of transaction failure to the node sending the transaction request. If the transaction request comes from the user, it is generally necessary to make a judgment first. When it is determined that the first shard is not the shard where the UTXO transaction input is located, the first node forwards the transaction request to the shard where the transaction input is located or sends a notification of transaction failure to the user who sent the transaction request.

[0087] If the first node determines that the first shard is only the shard where the transaction input of some UTXOs is located, it means that the transaction is a cross-shard transaction, and then jump to step S504. If the first node determines that the first shard is the shard where the transaction input of all UTXOs is located, it is necessary to further judge the transaction and execute step S503.

[0088] In step S503, the first node continues to determine whether the first shard is the shard where the transaction output is located. If so, it indicates that the transaction input and transaction output involved in the transaction request all belong to the first shard, and the transaction is an intra-shard transaction of the first shard. Intra-shard consensus can be performed in the first shard (step S504') to complete the transaction; if not, continue to execute step S504.

[0089] Step S504, the first node performs transaction conversion. Before performing transaction conversion, first determine the shards where each transaction input and each transaction output are located. That is to say, before performing intra-shard consensus and inter-shard consensus, the nodes of each shard perform transaction conversion for the transaction requests received that include transaction addresses corresponding to two or more shards. For example, the shards where the transaction input of a transaction is located include shard A 120 (the public address of the shard is public address A) and shard B 130 (the public address of the shard is public address B), where shard A 120 is the first shard and shard B 130 is the second shard, and the shards where the transaction output is located include shard C 140 (the public address of the shard is public address C) and shard D 150 (the public address of the shard is public address D), where shard C 140 is the third shard and shard D 150 is the fourth shard. It should be noted that in the embodiment of the present disclosure, the second shard, the third shard and the fourth shard may include one or more shards, and each of them is provided with a public address. The multiple sub-transactions converted by the transaction request include: an input intra-shard transaction (step S505), an inter-shard transaction (step S506) and an output intra-shard transaction (step S507), the input intra-shard transaction is a transaction between the transaction input and the first public address of the shard where it is located (i.e., the transaction input in shard A 120 is transferred to the first intra-shard transaction of public address A and the transaction input in shard B 130 is transferred to the second intra-shard transaction of public address B), the output intra-shard transaction is a transaction between the transaction output and the second public address of the shard where it is located (i.e., the third intra-shard transaction of public address C transferred to the transaction output in shard C 140 and the fourth intra-shard transaction of public address D transferred to the transaction output in shard D 150), and the inter-shard transaction is a transaction between the first public address and the second public address (i.e., the transaction is transferred from public address A and public address B to public address C and public address D). It is understandable that before performing transaction conversion, node A can determine the shards where other transaction inputs are located (i.e., shard B 130 in this embodiment) and the shards where transaction outputs are located (i.e., shard C 140 and shard D 150 in this embodiment) based on the information managed by the shard management module 113 and synchronized to each shard, and can determine the public address of each shard to perform transaction conversion.

[0090] That is to say, Figure 5There are some differences between the process of jumping from step S502 to step S504 and the process of continuing to execute step S504 through step S503. Among them, when jumping to step S504 through step S502, shard A 120 is the shard where part of the transaction input is located, and when the transaction is converted, it is necessary to determine the second shard (i.e., shard B 130 of this embodiment) where the remaining part of the transaction input is located; the input intra-shard transaction therefore also includes the second intra-shard transaction, wherein the second intra-shard transaction is the transaction between the transaction input included in shard B130 and the public address B; the first node sends the second intra-shard transaction, so that the second intra-shard transaction is carried out in the second shard. While the process of continuing to execute step S504 through step S503, the first shard is the shard where all the transaction inputs are located, and at this time, it is only necessary to determine all the shards where the transaction outputs are located.

[0091] The converted output intra-chip transaction is sent to the target shard through a private channel, inter-chip consensus or inter-chip network channel. It can be understood that when sending by inter-chip consensus, each master node will store relevant information, thus forming a certain amount of redundant storage.

[0092] Based on transaction conversion, it can be understood that in cross-shard transactions, after the first node initiates a proposal, all or part of the input intra-shard transactions are subject to intra-shard consensus in the first shard, and inter-shard transactions and output intra-shard transactions are sent, so that the inter-shard transactions are subject to inter-shard consensus between the master nodes of each shard, and the output intra-shard transactions are subject to intra-shard consensus in the shard where the transaction output is located. In addition, it should be noted that in one or more embodiments of the present disclosure, the reception or forwarding of transaction requests, the sending of notifications of transaction failures, the sending of inter-shard transactions, the sending of output intra-shard transactions, and the sending of second intra-shard transactions can all be implemented through one or more of private channels, inter-shard consensus, and inter-shard network channels.

[0093] Step S508, if the transaction is successful, the transaction is completed; if the transaction fails, a backwash transaction is constructed (step S509'). Preferably, in order to ensure the atomicity of the transaction, if the output intra-chip transaction completes the intra-chip consensus, the final transaction result of the transaction request in the original shard (i.e., shard A 120 in this embodiment) is determined to be successful; if the output intra-chip transaction fails to reach the intra-chip consensus, and the input intra-chip transaction and / or inter-chip transaction complete the consensus, a backwash transaction is constructed for the input intra-chip transaction and / or inter-chip transaction that has completed the consensus, so as to roll back the state update caused by the transaction.

[0094] Figure 6A schematic diagram of transaction backwash for cross-shard transactions in a blockchain system according to some embodiments of the present disclosure is shown. For cross-shard transaction A-1, after transaction conversion, three transactions are formed, including intra-shard transaction a-1, intra-shard transaction b-1, and inter-shard transaction A-2. At this time, if the intra-shard transaction b-1 succeeds, the cross-shard transaction A-1 succeeds; if the transaction result of the intra-shard transaction b-1 fails, and the intra-shard transaction a-1 and the inter-shard transaction A-2 have completed consensus, it is necessary to construct corresponding backwash transactions, namely, intra-shard backwash transaction a-2 and inter-shard backwash transaction B-1, so that the state update caused by the previous transaction is rolled back to the original state. Among them, the intra-shard backwash transaction a-2 is the transaction address of the first public address of shard A (for example, it can be the transaction address of the master node N1 of shard A) transferred to the transaction address of users U1 and U2; the inter-shard backwash transaction B-1 is the transaction of the second public address of shard B (for example, it can be the transaction address of the master node N2 of shard B) transferred to the first public address of shard A. It is understandable that for transactions that do not reach consensus, there is no need to construct a backlash transaction.

[0095] Figure 7 A schematic diagram of the main steps of a cross-shard transaction method 700 of a blockchain system according to some embodiments of the present disclosure is shown. The blockchain system includes at least two shards, each shard includes a master node, the master node of each shard performs inter-shard consensus, and the nodes in each shard perform intra-shard consensus. The cross-shard transaction method 700 of the blockchain system includes:

[0096] Step S701, a first node of a first shard of a blockchain system receives a transaction request, wherein the transaction request includes a transaction input and a transaction output indexed to UTXO, and the first shard is a shard in the blockchain system where all or part of the transaction input is located;

[0097] Step S702: The first node performs transaction conversion to convert the transaction request into multiple sub-transactions, including: input intra-chip transactions, inter-chip transactions, and output intra-chip transactions. The input intra-chip transaction is a transaction between the transaction input and the first public address of the shard where it is located, the output intra-chip transaction is a transaction between the transaction output and the second public address of the shard where it is located, and the inter-chip transaction is a transaction between the first public address and the second public address.

[0098] Step S703: The first node initiates a proposal to perform intra-shard consensus on all or part of the input intra-shard transactions in the first shard, and sends inter-shard transactions and output intra-shard transactions, so that the inter-shard transactions can be performed on the master nodes of each shard, and the output intra-shard transactions can be performed on the shard where the transaction output is located.

[0099] Figure 8A schematic diagram of the main steps of a blockchain system sharding consensus method 800 according to at least one embodiment of the present disclosure is shown. The blockchain system includes a sharding coordination module 110 and multiple blockchain nodes, and the blockchain system sharding consensus method 800 includes:

[0100] The shard coordination module 110 performs sharding operations on the blockchain system, including determining the transaction address, blockchain node and public address corresponding to each shard, and determining the master node from the blockchain nodes included in each shard;

[0101] The nodes of each shard use the in-shard consensus algorithm of the shard to reach an in-shard consensus for the received transaction requests that only include the transaction address and public address corresponding to the shard. If the in-shard consensus is successful, the transaction request that has completed the in-shard consensus will be written into the in-shard block.

[0102] The master node of each shard uses the inter-shard consensus algorithm to conduct inter-shard consensus among the master nodes of each shard for the transaction requests received that include the public addresses corresponding to two or more shards, and writes the transaction requests that have completed the inter-shard consensus into the inter-shard block if the inter-shard consensus is successful.

[0103] It should be noted that in addition to performing inter-shard consensus, the master node of each shard also participates in the intra-shard consensus process as a node for intra-shard consensus.

[0104] Fig. 9 A schematic diagram of the main modules of a cross-shard transaction device 900 of a blockchain system according to at least one embodiment of the present disclosure is shown. The blockchain system includes at least two shards, each shard includes a master node, the master node of each shard performs inter-shard consensus, and the nodes in each shard perform intra-shard consensus. The cross-shard transaction device 900 is set at the first node of the first shard of the blockchain system, and includes:

[0105] The transceiver module 910 is configured to receive a transaction request, wherein the transaction request includes a transaction input and a transaction output indexed to the UTXO, and the first shard is a shard in the blockchain system where all or part of the transaction input is located;

[0106] The transaction conversion module 920 is configured to perform transaction conversion, converting the transaction request into multiple sub-transactions, including: an input intra-chip transaction, an inter-chip transaction, and an output intra-chip transaction, wherein the input intra-chip transaction is a transaction between the transaction input and the first public address of the shard where the transaction is located, the output intra-chip transaction is a transaction between the transaction output and the second public address of the shard where the transaction is located, and the inter-chip transaction is a transaction between the first public address and the second public address;

[0107] The transaction execution module 930 is configured to initiate a proposal to perform an intra-shard consensus on all or part of the input intra-shard transactions in the first shard;

[0108] The transceiver module 910 is further configured to send inter-shard transactions and output intra-shard transactions, so that the inter-shard transactions are subject to inter-shard consensus among the master nodes of each shard, and the output intra-shard transactions are subject to intra-shard consensus in the shard where the transaction output is located.

[0109] It should be noted that the above application scenarios are only exemplary, so as to facilitate the description of one or more aspects of the present disclosure in a specific scenario, but these aspects are not necessary, and various modifications can be made to the application scenarios. It is easy to understand that the specific application scenarios of the present disclosure are not limited.

[0110] At least some embodiments of the present disclosure also provide an electronic device. Fig.10 A schematic diagram of an electronic device 1000 according to at least one embodiment of the present disclosure is shown.

[0111] like Fig.10 As shown, the electronic device 1000 includes one or more processors 1010 and a memory 1020. The memory 1020 includes one or more computer program modules 1021. One or more computer program modules 1021 are stored in the memory 1020 and are configured to be executed by the processor 1010. The one or more computer program modules 1021 include instructions for executing the blockchain system cross-shard transaction method 700 and its additional aspects according to at least one embodiment of the present disclosure. When it is executed by the processor 1010, one or more steps of the blockchain system cross-shard transaction method 700 and its additional aspects according to at least one embodiment of the present disclosure can be executed. The memory 1020 and the processor 1010 can be interconnected through a bus system and / or other forms of connection mechanisms (not shown). For example, the bus can be a peripheral component interconnect standard (PCI) bus or an extended industrial standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0112] Exemplarily, the processor 1010 may be a central processing unit (CPU), a digital signal processor (DSP), or other forms of processing units having data processing capabilities and / or program execution capabilities, such as a field programmable gate array (FPGA), etc. The processor 1010 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 1000 to perform desired functions.

[0113] Exemplarily, the memory 1020 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules 1021 may be stored on the computer-readable storage medium, and the processor 1010 may run one or more computer program modules 1021 to implement various functions of the electronic device 1000. The computer program module includes a plurality of computer-executable instructions. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.

[0114] For example, the electronic device 1000 may also include input devices such as a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices such as a liquid crystal display, a speaker, a vibrator, etc.; storage devices such as a magnetic tape, a hard disk (HDD or SDD), etc.; and communication devices such as a network interface card such as a LAN card, a modem, etc. may also be included. The communication device may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data, and perform communication processing via a network such as the Internet. The drive is connected to the I / O interface as needed. Removable storage media, such as a disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage device as needed.

[0115] For example, the electronic device 1000 may further include a peripheral interface (not shown in the figure), etc. The peripheral interface may be various types of interfaces, such as a USB interface, a lightning interface, etc. The communication device may communicate with a network and other devices through wireless communication, such as the Internet, an intranet and / or a wireless network such as a cellular phone network, a wireless local area network (LAN), and / or a metropolitan area network (MAN). Wireless communication may use any of a variety of communication standards, protocols, and technologies, including but not limited to a global system for mobile communications (GSM), an enhanced data GSM environment (EDGE), a wideband code division multiple access (W-CDMA), a code division multiple access (CDMA), a time division multiple access (TDMA), Bluetooth, Wi-Fi (e.g., based on IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n standards), a voice transmission over Internet protocol (VoIP), Wi-MAX, protocols for email, instant messaging, and / or short message service (SMS), or any other suitable communication protocol.

[0116] The electronic device 1000 may be, for example, a system on a chip (SOC) or a device including the SOC, for example, a mobile phone, a tablet computer, a laptop computer, an e-book, a game console, a television, a digital photo frame, a navigator, a home appliance, a communication base station, an industrial controller, a server, or any other device, or a combination of any data processing device and hardware, which is not limited by the embodiments of the present disclosure. The specific functions and technical effects of the electronic device 1000 may refer to the description of the cross-shard transaction method 700 of the blockchain system and its additional aspects according to at least one embodiment of the present disclosure, and will not be repeated here.

[0117] Fig.11 A schematic diagram of a readable storage medium 1100 according to at least one embodiment of the present disclosure is shown.

[0118] like Fig.11 As shown, a computer program 1110 is stored on the readable storage medium 1100, that is, a computer-readable storage medium. When the computer program 1110 is executed by a processor, one or more steps of the cross-shard transaction method 700 of the blockchain system and its additional aspects as described above are performed.

[0119] Exemplarily, when the program code is read by a computer, the computer may execute the program code stored in the computer storage medium to implement, for example, one or more steps of the blockchain system cross-shard transaction method 700 and additional aspects thereof according to at least one embodiment of the present disclosure.

[0120] Exemplarily, the readable storage medium may include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), flash memory, and other readable storage media or any combination thereof. The readable storage medium 1100 may be a non-transitory readable storage medium.

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

[0122] It should be noted that, in the present disclosure, relational terms such as first, second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprises", or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements includes not only those elements, but also further includes other elements not explicitly listed, or further includes elements inherent to such process, method, article, or device. In the absence of further restrictions, the elements defined by the statement "includes..." do not exclude the presence of other identical elements in the process, method, article, or device including the elements.

[0123] The flowchart and block diagram in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved; that is, the previous or following operations are not necessarily executed accurately in order. On the contrary, various steps can be processed in reverse order or simultaneously as needed. At the same time, other operations can also be added to these processes, or a certain step or several steps can be removed from these processes.

[0124] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0125] There are a few points to note about this disclosure:

[0126] (1) The drawings of the embodiments of the present disclosure only relate to the structures related to the embodiments of the present disclosure, and other structures may refer to the general design.

[0127] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to obtain new embodiments.

[0128] The above description is merely an exemplary embodiment of the present disclosure and is not intended to limit the protection scope of the present disclosure. The protection scope of the present disclosure is determined by the appended claims.

Claims

1. A cross-shard transaction method for a blockchain system based on UTXO, characterized in that: The blockchain system includes at least two shards, each shard includes a master node, the master node of each shard performs inter-shard consensus, and the nodes in each shard perform intra-shard consensus, and the method includes: A first node of a first shard of the blockchain system receives a transaction request, wherein the transaction request includes a transaction input and a transaction output indexed to the UTXO, and the first shard is a shard in the blockchain system where all or part of the transaction input is located; The first node performs transaction conversion to convert the transaction request into multiple sub-transactions, including: an input intra-chip transaction, an inter-chip transaction, and an output intra-chip transaction, wherein the input intra-chip transaction is a transaction between the transaction input and the first public address of the shard where the transaction is located, the output intra-chip transaction is a transaction between the transaction output and the second public address of the shard where the transaction is located, and the inter-chip transaction is a transaction between the first public address and the second public address; The first node initiates a proposal to perform intra-shard consensus on all or part of the input intra-shard transactions in the first shard, and sends the inter-shard transactions and the output intra-shard transactions, so that the inter-shard transactions perform inter-shard consensus between the master nodes of each shard, and the output intra-shard transactions perform intra-shard consensus in the shard where the transaction output is located.

2. The method according to claim 1, characterized in that The sender of the transaction request is a user of the first shard or a node of another shard.

3. The method according to claim 2, characterized in that Before executing the transaction conversion, the method further includes: The first node determines whether the first shard is the shard where all or part of the transaction input is located; If not, the transaction request is forwarded to the shard where the transaction input is located or a transaction failure notification is sent to the sender of the transaction request.

4. The method according to claim 3, characterized in that The method further comprises: When the first node determines that the first shard is the shard where all the transaction inputs are located, the first node further determines whether the first shard is the shard where all the transaction outputs are located; If yes, an intra-shard consensus is performed on the first shard to complete the transaction; if no, the shard where the transaction output is located is determined, and the transaction conversion is performed.

5. The method according to claim 3, characterized in that: The method further comprises: When the first node determines that the first shard is the shard where part of the transaction input is located, the first node further determines the shard where the transaction output is located and performs transaction conversion.

6. The method according to claim 5, characterized in that When the first node determines that the first shard is the shard where part of the transaction input is located, the method further includes: Determine the second shard where the remaining portion of the transaction input is located; The input intra-shard transaction includes a second intra-shard transaction, wherein the second intra-shard transaction is a transaction between the transaction input included in the second shard and a public address of the second shard; The first node sends the second in-chip transaction so that the second in-chip transaction is subject to in-chip consensus in the second shard.

7. The method according to any one of claims 1 to 6, characterized in that: The receiving or forwarding of the transaction request, the sending of the notification of transaction failure, the sending of the inter-chip transaction, the sending of the output intra-chip transaction and the sending of the second intra-chip transaction are implemented by using one or more of a private channel, the inter-chip consensus and an inter-chip network channel.

8. The method according to claim 1, characterized in that If the output intra-chip transaction completes the intra-chip consensus, the transaction is successful.

9. The method according to claim 1, characterized in that: If the output intra-chip transaction fails to reach an intra-chip consensus, and the input intra-chip transaction and / or the inter-chip transaction reach a consensus, a backwash transaction is constructed for the input intra-chip transaction and / or the inter-chip transaction that have reached a consensus.

10. A cross-shard transaction device for a blockchain system based on UTXO, characterized in that: The blockchain system includes at least two shards, each shard includes a master node, the master node of each shard performs inter-shard consensus, and the nodes in each shard perform intra-shard consensus, and the device is arranged at the first node of the first shard of the blockchain system, and includes: A transceiver module is configured to receive a transaction request, wherein the transaction request includes a transaction input and a transaction output indexed to the UTXO, and the first shard is a shard in the blockchain system where all or part of the transaction input is located; A transaction conversion module, configured to perform transaction conversion, converting the transaction request into multiple sub-transactions, including: an input intra-chip transaction, an inter-chip transaction, and an output intra-chip transaction, wherein the input intra-chip transaction is a transaction between the transaction input and the first public address of the shard where the transaction is located, the output intra-chip transaction is a transaction between the transaction output and the second public address of the shard where the transaction is located, and the inter-chip transaction is a transaction between the first public address and the second public address; A transaction execution module, configured to initiate a proposal to perform an intra-shard consensus on all or part of the input intra-shard transactions in the first shard; The transceiver module is further configured to send the inter-shard transaction and the output intra-shard transaction, so that the inter-shard transaction is subject to inter-shard consensus among the master nodes of each shard, and the output intra-shard transaction is subject to intra-shard consensus in the shard where the transaction output is located.

11. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Hybrid consensus method based on fragmentation technology

    CN110570202A

  • Block chain transaction method, device and system based on man-in-the-middle account excitation

    CN115797070A

  • Block chain protocol verification platform supporting multiple consensus protocols and cross-fragmentation mechanism

    CN116582244A

  • Fragmented block chain transaction synchronization consensus method based on committee

    CN116599970A

  • Expandable block chain network model based on fragmentation

    CN116668313A