Method and device for implementing a utxo-account hybrid blockchain system based on a dag graph
By introducing a UTXO-Account hybrid blockchain system into the DAG graph, expanding the account chain storage of UTXOs and introducing new contract forms, the problem of low transaction execution efficiency in the DAG graph is solved. Asynchronous concurrent execution of UTXO transactions and efficient sorting of contract transactions are achieved, improving the system's throughput and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANHUI ZHONGKE LATTICE TECH CO LTD
- Filing Date
- 2023-04-06
- Publication Date
- 2026-04-24
Smart Images

Figure CN116226288B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and specifically to a method and device for implementing a UTXO-Account hybrid blockchain system based on a DAG graph. Background Technology
[0002] Blockchain is a distributed ledger built on a peer-to-peer (P2P) network. Nodes in the network do not trust each other, and the integrity and trustworthiness of the ledger are maintained through the blockchain structure and consensus mechanism. Blockchain systems designed in this way are characterized by decentralization, immutability, and data traceability.
[0003] Transaction throughput in blockchain has always been one of the most pressing issues. Account-based blockchains (such as Ethereum) require transactions to be executed sequentially, resulting in low throughput. While UTXO-based blockchain systems can execute transactions in parallel, achieving high throughput, their functionality is limited by scripting languages and their stateless nature.
[0004] To address the low throughput issue of account-based blockchains, some research has improved the blockchain structure from a single chain to a directed acyclic graph (DAG). This avoids the limitation of serial transaction verification inherent in single-chain blockchains, enabling the blockchain to possess high concurrency characteristics to some extent, thereby improving throughput. However, the transaction order in a DAG blockchain is difficult to confirm, making contract transactions challenging. Patent application CN202111086285.1 only allows asynchronous concurrent execution of transfer transactions within the DAG, while contract transactions require serial execution on the chained blockchain. Lattice Chain, patent application CN202111086285.1, proposes a graph-chain fusion structure. This involves adding a chained blockchain to the DAG graph, performing transfer transactions in the graph to ensure asynchronous concurrent execution, and performing contract transactions on the chained blockchain to ensure contract state consistency. However, Lattice Chain also only supports transfer transactions within the DAG; other types of transactions (such as user-defined token transactions) are still executed serially on the chained blockchain.
[0005] Specialized Glossary:
[0006] The UTXO ledger model, where UTXO stands for Unspent Transaction Output, is used in blockchain systems like Bitcoin. These systems maintain a UTXO-SET that stores all UTXOs in the system. Blockchain transactions take existing UTXOs in the UTXO-SET as input and the expected UTXOs as output. Once the transaction is verified, the input UTXOs are deleted, and the output UTXOs are added back to the UTXO-SET.
[0007] The UTXO model uses a scripting language to construct smart contracts with a lock-key structure. Specifically, the locking script is stored in the UTXO, which can be viewed as a lock. Transactions requiring the use of a UTXO must include the corresponding unlocking data in the transaction. A transaction is considered valid only after it has been verified that it can unlock all input UTXOs. Theoretically, UTXO transactions can realize various types of transactions such as custom token transfers, voting, and crowdfunding. Summary of the Invention
[0008] The present invention proposes a method for implementing a UTXO-Account hybrid blockchain system based on DAG graphs, which can solve the problem that single-function transactions under DAG structure can only be executed or verified asynchronously in parallel.
[0009] To achieve the above objectives, the present invention adopts the following technical solution:
[0010] A method for implementing a UTXO-Account hybrid blockchain system based on DAG graphs includes the following steps:
[0011] S1: Extend the account chain by adding storage for the UTXO-SET, which stores the UTXOs owned by the account chain;
[0012] S2: Expand the transaction types in the account chain, delete send-receive transactions and replace them with UTXO transactions, and operate on the UTXOs maintained by the account chain;
[0013] S3: To address the issue of data incompatibility between UTXO transactions and account-based contract transactions, a new form of contract is proposed to enable data interaction between the two accounting models, UTXO and account.
[0014] Furthermore, in the account chain, each transaction is a block, so a transaction is called a transaction block (TB). Based on the different functions of transaction blocks (TBs), TBs are divided as follows:
[0015] A: Transactions used to execute UTXOs, denoted as TB. UTXO The explanation of each field in the transaction is shown in Table 1:
[0016] Table 1: TB UTXO Explanation of each field
[0017]
[0018]
[0019] B: Transactions used to execute contracts, including deploying transaction blocks (TB). cot and the execution block (TB) for executing transactions exc ;
[0020] Each account has its own account chain, and accounts interact with the blockchain system by issuing transactions on the account chain; accounts are accessed through TB. UTXO To complete UTXO transactions, via TB cot To deploy smart contracts, via TB exc To invoke the smart contract. All account chains form a DAG graph chain.
[0021] Furthermore, it also includes state blocks and state chains;
[0022] The state chain consists of state blocks arranged in chronological order. Each state block contains multiple transactions, which are used to sort contract transactions, witness them, and resolve issues such as forks.
[0023] Furthermore, each account chain maintains two state data: one is the account's balance, and the other is the UTXO set owned by the user.
[0024] The UTXO format is the same as in Bitcoin, consisting of a LockingScript and a face value.
[0025] Furthermore, the execution process of the UTXO transaction block includes,
[0026] Let's take a specific transaction as an example to illustrate the execution process of a UTXO transaction block: Account A sends a UTXO transaction with a face value of 10. R As input, a UTXO with a face value of 7 is passed to account B. T He then gave himself a UTXO with a face value of 3. S The execution process is divided into the on-chain stage and the witnessing stage;
[0027] The on-chain phase occurs within the account chain, where the UTXO transaction sender builds block TB on their own account chain. UTXO Then the block is propagated to the network. In this example, account A builds block TB in the graph on its own account chain. UTXO Concurrently sent to the network; in the hybrid system, a group of witness nodes act as a committee, using a consensus algorithm similar to PBFT to maintain the ledger, and the witness nodes receive TB UTXO Verify the correctness of the block afterward;
[0028] If the block is correct, a vote will be held for it. When the block receives votes from more than 2 / 3 of the witness nodes, the block is deemed valid, and the witness nodes will execute the TB (Transaction Block). UTXO According to TB UTXO The input and output of the UTXO are deleted from the UTXO-SET of the UTXO owner. UTXO The input UTXO, add TB to the UTXO-SET of the output UTXO receiver. UTXO Output UTXO;
[0029] To delete UTXO in account A's UTXO-SET R Add UTXO S Add a UTXO to the UTXO-SET of account B. T ;
[0030] The witnessing phase occurs within the state chain. Witness nodes periodically elect a producer to build a state block, which contains all the TBs that have passed the on-chain phase during this period.
[0031] Furthermore, the witness node receives TB UTXO The steps to verify the correctness of the block are as follows:
[0032] Based on the UTXO Owner address, check the existence of all input UTXOs, i.e., whether they are all in the UTXO-SET of the corresponding UTXO Owner;
[0033] Check if the sum of the values of all input UTXOs is equal to the sum of the values of all output UTXOs;
[0034] Check the correctness of the transaction signatures for all owners who input the UTXO;
[0035] Check if the UTXO can be unlocked.
[0036] Furthermore, all operations during the on-chain phase can be executed asynchronously and concurrently.
[0037] Furthermore, contract transactions also include an on-chain phase and a witnessing phase. During the on-chain phase, the witnessing node also verifies the TB (Transaction Token). cot or TB exc The correctness of the transaction is questioned; even if the transaction votes to approve it, the transaction will not be executed.
[0038] During the witnessing phase, the producer sorts the contract transactions when building the state block, and all nodes execute the contract transactions in the order within the block.
[0039] Furthermore, the new form of contract includes,
[0040] Issue Contract: Contract execution changes the relevant contract state, constructs the values of each field of the UTXO through the contract, and distributes the UTXO to the account;
[0041] Recycle contract: The contract takes UTXO as input, changes the contract state after verifying the correctness of the UTXO, and deletes the UTXO after the contract is successfully executed;
[0042] These two types of contracts are used to distribute and recycle UTXOs and interact with state data.
[0043] Furthermore, the new form of contract transaction expands the fields based on the original deployment and execution of contract transactions, as follows;
[0044] The deployment contract transaction includes the following fields.
[0045] Hash of Previous Block represents the hash of the parent block;
[0046] Joule represents transaction fees;
[0047] POW Nonce indicates proof of work.
[0048] Timestamp represents a timestamp;
[0049] Contract Class indicates the type of smart contract. Smart contracts are divided into state contracts (traditional smart contracts), issue contracts (contracts that distribute UTXOs), and recycle contracts (contracts that recycle UTXOs).
[0050] Code refers to the contract code;
[0051] Signature represents the signature of a transaction;
[0052] Executing a contract transaction includes the following fields:
[0053] Hash of Previous Block represents the hash of the parent block;
[0054] Joule represents transaction fees;
[0055] POW Nonce indicates proof of work.
[0056] Timestamp represents a timestamp;
[0057] Contract Class indicates the contract type, used to identify the types of smart contracts. Smart contracts are divided into state contracts (traditional smart contracts), issue contracts (contracts that distribute UTXOs), and recycle contracts (contracts that recycle UTXOs).
[0058] Contract Address refers to the contract address;
[0059] Data represents the contract call data;
[0060] Input UTXO represents the UTXO input for a transaction, used to receive the UTXO address and unlock data when calling the Recycle contract;
[0061] Signature represents the signature of a transaction.
[0062] Furthermore, the execution of the new form of contract includes,
[0063] The deployment of contracts is exactly the same for different types of contracts, and the contract code and related data are stored in the state chain.
[0064] In terms of contract execution, different types of contracts are the same in terms of the specific code execution, except that there are additional operations before and after the contract code execution;
[0065] The steps to execute an Issue contract are as follows:
[0066] Execute the contract code. Upon successful execution, the contract returns LockingScript and Value, which are the locking script and face value of the UTXO to be distributed, respectively. The corresponding Value is deducted from the balance of the contract deployment account.
[0067] After combining LockingScript and Value into a UTXO, add the UTXO to the account that calls the contract;
[0068] The steps to execute a Recycle contract are as follows:
[0069] Check if the input UTXO exists;
[0070] Execute the contract, which verifies whether the UTXO can be unlocked and the corresponding state changes after unlocking;
[0071] After the contract is successfully executed, all input UTXOs are deleted, and the value of the UTXOs is added to the balance of the user who deployed the contract.
[0072] On the other hand, the present invention also discloses a computer device including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0073] As can be seen from the above technical solution, the UTXO-Account hybrid blockchain system implementation method based on DAG graph of the present invention enables transactions with more functions to be executed asynchronously and concurrently in the DAG graph through UTXO transactions by supporting UTXO transactions in the DAG graph, thereby improving the overall transaction throughput of the blockchain. Under the DAG multi-chain model, the present invention proposes a UTXO-Account hybrid blockchain system based on DAG graph to solve the problem of DAG graph chains only supporting single-function transactions.
[0074] Specifically, the beneficial effects of the present invention are as follows:
[0075] 1. Based on an existing blockchain architecture based on graph chain fusion, a DAG-based UTXO-Account hybrid blockchain system is proposed, which supports UTXO and state contract transactions and realizes asynchronous concurrent execution of UTXO transactions.
[0076] 2. Through UTXO transactions, many transactions that were originally based on state contracts can be converted into UTXO transactions. The asynchronous and concurrent execution capabilities of UTXO transactions improve the throughput of system transaction execution and reduce transaction execution latency.
[0077] 3. This invention distributes UTXOs in the account chain. Compared with Bitcoin storing UTXOs in the global UTXO-SET, storing UTXOs in the account's UTXO-SET can use the account chain as an index, which speeds up the UTXO lookup and thus improves the execution efficiency of UTXO transactions.
[0078] 4. To address the issue of the inability to convert data between the UTXO model and the Account model, a new type of contract is proposed to enable the conversion between UTXO and state data, thereby facilitating data exchange in the hybrid blockchain system and enhancing its high availability.
[0079] 5. UTXOs are stored in the account blockchain and can only be used by the account owner, while account data in contracts can be accessed by everyone. Therefore, UTXO transactions offer higher security than contract transactions. By using UTXO transactions, many transactions that were originally based on state contracts can be converted into UTXO transactions, thereby improving system security. Attached Figure Description
[0080] Figure 1 This is a hybrid system model according to an embodiment of the present invention;
[0081] Figure 2 This is the transaction format of the hybrid system in this embodiment of the invention;
[0082] Figure 3 This is a functional schematic diagram of the novel contract according to an embodiment of the present invention;
[0083] Figure 4 This is an example diagram of the execution of the Issue-Recycle contract according to an embodiment of the present invention. Detailed Implementation
[0084] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.
[0085] The UTXO-Account hybrid blockchain system implementation method based on DAG graphs described in this embodiment achieves concurrent execution of UTXO transactions within the system by extending the accounts and transactions of the DAG multi-chain structure, and realizes data interaction between the two accounting models of UTXO and accounts through a new form of contract. Specifically, it includes the following steps:
[0086] S1: Extend the account chain by adding storage for the UTXO-SET, which stores the UTXOs owned by the account chain;
[0087] S2: Expand the transaction types in the account chain, delete send-receive transactions and replace them with UTXO transactions, and operate on the UTXOs maintained by the account chain;
[0088] S3: To address the issue of data incompatibility between UTXO transactions and account-based contract transactions, a new form of contract is proposed to enable data interaction between the two accounting models, UTXO and account.
[0089] Combination Figure 1 and Figure 2 As shown, the following are detailed explanations:
[0090] 1.1 Transaction Blocks and Account Chains
[0091] In the account chain, each transaction is a block, so a transaction is called a transaction block (TB). Based on their different functions, TBs are divided into two categories (see...). Figure 1 ,2);
[0092] The transaction used to execute a UTXO is denoted as TB. UTXO See Table 1 for explanations of each field in the transaction;
[0093] Transactions used to execute contracts, including deploying transaction deploy blocks (TB). cot ) and execute block (TB) exc For a detailed explanation of the transaction, please refer to Section 2.
[0094] Each account has its own account chain, and accounts interact with the blockchain system by issuing transactions on this chain. Accounts are accessed via TB. UTXO To complete UTXO transactions and implement functions such as fund transfers, via TB cot To deploy smart contracts, via TB exc This is used to invoke smart contracts. All the account chains form a DAG graph chain.
[0095] Table 1: TB UTXO Explanation of each field
[0096]
[0097]
[0098] 1.2 State Blocks and State Chains
[0099] The state chain consists of state blocks arranged in chronological order, and each state block contains multiple transactions (see...). Figure 2 It is used to sort, witness, and resolve issues such as forks in contract transactions.
[0100] 1.3 Balance and UTXO-SET
[0101] Each account chain maintains two state data: one is the account's balance, and the other is the UTXO set owned by the user.
[0102] The format of a UTXO is the same as that of Bitcoin: LockingScript + Value, which is represented in the diagram as (LockingScript, Value).
[0103] 1.4 UTXO Transaction Execution
[0104] like Figure 1 As shown, this invention uses a specific transaction as an example to illustrate the execution process of a UTXO transaction block: Account A sends a UTXO transaction with a face value of 10 UTXOs. R As input, a UTXO with a face value of 7 is passed to account B. T He then gave himself a UTXO with a face value of 3. S The execution process is divided into the on-chain stage and the witnessing stage.
[0105] On-chain stage
[0106] The on-chain phase mainly occurs within the account chain, where UTXO transaction senders build blocks (TB) on their own account chains. UTXO Then the block is propagated to the network. In this example, account A builds block TB in the graph on its own account chain. UTXO The data is then sent to the network concurrently. In the hybrid system, a group of witness nodes act as a committee, using a consensus algorithm similar to PBFT to maintain the ledger. The witness nodes receive TB... UTXO Verify the correctness of the block afterward:
[0107] 1. Based on the UTXO Owner address, check the existence of all input UTXOs, i.e., whether they are all in the corresponding UTXO Owner's UTXO-SET.
[0108] 2. Check if the sum of the values of all input UTXOs is equal to the sum of the values of all output UTXOs;
[0109] 3. Check the correctness of transaction signatures for all owners who input the UTXO.
[0110] 4. Check if the UTXO can be unlocked.
[0111] If the block is correct, a vote will be held for it. When a block receives votes from more than 2 / 3 of the witness nodes, it is considered valid. The witness nodes will then execute the TB (Transaction Block). UTXO According to TB UTXO The input and output of the UTXO are deleted from the UTXO-SET of the UTXO owner. UTXO The input UTXO, add TB to the UTXO-SET of the output UTXO receiver. UTXO The output UTXO. In the example, this deletes a UTXO in account A's UTXO-SET. R Add UTXO S Add a UTXO to the UTXO-SET of account B. T (All operations during the on-chain phase can be executed asynchronously and concurrently.)
[0112] Witnessing phase
[0113] The witnessing phase primarily occurs within the state chain. Witness nodes periodically elect a producer to construct the state block, which contains all the TBs that have passed the on-chain phase during this period.
[0114] 1.5 Execution of Contract Transactions
[0115] Contract transactions also involve an on-chain phase and a witnessing phase. During the on-chain phase, the witnessing node also verifies TB. cot or TB exc The correctness of the transaction is questioned; even if the transaction votes to pass, the transaction will not be executed.
[0116] During the witnessing phase, producers sort contract transactions when building state blocks, and all nodes execute contract transactions in the order within the block (see New Form Contracts).
[0117] 2. New forms of contracts
[0118] The hybrid system executes UTXO transactions in the account chain and contract transactions in the state chain. Under normal circumstances, UTXOs cannot interact with state data in contracts; that is, the two types of transactions have no overlap, which divides the entire system into two parts. To ensure better usability of the hybrid system, this invention designs a new type of contract to realize the conversion between state data and UTXOs, such as... Figure 3 As shown, they are respectively:
[0119] Issue Contract: Contract execution changes the relevant contract state, constructs the values of each field of the UTXO through the contract, and distributes the UTXO to the account.
[0120] Recycle contract: The contract takes UTXO as input, verifies the correctness of the UTXO, changes the state of the contract, and deletes the UTXO after the contract is successfully executed.
[0121] These two types of contracts are used to distribute and recycle UTXOs and interact with state data. The functionality of the new contract type includes... Figure 3 As shown.
[0122] 2.1 Contract Form
[0123] Contract trading is divided into deployment contract trading and execution contract trading. The new form of contract trading is based on the original deployment contract trading TB. cot and executing contract transactions TB exc Expand fields based on existing fields; the specific form of the contract is as follows: Figure 1 As shown;
[0124] Deploying contract transactions includes an expanded Contract Class.
[0125] Contract Class: Used to indicate the type of smart contract. Smart contracts are divided into state contracts (traditional smart contracts), issue contracts (contracts that distribute UTXOs), and recycle contracts (contracts that recycle UTXOs).
[0126] The original fields include:
[0127] Hash of Previous Block represents the hash of the parent block;
[0128] Joule represents transaction fees;
[0129] POW Nonce indicates proof of work.
[0130] Timestamp represents a timestamp;
[0131] Code refers to the contract code;
[0132] Signature represents the signature of a transaction;
[0133] The execution contract includes extended fields, Contract Class: used to identify the type of smart contract. Smart contracts are divided into state contracts (traditional smart contracts), issue contracts (contracts that distribute UTXOs), and recycle contracts (contracts that recycle UTXOs).
[0134] Input UTXO: Used to receive the UTXO address and unlock data entered when calling the Recycle contract;
[0135] And the original fields:
[0136] Hash of Previous Block represents the hash of the parent block;
[0137] Joule represents transaction fees;
[0138] POW Nonce indicates proof of work.
[0139] Timestamp represents a timestamp;
[0140] Contract Address refers to the contract address;
[0141] Data represents the contract call data;
[0142] Input UTXO represents the UTXO input for a transaction, used to receive the UTXO address and unlock data when calling the Recycle contract;
[0143] Signature represents the signature of a transaction.
[0144] 2.2 Execution of the Issue Contract
[0145] The deployment of contracts is exactly the same for different types of contracts, and the contract code and related data are stored in the state chain.
[0146] In terms of contract execution, different types of contracts are the same in terms of the specific code execution (basically the same as Ethereum smart contracts), except that there are additional operations before and after the contract code execution.
[0147] The steps to execute an Issue contract are as follows:
[0148] Execute the contract code. Upon successful execution, the contract returns LockingScript and Value, which are the locking script and face value of the UTXO to be distributed, respectively.
[0149] The corresponding Value will be deducted from the balance of the contract deployment account.
[0150] After combining LockingScript and Value into a UTXO, add the UTXO to the account that calls the contract.
[0151] 2.3 Execution of the Recycle Contract
[0152] The steps to execute a Recycle contract are as follows:
[0153] 1. Check if the input UTXO exists.
[0154] 2. Execute the contract, which verifies whether the UTXO can be unlocked and the corresponding state changes after unlocking.
[0155] 3. After the contract is successfully executed, delete all input UTXOs. Add the value of the UTXO to the balance of the user who deployed the contract.
[0156] 2.4 Example of Issue-Recycle Contract Execution
[0157] like Figure 4 As shown, account A used transactions C1 and C2 to deploy Issue and Recycle contracts in the account chain. Account B sent transaction E1 in the account chain to call the Issue contract (C1). The contract was executed in the state chain. After successful execution, a UTXO was added to the UTXO-SET of account chain B. R .
[0158] Account B can use UTXO R To conduct UTXO transactions, for example, account B using UTXO... R For input, transfer a UTXO with a face value of 3 to account C. T Then give yourself change in UTXOs with a face value of 7. S(Regarding transaction U in the diagram, it should be noted that due to the existence of the locking script, the above UTXO transaction can be more than just a transfer transaction, thus extending the transaction functionality in the account chain. At the same time, such UTXO transactions can be executed asynchronously and concurrently on the account chain.)
[0159] Finally, account B sends transaction E2 in the account chain to invoke the Recycle contract (C2). The contract is executed in the state chain, and upon successful execution, the UTXO in account B's UTXO-SET is deleted. S .
[0160] In summary, the DAG-based UTXO-Account hybrid blockchain system implementation method of this invention improves the overall transaction throughput of the blockchain by supporting UTXO transactions in the DAG graph, enabling transactions with more functions to be executed asynchronously and concurrently in the DAG graph through UTXO transactions. This invention proposes a DAG-based UTXO-Account hybrid blockchain system under the DAG multi-chain model to solve the problem of DAG graph chains only supporting single-function transactions.
[0161] In another aspect, the present invention also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the steps of any of the methods described above.
[0162] In another aspect, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of any of the methods described above.
[0163] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform the steps of any of the methods described above.
[0164] It is understood that the system provided in the embodiments of the present invention corresponds to the method provided in the embodiments of the present invention, and the explanation, examples and beneficial effects of the relevant content can be referred to the corresponding parts of the above methods.
[0165] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0166] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above 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.
[0167] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for implementing a UTXO-Account hybrid blockchain system based on a DAG graph, characterized in that, Includes the following steps, S1: Extend the account chain by adding storage for the UTXO-SET, which stores the UTXOs owned by the account chain; S2: Expand the transaction types in the account chain, delete send-receive transactions and replace them with UTXO transactions, and operate on the UTXOs maintained by the account chain; S3: To address the issue of data incompatibility between UTXO transactions and account-based contract transactions, a new form of contract is proposed to enable data interaction between the two accounting models: UTXO and account. In the account chain, each transaction is a block, so a transaction is called a transaction block (TB). Based on the different functions of transaction blocks (TBs), TBs are divided as follows: A: Transactions used to execute UTXOs, denoted as TB. UTXO The transaction fields are explained below: Define a field name BlockID, which means a unique identifier for TBUTXO; Define a field named Vout, which means the address of the input UTXO, i.e., BlockID+Index; Define a field named Key, which represents the unlock script entered into the UTXO. Define a field named Owner, which represents the address of the UTXO owner; Define a field name UTXO, which means outputting a UTXO, consisting of a locking script and a face value. Define a field named Reciever, which represents the address of the UTXO receiver; Define a field named Sig, which represents the signature of the transaction by the UTXO owner. B: Transactions used to execute contracts, including deploying contract transaction deploy blocks, i.e., TB. cot and the execution block (TB) for executing contract transactions exc ; Each account has its own account chain, and accounts interact with the blockchain system by issuing transactions on the account chain; accounts are accessed through TB. UTXO To complete UTXO transactions, via TB cot To deploy smart contracts, via TB exc To invoke smart contracts, all the account chains form a DAG graph chain; It also includes state blocks and state chains; The state chain consists of state blocks arranged in chronological order. Each state block contains multiple transactions, which are used to sort, witness, and resolve issues such as forks in contract transactions. The execution process of the UTXO transaction block includes an on-chain stage and a witnessing stage. The on-chain phase occurs within the account chain, where the UTXO transaction sender builds block TB on their own account chain. UTXO Then, the block is propagated to the network. In the hybrid system, a group of witness nodes act as a committee, using a consensus algorithm similar to PBFT to maintain the ledger. The witness nodes receive TB UTXO Verify the correctness of the block afterward; If the block is correct, a vote will be held for it. When the block receives votes from more than 2 / 3 of the witness nodes, the block is deemed valid, and the witness nodes will execute the TB (Transaction Block). UTXO According to TB UTXO The input and output of the UTXO are deleted from the UTXO-SET of the UTXO owner. UTXO The input UTXO, add TB to the UTXO-SET of the output UTXO receiver. UTXO Output UTXO; The witnessing phase occurs within the state chain. Witness nodes periodically elect a producer to build a state block, which contains all the TBs that have passed the on-chain phase during this period. Contract transactions also include an on-chain phase and a witnessing phase. During the on-chain phase, the witnessing node also verifies TB. cot or TB exc The correctness of the transaction is questioned; even if the transaction votes to approve it, the transaction will not be executed. During the witnessing phase, the producer sorts the contract transactions when building the state block, and all nodes execute the contract transactions in the order within the block; The new form of contract includes, Issue Contract: Contract execution changes the relevant contract state, constructs the values of each field of the UTXO through the contract, and distributes the UTXO to the account; Recycle contract: The contract takes UTXO as input, changes the contract state after verifying the correctness of the UTXO, and deletes the UTXO after the contract is successfully executed; These two types of contracts are used to distribute and recycle UTXOs and interact with the state data in the contracts.
2. The method for implementing a UTXO-Account hybrid blockchain system based on a DAG graph according to claim 1, characterized in that: Each account chain maintains two state data: one is the account's balance, and the other is the UTXO set (UTXO-SET) owned by the account. The UTXO format is the same as in Bitcoin, consisting of a LockingScript and a face value.
3. The method for implementing a DAG-based UTXO-Account hybrid blockchain system according to claim 2, characterized in that: The witness node received TB UTXO The steps to verify the correctness of the block are as follows: Based on the UTXO Owner address, check the existence of all input UTXOs, i.e., whether they are all in the UTXO-SET of the corresponding UTXO Owner; Check if the sum of the values of all input UTXOs is equal to the sum of the values of all output UTXOs; Check the correctness of the transaction signatures for all owners who input the UTXO; Check if the UTXO can be unlocked.
4. The method for implementing a UTXO-Account hybrid blockchain system based on a DAG graph according to claim 3, characterized in that: All operations during the on-chain phase can be executed asynchronously and concurrently.
5. The method for implementing a UTXO-Account hybrid blockchain system based on a DAG graph according to claim 1, characterized in that: The contract transactions of the new type of contract are divided into deployment contract transactions and execution contract transactions; The deployment contract transaction includes the following fields. Hash of Previous Block represents the hash of the parent block; Joule represents transaction fees; POW Nonce indicates proof of work. Timestamp represents a timestamp; Contract Class indicates the type of smart contract. Smart contracts are divided into state contracts (traditional smart contracts), issue contracts (contracts that distribute UTXOs), and recycle contracts (contracts that recycle UTXOs). Code refers to the contract code; Signature represents the signature of a transaction; Executing a contract transaction includes the following fields: Hash of Previous Block represents the hash of the parent block; Joule represents transaction fees; POW Nonce indicates proof of work. Timestamp represents a timestamp; Contract Class indicates the contract type, used to identify the types of smart contracts. Smart contracts are divided into state contracts (traditional smart contracts), issue contracts (contracts that distribute UTXOs), and recycle contracts (contracts that recycle UTXOs). Contract Address refers to the contract address; Data represents the contract call data; Input UTXO represents the UTXO input for a transaction, used to receive the UTXO address and unlock data when calling the Recycle contract; Signature represents the signature of a transaction.
6. The method for implementing a DAG-based UTXO-Account hybrid blockchain system according to claim 5, characterized in that: The execution of the new form of contract includes, The deployment of contracts is exactly the same for different types of contracts, and the contract code and related data are stored in the state chain. In terms of contract execution, different types of contracts are the same in terms of the specific code execution, except that there are additional operations before and after the contract code execution; The steps to execute an Issue contract are as follows: Execute the contract code. Upon successful execution, the contract returns LockingScript and Value, which are the locking script and face value of the UTXO to be distributed, respectively. The corresponding Value is deducted from the balance of the contract deployment account. After combining LockingScript and Value into a UTXO, add the UTXO to the account that calls the contract; The steps to execute a Recycle contract are as follows: Check if the input UTXO exists; Execute the contract, which verifies whether the UTXO can be unlocked and the corresponding state changes after unlocking; After the contract is successfully executed, all input UTXOs are deleted, and the value of the UTXOs is added to the balance of the user who deployed the contract.
7. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Systems and methods based on DAG blockchain structures of account chain and guardian chain
CN113837754B
Method for realizing transverse expansion of distributed account book based on fragmentation mechanism
CN110310115A
DAG based methods and systems of transaction processing in a distributed ledger
CN112602076A