CN111292190A - Transaction generation method, block creation method, related device and equipment - Google Patents
Transaction generation method, block creation method, related device and equipment Download PDFInfo
- Publication number
- CN111292190A CN111292190A CN202010076933.4A CN202010076933A CN111292190A CN 111292190 A CN111292190 A CN 111292190A CN 202010076933 A CN202010076933 A CN 202010076933A CN 111292190 A CN111292190 A CN 111292190A
- Authority
- CN
- China
- Prior art keywords
- transaction
- utxo
- node
- transaction data
- utxos
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- Strategic Management (AREA)
- Theoretical Computer Science (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
Description
技术领域technical field
本申请涉及互联网技术领域,具体涉及数据处理技术领域,尤其涉及一种交易生成方法、区块创建方法及相关装置、设备。The present application relates to the field of Internet technologies, in particular to the field of data processing technologies, and in particular, to a transaction generation method, a block creation method, and related devices and equipment.
背景技术Background technique
在区块链技术领域,“粉尘”是人们通常可以将其忽略的极少量的货币或代币。以比特币为例,比特币的最小单位是1satoshi,也就是0.00000001比特币,通常我们将小于几百satoshis的数量视为粉尘。也就是说,粉尘是很小部分的交易或金额,通常这部分金额都不值得交易,因为他们的交易费用常常都高于其本身价值。In the world of blockchain technology, "dust" is an extremely small amount of currency or token that people can usually ignore. Taking bitcoin as an example, the smallest unit of bitcoin is 1 satoshi, which is 0.00000001 bitcoin, and usually we consider the amount less than a few hundred satoshis as dust. That is, dust is a small fraction of a transaction or amount that is usually not worth trading because their transaction fees are often higher than they are worth.
目前粉尘攻击(Dusting Attack)是区块链领域面临的一个问题,粉尘攻击的过程是:粉尘攻击实施者通过向大量的用户的交易地址中发生少量的satoshi,生成“粉尘化”交易(也称为粉尘交易),进而,追踪粉尘交易,关联出该地址的其他关联地址,通过读这些关联地址进行行为分析,就可以分析一个地址背后的公司或个人,破坏比特币本身的匿名性。进一步地,受到攻击后,容易发起钓鱼威胁。而且,大量的粉尘交易会产生大量的待打包交易,造成区块的拥堵,增加交易费用,降低区块链网络的运行效率。At present, dusting attack is a problem facing the blockchain field. The process of dusting attack is: the implementer of the dusting attack generates a "dusting" transaction (also known as "dusting") by generating a small amount of satoshi to the transaction addresses of a large number of users. It is a dust transaction), and then, trace the dust transaction and associate other associated addresses of the address. By reading these associated addresses for behavior analysis, the company or individual behind an address can be analyzed, destroying the anonymity of Bitcoin itself. Further, after being attacked, it is easy to launch a phishing threat. 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.
如何降低粉尘交易的产生是当下区块链技术领域亟需解决的技术问题。How to reduce the generation of dust transactions is a technical problem that needs to be solved urgently in the current blockchain technology field.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种交易生成方法、区块创建方法及相关装置、设备,可以避免粉尘交易的产生,提高区块链网络的运行效率。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 operation efficiency of the blockchain network.
第一方面,本申请实施例提供了一种交易生成方法,应用于区块链网络中交易的发起方的节点,所述方法包括: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:
接收转出指令,所述转出指令用于指示将第一数字资产从所述第一节点的交易地址转移至所述第二节点的交易地址;receiving a transfer-out instruction, where the transfer-out instruction is used to instruct the transfer of the first digital asset from the transaction address of the first node to the transaction address of the second node;
从所述第一节点的剩余数字资产中选定至少一个未花费交易输出(UnspentTransaction Output,UTXO),其中,所述剩余数字资产包括M个UTXO,M为正整数;Select at least one unspent transaction output (UnspentTransaction 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;
根据所述至少一个UTXO和所述转出指令生成第一交易数据;所述第一交易数据以所述至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值;The first transaction data is generated according to the at least one UTXO and the transfer-out instruction; the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the output of the first transaction data is The total remaining digital assets of UTXO is equal to 0 or greater than the target threshold;
将所述第一交易数据上传至区块链网络。Upload the first transaction data to the blockchain network.
在一种可能的实现中,所述至少一个UTXO的总剩余数字资产等于所述第一数字资产或所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额大于所述目标阈值。In a possible implementation, the total remaining digital asset of the at least one UTXO is equal to the first digital asset or the difference between the total remaining digital asset of the at least one UTXO and the first digital asset is greater than the target threshold.
在一种可能的实现中,所述从所述第一节点的剩余数字资产中选定至少一个UTXO,具体包括:In a possible implementation, the selecting at least one UTXO from the remaining digital assets of the first node specifically includes:
将剩余UXTO集合中获取的一个UTXO加入到UTXO集合,所述剩余UXTO集合为所述M个UXTO中除所述UTXO集合外的UTXO;A UTXO obtained in the remaining UXTO set is added to the UTXO set, and the remaining UXTO set is the UTXO other than the UTXO set in the M UXTOs;
在所述UTXO集合中所有UTXO的总剩余数字资产等于所述第一数字资产时,确定所述UTXO集合为所述至少一个UTXO;When the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, determine that the UTXO set is the at least one UTXO;
在所述UTXO集合中所有UTXO的总剩余数字资产大于所述第一数字资产且所述UTXO集合中所有UTXO的总剩余数字资产与所述第一数字资产的差额大于所述目标阈值时,确定所述UTXO集合为所述至少一个UTXO;When the total remaining digital assets of all UTXOs in the UTXO set are greater than the first digital assets and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital assets is greater than the target threshold, determine the UTXO set is the at least one UTXO;
在所述UTXO集合中所有UTXO的总剩余数字资产小于所述第一数字资产时,重复执行所述将剩余UXTO集合中获取的一个UTXO加入到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 one UTXO obtained in the remaining UXTO set to the UTXO set is repeatedly performed.
在一种可能的实现中,所述从所述第一节点的剩余数字资产中选定至少一个UTXO,具体包括:In a possible implementation, the selecting at least one UTXO from the remaining digital assets of the first node specifically includes:
根据所述M个UTXO中的每一个UTXO的剩余数字资产,按剩余数字资产的从大到小对所述M个UTXO进行排序;According to the remaining digital assets of each UTXO in the M UTXOs, sort the M UTXOs in descending order of the remaining digital assets;
确定所述M个UTXO中前i个UTXO为所述至少一个UTXO,其中,所述前i个UTXO的总剩余数字资产不小于所述第一数字资产,i小于M的为正整数。It is determined 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 assets, and if i is less than M is a positive integer.
可选地,所述前i-1个UTXO的总剩余数字资产小于所述第一数字资产。Optionally, the total remaining digital assets of the first i-1 UTXOs are less than the first digital assets.
可选地,所述前i个UTXO的总剩余数字资产与所述第一数字资产的差额等于0或大于所述目标阈值。Optionally, the difference between the total remaining digital assets of the first i UTXOs and the first digital assets is equal to 0 or greater than the target threshold.
在一种可能的实现中,所述第一交易数据还包括交易费用,所述方法还包括:In a possible implementation, the first transaction data further includes transaction fees, and the method further includes:
在所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额小于所述目标阈值时,将所述差额作为所述第一交易数据的交易费用。When the difference between the total remaining digital assets of the at least one UTXO and the first digital asset is smaller than the target threshold, the difference is used as the transaction fee for the first transaction data.
在一种可能的实现中,所述转出指令还包括交易信息,所述方法还包括:In a possible implementation, the transfer-out instruction further includes transaction information, and the method further includes:
根据所述交易信息识别所述交易信息的交易类型;Identify the transaction type of the transaction information according to the transaction information;
根据交易类型与阈值的对应关系,确定所述交易信息的类型确定所述目标阈值。According to the corresponding relationship between the transaction type and the threshold, the type of the transaction information is determined to determine the target threshold.
第二方面,本申请实施例提供了一种区块创建方法,应用于区块链网络中的挖矿节点,所述方法包括:In a second aspect, the embodiments of the present application provide a method for creating a block, which is applied to a mining node in a blockchain network, and the method includes:
获取由第一节点上传到区块链网络中的第一交易数据,所述第一交易数据用于指示将第一数字资产从所述第一节点的交易地址转移至第二节点的交易地址,所述第一交易数据以至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值,所述至少一个UTXO是从所述第一节点的剩余数字资产中选定的,所述第一节点的剩余数字资产包括M个UTXO,M为正整数;obtaining the first transaction data uploaded by the first node into the blockchain network, where the first transaction data is used to instruct the transfer of the first digital asset from the transaction address of the first node to the transaction address of the second node, The first transaction data uses at least one UTXO as the transaction input of the first transaction data, the total remaining digital assets of the UTXO output from the first transaction data is equal to 0 or greater than the target threshold, and the at least one UTXO is from Selected from the remaining digital assets of the first node, the remaining digital assets of the first node include M UTXOs, where M is a positive integer;
根据所述第一交易数据,将第一交易数据写入到区块,其中,所述区块的输入为所述至少一个UTXO。According to the first transaction data, the first transaction data is written into a block, wherein the input of the block is the at least one UTXO.
第三方面,本申请实施例提供了一种交易生成装置,应用于区块链网络中交易的发起方的节点,包括: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:
接收单元,用于接收转出指令,所述转出指令用于指示将第一数字资产从所述第一节点的交易地址转移至所述第二节点的交易地址;a receiving unit, configured to 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;
选定单元,用于从所述第一节点的剩余数字资产中选定至少一个未花费交易输出(Unspent Transaction Output,UTXO),其中,所述剩余数字资产包括M个UTXO,M为正整数;A selection unit, configured to select at least one unspent transaction output (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;
生成单元,用于根据所述至少一个UTXO和所述转出指令生成第一交易数据;所述第一交易数据以所述至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值;A generating unit, configured to generate first transaction data according to the at least one UTXO and the transfer-out instruction; the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the first transaction data The total remaining digital assets of the UTXO output of the transaction data is equal to 0 or greater than the target threshold;
上传单元,用于将所述第一交易数据上传至区块链网络。an uploading unit, configured to upload the first transaction data to the blockchain network.
在一种可能的实现中,所述至少一个UTXO的总剩余数字资产等于所述第一数字资产或所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额大于所述目标阈值。In a possible implementation, the total remaining digital asset of the at least one UTXO is equal to the first digital asset or the difference between the total remaining digital asset of the at least one UTXO and the first digital asset is greater than the target threshold.
第四方面,本申请实施例提供了一种区块创建装置,应用于区块链网络中的挖矿节点,包括:In a fourth aspect, an embodiment of the present application provides a block creation device, which is applied to a mining node in a blockchain network, including:
获取单元,用于获取由第一节点上传到区块链网络中的第一交易数据,所述第一交易数据用于指示将第一数字资产从所述第一节点的交易地址转移至第二节点的交易地址,所述第一交易数据以至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值,所述至少一个UTXO是从所述第一节点的剩余数字资产中选定的,所述第一节点的剩余数字资产包括M个UTXO,M为正整数;an acquisition unit, configured to acquire the first transaction data uploaded by the first node into the blockchain network, where the first transaction data is used to instruct the transfer of the first digital asset from the transaction address of the first node to the second The transaction address of the node, the first transaction data uses at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output from the first transaction data is equal to 0 or greater than the target threshold, the At least one UTXO is selected from the remaining digital assets of the first node, and the remaining digital assets of the first node include M UTXOs, where M is a positive integer;
创建单元,用于根据所述第一交易数据,将第一交易数据创建区块,其中,所述区块的输入为所述至少一个UTXO。The creating unit is configured 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.
第五方面,本申请实施例提供了一种交易生成装置,包括处理器和存储器,所述处理器和存储器耦合,其中,所述存储器用于存储计算机指令,所述处理器用于执行所述计算机指令,以使所述交易生成装置实现如权利要求第一方面或第一方面任意一种实现所述的方法。In a fifth aspect, an embodiment of the present application provides a transaction generation device, including a processor and a memory, 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 to cause the transaction generating device to implement the method as claimed in the first aspect or any one of the first aspects.
第六方面,本申请实施例提供了一种区块创建装置,包括处理器和存储器,所述处理器和存储器耦合,其中,所述存储器用于存储计算机指令,所述处理器用于执行所述计算机指令,以使所述区块创建装置实现如权利要求第一方面或第二方面任意一种实现所述的方法。In a sixth aspect, an embodiment of the present application provides a block creation device, including a processor and a memory, the processor and the memory are coupled, wherein the memory is used for storing computer instructions, and the processor is used for executing the Computer instructions to cause the block creation apparatus to implement a method as claimed in any one of the first or second claims.
第七方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机存储介质存储有一条或多条计算机指令,所述一条或多条计算机指令在被计算机调用时使得所述计算机实现如权利要求第一方面或第一方面任意一种实现所述的方法。In a seventh aspect, embodiments of the present application further provide a computer-readable storage medium, where one or more computer instructions are stored in the computer storage medium, and the one or more computer instructions cause the computer to be invoked by the computer. A method as claimed in the first aspect or any one implementation of the first aspect is implemented.
第八方面,本申请实施例提供了一种计算机程序,当所述计算机程序被计算机设备运行时,实现如权利要求第一方面或第一方面任意一种实现所述的方法。In an eighth aspect, an embodiment of the present application provides a computer program, when the computer program is run by a computer device, the method as claimed in the first aspect or any one of the first aspects is implemented.
第九方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机存储介质存储有一条或多条计算机指令,所述一条或多条计算机指令在被计算机调用时使得所述计算机实现如权利要求第二方面或第二方面任意一种实现所述的方法。In a ninth aspect, embodiments of the present application further provide a computer-readable storage medium, where the computer storage medium stores one or more computer instructions, and the one or more computer instructions cause the computer to be invoked by the computer. A method as claimed in the second aspect or any one implementation of the second aspect is implemented.
第十方面,本申请实施例提供了一种计算机程序,当所述计算机程序被计算机设备运行时,实现如权利要求第二方面或第二方面任意一种实现所述的方法。In a tenth aspect, an embodiment of the present application provides a computer program, when the computer program is run by a computer device, the method as claimed in the second aspect or any one of the second aspects is implemented.
本申请实施例中,第一节点接收转出指令,该转出指令用于指示将第一数字资产从第一节点的交易地址转移至第二节点的交易地址;进而,从所述第一节点的剩余数字资产中选定至少一个UTXO,从而,根据该至少一个UTXO和转出指令生成第一交易数据,将第一交易数据上传至区块链网络;其中,第一交易数据以该至少一个UTXO作为第一交易数据的交易输入,该第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值;从而避免粉尘交易的产生,提高区块链网络的运行效率。In this embodiment of the present application, the first node receives a transfer-out instruction, and the transfer-out instruction is used to instruct the transfer of the first digital asset from the transaction address of the first node to the transaction address of the second node; further, from the first node At least one UTXO is selected from the remaining digital assets of , so that the first transaction data is generated according to the at least one UTXO and the transfer instruction, and the first transaction data is uploaded to the blockchain network; wherein, the first transaction data is represented by the at least one UTXO. UTXO is used as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output from the first transaction data is equal to 0 or greater than the target threshold; thus avoiding the generation of dust transactions and improving the operation efficiency of the blockchain network.
附图说明Description of drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.
图1是本申请实施例提供的一种区块链网络的架构的示意图;1 is a schematic diagram of the architecture of a blockchain network provided by an embodiment of the present application;
图2是本申请实施例提供的一种区块链的数据结构的示意图;2 is a schematic diagram of a data structure of a blockchain provided by an embodiment of the present application;
图3是本申请实施例提供的一种交易生成方法的流程示意图;3 is a schematic flowchart of a transaction generation method provided by an embodiment of the present application;
图4A是本申请实施例提供的一种第一节点从第一节点的剩余数字资产中选定至少一个UTXO的实现方法的流程示意图;4A is a schematic flowchart of a method for implementing a first node to select at least one UTXO from the remaining digital assets of the first node according to an embodiment of the present application;
图4B是本申请实施例提供的另一种第一节点从第一节点的剩余数字资产中选定至少一个UTXO的实现方法的流程示意图;4B is a schematic flowchart of another implementation method for the first node to select at least one UTXO from the remaining digital assets of the first node provided by an embodiment of the present application;
图4C是本申请实施例提供的一种确定M个UTXO中前i个UTXO为至少一个UTXO的实现方法的流程示意图;4C is a schematic flowchart of a method for implementing a method for determining that the first i UTXOs among the M UTXOs are at least one UTXO provided by an embodiment of the present application;
图5是本申请另一实施例提供的一种区块创建方法的流程示意图;5 is a schematic flowchart of a block creation method provided by another embodiment of the present application;
图6是本申请实施例提供的一种交易生成的结构示意图;6 is a schematic structural diagram of a transaction generation provided by an embodiment of the present application;
图7是本申请实施例提供的一种区块创建的结构示意图;7 is a schematic structural diagram of a block creation provided by an embodiment of the present application;
图8是本申请实施例提供的另一种交易生成的结构示意图;8 is a schematic structural diagram of another transaction generation provided by an embodiment of the present application;
图9是本申请实施例提供的另一种区块创建的结构示意图。FIG. 9 is a schematic structural diagram of another block creation provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
首先对本申请实施例涉及的概念进行描述:First, the concepts involved in the embodiments of the present application are described:
(1)区块链(Blockchain):区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链,本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层。(1) Blockchain: Blockchain is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify the validity of its information. security (anti-counterfeiting) and generating the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
区块链一般被划分为三种类型:公有链(Public Blockchain),私有链(PrivateBlockchain)和联盟链(Consortium Blockchain)。Blockchains are generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
其中,去中心化程度最高的是公有链。常见的公有链有比特币、以太坊,加入公有链的节点/参与者都可以读取链上的数据、发布交易以及竞争新区块的记账权等;而且,各节点/参与者可自由加入以及退出公有链。私有链则相反,私有链的记账权限由某个组织或者机构控制,数据读取权限也受该组织或机构的控制,参与者少且不能随意加入到私有链,需经过组织或者机构的审核。Among them, the most decentralized is the public chain. Common public chains include Bitcoin and Ethereum. Nodes/participants who join the public chain can read the data on the chain, publish transactions, and compete for the accounting rights of new blocks. Moreover, each node/participant can join freely. And exit the public chain. The private chain is the opposite. The accounting authority of the private chain is controlled by an organization or institution, and the data reading authority is also controlled by the organization or institution. There are few participants and cannot join the private chain at will, and it needs to be reviewed by the organization or institution. .
联盟链是也称为共同体区块链,是指其共识过程受到预选节点控制的区块链,是公有链和私有链的混合,可实现“部分去中心化”。链上各个节点通常有与之相对应的实体机构或者组织;参与者通过授权加入网络并组成利益相关联盟,共同维护区块链运行。通过联盟链,新来的参与者可以加入已形成的区块链并共享数据,而不必从头开始构建它。同时,通过共同解决常见问题,公司减少了开发成本和时间费用。The consortium chain is also known as the community blockchain, which refers to the blockchain whose consensus process is controlled by pre-selected nodes. It is a mixture 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. With consortium chains, 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, the company reduces development costs and time expenses.
不论是公有链、私有链还是联盟链,都可能提供智能合约的功能。区块链上的智能合约是在区块链系统上可以被交易触发执行的合约。智能合约可以通过代码的形式定义。Whether it is a public chain, a private chain or a consortium chain, it is possible to 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.
(2)共享账本,用于提供数据指纹的存储和查询等操作的功能,将对文件或设备的操作的记录数据(本申请中也称为日志、基准数据)发送到区块链网络中的其他节点,其他节点验证有效后,将记录数据存入临时区块中,还可以向发起操作的节点发送确认。(2) Shared ledger, which is used to provide functions such as storage and query of data fingerprints, and send the record data of operations on files or devices (also referred to as logs and benchmark data in this application) to the blockchain network. Other nodes, after the other nodes verify that they are valid, store the recorded data in the temporary block, and can also send confirmation to the node that initiated the operation.
(3)智能合约,计算机化的协议,可以执行某个合约的条款,通过部署在共享账本上的用于在满足一定条件时而执行的代码实现,根据实际的业务需求代码用于完成自动化的交易,智能合约不仅限于执行用于交易的合约,还可以执行对接收的信息进行处理的合约。(3) Smart contracts, computerized agreements, which can execute the terms of a contract, are implemented through the code deployed on the shared ledger for execution when certain conditions are met, and the code is used to complete automated transactions according to actual business needs. , smart contracts are not limited to executing contracts for transactions, but can also execute contracts that process received information.
(4)、公钥、私钥、交易地址(4), public key, private key, transaction address
加入区块链网络的节点具备一对公私钥,具体可采用非对称加密算法创建,例如,节点可以先随机生成私钥,进而,基于非对称加密算法的原理,由私钥计算出公钥的,再由公钥经过一系列数字签名运算可以得到交易地址(也称为钱包地址)。也就是说,已知一个节点的公钥,可以计算出该节点的交易地址。在一些实施例中,公钥也可以作为钱包地址或钱包地址的标识。Nodes that join the blockchain network have a pair of public and private keys, which can be created by an asymmetric encryption algorithm. For example, a node can randomly generate a private key first, and then, based on the principle of asymmetric encryption algorithm, calculate the public key from the private key. , and then through a series of digital signature operations with the public key, the transaction address (also known as the wallet address) can be obtained. That is to say, knowing the public key of a node, the transaction address of the node can be calculated. In some embodiments, the public key may also serve as a wallet address or an identification of a wallet address.
其中,非对称加密算法可包括但不限于:Elgamal算法、Rabin算法、Diffie-Hellman算法、椭圆曲线加密(ECC)算法。其中,密钥对包括公钥和私钥;公钥通常被广播到区块链网络,私钥由节点保管。需要说明的是,区块链网络中的公私钥是具有唯一性。The asymmetric encryption algorithm may include, but is not limited to: Elgamal algorithm, Rabin algorithm, Diffie-Hellman algorithm, and Elliptic Curve Encryption (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.
如图1所示为本申请实施例提供的一种区块链网络100的架构的示意图。区块链100包括多个区块链节点设备(在本申请中也被称为节点),例如节点101、节点102、节点103、节点104等。虽然图1中示出的区块链网络100包括四个节点,但应领会,在实际应用中,区块链系统100可包括更多或更少的节点。可选地,各个节点可以是区块链网络中各个客户端,可以为手机、个人计算机、平板电脑、车载单元、服务器等电子设备,也可是应用程序。FIG. 1 is a schematic diagram of the architecture of a blockchain network 100 according to an embodiment of the present application. The blockchain 100 includes a plurality of blockchain node devices (also referred to in this application as nodes), such as
为了保证区块链网络100内的信息互通,区块链网络100中的每个节点之间可以存在信息连接,节点之间可以通过上述信息连接进行信息传输。例如,当区块链网络中的任意节点初次接收到交易数据后,验证该交易数据的合法性,在该交易数据合法时,可以向其邻居节点广播该交易数据,以便于区块链网络中其他节点接收交易数据。应理解,在该节点再次接收到同样的交易数据后,其不再向邻居节点广播,以避免交易数据的无限传播。In order to ensure the 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 the nodes through the above-mentioned information connection. For example, when any node in the blockchain network receives transaction data for the first time, it verifies the legality of the transaction data. When the transaction data is legal, it can broadcast the transaction data to its neighbor nodes, so as to facilitate the blockchain network. Other nodes receive transaction data. It should be understood that after the node receives the same transaction data again, it will no longer broadcast it to neighbor nodes, so as to avoid the infinite spread of transaction data.
在一种场景中,节点101可是交易数据的发起方(本申请中也称为第一节点),第一节点可以基于接收转出指令,该转出指令用于指示将第一数字资产从所述第一节点的交易地址转移至所述第二节点(数字资产的接收方),如节点103的交易地址;进而,查看该第一节点所有的UTXO,从所述第一节点的剩余数字资产中选定至少一个UTXO;从而,根据所述至少一个UTXO和所述转出指令生成第一交易数据。其中,所述第一交易数据以所述至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值,以避免粉尘交易的生成。In one scenario, the
进一步地,第一节点将第一交易数据上传至区块链网络。Further, the first node uploads the first transaction data to the blockchain network.
节点102、节点104可以是挖矿节点,挖矿节点在接收到上述第一交易数据后,根据第一交易数据,将第一交易数据写入到区块,其中,区块的输入为所述至少一个UTXO。挖矿节点在生成区块后,将区块发布至区块链网络,新区块的传播方式与交易数据的传播方式类似,不再赘述,接收到新区块的挖矿节点,可以检测该区块内容的合法性,以及查看该区块是不是在最长合法链上,进而,各个挖矿节点可以存储最大合法链,以保证各个挖矿节点存储数据的一致。The
一种实现中,区块链网络100中的每个节点可以均存储一条相同的区块链。区块链由多个区块组成,应理解,区块链包括一系列按照产生的先后时间顺序相互接续的区块(Block),新区块一旦加入到区块链中就不会再被移除,区块中记录了区块链系统中节点提交的记录数据。区块链网络中的每个节点均存储一条相同的区块链。区块链由多个区块组成,如图2所示,为本申请实施例提供的一种区块链的数据结构的示意图,区块链由多个区块组成,创始块中包括区块头和区块主体,区块头中存储有交易数据、版本号和时间戳等,区块主体中存储有交易数据;创始块的下一区块以创始块为父区块,下一区块中同样包括区块头和区块主体,区块头中存储有当前区块的交易数据、父区块中数据的哈希值、版本号和时间戳等,并以此类推,使得区块链中每个区块中存储的区块数据均与父区块中存储的区块数据存在关联,保证了区块中交易数据的安全性。In one implementation, each node in the blockchain network 100 may store an identical blockchain. The blockchain consists of multiple blocks. It should be understood that the blockchain includes a series of blocks (Blocks) that follow each other in chronological order. 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. Every node in a blockchain network stores an identical blockchain. The blockchain consists of multiple blocks, as shown in FIG. 2 , which is a schematic diagram of the data structure of a blockchain provided by the embodiment of the present application. The blockchain consists of multiple blocks, and the initial block includes a block header. and 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 same in the next block Including the block header and block body, the block header stores the transaction data of the current block, the hash value, version number and timestamp of the data in the parent block, and so on, so that each block in the blockchain The block data stored in the block is associated with the block data stored in the parent block, which ensures the security of the transaction data in the block.
可选地,区块链可以通过未花费交易输出(Unspent Transaction Output,UTXO)模型来记录与相关联的节点设备相关联的各个交易数据。其中,未花费交易输出是指该区块链中未出现在其他区块的交易输入中的交易输出。Optionally, the blockchain may record various transaction data associated with associated node devices through an Unspent Transaction Output (UTXO) model. Among them, the unspent transaction output refers to the transaction output that does not appear in the transaction input of other blocks in the blockchain.
区块体可以包括至少一个交易输入,如交易输入in1、交易输入in2等,以及至少一个交易输出,如交易输出out1、交易输出out2等。针对每一个交易输出,可以包括该交易输出对应的UTXO的先前区块在区块链网络中的地址,例如为该先前区块的哈希值;也可以包括交易输出的剩余数字资产、数字签名、数字资产的接收方的地址等。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, and so on. For each transaction output, it can include the address in the blockchain network of the previous block of the UTXO corresponding to the transaction output, such as the hash value of the previous block; it can also include the remaining digital assets and digital signatures of the transaction output. , the address of the recipient of the digital asset, etc.
可选地,区块链网络中的每一节点可以存储有仅与该节点相关联的区块链。每一区块链可以记录与相关联的节点有关的交易数据。Optionally, each node in the blockchain network may store only the blockchain associated with that node. Each blockchain can record transaction data related to the associated node.
下面介绍本申请实施例提供的一种交易生成方法,该方法可以由交易的发起方执行,本申请实施例以交易的发起方为区块链网络中的节点,这里也称第一节点,如图3所示,该方法包括但不限于如下部分或全部步骤:The following introduces a transaction generation method provided by the 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, which is also referred to as the first node here. As shown in Figure 3, the method includes but is not limited to some or all of the following steps:
S11:接收转出指令,转出指令用于指示将第一数字资产从第一节点的交易地址转移至第二节点的交易地址。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.
第一节点可以基于客户端接收用户输入的交易信息、该交易信息可以包括第一数字资产、资产转出方(第一节点的标识)、资产转入方(第二节点的标识)、交易附加信息等,其中,交易附加信息中可以包括交易信息的交易类型、交易的详细信息等。交易的详细信息可以包括第一数字资产兑换的产品或服务。例如,当交易是详细信息为第一节点花费第一数字资产向第二节点兑换指定产品,如手机。The first node may receive the transaction information input by the user based on the client, and the transaction information may include the first digital asset, the asset transfer party (the identifier of the first node), the asset transfer party (the identifier of the second node), the transaction additional information, etc., wherein, the transaction additional information may include the transaction type of the transaction information, the detailed information of the transaction, and the like. The detailed information of the transaction may include the product or service exchanged by the first digital asset. For example, when the transaction is detailed information, the first node spends the first digital asset to exchange the specified product, such as a mobile phone, to the second node.
其中,交易类型可以包括但不限于小额交易、中额交易和大额交易等。小额交易可以是交易资产(这里指第一数字资产)小于第一阈值的交易,中额交易可以是交易资产大于第一阈值且小于第二阈值的交易,大额交易可以是交易资产大于第二阈值的交易等。第一阈值小于第二阈值。The transaction types may include, but are not limited to, small-value transactions, medium-value transactions, and large-value transactions. A small-value transaction can be a transaction in which the transaction asset (here, the first digital asset) is less than the first threshold, a medium-value transaction can be a transaction in which the transaction asset is greater than the first threshold and less than the second threshold, and a large-value transaction can be a transaction in which the transaction asset is greater than the first threshold. Two-threshold transactions, etc. The first threshold is smaller than the second threshold.
应理解,交易类型以交易购买的产品或服务来区分,例如,交易类型可以包括日用品交易、电子产品交易、影视内容交易等。交易类型还可以其他方式来划分,此处不作限定。It should be understood that the transaction types are distinguished by the products or services purchased in the transaction. For example, the transaction types may include daily necessities transactions, electronic product transactions, video content transactions, and the like. Transaction types can also be divided in other ways, which are not limited here.
可选地,S11之后,该方法还可以包括:第一节点根据交易信息识别交易信息的交易类型;根据交易类型与阈值的对应关系,确定交易信息的类型确定目标阈值。进而,动态调整目标阈值的大小,以更好适应不同的交易场景。Optionally, after S11, the method may further include: the first node identifies the transaction type of the transaction information according to the transaction information; determines the type of the transaction information and determines the target threshold according to the corresponding relationship between the transaction type and the threshold. Furthermore, the size of the target threshold is dynamically adjusted to better adapt to different transaction scenarios.
S12:从第一节点的剩余数字资产中选定至少一个UTXO,其中,剩余数字资产包括M个UTXO,M为正整数。S12: Select at least one UTXO from the remaining digital assets of the first node, wherein the remaining digital assets include M UTXOs, and M is a positive integer.
第一节点可以查找其剩余数字资产,即余额,也就是查找出第一节点所有的UTXO。这里以第一节点包括M个UTXO为例来说明,应理解,第一节点包括的UTXO总数随着第一节点发布交易不断变化,不同节点,UTXO总数可能不同。The first node can find its remaining digital assets, that is, the balance, that is, to find out all the UTXOs of the first node. Here, the first node includes M UTXOs as an example for illustration. It should be understood that the total number of UTXOs included in the first node is constantly changing as the first node publishes transactions, and the total number of UTXOs may be different for different nodes.
为避免粉尘交易的产生,方式一:可以使生成的交易数据中的输入的UTXO的总剩余数字资产(也成为总余额)与第一数字资产的差额等于0或大于目标阈值,这里要求选定的至少一个UTXO的总剩余数字资产等于第一数字资产或要求选定的至少一个UTXO的总剩余数字资产与第一数字资产之间的差额大于目标阈值。方式二:可以在生成的交易数据中的输入的UTXO的总剩余数字资产(也成为总余额)与第一数字资产的差额小于目标阈值时,将该差额强制作为交易费用。应理解,选定的至少一个UTXO的总剩余数字资产与第一数字资产之间的差额是指选定的至少一个UTXO的总剩余数字资产减去第一数字资产后的差额,该差额大于0。In order 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 assets can be equal to 0 or greater than the target threshold, which is required to be selected here. The total remaining digital assets of the at least one UTXO of 1 is equal to the first digital asset or the difference between the total remaining digital assets of the selected at least one 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 of the input UTXO in the generated transaction data (also referred to as the total balance) 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 the selected at least one UTXO and the first digital asset refers to the difference between the total remaining digital assets of the selected at least one UTXO minus the first digital asset, and the difference is greater than 0. .
对于比特币来说,目标阈值可以是1000satoshi(也就是0.00001比特币)、2000satoshi(也就是0.00002比特币)、900satoshi(也就是0.00001比特币),或者其他数值。For Bitcoin, the target threshold can be 1000 satoshi (that is, 0.00001 Bitcoin), 2000 satoshi (that is, 0.00002 Bitcoin), 900 satoshi (that is, 0.00001 Bitcoin), or some other value.
对于其他数字货币来说,目标阈值还可以是其他阈值,本申请实施例不作限定。For other digital currencies, the target threshold may also be other thresholds, which are not limited in this embodiment of the present application.
对应于上述方式一或方式二,第一节点从第一节点的剩余数字资产中选定至少一个UTXO的可以包括但不限于如下三种实现:Corresponding to the above-mentioned
实现(一):Implementation (1):
如图4A所示,该实现(一)可以包括但不限于如下步骤:As shown in Figure 4A, the implementation (1) may include but not be limited to the following steps:
S121:将剩余UXTO集合中获取的一个UTXO加入到UTXO集合,剩余UXTO集合为M个UXTO中除UTXO集合外的UTXO。S121: Add one UTXO obtained from the remaining UXTO set to the UTXO set, and the remaining UXTO set is the UTXO except the UTXO set among the M UXTOs.
应理解,初始执行S121前,剩余UXTO集合为M个UTXO的集合,UTXO集合为空集;初始执行S121后,UTXO集合中包括初始执行S121时获取的一个UTXO。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 during the initial execution of S121.
S122:比对UTXO集合中所有UTXO的总剩余数字资产与第一数字资产的大小。S122: Compare the total remaining digital assets of all UTXOs in the UTXO set with the size of the first digital asset.
在UTXO集合中所有UTXO的总剩余数字资产等于第一数字资产时,则执行S123;在UTXO集合中所有UTXO的总剩余数字资产大于第一数字资产时,则执行S124;在UTXO集合中所有UTXO的总剩余数字资产大于第一数字资产时,则执行S124;在UTXO集合中所有UTXO的总剩余数字资产小于第一数字资产时,重复执行S121,指导UTXO集合中所有UTXO的总剩余数字资产不小于第一数字资产。When the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, execute S123; when the total remaining digital assets of all UTXOs in the UTXO set is greater than the first digital asset, execute S124; if all UTXOs in the UTXO set are When the total remaining digital assets of all UTXOs in the UTXO set are greater than the first digital assets, then execute S124; when the total remaining digital assets of all UTXOs in the UTXO set are less than the first digital assets, execute S121 repeatedly to instruct the total remaining digital assets of all UTXOs in the UTXO set to not less than the first digital asset.
S123:确定UTXO集合为至少一个UTXO。S123: Determine that the set of UTXOs is at least one UTXO.
在待选定的UTXO的剩余数字资产等于第一数字资产时,选定待选定的UTXO。When the remaining digital assets of the UTXO to be selected are equal to the first digital asset, the UTXO to be selected is selected.
S124:判断UTXO集合中所有UTXO的总剩余数字资产与第一数字资产的差额是否大于目标阈值,如果是,则执行S123,否则,执行S121,并重复执行S124,直到UTXO集合中所有UTXO的总剩余数字资产与第一数字资产的差额大于目标阈值。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 repeatedly execute S124 until the total of all UTXOs in the UTXO set is The difference between the remaining digital assets and the first digital assets is greater than the target threshold.
可见,上述实现(一)可以保证交易输出大于目标阈值,避免生成粉尘交易。It can be seen that the above implementation (1) can ensure that the transaction output is greater than the target threshold and avoid generating dust transactions.
实现(二):Implementation (two):
如图4B所示,该实现(二)可以包括但不限于如下步骤:As shown in Figure 4B, this realization (2) may include but not be limited to the following steps:
S125:根据M个UTXO中的每一个UTXO的剩余数字资产,按剩余数字资产的从大到小对M个UTXO进行排序;S125: According to the remaining digital assets of each UTXO in the M UTXOs, sort the M UTXOs in descending order of the remaining digital assets;
S126:确定M个UTXO中前i个UTXO为至少一个UTXO,其中,前i个UTXO的总剩余数字资产不小于第一数字资产。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 assets.
其中,如图4C所示,S126的实施方式(1)可以是:Wherein, as shown in FIG. 4C, the embodiment (1) of S126 may be:
S1261:从排序后的M个UTXO中选择前i个UTXO。S1261: Select the first i UTXOs from the sorted M UTXOs.
S1262:比对前i个UTXO中所有UTXO的总剩余数字资产与第一数字资产的大小。S1262: Compare the total remaining digital assets of all UTXOs in the first i UTXOs with the size of the first digital asset.
在前i个UTXO中所有UTXO的总剩余数字资产等于第一数字资产时,则执行S1263;在前i个UTXO中所有UTXO的总剩余数字资产大于第一数字资产时,则执行S124;在前i个UTXO中所有UTXO的总剩余数字资产大于第一数字资产时,则执行S124;在UTXO集合中所有UTXO的总剩余数字资产小于第一数字资产时,重复执行S121,直到UTXO集合中所有UTXO的总剩余数字资产不小于第一数字资产。When the total remaining digital assets of all UTXOs in the first i UTXOs are equal to the first digital asset, execute S1263; when the total remaining digital assets of all UTXOs in the first i UTXOs are greater than the first digital assets, execute S124; When the total remaining digital assets of all UTXOs in the i UTXOs are greater than the first digital asset, execute S124; when the total remaining digital assets of all UTXOs in the UTXO set is less than the first digital asset, repeat S121 until all UTXOs in the UTXO set are The total remaining digital asset is not less than the first digital asset.
S1263:确定前i个UTXO为至少一个UTXO。S1263: Determine that the first i UTXOs are at least one UTXO.
S1264:判断前i个UTXO中所有UTXO的总剩余数字资产与第一数字资产的差额是否大于目标阈值,如果是,则执行S1263和S13,否则,i=i+1,重复执行S1261,并重复执行S1264,直到前i个UTXO中所有UTXO的总剩余数字资产与第一数字资产的差额大于目标阈值。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 is performed until the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital assets is greater than the target threshold.
该S126的实施方式(1)可以保证选定的至少一个UTXO,即最后输出前i个UTXO的总剩余数字资产与第一数字资产的差额等于0或大于目标阈值,避免生成粉尘交易。The implementation (1) of this S126 can ensure that the selected at least one UTXO, that is, the difference between the total remaining digital assets of the first i UTXOs before the final output and the first digital asset is equal to 0 or greater than the target threshold, avoiding the generation of dust transactions.
在S126的实施方式(2)中,与实施方式(1)类似,在前i个UTXO中所有UTXO的总剩余数字资产等于第一数字资产时,则执行S1263。不同的是,在前i个UTXO中所有UTXO的总剩余数字资产大于第一数字资产时,第一节点可以执行S1263,在前i个UTXO中所有UTXO的总剩余数字资产小于第一数字资产时,i=i+1,重复执行S1261,直到前i个UTXO中所有UTXO的总剩余数字资产与第一数字资产的差额大于目标阈值。In the embodiment (2) of S126, similar to the embodiment (1), when the total remaining digital assets of all UTXOs in the first i UTXOs are equal to the first digital asset, then execute S1263. The difference is that when the total remaining digital assets of all UTXOs in the first i UTXOs are greater than the first digital assets, 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 assets , i=i+1, and execute S1261 repeatedly until the difference between the total remaining digital assets of all UTXOs in the first i UTXOs and the first digital assets is greater than the target threshold.
在S126的实施方式(2)中,在选定的至少一个UTXO为前i个UTXO,其前i-1个UTXO必定小于第一数字资产。该实施方式(2)虽然不能保证交易输出大于目标阈值,流程简单,运行速度快。In the embodiment (2) of S126, the selected at least one UTXO is the first i UTXO, and the first i-1 UTXO must be smaller than the first digital asset. Although this embodiment (2) cannot guarantee that the transaction output is greater than the target threshold, the process is simple and the running speed is fast.
实现(三)Realization (3)
在实现(三)中,在选定的至少一个UTXO的方式不作限定。第一节点可以从M个UTXO中任意选取至少一个UTXO或通过其他方式选取至少一个UTXO,只要选取的至少一个UTXO满足总剩余数字资产不小于第一数字资产,即可。In implementation (3), there is no limitation on the manner of the selected at least one UTXO. The first node can arbitrarily select at least one UTXO from the M UTXOs or select at least one UTXO by other means, as long as the selected at least one UTXO satisfies that the total remaining digital assets are not less than the first digital assets.
不限于上述三种选定至少一个UTXO的实现方式,本申请实施例还可以包括其他实现,这里不再赘述。Not limited to the above three implementations of selecting at least one UTXO, the embodiments of the present application may also include other implementations, which will not be repeated here.
S13:根据至少一个UTXO和转出指令生成第一交易数据。第一交易数据以至少一个UTXO作为第一交易数据的交易输入,第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值。S13: Generate first transaction data according to at least one UTXO and a transfer-out instruction. The first transaction data uses at least one UTXO as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output from the first transaction data is equal to 0 or greater than the target threshold.
可选地,第一交易数据可以包括第一节点的标识、第二节点的标识、选定的至少一个UTXO的信息、第一数字资产等。其中,第一节点的标识可以是第一节点的公钥或交易地址;第二节点的标识可以是第二节点的公钥或交易地址;UTXO的信息可以包括该UTXO的先前区块的地址(如该先前区块的哈希值)、剩余数字资产等。其中,该第一交易数据具有固定的数据格式,确定第一交易数据中包括的各个数据的含义。Optionally, the first transaction data may include the identifier of the first node, the identifier of the second node, information of the selected at least one UTXO, the first digital asset, and the like. Wherein, 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 the UTXO may include the address of the previous block of the UTXO ( such as the hash value of the previous block), remaining digital assets, etc. Wherein, the first transaction data has a fixed data format, and the meaning of each data included in the first transaction data is determined.
针对上述选定至少一个UTXO的实现(二)中S126的实施方式(2),第一交易数据还可以包括交易费用,第一节点可以在生成第一交易数据的过程可以判断前i个UTXO中所有UTXO的总剩余数字资产与第一数字资产的差额是否大于目标阈值,若前i个UTXO中所有UTXO的总剩余数字资产与第一数字资产的差额是否小于目标阈值,则将该差额作为第一交易数据的交易费用;否则,第一交易数据不包含交易费用,或交易费用为0。For the implementation (2) of S126 in the implementation (2) of the above-mentioned selection of at least one UTXO, the first transaction data may also include transaction fees, and the first node may determine the first i UTXOs in the process of generating the first transaction data. Whether the difference between the total remaining digital assets of all UTXOs and the first digital asset is greater than the target threshold, and 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, the difference will be used as the first The transaction fee of the first transaction data; otherwise, the first transaction data does not contain the transaction fee, or the transaction fee is 0.
应理解,对应于上述实现(三),第一节点可以在生成第一交易数据的过程可以判断选定的至少一个UTXO的总剩余数字资产与第一数字资产之间的差额是否大于目标阈值,若选定的至少一个UTXO的总剩余数字资产与第一数字资产之间的差额小于目标阈值时,则将差额作为第一交易数据的交易费用;否则,第一交易数据不包含交易费用,或交易费用为0。It should be understood that, corresponding to the above-mentioned implementation (3), 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 assets 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 for the first transaction data; otherwise, the first transaction data does not contain transaction fees, or Transaction fees are 0.
还应理解,针对其他实现,第一交易数据也可以包括交易费用,但其选定的至少一个UTXO的总剩余数字资产在去除第一数字资产、交易费用后剩余的差额或等于0,或大于目标阈值。It should also be understood that, for other implementations, the first transaction data may also include transaction fees, but the total remaining digital assets of the selected at least one UTXO after the first digital assets and transaction fees are removed. The remaining difference may be equal to 0, or greater than target threshold.
S14:将第一交易数据上传至区块链网络。S14: Upload the first transaction data to the blockchain network.
第一节点将该第一交易数据发布到区块链网络后,区块链网络中的节点在初次接收到奥该第一交易数据后,验证第一交易数据的合法性,若合法则向其邻居节点广播该第一交易数据。挖矿节点在接收到该第一交易数据后,在验证第一交易数据的合法后,生成新区块,并发布该新区块。其中,在挖矿节点生成区块的过程中,以第一交易数据中的选定的至少一个UTXO作为该区块的输入。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 of Aogai for the first time. Neighbor nodes broadcast the first transaction data. After receiving the first transaction data, the mining node generates a new block and publishes the new block after verifying the legality of the first transaction data. Wherein, in the process of generating a block by the mining node, at least one UTXO selected in the first transaction data is used as the input of the block.
如图5所示,为本申请实施例提供的一种区块创建方法,该方法可以由区块链网络中的挖矿节点执行,其中,在公有链,比如比特币中,挖矿节点可以是区块链网络中的任意节点,也就是说,任意一个节点都可以争夺区块的创建权,该区块生成方法可以包括但不限于如下步骤:As shown in FIG. 5 , a method for creating a block provided in an embodiment of the present application can be executed by a mining node in a blockchain network, wherein, in a public chain, such as Bitcoin, the mining node can It is any node in the blockchain network, that is to say, any node can compete for the right to create a block. The block generation method can include but is not limited to the following steps:
S21:获取第一交易数据,其中,第一交易数据的具体描述可以参见上述交易生成方法的实施例中相关描述,这里不再赘述。S21: Acquire first transaction data, wherein, for a specific description of the first transaction data, reference may be made to the relevant description in the embodiment of the transaction generation method above, and details are not repeated here.
S22:根据第一交易数据,将第一交易数据写入到区块,其中,区块的输入为至少一个UTXO。S22: Write the first transaction data into the block according to the first transaction data, wherein the input of the block is at least one UTXO.
进一步地,挖矿节点可以将生成的新区块并发布到区块链网络。Further, mining nodes can publish new blocks generated to the blockchain network.
应理解,其他挖矿节点也可以生成新区块并发布区块链网络。各个挖矿节点都可以接收新区块,可以检测该区块内容的合法性,以及查看该区块是不是在最长合法链上,进而,各个挖矿节点可以存储最大合法链,以保证各个挖矿节点存储数据的一致。It should be understood that other mining nodes can also generate new blocks and publish the blockchain network. Each mining node can receive new blocks, detect the validity of the block content, and check whether the block is on the longest legal chain. Furthermore, each mining node can store the largest legal chain to ensure that each mining Mining nodes store data consistently.
基于上述方法实施例的描述,本申请实施例还提出了一种交易生成装置,该交易生成装置可运行于第一节点中,该交易生成装置可以是运行于第一节点中的计算机程序(包括程序代码)、客户端;请参见图6所示,该交易生成装置60可以包括或可以运行如下单元:Based on the descriptions of the above method embodiments, an embodiment of the present application further proposes a transaction generation device, the transaction generation device can run in the first node, and the transaction generation device can be a computer program (including a computer program) running in the first node program code), client; please refer to Fig. 6, the transaction generating device 60 may include or may run the following units:
接收单元601,用于接收转出指令,所述转出指令用于指示将第一数字资产从所述第一节点的交易地址转移至所述第二节点的交易地址;a receiving
选定单元602,用于从所述第一节点的剩余数字资产中选定至少一个未花费交易输出(Unspent Transaction Output,UTXO),其中,所述剩余数字资产包括M个UTXO,M为正整数;A
生成单元603,用于根据所述至少一个UTXO和所述转出指令生成第一交易数据;所述第一交易数据以所述至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值;The generating unit 603 is configured to generate first transaction data according to the at least one UTXO and the transfer-out instruction; the first transaction data takes the at least one UTXO as the transaction input of the first transaction data, and the first transaction data The total remaining digital assets of the UTXO output of a transaction data is equal to 0 or greater than the target threshold;
上传单元604,用于将所述第一交易数据上传至区块链网络。The
在一种可能的实现中,所述至少一个UTXO的总剩余数字资产等于所述第一数字资产或所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额大于所述目标阈值。In a possible implementation, the total remaining digital asset of the at least one UTXO is equal to the first digital asset or the difference between the total remaining digital asset of the at least one UTXO and the first digital asset is greater than the target threshold.
在一种可能的实现中,所述选定单元602,具体用于:In a possible implementation, the selecting
将剩余UXTO集合中获取的一个UTXO加入到UTXO集合,所述剩余UXTO集合为所述M个UXTO中除所述UTXO集合外的UTXO;A UTXO obtained in the remaining UXTO set is added to the UTXO set, and the remaining UXTO set is the UTXO other than the UTXO set in the M UXTOs;
在所述UTXO集合中所有UTXO的总剩余数字资产等于所述第一数字资产时,确定所述UTXO集合为所述至少一个UTXO;When the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, determine that the UTXO set is the at least one UTXO;
在所述UTXO集合中所有UTXO的总剩余数字资产大于所述第一数字资产且所述UTXO集合中所有UTXO的总剩余数字资产与所述第一数字资产的差额大于所述目标阈值时,确定所述UTXO集合为所述至少一个UTXO;When the total remaining digital assets of all UTXOs in the UTXO set are greater than the first digital assets and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital assets is greater than the target threshold, determine the UTXO set is the at least one UTXO;
在所述UTXO集合中所有UTXO的总剩余数字资产小于所述第一数字资产时,重复执行所述将剩余UXTO集合中获取的一个UTXO加入到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 one UTXO obtained in the remaining UXTO set to the UTXO set is repeatedly performed.
在一种可能的实现中,所述选定单元602,具体用于:In a possible implementation, the selecting
根据所述M个UTXO中的每一个UTXO的剩余数字资产,按剩余数字资产的从大到小对所述M个UTXO进行排序;According to the remaining digital assets of each UTXO in the M UTXOs, sort the M UTXOs in descending order of the remaining digital assets;
确定所述M个UTXO中前i个UTXO为所述至少一个UTXO,其中,所述前i个UTXO的总剩余数字资产不小于所述第一数字资产,i小于M的为正整数。It is determined 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 assets, and if i is less than M is a positive integer.
可选地,所述前i-1个UTXO的总剩余数字资产小于所述第一数字资产。Optionally, the total remaining digital assets of the first i-1 UTXOs are less than the first digital assets.
可选地,所述前i个UTXO的总剩余数字资产与所述第一数字资产的差额等于0或大于所述目标阈值。Optionally, the difference between the total remaining digital assets of the first i UTXOs and the first digital assets is equal to 0 or greater than the target threshold.
在一种可能的实现中,所述第一交易数据还包括交易费用,所述装置60还包括:In a possible implementation, the first transaction data further includes transaction fees, and the apparatus 60 further includes:
处理单元,在所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额小于所述目标阈值时,将所述差额作为所述第一交易数据的交易费用。The processing unit, when the difference between the total remaining digital asset of the at least one UTXO and the first digital asset is smaller than the target threshold, use the difference as the transaction fee of the first transaction data.
在一种可能的实现中,所述转出指令还包括交易信息,所述装置60还包括:In a possible implementation, the transfer-out instruction further includes transaction information, and the apparatus 60 further includes:
识别单元,用于根据所述交易信息识别所述交易信息的交易类型;an identification unit, configured to identify the transaction type of the transaction information according to the transaction information;
确定单元,用于根据交易类型与阈值的对应关系,确定所述交易信息的类型确定所述目标阈值。and a determining unit, configured to determine the type of the transaction information and determine the target threshold according to the corresponding relationship between the transaction type and the threshold.
基于上述方法实施例的描述,本申请实施例还提出了一种区块创建装置,该区块创建装置可运行于挖矿节点中,该区块创建装置可以是运行于挖矿节点中的计算机程序(包括程序代码);请参见图7所示,该区块创建装置70可以包括或运行如下单元:Based on the description of the above method embodiments, the embodiments of the present application also propose a block creation device, the block creation device can run in the mining node, and the block creation device can be a computer running in the mining node Program (including program code); please refer to FIG. 7 , the block creation device 70 may include or run the following units:
获取单元701,用于获取由第一节点上传到区块链网络中的第一交易数据,所述第一交易数据用于指示将第一数字资产从所述第一节点的交易地址转移至第二节点的交易地址,所述第一交易数据以至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值,所述至少一个UTXO是从所述第一节点的剩余数字资产中选定的,所述第一节点的剩余数字资产包括M个UTXO,M为正整数;The obtaining
创建单元702,用于根据所述第一交易数据,将第一交易数据创建区块,其中,所述区块的输入为所述至少一个UTXO。The creating
根据本申请的一个实施例,图3所示的交易生成方法所涉及的部分步骤可由图6所示的交易生成装置中的各个单元来执行,图5所示的区块创建方法所涉及的部分步骤可由图7所示的区块创建装置中的各个单元来执行。根据本申请的另一个实施例,图6所示的交易生成装置或图7所示的区块创建装置中的各个单元可以分别或全部合并为一个或若干个另外的单元来构成,或者其中的某个(些)单元还可以再拆分为功能上更小的多个单元来构成,这可以实现同样的操作,而不影响本申请的实施例的技术效果的实现。上述单元是基于逻辑功能划分的,在实际应用中,一个单元的功能也可以由多个单元来实现,或者多个单元的功能由一个单元实现。在本申请的其它实施例中,基于数据处理装置也可以包括其它单元,在实际应用中,这些功能也可以由其它单元协助实现,并且可以由多个单元协作实现。According to an embodiment of the present application, part of the steps involved in the transaction generation method shown in FIG. 3 can be performed by each unit in the transaction generation device shown in FIG. 6 , and the part involved in the block creation method shown in FIG. 5 The steps may be performed by various units in the block creation apparatus shown in FIG. 7 . According to another embodiment of the present application, each unit in the transaction generating device shown in FIG. 6 or the block creating device shown in FIG. 7 may be respectively or all combined into one or several other units to form, or one of the A certain unit(s) may be further divided into a plurality of units with smaller functions, which can realize 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 function of one unit may also be implemented by multiple units, or the functions of multiple units may be implemented by one unit. In other embodiments of the present application, the data-based processing apparatus may also include other units. In practical applications, these functions may also be implemented with the assistance of other units, and may be implemented by cooperation of multiple units.
根据本申请的另一个实施例,可以通过在包括中央处理单元(CPU)、随机存取存储介质(RAM)、只读存储介质(ROM)等处理元件和存储元件的例如计算机的通用计算设备上运行能够执行如图3以及图5中所示的相应方法所涉及的各步骤的计算机程序(包括程序代码),来构造图6所示的交易生成装置或图7所示的区块创建装置,以及来实现本申请实施例的方法。所述计算机程序可以记载于例如计算机可读记录介质上,并通过计算机可读记录介质装载于上述计算设备中,并在其中运行。According to another embodiment of the present application, a general-purpose computing device, such as a computer, may be implemented on a general-purpose computing device including a central processing unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM), and other processing elements and storage elements. Running a computer program (including program code) capable of executing the steps involved in the corresponding methods as shown in FIG. 3 and FIG. 5 , to construct the transaction generating device shown in FIG. 6 or the block creating device shown in FIG. 7 , and to implement the method of the embodiments of the present application. The computer program can be recorded on, for example, a computer-readable recording medium, and loaded in the above-mentioned computing device through the computer-readable recording medium, and executed therein.
在本申请实施例中,第一节点接收转出指令,该转出指令用于指示将第一数字资产从第一节点的交易地址转移至第二节点的交易地址;进而,从所述第一节点的剩余数字资产中选定至少一个UTXO,从而,根据该至少一个UTXO和转出指令生成第一交易数据,将第一交易数据上传至区块链网络;其中,第一交易数据以该至少一个UTXO作为第一交易数据的交易输入,该第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值;从而避免粉尘交易的产生,提高区块链网络的运行效率。In the embodiment of the present application, the first node receives a transfer-out instruction, and the transfer-out instruction is used to instruct the transfer of the first digital asset from the transaction address of the first node to the transaction address of the second node; further, from the first node At least one UTXO is selected from the remaining digital assets of the node, so that the first transaction data is generated according to the at least one UTXO and the transfer instruction, and the first transaction data is uploaded to the blockchain network; A UTXO is used as the transaction input of the first transaction data, and the total remaining digital assets of the UTXO output from the first transaction data is equal to 0 or greater than the target threshold; thus avoiding the generation of dust transactions and improving the operation efficiency of the blockchain network.
基于上述方法实施例以及装置项实施例的描述,本发明实施例还提供一种交易生成装置;该交易生成装置可以是上述所提及的用户设备或检测设备,。请参见图8,该交易生成装置80可至少包括处理器801、输入装置802、输出装置803以存储器804及通信接口805;其中,处理器801、输入装置802、输出装置803、存储器804以及通信接口805可通过总线808或者其它连接方式进行连接。所述存储器804用于存储计算机程序,所述计算机程序包括程序指令,存储器804可包括易失性存储器(例如,动态随机存取存储器DRAM),还可以包括非易失性存储器(例如,一次性可编程只读存储器OTPROM)。在一些实例中,存储器804可进一步包括相对于处理器801远程设置的存储器,这些远程存储器可以通过网络连接至装置80。输入装置802可以包括:键盘8021、麦克风8022、触摸面板8023等。输出装置803可以包括显示面板8031、扩音器8032等。Based on the descriptions of the above method embodiments and device item embodiments, the embodiments of the present invention further provide a transaction generation device; the transaction generation device may be the user equipment or detection device mentioned above. Referring to FIG. 8 , the
通信接口805用于实现交易生成装置80与其他设备装置,如区块链网络的信息交互。The
所述处理器801用于执行所述存储器804存储的程序指令。处理器801(或称CPU(Central Processing Unit,中央处理器))是客户端的计算核心以及控制核心,其适于实现一条或多条指令,具体适于加载并执行一条或多条指令从而实现上述交易生成方法实施例中的相应方法流程或相应功能。The
在一些实施例中,本发明实施例所述的处理器801可用于进行一系列的数据处理,包括:In some embodiments, the
接收转出指令,所述转出指令用于指示将第一数字资产从所述第一节点的交易地址转移至所述第二节点的交易地址;receiving a transfer-out instruction, where the transfer-out instruction is used to instruct the transfer of the first digital asset from the transaction address of the first node to the transaction address of the second node;
从所述第一节点的剩余数字资产中选定至少一个未花费交易输出(UnspentTransaction Output,UTXO),其中,所述剩余数字资产包括M个UTXO,M为正整数;Select at least one unspent transaction output (UnspentTransaction 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;
根据所述至少一个UTXO和所述转出指令生成第一交易数据;所述第一交易数据以所述至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值;The first transaction data is generated according to the at least one UTXO and the transfer-out instruction; the first transaction data uses the at least one UTXO as the transaction input of the first transaction data, and the output of the first transaction data is The total remaining digital assets of UTXO is equal to 0 or greater than the target threshold;
将所述第一交易数据上传至区块链网络。Upload the first transaction data to the blockchain network.
在一种可能的实现中,所述至少一个UTXO的总剩余数字资产等于所述第一数字资产或所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额大于所述目标阈值。In a possible implementation, the total remaining digital asset of the at least one UTXO is equal to the first digital asset or the difference between the total remaining digital asset of the at least one UTXO and the first digital asset is greater than the target threshold.
在一种可能的实现中,所述处理器801执行所述从所述第一节点的剩余数字资产中选定至少一个UTXO,具体包括执行:In a possible implementation, the
将剩余UXTO集合中获取的一个UTXO加入到UTXO集合,所述剩余UXTO集合为所述M个UXTO中除所述UTXO集合外的UTXO;A UTXO obtained in the remaining UXTO set is added to the UTXO set, and the remaining UXTO set is the UTXO other than the UTXO set in the M UXTOs;
在所述UTXO集合中所有UTXO的总剩余数字资产等于所述第一数字资产时,确定所述UTXO集合为所述至少一个UTXO;When the total remaining digital assets of all UTXOs in the UTXO set are equal to the first digital asset, determine that the UTXO set is the at least one UTXO;
在所述UTXO集合中所有UTXO的总剩余数字资产大于所述第一数字资产且所述UTXO集合中所有UTXO的总剩余数字资产与所述第一数字资产的差额大于所述目标阈值时,确定所述UTXO集合为所述至少一个UTXO;When the total remaining digital assets of all UTXOs in the UTXO set are greater than the first digital assets and the difference between the total remaining digital assets of all UTXOs in the UTXO set and the first digital assets is greater than the target threshold, determine the UTXO set is the at least one UTXO;
在所述UTXO集合中所有UTXO的总剩余数字资产小于所述第一数字资产时,重复执行所述将剩余UXTO集合中获取的一个UTXO加入到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 one UTXO obtained in the remaining UXTO set to the UTXO set is repeatedly performed.
在一种可能的实现中,所述处理器801执行所述从所述第一节点的剩余数字资产中选定至少一个UTXO,具体包括执行:In a possible implementation, the
根据所述M个UTXO中的每一个UTXO的剩余数字资产,按剩余数字资产的从大到小对所述M个UTXO进行排序;According to the remaining digital assets of each UTXO in the M UTXOs, sort the M UTXOs in descending order of the remaining digital assets;
确定所述M个UTXO中前i个UTXO为所述至少一个UTXO,其中,所述前i个UTXO的总剩余数字资产不小于所述第一数字资产,i小于M的为正整数。It is determined 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 assets, and if i is less than M is a positive integer.
可选地,所述前i-1个UTXO的总剩余数字资产小于所述第一数字资产。Optionally, the total remaining digital assets of the first i-1 UTXOs are less than the first digital assets.
可选地,所述前i个UTXO的总剩余数字资产与所述第一数字资产的差额等于0或大于所述目标阈值。Optionally, the difference between the total remaining digital assets of the first i UTXOs and the first digital assets is equal to 0 or greater than the target threshold.
在一种可能的实现中,所述第一交易数据还包括交易费用,所述处理器701还用于执行:In a possible implementation, the first transaction data further includes transaction fees, and the
在所述至少一个UTXO的总剩余数字资产与所述第一数字资产之间的差额小于所述目标阈值时,将所述差额作为所述第一交易数据的交易费用。When the difference between the total remaining digital assets of the at least one UTXO and the first digital asset is smaller than the target threshold, the difference is used as the transaction fee for the first transaction data.
在一种可能的实现中,所述转出指令还包括交易信息,所述处理器701还用于执行:In a possible implementation, the transfer-out instruction further includes transaction information, and the
根据所述交易信息识别所述交易信息的交易类型;Identify the transaction type of the transaction information according to the transaction information;
根据交易类型与阈值的对应关系,确定所述交易信息的类型确定所述目标阈值。According to the corresponding relationship between the transaction type and the threshold, the type of the transaction information is determined to determine the target threshold.
需要说明的是,上述输入装置802、输出装置803不是交易生成装置80必须的单元,交易生成装置80可以不包括上述输入装置802、输出装置803,也可以包括其他的器件或模块,本申请实施例不作限定。It should be noted that the above-mentioned
应当理解,本发明实施例中所描述的交易生成装置60、80可执行前文图3所对应实施例中对所述交易生成方法的描述,在此不再赘述。It should be understood that the
基于上述方法实施例以及装置项实施例的描述,本发明实施例还提供一种区块创建装置;该区块创建装置可以是上述所提及的用户设备或检测设备,。请参见图9,该区块创建装置90可至少包括处理器901、输入装置902、输出装置903以存储器904及通信接口905;其中,处理器901、输入装置902、输出装置903、存储器904以及通信接口905可通过总线906或者其它连接方式进行连接。所述存储器904用于存储计算机程序,所述计算机程序包括程序指令,存储器904可包括易失性存储器(例如,动态随机存取存储器DRAM),还可以包括非易失性存储器(例如,一次性可编程只读存储器OTPROM)。在一些实例中,存储器904可进一步包括相对于处理器901远程设置的存储器,这些远程存储器可以通过网络连接至装置90。输入装置902可以包括:键盘9021、麦克风9022、触摸面板9023等。输出装置903可以包括显示面板9031、扩音器9032等。Based on the descriptions of the foregoing method embodiments and device item embodiments, an embodiment of the present invention further provides a block creation apparatus; the block creation apparatus may be the user equipment or detection equipment mentioned above. Referring to FIG. 9 , the
通信接口905用于实现区块创建装置90与其他设备装置,如区块链网络的信息交互。The
所述处理器901用于执行所述存储器904存储的程序指令。处理器901(或称CPU(Central Processing Unit,中央处理器))是客户端的计算核心以及控制核心,其适于实现一条或多条指令,具体适于加载并执行一条或多条指令从而实现上述区块创建方法实施例中的相应方法流程或相应功能。The
在一些实施例中,本发明实施例所述的处理器901可用于进行一系列的数据处理,包括:In some embodiments, the
获取由第一节点上传到区块链网络中的第一交易数据,所述第一交易数据用于指示将第一数字资产从所述第一节点的交易地址转移至第二节点的交易地址,所述第一交易数据以至少一个UTXO作为所述第一交易数据的交易输入,所述第一交易数据的输出的UTXO的总剩余数字资产等于0或大于目标阈值,所述至少一个UTXO是从所述第一节点的剩余数字资产中选定的,所述第一节点的剩余数字资产包括M个UTXO,M为正整数;obtaining the first transaction data uploaded by the first node into the blockchain network, where the first transaction data is used to instruct the transfer of the first digital asset from the transaction address of the first node to the transaction address of the second node, The first transaction data uses at least one UTXO as the transaction input of the first transaction data, the total remaining digital assets of the UTXO output from the first transaction data is equal to 0 or greater than the target threshold, and the at least one UTXO is from Selected from the remaining digital assets of the first node, the remaining digital assets of the first node include M UTXOs, where M is a positive integer;
根据所述第一交易数据,将第一交易数据写入到区块,其中,所述区块的输入为所述至少一个UTXO。According to the first transaction data, the first transaction data is written into a block, wherein the input of the block is the at least one UTXO.
需要说明的是,上述输入装置902、输出装置903不是区块创建装置90必须的单元,区块创建装置90可以不包括上述输入装置902、输出装置903,也可以包括其他的器件或模块,本申请实施例不作限定。It should be noted that the above-mentioned
应当理解,本发明实施例中所描述的区块创建装置70、90可执行前文图5对应实施例中对所述区块创建方法的描述,在此不再赘述。It should be understood that the
本发明实施例还提供了一种计算机可读存储介质(Memory),所述计算机可读存储介质是客户端中的记忆设备,用于存放程序和数据。可以理解的是,此处的计算机可读存储介质既可以包括客户端中的内置存储介质,当然也可以包括客户端所支持的扩展存储介质。计算机可读存储介质提供存储空间,该存储空间存储了客户端的操作系统。并且,在该存储空间中还存放了适于被处理器加载并执行的一条或多条指令,这些指令可以是一个或一个以上的计算机程序(包括程序代码)。需要说明的是,此处的计算机可读存储介质可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器;可选的还可以是至少一个位于远离前述处理器的计算机可读存储介质。Embodiments of the present invention further provide a computer-readable storage medium (Memory), where the computer-readable storage medium is a memory device in a client, and is used to store programs and data. It can be understood that the computer-readable storage medium here may include both a built-in storage medium in the client, and of course, an extended storage medium supported by the client. The computer-readable storage medium provides storage space in which the client's operating system is stored. 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 may 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 magnetic disk memory; optionally, at least one storage medium located far away from the aforementioned A computer-readable storage medium for the processor.
在一个实施例中,可由处理器加载并执行计算机可读存储介质中存放的一条或多条第一指令,以实现上述有关数据处理实施例中第一客户端所执行的相应步骤;具体实现中,计算机可读存储介质中的一条或多条第一指令由计算机设备加载并执行时,可以实现如上述图3或图5所述的方法,具体可参见上述方法中相关描述,这里不再赘述。In one embodiment, the processor can load and execute one or more first instructions stored in the computer-readable storage medium, so as to implement the corresponding steps executed by the first client in the above-mentioned relevant data processing embodiment; in the specific implementation , when one or more first instructions in the computer-readable storage medium are loaded and executed by the computer device, the method described in FIG. 3 or FIG. 5 can be implemented. For details, please refer to the relevant description in the above method, which will not be repeated here. .
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random AccessMemory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. During execution, the processes of the embodiments of the above-mentioned methods may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。The above disclosures are only preferred embodiments of the present invention, and of course, the scope of the rights of the present invention cannot be limited by this. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010076933.4A CN111292190B (en) | 2020-01-23 | 2020-01-23 | Transaction generation method, block creation method and related devices and equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010076933.4A CN111292190B (en) | 2020-01-23 | 2020-01-23 | Transaction generation method, block creation method and related devices and equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111292190A true CN111292190A (en) | 2020-06-16 |
| CN111292190B CN111292190B (en) | 2025-01-07 |
Family
ID=71023470
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010076933.4A Active CN111292190B (en) | 2020-01-23 | 2020-01-23 | Transaction generation method, block creation method and related devices and equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111292190B (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111598571A (en) * | 2020-07-20 | 2020-08-28 | 百度在线网络技术(北京)有限公司 | Transaction processing method, device, equipment and storage medium of block chain |
| CN113127908A (en) * | 2021-04-29 | 2021-07-16 | 郑杰骞 | Chain structure address generation method, chain structure address generation device, transaction data processing method, transaction data processing device and storage medium |
| CN113409140A (en) * | 2021-05-27 | 2021-09-17 | 卓尔智联(武汉)研究院有限公司 | Block chain data processing method and device, computer equipment and storage medium |
| WO2022227694A1 (en) * | 2021-04-29 | 2022-11-03 | 郑杰骞 | Chain structure address generation method, transaction data processing method, apparatus, and storage medium |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190057382A1 (en) * | 2016-02-23 | 2019-02-21 | nChain Holdings Limited | Registry and automated management method for blockchain-enforced smart contracts |
| CN110166237A (en) * | 2019-05-31 | 2019-08-23 | 杭州时戳信息科技有限公司 | A kind of cryptographic key distribution method and system based on block chain |
-
2020
- 2020-01-23 CN CN202010076933.4A patent/CN111292190B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190057382A1 (en) * | 2016-02-23 | 2019-02-21 | nChain Holdings Limited | Registry and automated management method for blockchain-enforced smart contracts |
| CN110166237A (en) * | 2019-05-31 | 2019-08-23 | 杭州时戳信息科技有限公司 | A kind of cryptographic key distribution method and system based on block chain |
Non-Patent Citations (2)
| Title |
|---|
| MIND: ""粉尘交易的定义与处理"", Retrieved from the Internet <URL:https://zhuanlan.zhihu.com/p/43203734> * |
| 周亮: ""区块链中灰尘量与热力学问题分析"", Retrieved from the Internet <URL:https://www.elecfans.com/blockchain/1054804.html> * |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111598571A (en) * | 2020-07-20 | 2020-08-28 | 百度在线网络技术(北京)有限公司 | Transaction processing method, device, equipment and storage medium of block chain |
| CN113127908A (en) * | 2021-04-29 | 2021-07-16 | 郑杰骞 | Chain structure address generation method, chain structure address generation device, transaction data processing method, transaction data processing device and storage medium |
| WO2022227694A1 (en) * | 2021-04-29 | 2022-11-03 | 郑杰骞 | Chain structure address generation method, transaction data processing method, apparatus, and storage medium |
| CN113127908B (en) * | 2021-04-29 | 2024-04-26 | 郑杰骞 | Chained address generation and transaction data processing method and device and storage medium |
| CN113409140A (en) * | 2021-05-27 | 2021-09-17 | 卓尔智联(武汉)研究院有限公司 | Block chain data processing method and device, computer equipment and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111292190B (en) | 2025-01-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110442652B (en) | Cross-chain data processing method and device based on block chain | |
| CN107438002B (en) | Block chain based system and electronic device and method in system | |
| CN110431577B (en) | System and method for detecting replay attacks | |
| CN111292190A (en) | Transaction generation method, block creation method, related device and equipment | |
| CN109493204B (en) | Service accounting method based on block chain and terminal equipment | |
| WO2020082887A1 (en) | Block chain transaction method and apparatus | |
| WO2020063820A1 (en) | Asset transaction method, storage medium and computer device | |
| JP2023076628A (en) | Computer-implemented systems and methods relating to binary blockchain comprising one pair of coupled blockchains | |
| KR20180014534A (en) | Verification system and method for transaction based block chain | |
| CN110998633B (en) | Methods and devices to avoid double-spending problems in blockchain technology | |
| CN110730963A (en) | System and method for information protection | |
| JP7688046B2 (en) | A method for implementing a digital coin system using blockchain | |
| CN110599331A (en) | Debt charging system, method, device and storage medium based on block chain | |
| CN111311341A (en) | Bill processing method, equipment and medium | |
| TW202316844A (en) | Propagating locking scripts | |
| WO2021053425A1 (en) | Multi-criteria blockchain protocol | |
| CN111597264A (en) | Block chain accounting method and device | |
| US12020242B2 (en) | Fair transaction ordering in blockchains | |
| JP2024525196A (en) | Multi-level Blockchain | |
| CN111899104A (en) | Service execution method and device | |
| WO2024156510A1 (en) | Proof and verification of data storage | |
| KR102675958B1 (en) | A hierarchical multi-blockchain method for parallel computation in crytocurrency transfers and smart contracts and its system | |
| CN112749967B (en) | Transaction data processing method and device, user terminal and server | |
| HK40024704A (en) | Transaction generation method, block creation method, and related apparatuses, devices | |
| CN114666327A (en) | Block packaging method, device and electronic device based on block chain transaction |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40024704 Country of ref document: HK |
|
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |