Transaction generation method, block creation method and related devices and equipment
By selecting appropriate UTXO in the blockchain network to generate transaction data, the total remaining digital assets of the UTXO output from the transaction are equal to or greater than the target threshold, which solves the problem of high transaction fees caused by dust transactions and improves the operation of the blockchain network efficiency.
Patent Information
- Application Number
- CN202010076933.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-23
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2040-01-23
AI Technical Summary
The occurrence of dust transactions in blockchain networks leads to high transaction costs and reduces network efficiency.
In the blockchain network, nodes select appropriate unspent transaction output (UTXO) from the remaining digital assets and generate transaction data so that the total remaining digital assets of the UTXO outputted by the transaction are equal to or greater than the target threshold, thereby avoiding dust transactions. The emergence of
It effectively reduces the occurrence of dust transactions, improves the operation efficiency of the blockchain network, and reduces transaction fees.
Smart Images

Figure CN111292190B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, specifically to the field of data processing technology, and in particular to a transaction generation method, a block creation method, and related devices and equipment. Background Art
[0002] In the blockchain technology world, "dust" is a very small amount of currency that people can usually ignore. In other words, dust is a small part of a transaction or amount that is usually not worth trading because their transaction fees are often higher than their own value.
[0003] Dusting Attack is a problem facing the blockchain field. The process of dusting attack is as follows: the implementer of dusting attack generates "dusted" transactions (also called dust transactions) by sending a small amount of satoshi to the transaction addresses of a large number of users, and then locates the dust transaction and associates other associated addresses of the address. By reading these associated addresses for behavioral analysis, the company or individual behind an address can be analyzed. Furthermore, after being attacked, it is easy to launch phishing threats. Moreover, a large number of dust transactions will generate a large number of transactions to be packaged, causing block congestion, increasing transaction fees, and reducing the operating efficiency of the blockchain network.
[0004] How to reduce the generation of dust transactions is a technical problem that urgently needs to be solved in the current blockchain technology field. Summary of the invention
[0005] The embodiments of the present application provide a transaction generation method, a block creation method, and related devices and equipment, which can avoid the generation of dust transactions and improve the operating efficiency of the blockchain network.
[0006] In a first aspect, an embodiment of the present application provides a transaction generation method, which is applied to a node of an initiator of a transaction in a blockchain network, and the method includes:
[0007] receiving a transfer instruction, wherein the transfer instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node;
[0008] Select at least one unspent transaction output (UTXO) from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, where M is a positive integer;
[0009] Generate first transaction data according to the at least one UTXO and the transfer instruction; the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the output UTXO of the first transaction data are equal to 0 or greater than the target threshold;
[0010] The first transaction data is uploaded to the blockchain network.
[0011] In one possible implementation, the total remaining digital assets of the at least one UTXO are equal to the first digital assets or the difference between the total remaining digital assets of the at least one UTXO and the first digital assets is greater than the target threshold.
[0012] In a possible implementation, selecting at least one UTXO from the remaining digital assets of the first node specifically includes:
[0013] Add a UTXO obtained from the remaining UXTO set to the UTXO set, wherein the remaining UXTO set is the UTXO in the M UXTOs except the UTXO set;
[0014] When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO;
[0015] When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO;
[0016] When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, repeat the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set.
[0017] In a possible implementation, selecting at least one UTXO from the remaining digital assets of the first node specifically includes:
[0018] According to the remaining digital assets of each of the M UTXOs, sort the M UTXOs from largest to smallest in terms of the remaining digital assets;
[0019] Determine that the first i UTXOs among the M UTXOs are the at least one UTXO, wherein the total remaining digital assets of the first i UTXOs are not less than the first digital asset, and i is a positive integer less than M.
[0020] Optionally, the total remaining digital assets of the first i-1 UTXOs are less than the first digital assets.
[0021] Optionally, the difference between the total remaining digital assets of the first i UTXOs and the first digital asset is equal to 0 or greater than the target threshold.
[0022] In a possible implementation, the first transaction data further includes transaction fees, and the method further includes:
[0023] When the difference between the total remaining digital assets of the at least one UTXO and the first digital asset is less than the target threshold, the difference is used as a transaction fee for the first transaction data.
[0024] In a possible implementation, the transfer instruction further includes transaction information, and the method further includes:
[0025] identifying a transaction type of the transaction information according to the transaction information;
[0026] According to the correspondence between the transaction type and the threshold, the type of the transaction information is determined to determine the target threshold.
[0027] In a second aspect, an embodiment of the present application provides a block creation method, which is applied to a blockchain node in a blockchain network, and the method includes:
[0028] Obtaining first transaction data uploaded by a first node to a blockchain network, the first transaction data being used to indicate a transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node, the first transaction data using at least one UTXO as a transaction input of the first transaction data, the total remaining digital assets of the UTXO output of the first transaction data being equal to 0 or greater than a target threshold, the at least one UTXO being selected from the remaining digital assets of the first node, the remaining digital assets of the first node including M UTXOs, where M is a positive integer;
[0029] According to the first transaction data, the first transaction data is written into a block, wherein an input of the block is the at least one UTXO.
[0030] In a third aspect, an embodiment of the present application provides a transaction generation device, which is applied to a node of an initiator of a transaction in a blockchain network, including:
[0031] A receiving unit, configured to receive a transfer instruction, wherein the transfer instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node;
[0032] A selecting unit, configured to select at least one unspent transaction output (UTXO) from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, where M is a positive integer;
[0033] A generating unit, configured to generate first transaction data according to the at least one UTXO and the transfer instruction; the first transaction data uses the at least one UTXO as a transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than a target threshold;
[0034] The uploading unit is used to upload the first transaction data to the blockchain network.
[0035] In one possible implementation, the total remaining digital assets of the at least one UTXO are equal to the first digital assets or the difference between the total remaining digital assets of the at least one UTXO and the first digital assets is greater than the target threshold.
[0036] In a fourth aspect, an embodiment of the present application provides a block creation device, which is applied to a blockchain node in a blockchain network, including:
[0037] an acquisition unit, configured to acquire first transaction data uploaded by a first node to a blockchain network, the first transaction data being used to indicate a transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node, the first transaction data using at least one UTXO as a transaction input of the first transaction data, the total remaining digital assets of the UTXO output of the first transaction data being equal to 0 or greater than a target threshold, the at least one UTXO being selected from the remaining digital assets of the first node, the remaining digital assets of the first node including M UTXOs, where M is a positive integer;
[0038] A creating unit is used to create a block from the first transaction data according to the first transaction data, wherein the input of the block is the at least one UTXO.
[0039] In a fifth aspect, an embodiment of the present application provides a transaction generation device, comprising a processor and a memory, wherein the processor and the memory are coupled, wherein the memory is used to store computer instructions, and the processor is used to execute the computer instructions, so that the transaction generation device implements the method described in the first aspect or any one of the implementations of the first aspect.
[0040] In a sixth aspect, an embodiment of the present application provides a block creation device, comprising a processor and a memory, wherein the processor and the memory are coupled, wherein the memory is used to store computer instructions, and the processor is used to execute the computer instructions, so that the block creation device implements the method implemented as described in any one of the first aspect or the second aspect.
[0041] In the seventh aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer storage medium stores one or more computer instructions, and when the one or more computer instructions are called by a computer, the computer implements the method described in the first aspect or any one of the implementations of the first aspect.
[0042] In an eighth aspect, an embodiment of the present application provides a computer program, which, when executed by a computer device, implements the method described in the first aspect or any one of the implementations of the first aspect.
[0043] In the ninth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer storage medium stores one or more computer instructions, and when the one or more computer instructions are called by a computer, the computer implements the method described in the second aspect or any one of the implementations of the second aspect.
[0044] In a tenth aspect, an embodiment of the present application provides a computer program, which, when executed by a computer device, implements the method described in the second aspect or any one of the implementations of the second aspect.
[0045] In an embodiment of the present application, a first node receives a transfer instruction, which is used to instruct the transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node; then, at least one UTXO is selected from the remaining digital assets of the first node, thereby generating first transaction data based on the at least one UTXO and the transfer instruction, and uploading the first transaction data to the blockchain network; wherein the first transaction data uses the at least one UTXO as a transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than the target threshold; thereby avoiding the generation of dust transactions and improving the operating efficiency of the blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 It is a schematic diagram of the architecture of a blockchain network provided in an embodiment of the present application;
[0048] Figure 2 It is a schematic diagram of a data structure of a blockchain provided in an embodiment of the present application;
[0049] Figure 3 It is a flowchart of a transaction generation method provided in an embodiment of the present application;
[0050] Figure 4A It is a flowchart of an implementation method for a first node to select at least one UTXO from the remaining digital assets of the first node provided in an embodiment of the present application;
[0051] Figure 4B It is a flowchart of another implementation method of a first node selecting at least one UTXO from the remaining digital assets of the first node provided in an embodiment of the present application;
[0052] Figure 4C It is a flowchart of an implementation method for determining that the first i UTXOs among M UTXOs are at least one UTXO provided in an embodiment of the present application;
[0053] Figure 5 is a flowchart of a block creation method provided by another embodiment of the present application;
[0054] Figure 6 This is a schematic diagram of a transaction generation structure provided by an embodiment of the present application;
[0055] Figure 7 This is a schematic diagram of a block creation structure provided by an embodiment of the present application;
[0056] Figure 8 This is a schematic diagram of another transaction generation structure provided by an embodiment of the present application;
[0057] Fig. 9 It is a structural diagram of another block creation provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0059] First, the concepts involved in the embodiments of the present application are described:
[0060] (1) Blockchain: Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0061] Blockchain is generally divided into three types: public blockchain, private blockchain and consortium blockchain.
[0062] Among them, the public chain has the highest degree of decentralization. Nodes / participants who join the public chain can read the data on the chain, publish transactions, and compete for the right to record new blocks, etc. Moreover, each node / participant can freely join and exit the public chain. Private chains are the opposite. The accounting authority of private chains is controlled by a certain organization or institution, and the data reading authority is also controlled by the organization or institution. There are few participants and they cannot join the private chain at will. They must be reviewed by the organization or institution.
[0063] A consortium chain is also called a community blockchain. It is a blockchain whose consensus process is controlled by pre-selected nodes. It is a hybrid of public and private chains and can achieve "partial decentralization". Each node on the chain usually has a corresponding entity or organization; participants join the network through authorization and form a stakeholder alliance to jointly maintain the operation of the blockchain. Through the consortium chain, new participants can join an already formed blockchain and share data without having to build it from scratch. At the same time, by jointly solving common problems, companies reduce development costs and time expenses.
[0064] Whether it is a public chain, a private chain or a consortium chain, it may provide the function of smart contracts. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system. Smart contracts can be defined in the form of code.
[0065] (2) A shared ledger is used to provide functions such as storage and query of data fingerprints, and to send the recorded data of operations on files or devices (also referred to as logs or benchmark data in this application) to other nodes in the blockchain network. After other nodes verify that the data is valid, they will store the recorded data in a temporary block and can also send a confirmation to the node that initiated the operation.
[0066] (3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs. Smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0067] (4) Public key, private key, transaction address
[0068] The nodes that join the blockchain network have a pair of public and private keys, which can be created using an asymmetric encryption algorithm. For example, the node can first randomly generate a private key, and then, based on the principle of an asymmetric encryption algorithm, the public key is calculated from the private key, and then the transaction address (also called the wallet address) can be obtained from the public key through a series of digital signature operations. In other words, if the public key of a node is known, the transaction address of the node can be calculated. In some embodiments, the public key can also be used as a wallet address or an identifier of a wallet address.
[0069] Among them, asymmetric encryption algorithms may include but are not limited to: Elgamal algorithm, Rabin algorithm, Diffie-Hellman algorithm, elliptic curve cryptography (ECC) algorithm. Among them, the key pair includes a public key and a private key; the public key is usually broadcast to the blockchain network, and the private key is kept by the node. It should be noted that the public and private keys in the blockchain network are unique.
[0070] like Figure 1 The diagram is a schematic diagram of the architecture of a blockchain network 100 provided in an embodiment of the present application. The blockchain 100 includes a plurality of blockchain node devices (also referred to as nodes in the present application), such as node 101, node 102, node 103, node 104, etc. Figure 1 The blockchain network 100 shown in the figure includes four nodes, but it should be understood that in actual applications, the blockchain system 100 may include more or fewer nodes. Optionally, each node may be a client in the blockchain network, which may be an electronic device such as a mobile phone, a personal computer, a tablet computer, a vehicle-mounted unit, a server, or an application.
[0071] In order to ensure information intercommunication within the blockchain network 100, there may be an information connection between each node in the blockchain network 100, and information may be transmitted between nodes through the above information connection. For example, when any node in the blockchain network receives transaction data for the first time, it verifies the legitimacy of the transaction data. If the transaction data is legitimate, it may broadcast the transaction data to its neighboring nodes so that other nodes in the blockchain network can receive the transaction data. It should be understood that after the node receives the same transaction data again, it will no longer broadcast it to neighboring nodes to avoid unlimited propagation of transaction data.
[0072] In one scenario, node 101 may be the initiator of the transaction data (also referred to as the first node in this application). The first node may receive a transfer instruction, which is used to instruct the first digital asset to be transferred from the transaction address of the first node to the second node (the recipient of the digital asset), such as the transaction address of node 103; then, check all UTXOs of the first node, and select at least one UTXO from the remaining digital assets of the first node; thus, generate the first transaction data according to the at least one UTXO and the transfer instruction. The first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than the target threshold to avoid the generation of dust transactions.
[0073] Furthermore, the first node uploads the first transaction data to the blockchain network.
[0074] Node 102 and node 104 may be blockchain nodes. After receiving the first transaction data, the blockchain node writes the first transaction data into the block according to the first transaction data, wherein the input of the block is the at least one UTXO. After generating a block, the blockchain node publishes the block to the blockchain network. The propagation mode of the new block is similar to the propagation mode of the transaction data, which will not be described in detail. The blockchain node that receives the new block can detect the legitimacy of the content of the block and check whether the block is on the longest legal chain. Then, each blockchain node can store the maximum legal chain to ensure the consistency of the data stored by each blockchain node.
[0075] In one implementation, each node in the blockchain network 100 can store the same blockchain. The blockchain consists of multiple blocks. It should be understood that the blockchain includes a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system. Each node in the blockchain network stores the same blockchain. The blockchain consists of multiple blocks, such as Figure 2 As shown, it is a schematic diagram of the data structure of a blockchain provided by an embodiment of the present application. The blockchain is composed of multiple blocks. The genesis block includes a block header and a block body. The block header stores transaction data, version number and timestamp, etc., and the block body stores transaction data; the next block of the genesis block takes the genesis block as the parent block, and the next block also includes a block header and a block body. The block header stores the transaction data of the current block, the hash value of the data in the parent block, the version number and timestamp, etc., and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, thereby ensuring the security of the transaction data in the block.
[0076] Optionally, the blockchain can record various transaction data associated with the associated node device through an unspent transaction output (UTXO) model, where an unspent transaction output refers to a transaction output in the blockchain that does not appear in the transaction input of other blocks.
[0077] The block body may include at least one transaction input, such as transaction input in1, transaction input in2, etc., and at least one transaction output, such as transaction output out1, transaction output out2, etc. For each transaction output, it may include the address of the previous block of the UTXO corresponding to the transaction output in the blockchain network, such as the hash value of the previous block; it may also include the remaining digital assets of the transaction output, digital signatures, addresses of the recipients of the digital assets, etc.
[0078] Optionally, each node in the blockchain network may store a blockchain associated only with the node. Each blockchain may record transaction data related to the associated node.
[0079] The following describes a transaction generation method provided by an embodiment of the present application. The method can be executed by the initiator of the transaction. In the embodiment of the present application, the initiator of the transaction is a node in the blockchain network, also referred to as the first node. Figure 3 As shown, the method includes but is not limited to some or all of the following steps:
[0080] S11: Receive a transfer-out instruction, where the transfer-out instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node.
[0081] The first node may receive transaction information input by the user based on the client, and the transaction information may include the first digital asset, the asset transferor (the identifier of the first node), the asset transferee (the identifier of the second node), additional transaction information, etc., wherein the additional transaction information may include the transaction type of the transaction information, detailed transaction information, etc. The detailed transaction information may include the product or service exchanged for the first digital asset. For example, when the transaction details are that the first node spends the first digital asset to exchange a specified product, such as a mobile phone, from the second node.
[0082] The transaction types may include but are not limited to small transactions, medium transactions, and large transactions. Small transactions may be transactions where the transaction assets (here, the first digital asset) are less than the first threshold, medium transactions may be transactions where the transaction assets are greater than the first threshold and less than the second threshold, and large transactions may be transactions where the transaction assets are greater than the second threshold. The first threshold is less than the second threshold.
[0083] It should be understood that the transaction type is distinguished by the product or service purchased in the transaction, for example, the transaction type may include daily necessities transactions, electronic product transactions, film and television content transactions, etc. The transaction type may also be divided in other ways, which are not limited here.
[0084] Optionally, after S11, the method may further include: the first node identifying the transaction type of the transaction information according to the transaction information; determining the type of the transaction information and determining the target threshold according to the correspondence between the transaction type and the threshold. Then, dynamically adjusting the size of the target threshold to better adapt to different transaction scenarios.
[0085] S12: Select at least one UTXO from the remaining digital assets of the first node, where the remaining digital assets include M UTXOs, and M is a positive integer.
[0086] The first node can find its remaining digital assets, that is, the balance, that is, find out all the UTXOs of the first node. Here, the first node includes M UTXOs as an example. It should be understood that the total number of UTXOs included in the first node changes as the first node publishes transactions, and the total number of UTXOs of different nodes may be different.
[0087] To avoid the generation of dust transactions, method 1: the difference between the total remaining digital assets (also called the total balance) of the input UTXO in the generated transaction data and the first digital asset can be equal to 0 or greater than the target threshold, where the total remaining digital assets of at least one selected UTXO are required to be equal to the first digital asset or the difference between the total remaining digital assets of at least one selected UTXO and the first digital asset is required to be greater than the target threshold. Method 2: When the difference between the total remaining digital assets (also called the total balance) of the input UTXO in the generated transaction data and the first digital asset is less than the target threshold, the difference can be forced as a transaction fee. It should be understood that the difference between the total remaining digital assets of at least one selected UTXO and the first digital asset refers to the difference between the total remaining digital assets of at least one selected UTXO minus the first digital asset, and the difference is greater than 0.
[0088] Corresponding to the above-mentioned method 1 or method 2, the first node may select at least one UTXO from the remaining digital assets of the first node, including but not limited to the following three implementations:
[0089] Implementation (I):
[0090] like Figure 4A As shown, the implementation (I) may include but is not limited to the following steps:
[0091] S121: Add a UTXO obtained from the remaining UXTO set to the UTXO set, and the remaining UXTO set is the UTXO in the M UXTOs except the UTXO set.
[0092] It should be understood that before the initial execution of S121, the remaining UXTO set is a set of M UTXOs, and the UTXO set is an empty set; after the initial execution of S121, the UTXO set includes one UTXO obtained when S121 is initially executed.
[0093] S122: Compare the total remaining digital assets of all UTXOs in the UTXO set with the size of the first digital asset.
[0094] When the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, S123 is executed; when the total remaining digital assets of all UTXOs in the UTXO set are greater than the first digital asset, S124 is executed; when the total remaining digital assets of all UTXOs in the UTXO set are greater than the first digital asset, S124 is executed; when the total remaining digital assets of all UTXOs in the UTXO set are less than the first digital asset, S121 is repeatedly executed to guide the total remaining digital assets of all UTXOs in the UTXO set to be not less than the first digital asset.
[0095] S123: Determine that the UTXO set is at least one UTXO.
[0096] When the remaining digital assets of the UTXO to be selected are equal to the first digital assets, the UTXO to be selected is selected.
[0097] S124: Determine whether the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold. If so, execute S123; otherwise, execute S121 and repeat S124 until the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold.
[0098] It can be seen that the above implementation (I) can ensure that the transaction output is greater than the target threshold and avoid the generation of dust transactions.
[0099] Implementation (II):
[0100] like Figure 4B As shown, the implementation (II) may include but is not limited to the following steps:
[0101] S125: According to the remaining digital assets of each of the M UTXOs, the M UTXOs are sorted from large to small in terms of the remaining digital assets;
[0102] S126: Determine that the first i UTXOs among the M UTXOs are at least one UTXO, wherein the total remaining digital assets of the first i UTXOs are not less than the first digital asset.
[0103] Among them, Figure 4C As shown, the implementation (1) of S126 may be:
[0104] S1261: Select the first i UTXOs from the sorted M UTXOs.
[0105] S1262: Compare the total remaining digital assets of all UTXOs in the first i UTXOs with the size of the first digital asset.
[0106] When the total remaining digital assets of all UTXOs in the first i UTXOs are equal to the first digital asset, S1263 is executed; when the total remaining digital assets of all UTXOs in the first i UTXOs are greater than the first digital asset, S124 is executed; when the total remaining digital assets of all UTXOs in the first i UTXOs are greater than the first digital asset, S124 is executed; when the total remaining digital assets of all UTXOs in the UTXO set are less than the first digital asset, S121 is repeatedly executed until the total remaining digital assets of all UTXOs in the UTXO set are not less than the first digital asset.
[0107] S1263: Determine that the first i UTXOs are at least one UTXO.
[0108] S1264: Determine whether the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital asset is greater than the target threshold. If so, execute S1263 and S13. Otherwise, i=i+1, repeat S1261, and repeat S1264 until the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital asset is greater than the target threshold.
[0109] The implementation method (1) of S126 can ensure that the difference between the total remaining digital assets of at least one selected UTXO, i.e., the last output of the first i UTXOs and the first digital asset is equal to 0 or greater than the target threshold, thereby avoiding the generation of dust transactions.
[0110] In implementation (2) of S126, similar to implementation (1), when the total remaining digital assets of all UTXOs in the first i UTXOs are equal to the first digital asset, S1263 is executed. The difference is that when the total remaining digital assets of all UTXOs in the first i UTXOs are greater than the first digital asset, the first node can execute S1263, and when the total remaining digital assets of all UTXOs in the first i UTXOs are less than the first digital asset, i=i+1, and S1261 is repeatedly executed until the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital asset is greater than the target threshold.
[0111] In implementation (2) of S126, when at least one of the selected UTXOs is the first i UTXOs, its first i-1 UTXOs must be smaller than the first digital asset. Although this implementation (2) cannot guarantee that the transaction output is greater than the target threshold, the process is simple and the operation speed is fast.
[0112] Implementation (III)
[0113] In implementation (III), the method of selecting at least one UTXO is not limited. The first node can select at least one UTXO from the M UTXOs at will or select at least one UTXO by other methods, as long as the selected at least one UTXO satisfies that the total remaining digital assets are not less than the first digital assets.
[0114] Not limited to the above three implementation methods of selecting at least one UTXO, the embodiments of the present application may also include other implementations, which will not be described here.
[0115] S13: Generate first transaction data according to at least one UTXO and a transfer instruction. The first transaction data uses at least one UTXO as a transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than the target threshold.
[0116] Optionally, the first transaction data may include the identifier of the first node, the identifier of the second node, the information of at least one selected UTXO, the first digital asset, etc. Among them, the identifier of the first node may be the public key or transaction address of the first node; the identifier of the second node may be the public key or transaction address of the second node; the information of UTXO may include the address of the previous block of the UTXO (such as the hash value of the previous block), the remaining digital asset, etc. Among them, the first transaction data has a fixed data format, and the meaning of each data included in the first transaction data is determined.
[0117] With respect to implementation method (2) of S126 in implementation (II) of selecting at least one UTXO, the first transaction data may further include transaction fees. The first node may determine whether the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital asset is greater than the target threshold value during the process of generating the first transaction data. If the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital asset is less than the target threshold value, the difference is used as the transaction fee of the first transaction data; otherwise, the first transaction data does not include the transaction fee, or the transaction fee is 0.
[0118] It should be understood that, corresponding to the above implementation (three), the first node can determine whether the difference between the total remaining digital assets of the selected at least one UTXO and the first digital asset is greater than the target threshold in the process of generating the first transaction data. If the difference between the total remaining digital assets of the selected at least one UTXO and the first digital asset is less than the target threshold, the difference is used as the transaction fee of the first transaction data; otherwise, the first transaction data does not include the transaction fee, or the transaction fee is 0.
[0119] It should also be understood that for other implementations, the first transaction data may also include transaction fees, but the difference in the total remaining digital assets of at least one selected UTXO after deducting the first digital assets and the transaction fees is either equal to 0 or greater than the target threshold.
[0120] S14: Upload the first transaction data to the blockchain network.
[0121] After the first node publishes the first transaction data to the blockchain network, the nodes in the blockchain network verify the legitimacy of the first transaction data after receiving the first transaction data for the first time, and broadcast the first transaction data to its neighboring nodes if it is legal. After receiving the first transaction data, the blockchain node generates a new block after verifying the legitimacy of the first transaction data, and publishes the new block. In the process of generating a block by the blockchain node, at least one UTXO selected in the first transaction data is used as the input of the block.
[0122] like Figure 5 As shown, a block creation method provided by an embodiment of the present application can be executed by a blockchain node in a blockchain network, wherein, in a public chain, a blockchain node can be any node in the blockchain network, that is, any node can compete for the right to create a block, and the block generation method can include but is not limited to the following steps:
[0123] S21: Obtain first transaction data, wherein the specific description of the first transaction data can refer to the relevant description in the embodiment of the above-mentioned transaction generation method, which will not be repeated here.
[0124] S22: According to the first transaction data, write the first transaction data into a block, wherein an input of the block is at least one UTXO.
[0125] Furthermore, the blockchain node can publish the generated new blocks to the blockchain network.
[0126] It should be understood that other blockchain nodes can also generate new blocks and publish blockchain networks. Each blockchain node can receive new blocks, detect the legitimacy of the block content, and check whether the block is on the longest legal chain. Then, each blockchain node can store the maximum legal chain to ensure the consistency of data stored by each blockchain node.
[0127] Based on the description of the above method embodiment, the embodiment of the present application further proposes a transaction generation device, which can be run in the first node. The transaction generation device can be a computer program (including program code) running in the first node, or a client; see Figure 6 As shown, the transaction generating device 60 may include or may run the following units:
[0128] A receiving unit 601 is used to receive a transfer instruction, where the transfer instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node;
[0129] A selecting unit 602 is used to select at least one unspent transaction output (UTXO) from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, and M is a positive integer;
[0130] A generating unit 603 is configured to generate first transaction data according to the at least one UTXO and the transfer instruction; the first transaction data uses the at least one UTXO as a transaction input of the first transaction data, and the total remaining digital assets of the output UTXO of the first transaction data are equal to 0 or greater than a target threshold;
[0131] The uploading unit 604 is used to upload the first transaction data to the blockchain network.
[0132] In one possible implementation, the total remaining digital assets of the at least one UTXO are equal to the first digital assets or the difference between the total remaining digital assets of the at least one UTXO and the first digital assets is greater than the target threshold.
[0133] In a possible implementation, the selecting unit 602 is specifically configured to:
[0134] Add a UTXO obtained from the remaining UXTO set to the UTXO set, wherein the remaining UXTO set is the UTXO in the M UXTOs except the UTXO set;
[0135] When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO;
[0136] When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO;
[0137] When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, repeat the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set.
[0138] In a possible implementation, the selecting unit 602 is specifically configured to:
[0139] According to the remaining digital assets of each of the M UTXOs, sort the M UTXOs from largest to smallest in terms of the remaining digital assets;
[0140] Determine that the first i UTXOs among the M UTXOs are the at least one UTXO, wherein the total remaining digital assets of the first i UTXOs are not less than the first digital asset, and i is a positive integer less than M.
[0141] Optionally, the total remaining digital assets of the first i-1 UTXOs are less than the first digital assets.
[0142] Optionally, the difference between the total remaining digital assets of the first i UTXOs and the first digital asset is equal to 0 or greater than the target threshold.
[0143] In a possible implementation, the first transaction data further includes transaction fees, and the device 60 further includes:
[0144] The processing unit uses the difference between the total remaining digital assets of the at least one UTXO and the first digital asset as a transaction fee for the first transaction data when the difference between the total remaining digital assets of the at least one UTXO and the first digital asset is less than the target threshold.
[0145] In a possible implementation, the transfer instruction further includes transaction information, and the device 60 further includes:
[0146] an identification unit, configured to identify a transaction type of the transaction information according to the transaction information;
[0147] The determination unit is used to determine the type of the transaction information and the target threshold according to the corresponding relationship between the transaction type and the threshold.
[0148] Based on the description of the above method embodiment, the embodiment of the present application also proposes a block creation device, which can be run in a blockchain node. The block creation device can be a computer program (including program code) running in the blockchain node; see Figure 7 As shown, the block creation device 70 may include or run the following units:
[0149] An acquisition unit 701 is used to acquire first transaction data uploaded by a first node to a blockchain network, the first transaction data being used to indicate a transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node, the first transaction data using at least one UTXO as a transaction input of the first transaction data, the total remaining digital assets of the UTXO output of the first transaction data being equal to 0 or greater than a target threshold, the at least one UTXO being selected from the remaining digital assets of the first node, the remaining digital assets of the first node including M UTXOs, where M is a positive integer;
[0150] The creation unit 702 is used to create a block from the first transaction data according to the first transaction data, wherein the input of the block is the at least one UTXO.
[0151] According to one embodiment of the present application, Figure 3 Some of the steps involved in the transaction generation method shown can be represented by Figure 6 The transaction generation device shown in the figure is executed by each unit. Figure 5 Some of the steps involved in the block creation method shown can be represented by Figure 7 According to another embodiment of the present application, Figure 6 The transaction generating device shown or Figure 7 The various units in the block creation device shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, other units can also be included based on the data processing device. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0152] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 3 as well as Figure 5 A computer program (including program code) for each step involved in the corresponding method shown in Figure 6 The transaction generating device shown or Figure 7 The block creation device shown in the figure and the method for implementing the embodiment of the present application. The computer program can be recorded on a computer-readable recording medium, for example, and loaded into the above-mentioned computing device through the computer-readable recording medium and run therein.
[0153] In an embodiment of the present application, a first node receives a transfer instruction, which is used to instruct the transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node; then, at least one UTXO is selected from the remaining digital assets of the first node, thereby generating first transaction data based on the at least one UTXO and the transfer instruction, and uploading the first transaction data to the blockchain network; wherein, the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than the target threshold; thereby avoiding the generation of dust transactions and improving the operating efficiency of the blockchain network.
[0154] Based on the description of the above method embodiment and the device embodiment, the present invention also provides a transaction generation device; the transaction generation device can be the user device or detection device mentioned above. Figure 8 , the transaction generating device 80 may at least include a processor 801, an input device 802, an output device 803, a memory 804 and a communication interface 805; wherein the processor 801, the input device 802, the output device 803, the memory 804 and the communication interface 805 may be connected via a bus 808 or other connection methods. The memory 804 is used to store a computer program, and the computer program includes program instructions. The memory 804 may include a volatile memory (for example, a dynamic random access memory DRAM), and may also include a non-volatile memory (for example, a one-time programmable read-only memory OTPROM). In some examples, the memory 804 may further include a memory remotely arranged relative to the processor 801, and these remote memories may be connected to the device 80 via a network. The input device 802 may include: a keyboard 8021, a microphone 8022, a touch panel 8023, etc. The output device 803 may include a display panel 8031, a loudspeaker 8032, etc.
[0155] The communication interface 805 is used to implement information interaction between the transaction generating device 80 and other devices, such as a blockchain network.
[0156] The processor 801 is used to execute the program instructions stored in the memory 804. The processor 801 (or CPU (Central Processing Unit)) is the computing core and control core of the client, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function in the above transaction generation method embodiment.
[0157] In some embodiments, the processor 801 described in the embodiments of the present invention may be used to perform a series of data processing, including:
[0158] receiving a transfer instruction, wherein the transfer instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node;
[0159] Select at least one unspent transaction output (UTXO) from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, where M is a positive integer;
[0160] Generate first transaction data according to the at least one UTXO and the transfer instruction; the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the output UTXO of the first transaction data are equal to 0 or greater than the target threshold;
[0161] The first transaction data is uploaded to the blockchain network.
[0162] In one possible implementation, the total remaining digital assets of the at least one UTXO are equal to the first digital assets or the difference between the total remaining digital assets of the at least one UTXO and the first digital assets is greater than the target threshold.
[0163] In a possible implementation, the processor 801 executes the selecting of at least one UTXO from the remaining digital assets of the first node, specifically including executing:
[0164] Add a UTXO obtained from the remaining UXTO set to the UTXO set, wherein the remaining UXTO set is the UTXO in the M UXTOs except the UTXO set;
[0165] When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO;
[0166] When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO;
[0167] When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, repeat the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set.
[0168] In a possible implementation, the processor 801 executes the selecting of at least one UTXO from the remaining digital assets of the first node, specifically including executing:
[0169] According to the remaining digital assets of each of the M UTXOs, sort the M UTXOs from largest to smallest in terms of the remaining digital assets;
[0170] Determine that the first i UTXOs among the M UTXOs are the at least one UTXO, wherein the total remaining digital assets of the first i UTXOs are not less than the first digital asset, and i is a positive integer less than M.
[0171] Optionally, the total remaining digital assets of the first i-1 UTXOs are less than the first digital assets.
[0172] Optionally, the difference between the total remaining digital assets of the first i UTXOs and the first digital asset is equal to 0 or greater than the target threshold.
[0173] In a possible implementation, the first transaction data further includes transaction fees, and the processor 701 is further configured to execute:
[0174] When the difference between the total remaining digital assets of the at least one UTXO and the first digital asset is less than the target threshold, the difference is used as a transaction fee for the first transaction data.
[0175] In a possible implementation, the transfer instruction further includes transaction information, and the processor 701 is further configured to execute:
[0176] identifying a transaction type of the transaction information according to the transaction information;
[0177] According to the correspondence between the transaction type and the threshold, the type of the transaction information is determined to determine the target threshold.
[0178] It should be noted that the above-mentioned input device 802 and output device 803 are not necessary units of the transaction generating device 80. The transaction generating device 80 may not include the above-mentioned input device 802 and output device 803, and may also include other devices or modules, which is not limited in the embodiment of the present application.
[0179] It should be understood that the transaction generating devices 60 and 80 described in the embodiments of the present invention can execute the above Figure 3 The description of the transaction generation method in the corresponding embodiment will not be repeated here.
[0180] Based on the description of the above method embodiment and the device embodiment, the present invention also provides a block creation device; the block creation device can be the user equipment or detection device mentioned above. Fig. 9 , the block creation device 90 may include at least a processor 901, an input device 902, an output device 903, a memory 904 and a communication interface 905; wherein the processor 901, the input device 902, the output device 903, the memory 904 and the communication interface 905 may be connected via a bus 906 or other connection methods. The memory 904 is used to store a computer program, and the computer program includes program instructions. The memory 904 may include a volatile memory (for example, a dynamic random access memory DRAM), and may also include a non-volatile memory (for example, a one-time programmable read-only memory OTPROM). In some examples, the memory 904 may further include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the device 90 via a network. The input device 902 may include: a keyboard 9021, a microphone 9022, a touch panel 9023, etc. The output device 903 may include a display panel 9031, a loudspeaker 9032, etc.
[0181] The communication interface 905 is used to realize information interaction between the block creation device 90 and other equipment devices, such as a blockchain network.
[0182] The processor 901 is used to execute the program instructions stored in the memory 904. The processor 901 (or CPU (Central Processing Unit)) is the computing core and control core of the client, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function in the above block creation method embodiment.
[0183] In some embodiments, the processor 901 described in the embodiments of the present invention may be used to perform a series of data processing, including:
[0184] Obtaining first transaction data uploaded by a first node to a blockchain network, the first transaction data being used to indicate a transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node, the first transaction data using at least one UTXO as a transaction input of the first transaction data, the total remaining digital assets of the UTXO output of the first transaction data being equal to 0 or greater than a target threshold, the at least one UTXO being selected from the remaining digital assets of the first node, the remaining digital assets of the first node including M UTXOs, where M is a positive integer;
[0185] According to the first transaction data, the first transaction data is written into a block, wherein an input of the block is the at least one UTXO.
[0186] It should be noted that the above-mentioned input device 902 and output device 903 are not necessary units of the block creation device 90. The block creation device 90 may not include the above-mentioned input device 902 and output device 903, and may also include other devices or modules, which is not limited in the embodiment of the present application.
[0187] It should be understood that the block creation devices 70 and 90 described in the embodiments of the present invention can execute the above Figure 5 The description of the block creation method in the corresponding embodiment will not be repeated here.
[0188] The embodiment of the present invention also provides a computer-readable storage medium (Memory), which is a memory device in the client for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the client and the extended storage medium supported by the client. The computer-readable storage medium provides a storage space, which stores the operating system of the client. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0189] In one embodiment, the processor may load and execute one or more first instructions stored in a computer-readable storage medium to implement the corresponding steps performed by the first client in the above-mentioned data processing embodiment; in a specific implementation, when one or more first instructions in the computer-readable storage medium are loaded and executed by a computer device, the above-mentioned Figure 3 or Figure 5For details of the method, please refer to the relevant description in the above method, which will not be repeated here.
[0190] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0191] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A transaction generation method, characterized in that: The method comprises: Receiving a transfer instruction, wherein the transfer instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node; Selecting at least one unspent transaction output UTXO from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, where M is a positive integer; Generate first transaction data according to the at least one UTXO and the transfer instruction; the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than the target threshold; the target threshold is determined from the correspondence between the transaction type and the threshold according to the transaction type of the transaction information in the transfer instruction, and the size of the target threshold is dynamically adjusted; the first transaction data at least includes the identifier of the first node, the identifier of the second node, the information of the at least one UTXO, the first digital asset and the transaction fee, the identifier of the first node is the public key or transaction address of the first node, the identifier of the second node is the public key or transaction address of the second node, and the information of the at least one UTXO includes the address of the previous block of each UTXO; Uploading the first transaction data to the blockchain network; The selecting at least one UTXO from the remaining digital assets of the first node includes: A UTXO obtained from the remaining UXTO set is added to the UTXO set, wherein the remaining UXTO set is the UTXOs among the M UTXOs except the UTXO set; the initial remaining UXTO set is a set including the M UTXOs, and the initial UTXO set is an empty set; When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is less than the target threshold, the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is forcibly used as a transaction fee, and the UTXO set is determined to be the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set is repeated until the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, or the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold.
2. The method according to claim 1, characterized in that The total remaining digital assets of the at least one UTXO are equal to the first digital assets or the difference between the total remaining digital assets of the at least one UTXO and the first digital assets is greater than the target threshold.
3. The method according to claim 1, characterized in that The selecting at least one UTXO from the remaining digital assets of the first node specifically includes: According to the remaining digital assets of each of the M UTXOs, sort the M UTXOs from largest to smallest in terms of the remaining digital assets; Determine that the first i UTXOs among the M UTXOs are the at least one UTXO, wherein the total remaining digital assets of the first i UTXOs are not less than the first digital asset, and i is a positive integer less than M.
4. A block creation method, characterized in that: The method comprises: Obtaining first transaction data uploaded by a first node to a blockchain network, the first transaction data being used to indicate the transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node, the first transaction data using at least one unspent transaction output UTXO as a transaction input of the first transaction data, the total remaining digital assets of the output UTXO of the first transaction data being equal to 0 or greater than a target threshold, the at least one UTXO being selected from the remaining digital assets of the first node, the remaining digital assets of the first node including M UTXOs, M being a positive integer, the target threshold being determined from a correspondence between a transaction type and a threshold according to a transaction type of transaction information in a transfer-out instruction, and the size of the target threshold being dynamically adjusted; the first transaction data at least includes an identifier of the first node, an identifier of the second node, information of the at least one UTXO, the first digital asset, and a transaction fee, the identifier of the first node being a public key or a transaction address of the first node, the identifier of the second node being a public key or a transaction address of the second node, and the information of the at least one UTXO including an address of a previous block of each UTXO; According to the first transaction data, write the first transaction data into a block, wherein the input of the block is the at least one UTXO; The step of selecting the at least one UTXO from the remaining digital assets of the first node includes: A UTXO obtained from the remaining UXTO set is added to the UTXO set, wherein the remaining UXTO set is the UTXOs among the M UTXOs except the UTXO set; the initial remaining UXTO set is a set including the M UTXOs, and the initial UTXO set is an empty set; When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is less than the target threshold, the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is forcibly used as a transaction fee, and the UTXO set is determined to be the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set is repeated until the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, or the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold.
5. A transaction generating device, characterized in that: include: A receiving unit, configured to receive a transfer instruction, wherein the transfer instruction is used to instruct to transfer the first digital asset from the transaction address of the first node to the transaction address of the second node; A selecting unit, configured to select at least one unspent transaction output UTXO from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, where M is a positive integer; A generating unit, configured to generate first transaction data according to the at least one UTXO and the transfer instruction; the first transaction data uses the at least one UTXO as a transaction input of the first transaction data, and the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than a target threshold; the target threshold is determined from the correspondence between the transaction type and the threshold according to the transaction type of the transaction information in the transfer instruction, and the size of the target threshold is dynamically adjusted; the first transaction data at least includes an identifier of the first node, an identifier of the second node, information of the at least one UTXO, the first digital asset, and a transaction fee, the identifier of the first node is a public key or a transaction address of the first node, the identifier of the second node is a public key or a transaction address of the second node, and the information of the at least one UTXO includes an address of a previous block of each UTXO; An uploading unit, used to upload the first transaction data to a blockchain network; Wherein, the selected unit is specifically used for: A UTXO obtained from the remaining UXTO set is added to the UTXO set, wherein the remaining UXTO set is the UTXOs among the M UTXOs except the UTXO set; the initial remaining UXTO set is a set including the M UTXOs, and the initial UTXO set is an empty set; When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is less than the target threshold, the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is forcibly used as a transaction fee, and the UTXO set is determined to be the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set is repeated until the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, or the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold.
6. A block creation device, characterized in that: include: An acquisition unit is used to acquire first transaction data uploaded by a first node to a blockchain network, the first transaction data is used to indicate the transfer of a first digital asset from a transaction address of the first node to a transaction address of a second node, the first transaction data uses at least one UTXO as a transaction input of the first transaction data, the total remaining digital assets of the UTXO output of the first transaction data are equal to 0 or greater than a target threshold, the at least one UTXO is selected from the remaining digital assets of the first node, the remaining digital assets of the first node include M UTXOs, M is a positive integer, the target threshold is determined from the correspondence between the transaction type and the threshold according to the transaction type of the transaction information in the transfer instruction, and the size of the target threshold is dynamically adjusted; the first transaction data at least includes an identifier of the first node, an identifier of the second node, information of the at least one UTXO, the first digital asset, and a transaction fee, the identifier of the first node is a public key or a transaction address of the first node, the identifier of the second node is a public key or a transaction address of the second node, and the information of the at least one UTXO includes an address of a previous block of each UTXO; a creating unit, configured to create a block from the first transaction data according to the first transaction data, wherein an input of the block is the at least one UTXO; The step of selecting the at least one UTXO from the remaining digital assets of the first node includes: A UTXO obtained from the remaining UXTO set is added to the UTXO set, wherein the remaining UXTO set is the UTXOs among the M UTXOs except the UTXO set; the initial remaining UXTO set is a set including the M UTXOs, and the initial UTXO set is an empty set; When the total remaining digital assets of all UTXOs in the UTXO set is equal to the first digital asset, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold, determining that the UTXO set is the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is less than the target threshold, the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is forcibly used as a transaction fee, and the UTXO set is determined to be the at least one UTXO; When the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, the step of adding a UTXO obtained from the remaining UTXO set to the UTXO set is repeated until the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, or the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital asset is greater than the target threshold.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more computer instructions, and when the one or more computer instructions are called by a computer, the computer implements the method according to any one of claims 1 to 4.