WO2020001369A1 - 一种交易组、交易组构造方法、存储介质、设备和系统 - Google Patents
一种交易组、交易组构造方法、存储介质、设备和系统 Download PDFInfo
- Publication number
- WO2020001369A1 WO2020001369A1 PCT/CN2019/092156 CN2019092156W WO2020001369A1 WO 2020001369 A1 WO2020001369 A1 WO 2020001369A1 CN 2019092156 W CN2019092156 W CN 2019092156W WO 2020001369 A1 WO2020001369 A1 WO 2020001369A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- hash value
- group
- transactions
- head
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3829—Payment protocols; Details thereof insuring higher security of transaction involving key management
Definitions
- the present invention relates to the field of blockchain technology, and in particular, to a transaction group, a method for constructing a transaction group, a storage medium, a device, and a system.
- the transaction information on the blockchain includes three parts.
- TxHash is the hash value of the transaction content
- Tx content is the transaction content
- Tx signature is the transaction signature.
- the atomicity of a single transaction can be guaranteed. When two or more transactions are involved, if you want to send multiple transactions at the same time and keep the order of transactions undisturbed, or if multiple transactions succeed or fail at the same time, it cannot be achieved , Can not achieve the exchange atomicity of the transaction group, resulting in unfair transactions; in order to achieve the orderliness of the transaction, a single transaction is generally required to confirm a transaction before sending the next transaction, and, in the district In the case of block rollback, there is no guarantee that the order of transactions will not be reversed. When this method is applied to transaction groups that depend on each other, more time is required to propagate each transaction in the transaction group. The transaction processing capability is low and the propagation speed of the block is reduced.
- the present invention provides a transaction group, a method for constructing a transaction group, a storage medium, a device, and a system.
- the technical solution provided by the present invention is:
- a transaction group includes multiple transactions.
- the transaction includes transaction content, hash value, and signature.
- the transaction and the transaction are connected to each other through a hash list, and the head of the transaction group is saved in each transaction.
- the hash value of the transaction is a hash list, and the head of the transaction group is saved in each transaction.
- the hash list is a hash value of one of the adjacent transactions.
- the hash value of the transaction includes the transaction content, the hash value of the next transaction, and the total number of transactions.
- the signature includes a transaction content, a hash value of a next transaction, a total number of transactions, and a hash value of a head transaction of the transaction group; preferably, the total number of the transactions is greater than or equal to two.
- the overall transaction fee of the transaction group is paid by the head transaction, and other transactions in the transaction do not need to pay the transaction fee; preferably, the transactions in the transaction group are contract transactions or payment transactions.
- a method for constructing a transaction group includes the following steps:
- the first step is to calculate the hash value of the transaction from the tail transaction to the head transaction of the transaction group according to any one of the above, and first calculate the hash value of the tail transaction;
- the second step is to calculate the Hash value of the transaction adjacent to the tail transaction, and in this order, calculate the Hash value of each transaction in turn until the Hash value of the head transaction is calculated;
- the third step is to put the hash value of the head transaction into each transaction in the transaction group;
- the fourth step is to calculate the SIGHASH of each transaction and calculate the signature.
- the hash value of the next transaction among the hash values of the tail transaction is null.
- the SIGHASH mode is SIGHASH_ALL, SIGHASH_NONE, or SIGHASH_SINGLE.
- a storage medium is used to store one or more programs corresponding to the methods described above.
- a device comprising: one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, causing the One or more processors execute the method according to any one of the foregoing to form a transaction group as described above.
- a system includes a transaction construction unit and a transaction group construction unit.
- the transaction construction unit forms a transaction in a transaction group according to the method described above.
- the transaction group construction unit according to the above The method forms a transaction group as described above.
- Each transaction in the present invention is still independent of each other and can be executed in accordance with the original transaction logic without invading any business logic of the transaction;
- Figure 1 shows transaction information on the blockchain in the prior art
- FIG. 2 is a schematic diagram of a transaction group and a construction method thereof according to the present invention.
- FIG. 3 is a schematic diagram of a transaction group and its structure when the total number of transactions is 2.
- 4 is a schematic diagram of a transaction group and its structure when the total number of transactions is 3;
- FIG. 5 is a schematic diagram of a device according to the present invention.
- FIG. 6 is a schematic diagram of address distribution in a client
- Figure 7 is a schematic diagram of the distribution of transaction groups within and between clients on the system and the device.
- a transaction group includes multiple transactions.
- the transaction includes transaction content, hash value, and signature.
- the transaction and the transaction are connected to each other through a hash list, and the head of the transaction group is saved in each transaction.
- the hash value of the transaction is a hash list, and the head of the transaction group is saved in each transaction.
- a transaction group in this embodiment is further improved on the basis of Embodiment 1.
- the Hash linked list is a hash value of one of the adjacent transactions.
- Each transaction in the transaction group is constructed in the order from the tail transaction to the head transaction.
- the two adjacent transactions are linked by the hash value.
- a head transaction is constructed, and the hash value of the head transaction is placed in the content of each transaction.
- a transaction group in this embodiment is further improved on the basis of Embodiment 1 or 2.
- the hash value of the transaction includes the transaction content, the hash value of the next transaction, and the total number of transactions. When constructing this transaction, the hash value of the next transaction is added. When the content of the previous transaction changes, this transaction cannot be established, and a transaction error occurs, ensuring that each transaction within the transaction group cannot be changed. Each transaction succeeds or fails at the same time, ensuring the atomicity of the transaction group.
- the content of the transaction can include smart contracts or smart assets. When multiple parties involve multiple smart contracts or smart assets, for interdependent transactions, it can ensure the atomicity of all transactions during execution, reduce the execution risk, and avoid unfair transactions. .
- a transaction group of this embodiment is further improved on the basis of Embodiment 1 or 2 or 3.
- the signature includes the transaction content, the hash value of the next transaction, the total number of transactions, and the hash of the head transaction of the transaction group. Value; preferably, the total number of said transactions is two or more.
- the hash value of the next transaction, the total number of transactions, and the hash value of the head transaction of the transaction group are added to the current transaction signature structure to ensure that the associated transaction changes, or the number of this transaction group changes, or the head transaction of the transaction group The changes can be reflected in the current transaction.
- any change in any transaction will cause an error in the transaction group, and all transactions cannot be executed successfully, ensuring that the transaction group Atomicity to ensure the fairness of the transaction.
- any other one or more transaction parties in the transaction group modify the original transaction, which will cause the transaction group's head transaction hash value to change, thus allowing the transaction group Incorrect, to prevent one or more parties from modifying the transaction after the signature of one or more parties to avoid unfair transactions.
- a transaction group in this embodiment is further improved on the basis of Embodiment 1 or 2 or 3 or 4.
- the overall transaction fee of the transaction group is paid by the head transaction, and other transactions in the transaction do not need to pay the transaction fee;
- the transaction initiators other than the head transaction in the transaction group do not need to pay a commission fee, and can also initiate a transaction, which increases the flexibility of the transaction.
- the transactions in the transaction group are contract transactions, the exchanges between various traders You can agree on the contents of different contracts.
- the contents of the contract can involve stock transactions, loan repayments, personal health management, legal rights agreements, wills, distribution of physical assets, renting and car rental agreements in real property law, house purchases, car purchase loans, etc.
- a method for constructing a transaction group in this embodiment includes the following steps:
- the first step is to calculate a hash value of the transaction from the tail transaction to the head transaction according to a transaction group described in any one of the technical solutions in Embodiment 1 or 2 or 3 or 4 or 5.
- N1 is used as the head transaction N1
- Nn is used as the tail transaction Nn.
- the hash value of the tail Nn is calculated.
- the second step is to calculate the hash value of the transaction adjacent to the tail transaction. In this order, calculate the hash value of each transaction in turn until the hash value of the head transaction is calculated. Corresponding to Figure 2, the calculation is adjacent to the tail transaction.
- the Hash value of the transaction Nn-1 is calculated in this order, and the Hash value of each transaction is calculated in turn, until the Hash value of the head transaction N1 is calculated;
- the third step is to put the hash value of the head transaction into each transaction in the transaction group; corresponding to Figure 2, put the hash value of the head transaction N1 into each transaction in the transaction group. ;
- the fourth step is to calculate the SIGHASH of each transaction and calculate the signature.
- the hash value of the next transaction is empty, and the SIGHASH mode is SIGHASH_ALL, SIGHASH_NONE, or SIGHASH_SINGLE; the content of a single transaction can be participated by multiple parties, and signature verification is flexible.
- a storage medium is configured to store one or more programs corresponding to the method described in Embodiment 6.
- a device as shown in FIG. 5, the device includes: one or more processors; a memory for storing one or more programs, and when the one or more programs are used by the one or more processors When executed, the one or more processors are caused to execute the method described in Embodiment 6 to form a transaction group described in Embodiment 1 or 2 or 3 or 4 or 5.
- the arrow direction in the figure refers to the direction in which the input address in the transaction points to the output address.
- the client is installed on the device and can independently execute the method of constructing the transaction group, which can form all
- the transaction group is sent to the blockchain network.
- each transaction in the transaction group will not be sent to different network nodes in the blockchain network, but will be sent to each network node on the blockchain in the form of the transaction group as a whole.
- Make the transaction group have the same characteristics of a single transaction, either execute successfully (each transaction in the transaction group is successfully executed) or fail to execute (each transaction in the transaction group is failed to execute), and no execution will occur. Half of the cases (some transactions in the transaction group were executed successfully and others failed).
- a system includes a transaction construction unit and a transaction group construction unit.
- the transaction construction unit forms a transaction in a transaction group according to the method in Embodiment 6 according to Embodiment 1.
- the transaction group constructing unit according to the method of embodiment 6 forms a transaction group according to embodiment 1 or 2 or 3 or 4 or 5.
- step S4 when the fund demander sends the financing ratio to the fund supplier's public key address ( Transaction A), the fund supplier is about to enter the digital currency or RMB into the corresponding account of the fund demander (transaction B), there are still certain risks in the actual situation of these two transactions: there is no measure to ensure that the fund supplier will After the financing currency is sent to the fund supplier, the fund supplier can deposit digital currency or RMB into the corresponding account of the fund demander.
- the transaction group created on the blockchain in this embodiment creatively solves this technical problem.
- the transaction group composed of transaction A and transaction B is: when transaction A is the head transaction, and transaction B is the For the tail transaction, put the hash value of transaction B in transaction A, and save the hash value of transaction A in both transaction A and transaction B, respectively.
- the components of transaction A and B are the same, including the transaction content, hash value, and signature.
- the transaction content involves the transaction amount, input and output addresses, lock time, and the content that needs to be recorded on the blockchain.
- the hash value includes the content of transaction A, the hash value of transaction B, and the total number of transactions 2;
- the hash value of transaction B includes the content of transaction B and the total number of transactions 2;
- the signature of transaction A includes the content of transaction A, and the hash value of transaction B ,
- the signature of transaction B includes the content of transaction B, the total number of transactions 2 and the hash value of transaction A.
- the situation is similar when transaction A is the tail transaction and transaction B is the head transaction.
- the overall transaction fee of the transaction group is paid by the head transaction A, and the transaction B does not need to pay the transaction fee.
- the method of constructing the transaction group consisting of transaction A and transaction B is as follows:
- the first step is to calculate the hash value of the transaction from the tail transaction B of the transaction group to the head transaction A. First, calculate the hash value of the tail transaction B;
- the second step is to calculate the hash value of the head transaction A adjacent to the tail transaction B;
- the third step is to put the hash value of the head transaction A into the head transaction A and the tail transaction B respectively;
- the fourth step is to calculate the SIGHASH of each transaction and calculate the signature.
- the above transaction A and transaction B may be any one of single-input single-output transactions, single-input multiple-output transactions, multiple-input single-output transactions, and multiple-input multiple-output transactions.
- the lender here is not limited to banks (Such as financial institutions, can be the owner of the funds) View the above records of the borrower, after the approval, the lender agrees to the maximum borrowing amount and writes it to the blockchain. After the borrower agrees to the loan, in order to ensure the borrower's timely repayment , The two parties agree on the conditions, such as the monthly payment of the borrower's salary, the repayment is required, otherwise the corresponding penalty conditions will be implemented, and the contract content will be recorded on the blockchain, the lender will follow the contract to the borrower through the blockchain.
- the two parties construct a transaction group to ensure that two transactions are executed simultaneously. Success, to ensure the timely repayment of loans; repayment of this form can be applied as one way of repayment.
- the transaction group consisting of transactions C, D, and E is: when transaction C is the head transaction, transaction E is the tail transaction, the hash value of transaction D is placed in transaction C, and the hash value of transaction D is placed in The hash value of transaction E, and the hash value of transaction A are stored in transactions C, D, and E, respectively.
- the components of transaction C, D, and E are the same, including transaction content, hash value, and signature.
- the transaction content involves the transaction amount, input and output addresses, lock time, and the content that needs to be recorded on the blockchain.
- the hash value of C includes the content of transaction C, the hash value of transaction D, and the total number of transactions 3;
- the hash value of transaction D includes the content of transaction D, the hash value of transaction E, and the total number of transactions 3;
- the hash value of transaction E includes transactions The content of E and the total number of transactions 3;
- the signature of transaction C includes the content of transaction C, the hash value of transaction D, the total number of transactions 3 and the hash value of transaction C;
- the signature of transaction D includes the content of transaction D, and the hash of transaction E Value, the total number of transactions 3, and the hash value of transaction C;
- the signature of transaction E includes the content of transaction E, the total number of transactions 3, and the hash value of transaction C.
- the situation is similar when transaction C
- the first step is to calculate the hash value of the transaction from the tail transaction E of the transaction group to the head transaction C. First, calculate the hash value of the tail transaction E;
- the second step is to calculate the hash value of transaction D adjacent to the tail transaction E, and then calculate the hash value of the head transaction C;
- the third step is to put the hash value of head transaction C into transaction D and tail transaction E respectively;
- the fourth step is to calculate the SIGHASH of each transaction and calculate the signature.
- the transactions C, D, and E may be any one of single-input single-output transactions, single-input multiple-output transactions, multiple-input single-output transactions, and multiple-input multiple-output transactions.
- Raw material suppliers, manufacturers, and retailers can also use the above-mentioned transaction associations in the distribution of benefits and wages with their respective shareholders and employees, forming a transaction group, which is combined with smart contracts to simplify the distribution of benefits and The procedures for salary distribution keep the business running smoothly.
Landscapes
- Business, Economics & Management (AREA)
- Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Computer Security & Cryptography (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
一种交易组构造方法,该方法包括从交易组的尾部交易向头部交易开始计算交易的Hash值,首先计算尾部交易的Hash值;计算与尾部交易相邻的交易的Hash值,按照该顺序,依次计算各个交易的Hash值,直至计算出头部交易的Hash值;把头部交易的Hash值分别放入到交易组中的每一个交易中;计算各个交易的SIGHASH,并计算签名。针对现有技术中发送到区块链中的一组交易无法做到交易的原子性的问题,该方法可以确保发送到区块链中的一组交易,要么转账都成功,要么转账都失败。
Description
本发明涉及区块链技术领域,尤其涉及一种交易组、交易组构造方法、存储介质、设备和系统。
现有技术中区块链上的交易信息包括三部分,如图1所示,TxHash是对交易内容的Hash值;Tx内容是指交易内容;Tx签名是指交易的签名。对于单笔交易原子性是可以保证的,当涉及2笔及以上的交易时,若想同时发送多笔交易,并且保持交易顺序不被打乱,或多笔交易同时成功或者同时失败则无法实现,不能够做到交易组的互换原子性,导致出现不公平的交易;为了做到交易的有序性,一般需要单笔交易确认了一个交易后才能发送下一笔交易,而且,在区块回滚的情况下,无法保证交易顺序不被颠倒。这种方式应用在交易之间互相依赖的交易组上时,需要更多的时间来传播交易组中的各个交易,交易处理能力低,降低区块的传播速度。
在区块链系统中,大部分系统只保证单笔交易的原子性,也就是说,交易A要么在区块链中执行成功,要么执行失败,不会说执行到一半的情况。但是区块链中独立的几笔交易之间并不能做到原子性。
现有的方案中,多笔交易不能保证交易的原子性和顺序性。比如,A0给A1打十个token1,A1去A2这里用这十个token1买一个token2,这实际上是两笔交易;执行这两笔交易时必须先保证A0->A1这笔交易先在区块链中确认,然后才能发送A1->A2的交易,现在有方案不能同时发送这两笔交易。还有,比如,A1和A2要互相交换token1和token2,A1->A2十个token1,A2->A1一个token2,这两笔交易,必须保证原子性,否则会导致不公平的交易出现。也就是说发送到区块链中的一组交易,要么转账都成功,要么转账都失败;而现有的方案中,并不能做到互换的原子性。
发明内容
1.发明要解决的技术问题
为了克服以上技术问题,本发明提供了一种交易组、交易组构造方法、存储介质、设备和系统。
2.技术方案
为解决上述问题,本发明提供的技术方案为:
一种交易组,所述交易组包括多个交易,所述交易包括交易内容、Hash值和签名,交易 和交易之间通过一个Hash链表互相连接,并在每笔交易中保存交易组的头部交易的Hash值。
优选地,所述的Hash链表为相邻交易中其中一笔交易的Hash值。
优选地,所述交易的Hash值包括交易内容,下一个交易的Hash值和交易的总数。
优选地,所述签名包括交易内容,下一个交易的Hash值,交易的总数和交易组的头部交易的Hash值;优选地,所述交易的总数大于等于2。
优选地,交易组的整体手续费由头部交易来支付,交易中的其他交易不需要支付手续费;优选地,所述的交易组中的交易为合约交易或支付交易。
一种交易组构造方法,包括以下步骤:
第一步、根据以上任意一项所述的一种交易组,从交易组的尾部交易向头部交易开始计算交易的Hash值,首先计算尾部交易的Hash值;
第二步、计算与尾部交易相邻的交易的Hash值,按照该顺序,依次计算各个交易的Hash值,直至计算出头部交易的Hash值;
第三步、把头部交易的Hash值分别放入到交易组中的每一个交易中;
第四步、计算各个交易的SIGHASH,并计算签名。
优选地,所述尾部交易的Hash值中下一个交易的Hash值为空。
优选地,SIGHASH模式为SIGHASH_ALL、SIGHASH_NONE或SIGHASH_SINGLE。
一种存储介质,用于存储一个或多个以上所述的方法对应的程序。
一种设备,所述设备包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以上任一项所述的方法,形成以上所述的一种交易组。
一种系统,包括交易构造单元和交易组构造单元,所述的交易构造单元,按照以上所述的方法形成以上所述的一种交易组中的交易,所述的交易组构造单元,按照以上所述的方法形成以上所述的一种交易组。
3.有益效果
采用本发明提供的技术方案,与现有技术相比,具有如下有益效果:
(1)本发明中每笔交易还是互相的独立,可以按照原来的交易逻辑来执行,不会侵入交易的任何业务逻辑;
(2)本发明中交易和交易之间通过一个Hash链表互相连接,并在每笔交易中保存交易组的头部交易Hash值,这样,交易组中的任何一方修改了原来的交易,都会引起头部交易的变化,从而让交易组不正确,防止一方签名后,另外一方来修改交易,确保交易组的原子性。
图1为现有技术中区块链上的交易信息;
图2为本发明的交易组及其构造方法示意图;
图3为当交易总数为2时的交易组及其构造示意图;
图4为当交易总数为3时的交易组及其构造示意图;
图5为本发明的设备示意图;
图6为客户端中的地址分布示意图;
图7为系统和设备上的客户端内部及其之间的交易组分布示意图。
为进一步了解本发明的内容,结合附图及实施例对本发明作详细描述。
实施例1
一种交易组,所述交易组包括多个交易,所述交易包括交易内容、Hash值和签名,交易和交易之间通过一个Hash链表互相连接,并在每笔交易中保存交易组的头部交易的Hash值。
通过这样的结构,任何一个交易从交易组中删除或者被修改,都很容易判断出这个交易组是错误的。这个保证非常重要,用户可以放心的签名自己的交易,不用怕其他方来修改任何一笔交易。
实施例2
如图2所示,本实施例的一种交易组,在实施例1的基础上作进一步改进,所述的Hash链表为相邻交易中其中一笔交易的Hash值。交易组中的各笔交易,按照从尾部交易到头部交易的顺序进行构造,通过在当前交易的内容中加入上一笔交易的Hash值,将相邻的两笔交易通过Hash值关联起来,最后构造出头部交易,在每个交易的内容中放入头部交易的Hash值,当更改交易组中的任一笔交易时,该交易组将出现错误,交易组中的任一笔交易都无法成功。
实施例3
本实施例的一种交易组,在实施例1或2的基础上作进一步改进,所述交易的Hash值包括交易内容,下一个交易的Hash值和交易的总数。在构造本次交易的时候,加入下一个交易的Hash值,当上一个交易的内容发生改变时,本次交易也不能够成立,出现交易错误,保证交易组内部各个交易的不能够改变,确保各笔交易同时成功或同时失败,确保交易组的原子性。交易的内容可以包括智能合约或智能资产,当多方涉及多项智能合约或智能资产时,对于互相依赖的交易,能够确保所有交易在执行时的原子性,降低执行风险,避免出现不公平的交易。
实施例4
本实施例的一种交易组,在实施例1或2或3的基础上作进一步改进,所述签名包括交 易内容,下一个交易的Hash值,交易的总数和交易组的头部交易的Hash值;优选地,所述交易的总数大于等于2。当前的交易签名构造中加入下一个交易的Hash值,交易的总数和交易组的头部交易的Hash值,确保相关联的交易的改变,或这交易组数的改变,或交易组头部交易的改变,能够在当前交易中体现,除非所有交易都重新进行更改,交易组重新进行构造,否则任一笔交易的改变,都会致使交易组出现错误,所有交易都不能够执行成功,确保交易组的原子性,确保交易的公平性。当交易组中的一个或多个交易方签名交易后,交易组中的其余任何一个或多个交易方修改原来的交易时,都会引起交易组的头部交易Hash值的变化,从而让交易组不正确,防止一方或多方签名后,任何一方或多方来修改交易时,避免不公平的交易发生。
实施例5
本实施例的一种交易组,在实施例1或2或3或4的基础上作进一步改进,交易组的整体手续费由头部交易来支付,交易中的其他交易不需要支付手续费;这样除了交易组中的头部交易以外的交易发起者,不需要支付手续费,也可以发起交易,增大了交易的灵活性;当交易组中的交易为合约交易时,各个交易者之间可以约定不同的合约的内容,比如合约内容可以涉及股票交易,贷款还款,个人健康管理,涉及法律的权益协议,遗嘱,实体资产的分配,物权法中的租房、租车协议,购房、购车贷款等方面;当交易组中的交易为支付交易时,实体资金与加密货币关联起来,智能资产与实体资产通过物联网关联起来,多方交易者可以合法地进行资产/资金的转移、交换和买卖,提高交易执行的效率。多笔交易之间互相关联,不存在银行等第三方交易中心,实现去中心化的设计,防止交易数据篡改、丢失等意外情况的发生。
实施例6
本实施例的一种交易组构造方法,构造实施例1或2或3或4或5所述的一种交易组,包括以下步骤:
第一步、根据实施例1或2或3或4或5中任意一个技术方案所述的一种交易组,从交易组的尾部交易向头部交易开始计算交易的Hash值,首先计算尾部交易的Hash值;如图2所示,N1作为头部交易N1,Nn作为尾部交易Nn,首先计算尾部Nn的Hash值;
第二步、计算与尾部交易相邻的交易的Hash值,按照该顺序,依次计算各个交易的Hash值,直至计算出头部交易的Hash值;对应在图2中,计算与尾部交易相邻的交易Nn-1的Hash值,按照该顺序,依次计算各个交易的Hash值,直至计算出头部交易N1的Hash值;
第三步、把头部交易的Hash值分别放入到交易组中的每一个交易中;对应在图2中,把头部交易N1的Hash值分别放入到交易组中的每一个交易中;
第四步、计算各个交易的SIGHASH,并计算签名。
所述尾部交易的Hash值中下一个交易的Hash值为空,SIGHASH模式为SIGHASH_ALL、SIGHASH_NONE或SIGHASH_SINGLE;单笔交易内容可以由多方参与,签名验证灵活。
实施例7
一种存储介质,用于存储一个或多个实施例6所述的方法对应的程序。一种设备,如图5所示,所述设备包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如实施例6中所述的方法,形成实施例1或2或3或4或5所述的一种交易组。
如图5、6、和7所示,图中的箭头方向是指交易中的输入地址指向输出地址的方向,客户端安装在所述设备上,可以独立执行构造交易组的方法,可以形成所述交易组发送到区块链网络中,单个客户端上有多个钱包,每个钱包对应多个地址,多个地址之间可以形成多笔交易,相互依赖或关联的多笔交易可以构建交易组;不同的客户端中,不同的钱包中,不同的地址之间可以构建多笔交易,相互依赖或关联的多笔交易可以构建交易组,发送到区块链网络中。因为交易组的原子性,使一组相互关联的交易仅能存在于同一个有效的区块中,与单笔交易特性相同。若矿工在计算区块时,仅用到了同一交易组的部分交易,那么该区块将不能够被计算成功,且交易组本身必然执行失败。反过来也约束了交易组中的各笔交易不会分别发送到区块链网络中不同网络节点上,而是以交易组整体的形式发送到区块链上的每个网络节点。使交易组具备了单笔交易同样的特性,要么执行成功(交易组中的各笔交易均执行成功),要么执行失败(交易组中的各笔交易均执行失败),而不会出现执行到一半(交易组中的部分交易执行成功,另外一部分交易执行失败)的情况出现。
实施例8
一种系统,包括交易构造单元和交易组构造单元,所述的交易构造单元,按照实施例6中的方法形成实施例1或2或3或4或5所述的一种交易组中的交易,所述的交易组构造单元,按照实施例6的方法形成实施例1或2或3或4或5所述的一种交易组。
实施例9
担保授信融资方案
现有技术中中国发明专利申请,申请号为2017101355993,公开了一种基于区块链技术的担保授信融资方案,在步骤S4中,当资金需求方将融资比发送给资金供给方公钥地址(交易A),资金供给方即将数字货币或人民币打入资金需求方相应账户(交易B),这两笔交易在现实情况中仍然存在一定风险:没有措施能够确保资金供给方一定会在资金需求将融资币发送给资金供给方后,资金供给方能够将数字货币或人民币打入资金需求方相应账户。
而本实施例在区块链上创建的交易组创造性地解决了这一技术问题,如图3所示,交易A和交易B构成的交易组为:当交易A作为头部交易,交易B作为尾部交易,在交易A中放入交易B的Hash值,并分别在交易A和交易B中均保存交易A的Hash值。使得两个交易关联起来,如果其中任何一笔交易没有执行,或者被删除,或者被修改,都会导致这2笔交易同时不能够成功,避免交易不公平的现象出现;如果两者都执行成功,则完成公平交易。通过这种方式仍然可以确保仅资金需求方本身可使用其关联的融资币,不可转让给其他资金需求方融资;且资金需求方获得的融资不大于最大担保额度。
交易A和B的组成部分相同,包括交易内容,Hash值和签名;其中,交易内容涉及交易的额度,输入和输出地址,锁定时间,需要被记录在区块链上的内容等,交易A的Hash值包括交易A的内容、交易B的Hash值和交易的总数2;交易B的Hash值包括交易B的内容和交易的总数2;交易A的签名包括交易A的内容,交易B的Hash值,交易的总数2和交易A的Hash值;交易B的签名包括交易B的内容,交易的总数2和交易A的Hash值。当交易A作为尾部交易,交易B作为头部交易时,情况类似。交易组的整体手续费由头部交易A来支付,交易B不需要支付手续费。
交易A和交易B构成的交易组的构造方法如下:
第一步、从交易组的尾部交易B向头部交易A开始计算交易的Hash值,首先计算尾部交易B的Hash值;
第二步、计算与尾部交易B相邻的头部交易A的Hash值;
第三步、把头部交易A的Hash值分别放入到头部交易A和尾部交易B中;
第四步、计算各个交易的SIGHASH,并计算签名。
上述交易A和交易B分别可以为单输入单输出的交易,单输入多输出的交,多输入单输出的交易,多输入多输出的交易其中的任一种。
贷款还款方案
利用区块链的分布式加密记录、保密性及不可篡改性,借款方的历史借贷记录、工资流水、经济状况、信用报告等全部内容记录在区块链上,贷款方(此处不限于银行等金融机构,可为资金拥有人)查看借款方的上述记录,审核通过后,贷款方同意最大的借贷额度,并写入到区块链,借款方同意贷款后,为确保借款方及时还款,双方约定条件,比如每月借款方工资发放后,就要还款,否则会执行相应处罚条件,并将该合约内容记录在区块链上,贷款方按照合约约定通过区块链向借款方发送该借贷额度的加密货币,当借款方所在单位发放工资到借款方账户后(交易A,此处假设所述工资也为加密货币),借款方将还款给贷款方(交易B),为确保按时还款,按照本实施例中所述“担保授信融资方案”交易组构建方式,双方 构建一笔交易组,确保两笔交易同时执行成功,确保按时还款;这种还款形式可以作为还款的方式之一进行应用。
实施例10
类比空调行业,现有技术的大多数生产制造业均涉及到原料供应商、制造商、零售商和消费者等几方,在原料采购,生产制造加工,零售批发等各环节中多涉及资金往来,交易过程中涉及的应付款催款,垫付,融资,借贷款,股东利益分配及员工工资发放等情况耗费成本较高,耗时较长,且常有不公平的情况出现。原料供应商、制造商、零售商将互相之间约定的合约记录到区块链上,希望在消费者向零售商回款后(交易C),零售商可以向制造商回款(交易D),制造商可以向供应商回款(交易E)。
如图4所示,交易C、D和E构成的交易组为:当交易C作为头部交易,交易E作为尾部交易,在交易C中放入交易D的Hash值,在交易D中放入交易E的Hash值,并分别在交易C、D和E中均保存交易A的Hash值。
交易C、D和E的组成部分相同,包括交易内容,Hash值和签名;其中,交易内容涉及交易的额度,输入和输出地址,锁定时间,需要被记录在区块链上的内容等,交易C的Hash值包括交易C的内容、交易D的Hash值和交易的总数3;交易D的Hash值包括交易D的内容、交易E的Hash值和交易的总数3;交易E的Hash值包括交易E的内容和交易的总数3;交易C的签名包括交易C的内容,交易D的Hash值,交易的总数3和交易C的Hash值;交易D的签名包括交易D的内容、交易E的Hash值、交易的总数3和交易C的Hash值;交易E的签名包括交易E的内容、交易的总数3和交易C的Hash值。当交易C作为尾部交易,交易E作为头部交易时,情况类似。交易组的整体手续费由头部交易C来支付,交易D和E不需要支付手续费。
交易C、D和E构成的交易组的构造方法如下:
第一步、从交易组的尾部交易E向头部交易C开始计算交易的Hash值,首先计算尾部交易E的Hash值;
第二步、计算与尾部交易E相邻的交易D的Hash值,然后计算出头部交易C的Hash值;
第三步、把头部交易C的Hash值分别放入到交易D和尾部交易E中;
第四步、计算各个交易的SIGHASH,并计算签名。
上述交易C、D和E分别可以为单输入单输出的交易,单输入多输出的交,多输入单输出的交易,多输入多输出的交易其中的任一种。
原料供应商、制造商、零售商在与各自的股东和员工等方面人员进行利益分配和工资发放时也可采用上述交易关联,形成交易组的形式,与智能合约相结合,简化了利益分配和工资发放的手续,保持企业的良好运转。
以上示意性的对本发明及其实施方式进行了描述,该描述没有限制性,描述中涉及的“头部”、“尾部”、“上一个”、“下一个”等词汇均是相对的概念,附图中所示的也只是本发明的实施方式之一,实际的方式和应用场景并不局限于此。所以,如果本领域的普通技术人员受其启示,在不脱离本发明创造宗旨的情况下,不经创造性的设计出与该技术方案相似的方式及实施例,均应属于本发明的保护范围。
Claims (10)
- 一种交易组,所述交易组包括多个交易,所述交易包括交易内容、Hash值和签名,其特征在于,交易和交易之间通过一个Hash链表互相连接,并在每笔交易中保存交易组的头部交易的Hash值。
- 根据权利要求1所述的一种交易组,其特征在于,所述的Hash链表为相邻交易中其中一笔交易的Hash值。
- 根据权利要求1所述的一种交易组,其特征在于,所述交易的Hash值包括交易内容,下一个交易的Hash值和交易的总数。
- 根据权利要求1所述的一种交易组,其特征在于,所述签名包括交易内容,下一个交易的Hash值,交易的总数和交易组的头部交易的Hash值;优选地,所述交易的总数大于等于2。
- 根据权利要求4所述的一种交易组,其特征在于,交易组的整体手续费由头部交易来支付,交易中的其他交易不需要支付手续费;优选地,所述的交易组中的交易为合约交易或支付交易。
- 一种交易组构造方法,其特征在于,包括以下步骤:第一步、根据权利要求1-5任意一项所述的一种交易组,从交易组的尾部交易向头部交易开始计算交易的Hash值,首先计算尾部交易的Hash值;第二步、计算与尾部交易相邻的交易的Hash值,按照该顺序,依次计算各个交易的Hash值,直至计算出头部交易的Hash值;第三步、把头部交易的Hash值分别放入到交易组中的每一个交易中;第四步、计算各个交易的SIGHASH,并计算签名。
- 根据权利要求6所述的一种交易组构造方法,其特征在于,所述尾部交易的Hash值中下一个交易的Hash值为空;优选地,SIGHASH模式为SIGHASH_ALL、SIGHASH_NONE或SIGHASH_SINGLE。
- 一种存储介质,其特征在于:用于存储一个或多个权利要求6-7所述的方法对应的程序。
- 一种设备,其特征在于:所述设备包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求6-8中任一项所述的方法,形成权利要求1-5所述的一种交易组。
- 一种系统,其特征在于:包括交易构造单元和交易组构造单元,所述的交易构造单元,按照权利要求6-8的方法形成权利要求1-5所述的一种交易组中的交易,所述的交易组构造单元,按照权利要求6-8的方法形成权利要求1-5所述的一种交易组。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810695527.9A CN108960826B (zh) | 2018-06-29 | 2018-06-29 | 一种交易组、交易组构造方法、存储介质、设备和系统 |
CN201810695527.9 | 2018-06-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020001369A1 true WO2020001369A1 (zh) | 2020-01-02 |
Family
ID=64487892
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/092156 WO2020001369A1 (zh) | 2018-06-29 | 2019-06-20 | 一种交易组、交易组构造方法、存储介质、设备和系统 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108960826B (zh) |
WO (1) | WO2020001369A1 (zh) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108960826B (zh) * | 2018-06-29 | 2021-02-09 | 杭州复杂美科技有限公司 | 一种交易组、交易组构造方法、存储介质、设备和系统 |
CN109829822B (zh) * | 2019-01-28 | 2020-10-23 | 杭州复杂美科技有限公司 | 交易替换方法、交易排队方法、设备和存储介质 |
CN109741052A (zh) * | 2019-01-28 | 2019-05-10 | 杭州复杂美科技有限公司 | 红包处理方法、设备和存储介质 |
CN110008754A (zh) * | 2019-03-18 | 2019-07-12 | 阿里巴巴集团控股有限公司 | 一种对沟通记录进行区块链存证方法及系统 |
CN110163605B (zh) * | 2019-04-29 | 2020-09-11 | 阿里巴巴集团控股有限公司 | 一种基于区块链的结算方法、装置以及电子设备 |
US10991045B2 (en) | 2019-04-29 | 2021-04-27 | Advanced New Technologies Co., Ltd. | Blockchain-based settlement method, apparatus, and electronic device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107369010A (zh) * | 2017-07-25 | 2017-11-21 | 光载无限(北京)科技有限公司 | 一种基于区块链的电子钱包的创建方法 |
US20180025435A1 (en) * | 2016-07-22 | 2018-01-25 | Nec Europe Ltd. | Method for secure ledger distribution and computer system using secure distributed ledger technology |
CN108960826A (zh) * | 2018-06-29 | 2018-12-07 | 杭州复杂美科技有限公司 | 一种交易组、交易组构造方法、存储介质、设备和系统 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090198619A1 (en) * | 2008-02-06 | 2009-08-06 | Motorola, Inc. | Aggregated hash-chain micropayment system |
CN106506146A (zh) * | 2016-10-26 | 2017-03-15 | 北京瑞卓喜投科技发展有限公司 | 基于区块链技术的交易信息校验方法、装置及系统 |
CN106506638B (zh) * | 2016-11-04 | 2020-01-07 | 江苏通付盾科技有限公司 | 区块链中的区块存储方法及装置 |
CN107590658B (zh) * | 2017-09-01 | 2020-12-25 | 上海专精特新金融信息服务有限公司 | 基于区块链多级交易的方法及装置 |
CN108009810A (zh) * | 2017-12-27 | 2018-05-08 | 光载无限(北京)科技有限公司 | 一种可信数字资产交易方法 |
CN108053211B (zh) * | 2017-12-27 | 2021-04-06 | 北京欧链科技有限公司 | 基于区块链的交易处理方法及装置 |
-
2018
- 2018-06-29 CN CN201810695527.9A patent/CN108960826B/zh active Active
-
2019
- 2019-06-20 WO PCT/CN2019/092156 patent/WO2020001369A1/zh active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180025435A1 (en) * | 2016-07-22 | 2018-01-25 | Nec Europe Ltd. | Method for secure ledger distribution and computer system using secure distributed ledger technology |
CN107369010A (zh) * | 2017-07-25 | 2017-11-21 | 光载无限(北京)科技有限公司 | 一种基于区块链的电子钱包的创建方法 |
CN108960826A (zh) * | 2018-06-29 | 2018-12-07 | 杭州复杂美科技有限公司 | 一种交易组、交易组构造方法、存储介质、设备和系统 |
Non-Patent Citations (1)
Title |
---|
ARVIND, N. ET AL.: "Bitcoin and Cryptocurrency Technologies", CITIC PRESS, 31 August 2016 (2016-08-31) * |
Also Published As
Publication number | Publication date |
---|---|
CN108960826B (zh) | 2021-02-09 |
CN108960826A (zh) | 2018-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020001369A1 (zh) | 一种交易组、交易组构造方法、存储介质、设备和系统 | |
US12056766B2 (en) | System and method of providing a block chain-based recordation process | |
WO2021042817A1 (zh) | 一种基于区块链的违约资产处理方法、装置及电子设备 | |
US20200175595A1 (en) | Devices, System, and Method for Transfer of Commodities | |
US20200042989A1 (en) | Asset-backed tokens | |
CN108734574B (zh) | 一种区块链的跨链操作方法及区块链管理系统 | |
CN110765200B (zh) | 一种基于区块链的资产申购方法、装置及电子设备 | |
EP3411824B1 (en) | Systems and methods for storing and sharing transactional data using distributed computer systems | |
US20170308893A1 (en) | Asset and obligation management using flexible settlement times | |
WO2017098519A1 (en) | A system and method for automated financial transaction validation, processing and settlement using blockchain smart contracts | |
CN111383117A (zh) | 基于区块链的资产管理方法、装置及电子设备 | |
CN111383119A (zh) | 一种基于区块链的资产管理方法、装置及电子设备 | |
WO2021042810A1 (zh) | 基于区块链的资产清偿方法及装置、电子设备 | |
US11842393B2 (en) | Special purpose systems | |
WO2023078124A1 (zh) | 基于区块链的跨境汇款 | |
CN111383122A (zh) | 基于区块链的资产管理方法、装置及电子设备 | |
WO2020102432A1 (en) | Physically settled futures delivery system | |
Adrian et al. | A multi-currency exchange and contracting platform | |
CN111028078A (zh) | 一种将区块链智能合约技术应用于票据池业务的方法 | |
CN111383118A (zh) | 基于区块链的资产管理方法、装置和电子设备 | |
Yaksick | Overcoming supply chain finance challenges via blockchain technology | |
Kahn et al. | Payments settlement: tiering in private and public systems | |
Moore | How to finance a debtor in possession | |
US20200286196A1 (en) | System and method for intellectual property financing | |
US11869105B1 (en) | Systems and methods for bypassing intermediation using living arrangements |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19824753 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19824753 Country of ref document: EP Kind code of ref document: A1 |