Movatterモバイル変換


[0]ホーム

URL:


CN107358424A - A kind of method of commerce and device based on digital cash - Google Patents

A kind of method of commerce and device based on digital cash
Download PDF

Info

Publication number
CN107358424A
CN107358424ACN201710494860.9ACN201710494860ACN107358424ACN 107358424 ACN107358424 ACN 107358424ACN 201710494860 ACN201710494860 ACN 201710494860ACN 107358424 ACN107358424 ACN 107358424A
Authority
CN
China
Prior art keywords
currency
transaction
amount
ciphertext
list
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
Application number
CN201710494860.9A
Other languages
Chinese (zh)
Other versions
CN107358424B (en
Inventor
姚前
狄刚
钱友才
黄烈明
陈海波
赵新宇
王继伟
张大伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Printing Science and Technology Peoples Bank of China
Original Assignee
Institute of Printing Science and Technology Peoples Bank of China
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Institute of Printing Science and Technology Peoples Bank of ChinafiledCriticalInstitute of Printing Science and Technology Peoples Bank of China
Priority to CN201710494860.9ApriorityCriticalpatent/CN107358424B/en
Publication of CN107358424ApublicationCriticalpatent/CN107358424A/en
Application grantedgrantedCritical
Publication of CN107358424BpublicationCriticalpatent/CN107358424B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention discloses a kind of method of commerce and device based on digital cash, it is related to field of computer technology.One embodiment of this method includes:During being merchandised based on the bank settlement of distributed account book technology, gathering end and payment end the plaintext amount of money being related in transaction are encrypted to obtain the ciphertext amount of money, and generate corresponding checking message, the ciphertext amount of money is verified or decrypted.The embodiment solves in existing distributed account book technology that fund is difficult to the technical problem to maintain secrecy, has reached and has ensured that cooperation is shared and the technique effect of protection transaction privacy.

Description

Translated fromChinese
一种基于数字货币的交易方法和装置A transaction method and device based on digital currency

技术领域technical field

本发明涉及计算机技术领域,尤其涉及一种基于数字货币的交易方法和装置。The present invention relates to the field of computer technology, in particular to a transaction method and device based on digital currency.

背景技术Background technique

区块链是一种新型的分布式技术,由协议制定者在系统运行之前制定并公布规则,并开发出遵循该协议的客户端,之后由多家机构或个人作为节点,相互连接并运行该客户端,由恶意节点产生的不符合协议的数据会被其他的诚实节点抛弃,采用这种对抗性共识的方法共同维护一个总账本,达到没有一个中心化的权利机构或个人可以篡改初始协议的设想。Blockchain is a new type of distributed technology. Protocol makers formulate and publish rules before the system runs, and develop clients that follow the protocol. Afterwards, multiple institutions or individuals act as nodes to connect and run the system. On the client side, the data generated by malicious nodes that do not conform to the agreement will be discarded by other honest nodes. This method of confrontational consensus is used to jointly maintain a general ledger, so that no centralized authority or individual can tamper with the initial agreement. imagine.

第一个区块链的应用场景是比特币,实现了一种事先规定发行规则和转账逻辑的货币体系,货币发行的来源是记账节点的出块奖励Coinbase,货币转账逻辑被称为未花费交易输出(Unspent Transaction Output:UTXO)模型。假设用户A目前有货币这些货币的源头都来自于出块奖励,用户A希望给用户B转账7元,则用户A收集自己手中的货币,找到大于等于7的组合,发起一个以A1和A2为输入(input),以找零货币和新生货币为输出(output)的交易,即这个等式关系需要由记账节点首先进行验证,通过并写入区块链后,A1和A2就变为已花费货币,A4和B1就变成了新的未花费货币,可以作为以后UTXO结构的输入。The first blockchain application scenario is Bitcoin, which implements a currency system that stipulates issuance rules and transfer logic in advance. The source of currency issuance is the block reward Coinbase of the bookkeeping node, and the currency transfer logic is called unspent. Transaction output (Unspent Transaction Output: UTXO) model. Suppose user A currently has currency The source of these currencies comes from block rewards. User A wants to transfer 7 yuan to user B. User A collects the currency in his hand, finds a combination greater than or equal to 7, and initiates an input with A1 and A2. change currency and nascent currency is an output transaction, that is, This equation relationship needs to be verified by the bookkeeping node first. After passing and writing into the blockchain, A1 and A2 become spent currencies, and A4 and B1 become new unspent currencies, which can be used as future UTXO structures. input of.

由于记账节点需要验证每一笔交易是否有负值货币、是否出现超额转账、是否有货币创造等,以比特币为代表的区块链系统选择将所有用户的未花费货币信息进行明文存储,并且交易中新生成的货币信息也需要明文声明,节点才能对所有UTXO进行输入和输出相当关系的验证。Since the bookkeeping node needs to verify whether each transaction has negative currency, whether there is an excess transfer, whether there is currency creation, etc., the blockchain system represented by Bitcoin chooses to store all users’ unspent currency information in plain text. Moreover, the newly generated currency information in the transaction also needs to be clearly stated, so that nodes can verify the relationship between input and output of all UTXOs.

然而,在实现本发明的过程中,发明人发现现有技术中至少存在如下问题:现实生活中,用户(企业或个人)间点对点的交易金额一般有保密需求,用户在系统内的总余额也有保密需求。传统的中心化方案由于无需合作记账,也就可以方便地设置数据访问权限,可以很好地解决隐私的问题,但用户还是希望借助区块链等分布式技术合作记账的优势来存储多方合作的其他文档和数据,然而完整的业务闭环又需要资金参与实时清结算,从而导致合作共享与交易隐私无法共存的问题。However, in the process of realizing the present invention, the inventor found that there are at least the following problems in the prior art: in real life, the point-to-point transaction amount between users (enterprises or individuals) generally has confidentiality requirements, and the total balance of users in the system also has Confidentiality needs. Traditional centralized solutions can easily set data access rights without cooperative bookkeeping, which can solve the privacy problem well, but users still hope to use the advantages of distributed technology such as blockchain to store multi-party data. Other documents and data of cooperation, however, a complete business closed loop requires funds to participate in real-time clearing and settlement, which leads to the problem that cooperation sharing and transaction privacy cannot coexist.

发明内容Contents of the invention

有鉴于此,本发明实施例提供一种基于数字货币的交易方法和装置,能够在基于数字货币的交易过程中实现交易金额的加密,以保护用户的隐私权益。In view of this, the embodiments of the present invention provide a digital currency-based transaction method and device, which can realize the encryption of the transaction amount during the digital currency-based transaction process, so as to protect the privacy rights of users.

为实现上述目的,根据本发明实施例的一个方面,提供了一种基于数字货币的交易方法,包括:In order to achieve the above purpose, according to an aspect of the embodiment of the present invention, a transaction method based on digital currency is provided, including:

收款端对收到的明文交易金额进行加密以得到密文交易金额,以及生成用于验证所述密文交易金额的第一验证信息,然后生成收款请求以及广播该收款请求;所述收款请求中包括所述密文交易金额和所述第一验证信息;The receiving end encrypts the received plaintext transaction amount to obtain the ciphertext transaction amount, and generates first verification information for verifying the ciphertext transaction amount, and then generates a payment request and broadcasts the payment request; The collection request includes the ciphertext transaction amount and the first verification information;

节点在接收到所述收款请求后,根据所述第一验证信息确认所述密文交易金额符合规则,然后将所述收款请求存储到区块链,以及根据所述收款请求更新货币列表;After receiving the payment request, the node confirms that the ciphertext transaction amount complies with the rules according to the first verification information, then stores the payment request in the block chain, and updates the currency according to the payment request list;

付款端从所述区块链获取到所述收款请求后,根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额,以及根据所述明文交易金额和所述货币列表计算明文找零金额,再对所述明文找零金额进行加密以得到密文找零金额,然后生成用于验证所述密文找零金额的第二验证信息,以及生成转账数据结构,接着生成付款请求以及广播该付款请求;所述付款请求中包括所述密文找零金额、所述第二验证信息和所述转账数据结构;After obtaining the payment collection request from the blockchain, the payer decrypts the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount, and according to the plaintext transaction amount and the Calculate the change amount in plaintext for the currency list, then encrypt the change amount in plaintext to obtain the change amount in ciphertext, and then generate second verification information for verifying the change amount in ciphertext, and generate a transfer data structure , then generating a payment request and broadcasting the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure;

节点在接收到所述付款请求后,根据所述第二验证信息确认所述密文交易金额符合规则,以及根据所述转账数据结构确认所述货币列表符合规则,然后将所述付款请求存储到所述区块链,以及根据所述转账数据结构更新所述货币列表。After receiving the payment request, the node confirms that the ciphertext transaction amount conforms to the rules according to the second verification information, and confirms that the currency list conforms to the rules according to the transfer data structure, and then stores the payment request in The blockchain, and updating the currency list according to the transfer data structure.

在一些可选的实施例中,收款端对收到的明文交易金额进行加密以得到密文交易金额的步骤包括:In some optional embodiments, the step of the receiving end encrypting the received plaintext transaction amount to obtain the ciphertext transaction amount includes:

收款端生成本次收款使用的交易私钥;The receiving end generates the transaction private key used for this payment;

收款端存储基点值,以及使用基点加密算法对所述基点值进行加密计算然后得到基点校验值;The receiving end stores the base point value, and uses the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value;

收款端根据公式q=xG+mH计算所述密文交易金额;其中,q为所述密文交易金额,x为所述交易私钥,m为收到的所述明文交易金额,G为所述基点值,H为所述基点校验值。The receiving end calculates the ciphertext transaction amount according to the formula q=xG+mH; wherein, q is the ciphertext transaction amount, x is the transaction private key, m is the received plaintext transaction amount, and G is The base point value, H is the base point check value.

在一些可选的实施例中,In some optional embodiments,

所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;

收款端生成用于验证所述密文交易金额的第一验证信息的步骤包括:The steps for the receiving end to generate the first verification information for verifying the ciphertext transaction amount include:

收款端将所述明文交易金额m按照预设位数n进行二进制拆分,以得到其中mi=2i或mi=0,i表示索引位,并且0≤i<n;The receiving end performs binary splitting of the plaintext transaction amount m according to the preset number of digits n to obtain Where mi =2i or mi =0, i represents an index bit, and 0≤i<n;

收款端将所述交易私钥x按照预设位数n进行随机拆分,以得到其中x0至xn-2均随机生成,The receiving end randomly splits the transaction private key x according to the preset number of digits n to obtain Among them, x0 to xn-2 are randomly generated,

收款端对于每一个索引位,根据P(xi,mi)=xiG+miH和P(xi,mi-ki)=xiG+(mi-ki)H计算P(xi,mi)和P(xi,mi-ki);其中ki=2iFor each index bit, the payee, according to P(xi ,mi )=xi G+mi H and P(xi ,mi -ki )=xi G+(mi -ki )H Calculate P(xi , mi ) and P(xi , mi -ki ); where ki =2i ;

收款端对于每一个所述索引位,使用所述xi、所述P(xi,mi)和所述P(xi,mi-ki)生成该索引位的环签名SiFor each index bit, the payee uses the xi , the P(xi ,mi ) and the P(xi ,mi -ki ) to generate the ring signature Si of the index bit ;

收款端将全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述Si进行拼接以得到所述第一交易证明。The payee concatenates all the index bits, the P(xi ,mi ), the P(xi ,mi -ki ) and the Si to obtain the first transaction proof .

在一些可选的实施例中,节点根据所述第一验证信息确认所述密文交易金额符合规则的步骤包括:In some optional embodiments, the step of the node confirming that the encrypted transaction amount complies with the rules according to the first verification information includes:

节点拆解所述第一交易证明,以得到全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述SiThe node disassembles the first transaction proof to obtain all the index bits, the P(xi ,mi ), the P(xi ,mi-ki ) and the S i;

节点确认对于每一个所述索引位,所述Si为所述P(xi,mi)和所述P(xi,mi-ki)的环签名,以及确认对于每一个所述索引位,满足P(xi,mi)-P(xi,mi-ki)=kiH,然后确认满足以确认所述密文交易金额符合规则;其中ki=2iThe node confirms that for each of the index bits, the Si is the ring signature of the P(xi ,mi ) and the P(xi ,mi -ki) , and confirms that for each of the Index bit, satisfy P(xi ,mi )-P(xi ,mi -ki )=ki H, and then confirm that To confirm that the ciphertext transaction amount complies with the rules; where ki =2i .

在一些可选的实施例中,In some optional embodiments,

所述第一验证信息包括第一通信消息;The first verification information includes a first communication message;

收款端生成用于验证所述密文交易金额的第一验证信息的步骤包括:The steps for the receiving end to generate the first verification information for verifying the ciphertext transaction amount include:

收款端生成收款端固定私钥,获取付款端固定公钥,以及使用所述基点加密算法对所述收款端固定私钥与所述付款端固定公钥的乘积进行加密计算以得到共享密钥,然后将所述明文交易金额与所述交易私钥进行拼接,再使用所述共享密钥对拼接后的结果进行加密计算以生成所述第一通信消息。The receiving end generates the fixed private key of the receiving end, obtains the fixed public key of the paying end, and uses the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the paying end and the fixed public key of the paying end to obtain a shared key, and then concatenate the plaintext transaction amount with the transaction private key, and then use the shared key to encrypt and calculate the concatenated result to generate the first communication message.

在一些可选的实施例中,付款端根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额的步骤包括:In some optional embodiments, the step of the payment terminal decrypting the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount includes:

付款端存储所述基点值,以及使用所述基点加密算法对所述基点值进行加密计算得到所述基点校验值;The payment end stores the base point value, and uses the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value;

付款端生成付款端固定私钥,获取收款端固定公钥,以及使用所述基点加密算法对所述付款端固定私钥与所述收款端固定公钥的乘积进行加密计算以得到共享密钥,然后拆分使用所述共享密钥对所述第一通信消息进行解密计算的结果以得到所述明文交易金额。The payer generates the fixed private key of the payer, obtains the fixed public key of the payee, and uses the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the payer and the fixed public key of the payee to obtain a shared secret key, and then split the result of decrypting and computing the first communication message using the shared key to obtain the plaintext transaction amount.

在一些可选的实施例中,付款端根据所述明文交易金额和所述货币列表计算明文找零金额的步骤包括:In some optional embodiments, the step of calculating the change amount in plain text according to the transaction amount in plain text and the currency list at the payment end includes:

付款端从所述货币列表中选择收款方为所述付款端、且明文总金额大于或等于所述明文交易金额的数字货币然后组成所述货币子集,然后用所述明文总金额减去所述明文交易金额以得到明文找零金额。The payer selects the digital currency whose payee is the payer and the total plaintext amount is greater than or equal to the plaintext transaction amount from the currency list to form the currency subset, and then subtracts from the total plaintext amount The plaintext transaction amount is used to obtain the plaintext change amount.

在一些可选的实施例中,In some optional embodiments,

所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;

付款端生成转账数据结构的步骤包括:The steps for the payment terminal to generate the transfer data structure include:

付款端生成包含所述交易货币的哈希值、所述找零货币的哈希值和所述货币子集中各数字货币的哈希值的转账数据结构。The payment terminal generates a transfer data structure including the hash value of the transaction currency, the hash value of the change currency, and the hash values of each digital currency in the currency subset.

在一些可选的实施例中,In some optional embodiments,

节点根据所述收款请求更新货币列表的步骤前,还包括:节点建立用于存储货币、货币哈希值及二者对应关系的货币列表;所述货币列表包括未花费货币列表、确认中货币列表和已花费货币列表;Before the step of the node updating the currency list according to the collection request, it also includes: the node establishes a currency list for storing currency, currency hash value and the corresponding relationship between the two; the currency list includes an unspent currency list, a currency in confirmation list and list of spent currency;

节点根据所述收款请求更新货币列表的步骤包括:节点将所述交易货币和所述交易货币的哈希值存储到所述确认中货币列表;The step of the node updating the currency list according to the collection request includes: the node stores the transaction currency and the hash value of the transaction currency in the confirmed currency list;

节点将所述付款请求存储到所述区块链的步骤前,还包括:节点根据所述交易货币的哈希值查找并确认所述交易货币存储在所述确认中货币列表,再根据所述货币子集内数字货币的哈希值查找并确认所述货币子集内的数字货币存储在所述未花费货币列表,以及确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额;Before the node stores the payment request in the block chain, it also includes: the node searches and confirms that the transaction currency is stored in the currency list in the confirmation according to the hash value of the transaction currency, and then according to the The hash value of the digital currency in the currency subset looks up and confirms that the digital currency in the currency subset is stored in the unspent currency list, and confirms that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to The total amount of ciphertext of the digital currency in the currency subset;

节点根据所述转账数据结构更新所述货币列表的步骤包括:节点根据所述交易货币的哈希值查找到所述交易货币后,将所述交易货币及其哈希值从所述确认中货币列表移至所述未花费货币列表,再根据所述货币子集内数字货币的哈希值查找到所述货币子集内的货币后,将所述货币子集内的货币及其哈希值从所述未花费货币列表移至所述已花费货币列表,以及将所述找零货币及其哈希值存储到所述未花费货币列表。The step of the node updating the currency list according to the transfer data structure includes: after the node finds the transaction currency according to the hash value of the transaction currency, the transaction currency and its hash value are transferred from the confirmation currency The list is moved to the unspent currency list, and after the currency in the currency subset is found according to the hash value of the digital currency in the currency subset, the currency in the currency subset and its hash value moving from the unspent currency list to the spent currency list, and storing the change currency and its hash value in the unspent currency list.

为实现上述目的,根据本发明实施例的另一个方面,提供了一种基于数字货币的交易装置,包括:In order to achieve the above purpose, according to another aspect of the embodiment of the present invention, a transaction device based on digital currency is provided, including:

交易金额加密模块,用于对收到的明文交易金额进行加密以得到密文交易金额;The transaction amount encryption module is used to encrypt the received plaintext transaction amount to obtain the ciphertext transaction amount;

第一验证信息生成模块,用于生成用来验证所述密文交易金额的第一验证信息;A first verification information generating module, configured to generate first verification information used to verify the ciphertext transaction amount;

收款请求发送模块,用于生成收款请求以及广播该收款请求;所述收款请求中包括所述密文交易金额和所述第一验证信息;A collection request sending module, configured to generate a collection request and broadcast the collection request; the collection request includes the encrypted transaction amount and the first verification information;

收款请求接收模块,用于接收所述收款请求;A collection request receiving module, configured to receive the collection request;

交易金额解密模块,用于根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额;A transaction amount decryption module, configured to decrypt the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount;

找零金额计算模块,用于根据所述明文交易金额和所述货币列表计算明文找零金额;A change amount calculation module, configured to calculate a clear text change amount according to the plain text transaction amount and the currency list;

找零金额加密模块,用于对所述明文找零金额进行加密以得到密文找零金额;The change amount encryption module is used to encrypt the plaintext change amount to obtain the ciphertext change amount;

第二验证信息生成模块,用于生成用于验证所述密文找零金额的第二验证信息;A second verification information generating module, configured to generate second verification information for verifying the ciphertext change amount;

转账数据结构生成模块,用于生成转账数据结构;The transfer data structure generation module is used to generate the transfer data structure;

付款请求发送模块,用于生成付款请求以及广播该付款请求;所述付款请求中包括所述密文找零金额、所述第二验证信息和所述转账数据结构。A payment request sending module, configured to generate a payment request and broadcast the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure.

在一些可选的实施例中,所述交易金额加密模块还用于:生成本次收款使用的交易私钥;存储基点值,以及使用基点加密算法对所述基点值进行加密计算以得到基点校验值;根据公式q=xG+mH计算所述密文交易金额;其中,q为所述密文交易金额,x为所述交易私钥,m为收到的所述明文交易金额,G为所述基点值,H为所述基点校验值。In some optional embodiments, the transaction amount encryption module is also used to: generate the transaction private key used for this collection; store the base point value, and use the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point Check value; calculate the ciphertext transaction amount according to the formula q=xG+mH; wherein, q is the ciphertext transaction amount, x is the transaction private key, m is the received plaintext transaction amount, G is the base point value, and H is the check value of the base point.

在一些可选的实施例中,In some optional embodiments,

所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;

所述第一验证信息生成模块还用于:将所述明文交易金额m按照预设位数n进行二进制拆分,以得到其中mi=2i或mi=0,i表示索引位,并且0≤i<n;将所述交易私钥x按照预设位数n进行随机拆分,以得到其中x0至xn-2均随机生成,对于每一个索引位,根据P(xi,mi)=xiG+miH和P(xi,mi-ki)=xiG+(mi-ki)H计算P(xi,mi)和P(xi,mi-ki);其中ki=2i;对于每一个所述索引位,使用所述xi、所述P(xi,mi)和所述P(xi,mi-ki)生成该索引位的环签名Si;将全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述Si进行拼接以得到所述第一交易证明。The first verification information generation module is also used to: perform binary splitting of the plaintext transaction amount m according to the preset number of digits n, to obtain Where mi =2i or mi =0, i represents the index bit, and 0≤i<n; randomly split the transaction private key x according to the preset number of bits n to obtain Among them, x0 to xn-2 are randomly generated,Foreachindexbit,calculateP(__xi , mi ) and P(xi , mi -ki ); whereki =2i ; for each index bit, use thexi , the P(xi ,mi) and the P(xi ,mi-ki ) to generate the ring signature Si of the index bit; combine all the index bits, the P(xi ,mi ), the P(xi , mi-ki ) and the S iare spliced to obtain the first transaction proof.

在一些可选的实施例中,In some optional embodiments,

所述第一验证信息包括第一通信消息;The first verification information includes a first communication message;

所述第一验证信息生成模块还用于:生成收款端固定私钥,获取付款端固定公钥,以及使用所述基点加密算法对所述收款端固定私钥与所述付款端固定公钥的乘积进行加密计算以得到共享密钥,然后将所述明文交易金额与所述交易私钥进行拼接,再使用所述共享密钥对拼接后的结果进行加密计算以生成所述第一通信消息。The first verification information generation module is also used to: generate a fixed private key of the payment terminal, obtain a fixed public key of the payment terminal, and use the base point encryption algorithm to compare the fixed private key of the payment terminal with the fixed public key of the payment terminal. key product to obtain a shared key, then concatenate the plaintext transaction amount with the transaction private key, and then use the shared key to encrypt the concatenated result to generate the first communication information.

在一些可选的实施例中,所述交易金额解密模块还用于:存储所述基点值,以及使用所述基点加密算法对所述基点值进行加密计算得到所述基点校验值;生成付款端固定私钥,获取收款端固定公钥,以及使用所述基点加密算法对所述付款端固定私钥与所述收款端固定公钥的乘积进行加密计算以得到共享密钥,然后拆分使用所述共享密钥对所述第一通信消息进行解密计算的结果以得到所述明文交易金额。In some optional embodiments, the transaction amount decryption module is also used to: store the base point value, and use the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value; generate payment obtain the fixed private key of the receiving end, and use the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the paying end and the fixed public key of the receiving end to obtain a shared key, and then disassemble Decipher and calculate the result of decrypting the first communication message by using the shared key to obtain the plaintext transaction amount.

在一些可选的实施例中,所述找零金额计算模块还用于:从所述货币列表中选择收款方为所述付款端、且明文总金额大于或等于所述明文交易金额的数字货币然后组成所述货币子集,然后用所述明文总金额减去所述明文交易金额以得到明文找零金额。In some optional embodiments, the change amount calculation module is further configured to: select from the currency list a number whose payee is the payment terminal and whose total plaintext amount is greater than or equal to the plaintext transaction amount The currency is then composed of the currency subset, and the cleartext transaction amount is then subtracted from the cleartext total amount to obtain the cleartext change amount.

在一些可选的实施例中,In some optional embodiments,

所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;

所述转账数据结构生成模块还用于:生成包含所述交易货币的哈希值、所述找零货币的哈希值和所述货币子集中各数字货币的哈希值的转账数据结构。The transfer data structure generating module is further configured to: generate a transfer data structure including the hash value of the transaction currency, the hash value of the change currency, and the hash values of each digital currency in the currency subset.

为实现上述目的,根据本发明实施例的又一个方面,提供了一种基于数字货币的交易装置,包括:In order to achieve the above purpose, according to another aspect of the embodiment of the present invention, a transaction device based on digital currency is provided, including:

收款请求接收模块,用于接收收款请求;所述收款请求包括密文交易金额和第一验证信息;The payment request receiving module is used to receive the payment request; the payment request includes the encrypted transaction amount and the first verification information;

收款请求验证模块,用于根据所述第一验证信息确认所述密文交易金额符合规则;A collection request verification module, configured to confirm that the ciphertext transaction amount complies with the rules according to the first verification information;

收款请求入链模块,用于将所述收款请求存储到区块链;The collection request chain module is used to store the collection request into the block chain;

收款更新模块,用于根据所述收款请求更新货币列表;A collection update module, configured to update the currency list according to the collection request;

付款请求接收模块,用于接收付款请求;所述付款请求包括密文找零金额、第二验证信息和转账数据结构;The payment request receiving module is used to receive the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure;

付款请求验证模块,用于根据所述第二验证信息确认所述密文交易金额符合规则,以及根据所述转账数据结构确认所述货币列表符合规则;A payment request verification module, configured to confirm that the ciphertext transaction amount complies with the rules according to the second verification information, and confirm that the currency list complies with the rules according to the transfer data structure;

付款请求入链模块,用于将所述付款请求存储到所述区块链;A payment request chain entry module, configured to store the payment request into the block chain;

付款更新模块,用于根据所述转账数据结构更新所述货币列表。A payment update module, configured to update the currency list according to the transfer data structure.

在一些可选的实施例中,In some optional embodiments,

所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;

所述收款请求验证模块还用于:拆解所述第一交易证明,以得到全部的索引位i、P(xi,mi)、P(xi,mi-ki)和Si;确认对于每一个所述索引位,所述Si为所述P(xi,mi)和所述P(xi,mi-ki)的环签名,以及确认对于每一个所述索引位,满足P(xi,mi)-P(xi,mi-ki)=kiH,然后确认满足以确认所述密文交易金额符合规则;其中ki=2iThe collection request verification module is also used to: disassemble the first transaction certificate to obtain all index bits i, P(xi ,mi ), P(xi ,mi -ki ) and Si ; Confirm that for each of the index bits, the Si is the ring signature of the P(xi ,mi ) and the P(xi ,mi -ki) , and confirm that for each of the The index bit, satisfy P(xi ,mi )-P(xi ,mi -ki )=ki H, and then confirm that To confirm that the ciphertext transaction amount complies with the rules; where ki =2i .

在一些可选的实施例中,所述装置还包括货币列表建立模块,其中,In some optional embodiments, the device further includes a currency list establishment module, wherein,

所述货币列表建立模块用于建立用来存储货币、货币哈希值及二者对应关系的货币列表;所述货币列表包括未花费货币列表、确认中货币列表和已花费货币列表;The currency list establishment module is used to establish a currency list for storing currency, currency hash value and the corresponding relationship between the two; the currency list includes an unspent currency list, a confirmed currency list and a spent currency list;

所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;

所述收款更新模块还用于:将所述交易货币和所述交易货币的哈希值存储到所述确认中货币列表;The receipt update module is also used to: store the transaction currency and the hash value of the transaction currency in the confirmed currency list;

所述转账数据结构包括所述交易货币的哈希值、所述转账数据结构还包括找零货币的哈希值和所述货币子集内数字货币的哈希值;The transfer data structure includes the hash value of the transaction currency, and the transfer data structure further includes the hash value of the change currency and the hash value of the digital currency in the currency subset;

所述付款请求验证模块还用于:根据所述交易货币的哈希值查找并确认所述交易货币存储在所述确认中货币列表,再根据所述货币子集内数字货币的哈希值查找并确认所述货币子集内的货币存储在所述未花费货币列表,以及确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额;The payment request verification module is also used to: search and confirm that the transaction currency is stored in the currency list in the confirmation according to the hash value of the transaction currency, and then search according to the hash value of the digital currency in the currency subset And confirm that the currency in the currency subset is stored in the unspent currency list, and confirm that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to the total ciphertext of the digital currency in the currency subset amount;

所述付款更新模块还用于:根据所述交易货币的哈希值查找到所述交易货币后,将所述交易货币及其哈希值从所述确认中货币列表移至所述未花费货币列表,再根据所述货币子集内数字货币的哈希值查找到所述货币子集内的货币后,将所述货币子集内的货币及其哈希值从所述未花费货币列表移至所述已花费货币列表,以及将所述找零货币及其哈希值存储到所述未花费货币列表。The payment update module is also used for: after finding the transaction currency according to the hash value of the transaction currency, move the transaction currency and its hash value from the confirmed currency list to the unspent currency list, and after finding the currency in the currency subset according to the hash value of the digital currency in the currency subset, move the currency in the currency subset and its hash value from the unspent currency list to the spent currency list, and store the change currency and its hash value into the unspent currency list.

为实现上述目的,根据本发明实施例的再一个方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,其特征在于,所述计算机指令能够被计算机或计算机系统运行,从而使该计算机或计算机系统能够执行所述的基于数字货币的交易方法。In order to achieve the above object, according to still another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium stores computer instructions, which is characterized in that the computer instructions can be read by a computer or The computer system operates so that the computer or computer system can execute the described digital currency-based transaction method.

上述发明中的一个实施例具有如下优点或有益效果:因为采用基于分布式账本技术的收付款交易的过程中,收款端和付款端对交易中涉及的明文金额进行加密以得到密文金额,并生成相应的验证消息,用以对密文金额进行验证或者解密的技术手段,所以克服了现有的分布式账本技术中资金难以保密的技术问题,进而达到保障合作共享且保护交易隐私的技术效果。An embodiment of the above invention has the following advantages or beneficial effects: Because in the process of receiving and paying transactions based on distributed ledger technology, the receiving end and the paying end encrypt the plaintext amount involved in the transaction to obtain the ciphertext amount, And generate the corresponding verification message, which is used to verify or decrypt the ciphertext amount, so it overcomes the technical problem that the funds in the existing distributed ledger technology are difficult to keep secret, and then achieves a technology that guarantees cooperation and sharing and protects transaction privacy Effect.

上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。The further effects of the above-mentioned non-conventional alternatives will be described below in conjunction with specific embodiments.

附图说明Description of drawings

附图用于更好地理解本发明,不构成对本发明的不当限定。其中:The accompanying drawings are used to better understand the present invention, and do not constitute improper limitations to the present invention. in:

图1是根据本发明实施例的基于数字货币的交易方法的主要步骤的示意图;Fig. 1 is a schematic diagram of the main steps of a transaction method based on digital currency according to an embodiment of the present invention;

图2是根据本发明实施例的基于数字货币的交易装置的主要模块的示意图;Fig. 2 is a schematic diagram of main modules of a transaction device based on digital currency according to an embodiment of the present invention;

图3是根据本发明另一实施例的基于数字货币的交易装置的主要模块的示意图。Fig. 3 is a schematic diagram of main modules of a transaction device based on digital currency according to another embodiment of the present invention.

具体实施方式detailed description

以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present invention to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

图1是根据本发明实施例的基于数字货币的交易方法的主要步骤的示意图。Fig. 1 is a schematic diagram of main steps of a digital currency-based transaction method according to an embodiment of the present invention.

如图1所示,根据本发明实施例提供的一种基于数字货币的交易方法,包括:As shown in Figure 1, a digital currency-based transaction method provided according to an embodiment of the present invention includes:

S10,收款端对收到的明文交易金额进行加密以得到密文交易金额,以及生成用于验证所述密文交易金额的第一验证信息,然后生成收款请求以及广播该收款请求;所述收款请求中包括所述密文交易金额和所述第一验证信息。S10. The receiving end encrypts the received plaintext transaction amount to obtain the ciphertext transaction amount, and generates first verification information for verifying the ciphertext transaction amount, and then generates a payment request and broadcasts the payment request; The collection request includes the ciphertext transaction amount and the first verification information.

S11,节点在接收到所述收款请求后,根据所述第一验证信息确认所述密文交易金额符合规则,然后将所述收款请求存储到区块链,以及根据所述收款请求更新货币列表。S11. After receiving the payment request, the node confirms that the ciphertext transaction amount complies with the rules according to the first verification information, and then stores the payment request in the block chain, and according to the payment request Update the currency list.

S12,付款端从所述区块链获取到所述收款请求后,根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额,以及根据所述明文交易金额和所述货币列表计算明文找零金额,再对所述明文找零金额进行加密以得到密文找零金额,然后生成用于验证所述密文找零金额的第二验证信息,以及生成转账数据结构,接着生成付款请求以及广播该付款请求;所述付款请求中包括所述密文找零金额、所述第二验证信息和所述转账数据结构。S12. After obtaining the collection request from the blockchain, the payer decrypts the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount, and according to the plaintext transaction amount calculating the plaintext change amount with the currency list, and then encrypting the plaintext change amount to obtain the ciphertext change amount, and then generating second verification information for verifying the ciphertext change amount, and generating a transfer data structure, and then generate a payment request and broadcast the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure.

S13,节点在接收到所述付款请求后,根据所述第二验证信息确认所述密文交易金额符合规则,以及根据所述转账数据结构确认所述货币列表符合规则,然后将所述付款请求存储到所述区块链,以及根据所述转账数据结构更新所述货币列表。S13. After receiving the payment request, the node confirms that the encrypted transaction amount conforms to the rules according to the second verification information, and confirms that the currency list conforms to the rules according to the transfer data structure, and then sends the payment request to Stored in the block chain, and update the currency list according to the transfer data structure.

在一些可选的实施例中,所述收款请求中还包括收款时间戳,为了便于发送和接收以及记录,所述收款请求中还包括收款方地址和付款方地址。为了便于识别,所述收款请求在广播前,由所述收款端使用收款端固定私钥对其进行签名。所述付款请求中还包括付款时间戳。为了便于发送和接收以及记录,所述付款请求中还包括收款方地址和付款方地址。为了便于识别,所述付款请求在广播前,由所述付款端使用付款端固定私钥对其进行签名。In some optional embodiments, the payment collection request further includes a payment collection time stamp, and for the convenience of sending, receiving and recording, the payment collection request further includes a payee address and a payer address. In order to facilitate identification, the payment collection request is signed by the collection terminal using the fixed private key of the collection terminal before broadcasting. The payment request also includes a payment time stamp. In order to facilitate sending, receiving and recording, the payment request also includes the address of the payee and the address of the payer. In order to facilitate identification, the payment request is signed by the payer using the fixed private key of the payer before broadcasting.

从上面所述可以看出,本发明实施例因为采用基于分布式账本技术的收付款交易的过程中,收款端和付款端对交易中涉及的明文金额进行加密以得到密文金额,并生成相应的验证消息,用以对密文金额进行验证或者解密的技术手段,所以克服了现有的分布式账本技术中资金难以保密的技术问题,进而达到保障合作共享且保护交易隐私的技术效果。It can be seen from the above that, because the embodiment of the present invention adopts the process of receiving and paying transactions based on distributed ledger technology, the receiving end and the paying end encrypt the plaintext amount involved in the transaction to obtain the ciphertext amount, and generate The corresponding verification message is used to verify or decrypt the ciphertext amount, so it overcomes the technical problem that funds are difficult to keep secret in the existing distributed ledger technology, and then achieves the technical effect of ensuring cooperation and sharing and protecting transaction privacy.

在一些可选的实施例中,收款端对收到的明文交易金额进行加密以得到密文交易金额的步骤包括:In some optional embodiments, the step of the receiving end encrypting the received plaintext transaction amount to obtain the ciphertext transaction amount includes:

收款端生成本次收款使用的交易私钥;收款端存储基点值,以及使用基点加密算法对所述基点值进行加密计算以得到基点校验值;收款端根据公式q=xG+mH计算所述密文交易金额;其中,q为所述密文交易金额,x为所述交易私钥,m为收到的所述明文交易金额,G为所述基点值,H为所述基点校验值。其中,交易私钥仅用于本次收付款,每次进行新的交易时都会生成一个新的交易私钥。The receiving end generates the transaction private key used for this collection; the receiving end stores the base point value, and uses the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value; the receiving end uses the formula q=xG+ mH calculates the ciphertext transaction amount; where, q is the ciphertext transaction amount, x is the transaction private key, m is the plaintext transaction amount received, G is the base point value, and H is the Base point checksum. Among them, the transaction private key is only used for this payment, and a new transaction private key will be generated every time a new transaction is made.

所述基点加密算法可以是例如SHA256算法、RIPEMD-160算法或Base58编码等。基点加密算法的目的是通过预设的基点值G计算得到一个无人知晓私钥的公开公钥,即基点校验值H;而使用例如SHA256这类哈希算法得出的基点校验值H比较有公信力,当然也可以采用其他能够达到相同或相似效果的算法。基点加密算法需要保证计算得到的H与G之间没有类似与H=kG这种简单地对应关系,从而使得q=xG+mH在q、G、H均已知的时候,x和m的值有唯一解。The base point encryption algorithm may be, for example, SHA256 algorithm, RIPEMD-160 algorithm, or Base58 encoding. The purpose of the base point encryption algorithm is to calculate a public public key that no one knows the private key through the preset base point value G, that is, the base point check value H; and the base point check value H obtained by using a hash algorithm such as SHA256 It is more credible, and of course other algorithms that can achieve the same or similar effects can also be used. The base point encryption algorithm needs to ensure that there is no simple correspondence between the calculated H and G, such as H=kG, so that q=xG+mH when q, G, and H are all known, the values of x and m has a unique solution.

在一些可选的实施例中,所述第一验证信息包括第一交易证明;In some optional embodiments, the first verification information includes a first transaction certificate;

收款端生成用于验证所述密文交易金额的第一验证信息的步骤包括:The steps for the receiving end to generate the first verification information for verifying the ciphertext transaction amount include:

收款端将所述明文交易金额m按照预设位数n进行二进制拆分,以得到其中mi=2i或mi=0,i表示索引位,并且0≤i<n;The receiving end performs binary splitting of the plaintext transaction amount m according to the preset number of digits n to obtain Where mi =2i or mi =0, i represents an index bit, and 0≤i<n;

收款端将所述交易私钥x按照预设位数n进行随机拆分,以得到其中x0至xn-2均随机生成,在拆分时,预设位数n越大则加密程度越高,但是也会提高计算成本,并且多余的位数并不具备实际适用性,所以n的取值通常在64比较合适,根据情况也可以选择32或者128;The receiving end randomly splits the transaction private key x according to the preset number of digits n to obtain Among them, x0 to xn-2 are randomly generated, When splitting, the larger the preset number of bits n, the higher the degree of encryption, but it will also increase the calculation cost, and the extra number of bits does not have practical applicability, so the value of n is usually 64 is more appropriate, depending on the situation You can also choose 32 or 128;

收款端对于每一个索引位,根据P(xi,mi)=xiG+miH和P(xi,mi-ki)=xiG+(mi-ki)H计算P(xi,mi)和P(xi,mi-ki);其中ki=2iFor each index bit, the payee, according to P(xi ,mi )=xi G+mi H and P(xi ,mi -ki )=xi G+(mi -ki )H Calculate P(xi , mi ) and P(xi , mi -ki ); where ki =2i ;

收款端对于每一个所述索引位,使用所述xi、所述P(xi,mi)和所述P(xi,mi-ki)生成该索引位的环签名SiFor each index bit, the payee uses the xi , the P(xi ,mi ) and the P(xi ,mi -ki ) to generate the ring signature Si of the index bit ;

收款端将全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述Si进行拼接以得到所述第一交易证明。The payee concatenates all the index bits, the P(xi ,mi ), the P(xi ,mi -ki ) and the Si to obtain the first transaction proof .

在一些可选的实施例中,节点根据所述第一验证信息确认所述密文交易金额符合规则的步骤包括:In some optional embodiments, the step of the node confirming that the encrypted transaction amount complies with the rules according to the first verification information includes:

节点拆解所述第一交易证明,以得到全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述SiThe node disassembles the first transaction proof to obtain all the index bits, the P(xi ,mi ), the P(xi ,mi-ki ) and the S i;

节点确认对于每一个所述索引位,所述Si为所述P(xi,mi)和所述P(xi,mi-ki)的环签名,以及确认对于每一个所述索引位,满足P(xi,mi)-P(xi,mi-ki)=kiH,然后确认满足从而可以确认密文交易金额q对应的明文交易金额在0-2n范围内,以确认所述密文交易金额符合规则;其中ki=2iThe node confirms that for each of the index bits, the Si is the ring signature of the P(xi ,mi ) and the P(xi ,mi -ki) , and confirms that for each of the Index bit, satisfy P(xi ,mi )-P(xi ,mi -ki )=ki H, and then confirm that Therefore, it can be confirmed that the plaintext transaction amount corresponding to the ciphertext transaction amount q is in the range of 0-2n , so as to confirm that the ciphertext transaction amount complies with the rules; where ki =2i .

在一些可选的实施例中,所述第一验证信息包括第一通信消息;In some optional embodiments, the first verification information includes a first communication message;

收款端生成用于验证所述密文交易金额的第一验证信息的步骤包括:The steps for the receiving end to generate the first verification information for verifying the ciphertext transaction amount include:

收款端生成收款端固定私钥,获取付款端固定公钥,以及使用所述基点加密算法对所述收款端固定私钥与所述付款端固定公钥的乘积进行加密计算以得到共享密钥,然后将所述明文交易金额与所述交易私钥进行拼接,再使用所述共享密钥对拼接后的结果进行加密计算以生成所述第一通信消息。The receiving end generates the fixed private key of the receiving end, obtains the fixed public key of the paying end, and uses the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the paying end and the fixed public key of the paying end to obtain a shared key, and then concatenate the plaintext transaction amount with the transaction private key, and then use the shared key to encrypt and calculate the concatenated result to generate the first communication message.

在一些可选的实施例中,付款端根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额的步骤包括:In some optional embodiments, the step of the payment terminal decrypting the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount includes:

付款端存储所述基点值,以及使用所述基点加密算法对所述基点值进行加密计算得到所述基点校验值;The payment end stores the base point value, and uses the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value;

付款端生成付款端固定私钥,获取收款端固定公钥,以及使用所述基点加密算法对所述付款端固定私钥与所述收款端固定公钥的乘积进行加密计算以得到共享密钥,然后拆分使用所述共享密钥对所述第一通信消息进行解密计算的结果以得到所述明文交易金额。The payer generates the fixed private key of the payer, obtains the fixed public key of the payee, and uses the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the payer and the fixed public key of the payee to obtain a shared secret key, and then split the result of decrypting and computing the first communication message using the shared key to obtain the plaintext transaction amount.

需要说明的是,由于第一通信消息采用了付款端和收款端其中一端的固定私钥以及另一端的固定公钥进行加密,所以只有付款端和收款端可以对第一通信息消息进行解密,从而对密文交易金额进行解密。同理,任意的用户端只能解密并获取到与自身有关的(自身为付款方或者收款方的)数字货币中的明文金额,而无法获取与自身无关的数字货币中的明文交易金额,这样一来就保证了交易过程和交易账本的私密性。It should be noted that since the first communication message is encrypted with the fixed private key at one end of the payer and the payee and the fixed public key at the other end, only the payer and payee can encrypt the first message. Decrypt to decrypt the ciphertext transaction amount. Similarly, any client can only decrypt and obtain the plaintext amount in the digital currency related to itself (it is the payer or payee), but cannot obtain the plaintext transaction amount in the digital currency that has nothing to do with itself. In this way, the privacy of the transaction process and transaction ledger is guaranteed.

在一些可选的实施例中,付款端根据所述明文交易金额和所述货币列表计算明文找零金额的步骤包括:In some optional embodiments, the step of calculating the change amount in plain text according to the transaction amount in plain text and the currency list at the payment end includes:

付款端从所述货币列表中选择收款方为所述付款端、且明文总金额大于或等于所述明文交易金额的数字货币然后组成所述货币子集,然后用所述明文总金额减去所述明文交易金额以得到明文找零金额。需要说明的是,如果所述货币子集中数字货币的明文总金额等于所述明文交易金额,则计算得到的所述明文找零金额为零;在这种情况下,可以依旧按照明文找零金额不为0的方法进行后续处理,也可以设置单独的判断条件,不再处理后续出现明文找零金额及与其相关的内容。如果按照明文找零金额不为0的方法进行后续处理,则可以与后续步骤中节点对密文交易金额、密文找零金额以及货币子集中数字货币的明文总金额的验证保持一致,能够提高方法的整体性和安全性。The payer selects the digital currency whose payee is the payer and the total plaintext amount is greater than or equal to the plaintext transaction amount from the currency list to form the currency subset, and then subtracts from the total plaintext amount The plaintext transaction amount is used to obtain the plaintext change amount. It should be noted that if the total plaintext amount of the digital currency in the currency subset is equal to the plaintext transaction amount, the calculated plaintext change amount is zero; in this case, the plaintext change amount can still be used The method that is not 0 is used for subsequent processing, and a separate judgment condition can also be set, so that the amount of change in plain text and related content that appear later will not be processed. If the follow-up processing is carried out according to the method that the plaintext change amount is not 0, it can be consistent with the node’s verification of the ciphertext transaction amount, ciphertext change amount, and the total plaintext amount of the digital currency in the currency subset in the subsequent steps, which can improve Integrity and security of the method.

在一些可选的实施例中,所述密文找零金额的生成、解密和验证的方式参考所述密文交易金额;第二验证信息的生成和使用参考所述第一验证信息。需要说明的是,在生成第二验证信息时,由付款端生成本次付款使用的付款交易私钥,在另外一些实施例中,为了满足验证条件,所述付款交易私钥还要满足一定条件,在后续实施例中进行说明;如果需要生成第二通信消息,则付款端根据付款端固定私钥和付款端固定公钥,参照所述第一验证消息的生成方式进行生成。In some optional embodiments, the method of generating, decrypting and verifying the ciphertext change amount refers to the ciphertext transaction amount; the generation and use of the second verification information refers to the first verification information. It should be noted that when generating the second verification information, the payment transaction private key used for this payment is generated by the payer. In some other embodiments, in order to meet the verification conditions, the payment transaction private key must also meet certain conditions , which will be described in subsequent embodiments; if the second communication message needs to be generated, the payer generates it according to the fixed private key of the payer and the fixed public key of the payer, referring to the generation method of the first verification message.

在一些可选的实施例中,In some optional embodiments,

节点根据所述收款请求更新货币列表的步骤前,还包括:节点建立用于存储货币、货币哈希值及二者对应关系的货币列表;所述货币列表包括未花费货币列表、确认中货币列表和已花费货币列表;Before the step of the node updating the currency list according to the collection request, it also includes: the node establishes a currency list for storing currency, currency hash value and the corresponding relationship between the two; the currency list includes an unspent currency list, a currency in confirmation list and list of spent currency;

节点根据所述收款请求更新货币列表的步骤包括:节点将所述交易货币和所述交易货币的哈希值存储到所述确认中货币列表;The step of the node updating the currency list according to the collection request includes: the node stores the transaction currency and the hash value of the transaction currency in the confirmed currency list;

节点将所述付款请求存储到所述区块链的步骤前,还包括:节点根据所述交易货币的哈希值查找并确认所述交易货币存储在所述确认中货币列表,再根据所述货币子集内数字货币的哈希值查找并确认所述货币子集内的数字货币存储在所述未花费货币列表,以及确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额;Before the node stores the payment request in the block chain, it also includes: the node searches and confirms that the transaction currency is stored in the currency list in the confirmation according to the hash value of the transaction currency, and then according to the The hash value of the digital currency in the currency subset looks up and confirms that the digital currency in the currency subset is stored in the unspent currency list, and confirms that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to The total amount of ciphertext of the digital currency in the currency subset;

节点根据所述转账数据结构更新所述货币列表的步骤包括:节点根据所述交易货币的哈希值查找到所述交易货币后,将所述交易货币及其哈希值从所述确认中货币列表移至所述未花费货币列表,再根据所述货币子集内数字货币的哈希值查找到所述货币子集内的货币后,将所述货币子集内的货币及其哈希值从所述未花费货币列表移至所述已花费货币列表,以及将所述找零货币及其哈希值存储到所述未花费货币列表。The step of the node updating the currency list according to the transfer data structure includes: after the node finds the transaction currency according to the hash value of the transaction currency, the transaction currency and its hash value are transferred from the confirmation currency The list is moved to the unspent currency list, and after the currency in the currency subset is found according to the hash value of the digital currency in the currency subset, the currency in the currency subset and its hash value moving from the unspent currency list to the spent currency list, and storing the change currency and its hash value in the unspent currency list.

本实施例中,因为要确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额,所以当所述货币子集中数字货币的明文总金额等于所述明文交易金额,即所述明文找零金额的值为0时,仍然要参照对明文交易金额进行加密的方法对明文找零金额进行加密;此外,在对明文找零金额进行加密时,由付款端生成付款交易私钥,这里的付款交易私钥的生成方式与收款端生成交易私钥的方式不同,并非随机生成,而是以所述货币子集中数字货币的交易私钥之和减去所述付款端的交易私钥得到的结果作为所述付款端的付款交易私钥,这样才能够在明文找零金额为0时,仍然满足密文交易金额与密文找零金额的和等于货币子集内数字货币的密文总金额,从而完成验证过程。In this embodiment, because it is confirmed that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to the total ciphertext amount of the digital currency in the currency subset, when the plaintext of the digital currency in the currency subset The total amount is equal to the plaintext transaction amount, that is, when the value of the plaintext change amount is 0, it is still necessary to encrypt the plaintext change amount by referring to the method for encrypting the plaintext transaction amount; When encrypting, the payment transaction private key is generated by the payer. The generation method of the payment transaction private key here is different from that of the payee. It is not randomly generated, but the transaction private key of the digital currency in the currency subset. The result obtained by subtracting the transaction private key of the payment terminal from the sum of the private keys of the payment terminal is used as the payment transaction private key of the payment terminal, so that when the plaintext change amount is 0, the relationship between the ciphertext transaction amount and the ciphertext change amount can still be satisfied. The sum is equal to the total amount of ciphertext of the digital currency in the currency subset, thus completing the verification process.

需要说明的是,任意用户端如果需要查询自身的账户余额,则可以收集货币列表的未花费货币列表中,收款方地址为自身地址的货币,根据这些货币付款端的公钥逐个计算每个货币的共享密钥,并使用所述共享密钥分别解密这些货币中的密文金额,以得到每个货币的明文金额,将这些明文金额相加即可得到自身的账户余额。It should be noted that if any client needs to query its own account balance, it can collect the currencies whose payee address is its own address in the unspent currency list of the currency list, and calculate each currency one by one according to the public key of the payment terminal of these currencies and use the shared key to decrypt the ciphertext amounts in these currencies respectively to obtain the plaintext amounts of each currency, and add these plaintext amounts to obtain their own account balances.

在一些可选的实施例中,付款端从所述区块链获取到所述收款请求后,还可能拒绝进行付款;此时,所述方法还包括:In some optional embodiments, after the payment terminal obtains the collection request from the block chain, it may also refuse to make payment; at this time, the method further includes:

付款端获取所述收款请求中包含的交易货币,以及计算所述交易货币的哈希值,然后生成拒绝付款请求以及广播该拒绝付款请求;所述拒绝付款请求中包括所述交易货币的哈希值;The payment end obtains the transaction currency contained in the payment request, and calculates the hash value of the transaction currency, and then generates a payment rejection request and broadcasts the payment rejection request; the payment rejection request includes the transaction currency hash value Greek value;

节点端在接收到所述拒绝付款请求后,根据所述交易货币的哈希值在所述货币列表中查找所述交易货币,以及在确定所述交易货币存在于所述确认中货币列表且所述交易货币的付款方地址为所述付款端的地址后,将所述交易货币从所述货币列表中删除。After receiving the payment rejection request, the node side looks up the transaction currency in the currency list according to the hash value of the transaction currency, and after determining that the transaction currency exists in the confirmation currency list and the After the payer address of the transaction currency is the address of the payment terminal, the transaction currency is deleted from the currency list.

在一些可选的实施例中,收款端还可以在付款端没有发起付款请求或拒绝付款请求前,发起撤回收款请求;此时,所述方法还包括:In some optional embodiments, the payee can also initiate a withdrawal request before the payer does not initiate a payment request or reject the payment request; at this time, the method further includes:

收款端计算所述交易货币的哈希值,然后生成撤回收款请求以及广播该撤回收款请求;所述撤回收款请求中包括所述交易货币的哈希值;The receiving end calculates the hash value of the transaction currency, and then generates a withdrawal request and broadcasts the withdrawal request; the withdrawal request includes the transaction currency hash value;

节点端在接收到所述撤回收款请求后,根据所述交易货币的哈希值在所述货币列表中查找所述交易货币,以及在确定所述交易货币存在于所述确认中货币列表且所述交易货币的收款方地址为所述收款端的地址后,将所述交易货币从所述货币列表中删除。After receiving the withdrawal request, the node side looks up the transaction currency in the currency list according to the hash value of the transaction currency, and determines that the transaction currency exists in the confirmation currency list and After the payee address of the transaction currency is the address of the payee terminal, the transaction currency is deleted from the currency list.

在一些可选的实施例中,所述交易货币、找零货币和数字货币的数据结构如表1所示:In some optional embodiments, the data structures of the transaction currency, change currency and digital currency are shown in Table 1:

表1货币数据结构表Table 1 Currency data structure table

字段field缩写abbreviation类型Types of解释ExplanationAddressFromAddressFromDxx地址address付款方地址Payer's addressAddressToAddressToDxx地址address收款方地址Payee addressMoneyMoneyqq公钥public key密文金额ciphertext amountProofProofffBytesBytes交易证明proof of transactionMessagemessageccBytesBytes通信消息communication messageTimestampTimestampsthe s时间time毫秒级时间戳Timestamp in milliseconds

在一些可选的实施例中,所述交易证明的数据结构如表2所示:In some optional embodiments, the data structure of the transaction proof is shown in Table 2:

表2交易证明数据结构表Table 2 Transaction proof data structure table

在一些可选的实施例中,所述转账数据结构的可选数据结构如表3所示:In some optional embodiments, the optional data structure of the transfer data structure is shown in Table 3:

表3转账数据结构表Table 3 transfer data structure table

字段field类型Types of解释ExplanationInputsInputsHash列表Hash list输入货币哈希列表Enter a list of currency hashesOutputsOutputsHash列表Hash list输出货币哈希列表Output currency hash list

其中,所述输入货币哈希列表中包括货币子集中数字货币的哈希值;所述输出货币哈希列表中包括所述交易货币的哈希值,以及在存在找零时,还包括所述找零货币的哈希值。Wherein, the input currency hash list includes the hash value of the digital currency in the currency subset; the output currency hash list includes the transaction currency hash value, and when there is change, it also includes the The hash value of the change currency.

图2是根据本发明实施例的基于数字货币的交易装置的主要模块的示意图。Fig. 2 is a schematic diagram of main modules of a transaction device based on digital currency according to an embodiment of the present invention.

如图2所示,本发明实施例提供一种基于数字货币的交易装置200,主要应用于具备收款和付款功能的用户端,包括:As shown in Figure 2, the embodiment of the present invention provides a transaction device 200 based on digital currency, which is mainly applied to a client terminal with functions of collection and payment, including:

交易金额加密模块201,用于对收到的明文交易金额进行加密以得到密文交易金额;The transaction amount encryption module 201 is used to encrypt the received plaintext transaction amount to obtain the ciphertext transaction amount;

第一验证信息生成模块202,用于生成用来验证所述密文交易金额的第一验证信息;A first verification information generating module 202, configured to generate first verification information used to verify the encrypted transaction amount;

收款请求发送模块203,用于生成收款请求以及广播该收款请求;所述收款请求中包括所述密文交易金额和所述第一验证信息;A payment request sending module 203, configured to generate a payment request and broadcast the payment request; the payment request includes the encrypted transaction amount and the first verification information;

收款请求接收模块204,用于接收所述收款请求;A collection request receiving module 204, configured to receive the collection request;

交易金额解密模块205,用于根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额;A transaction amount decryption module 205, configured to decrypt the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount;

找零金额计算模块206,用于根据所述明文交易金额和所述货币列表计算明文找零金额;A change amount calculation module 206, configured to calculate a clear text change amount according to the plain text transaction amount and the currency list;

找零金额加密模块207,用于对所述明文找零金额进行加密以得到密文找零金额;A change amount encryption module 207, configured to encrypt the plaintext change amount to obtain a ciphertext change amount;

第二验证信息生成模块208,用于生成用于验证所述密文找零金额的第二验证信息;A second verification information generating module 208, configured to generate second verification information for verifying the ciphertext change amount;

转账数据结构生成模块209,用于生成转账数据结构;A transfer data structure generating module 209, configured to generate a transfer data structure;

付款请求发送模块210,用于生成付款请求以及广播该付款请求;所述付款请求中包括所述密文找零金额、所述第二验证信息和所述转账数据结构。The payment request sending module 210 is configured to generate a payment request and broadcast the payment request; the payment request includes the encrypted change amount, the second verification information and the transfer data structure.

在一些可选的实施例中,所述交易金额加密模块201还用于:生成本次收款使用的交易私钥;存储基点值,以及使用基点加密算法对所述基点值进行加密计算以得到基点校验值;根据公式q=xG+mH计算所述密文交易金额;其中,q为所述密文交易金额,x为所述交易私钥,m为收到的所述明文交易金额,G为所述基点值,H为所述基点校验值。In some optional embodiments, the transaction amount encryption module 201 is also used to: generate the transaction private key used in this collection; store the base point value, and use the base point encryption algorithm to encrypt and calculate the base point value to obtain Base point check value; calculate the ciphertext transaction amount according to the formula q=xG+mH; wherein, q is the ciphertext transaction amount, x is the transaction private key, m is the received plaintext transaction amount, G is the base point value, and H is the check value of the base point.

所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;

所述第一验证信息生成模块202还用于:将所述明文交易金额m按照预设位数n进行二进制拆分,以得到其中mi=2i或mi=0,i表示索引位,并且0≤i<n;将所述交易私钥x按照预设位数n进行随机拆分,以得到其中x0至xn-2均随机生成,对于每一个索引位,根据P(xi,mi)=xiG+miH和P(xi,mi-ki)=xiG+(mi-ki)H计算P(xi,mi)和P(xi,mi-ki);其中ki=2i;对于每一个所述索引位,使用所述xi、所述P(xi,mi)和所述P(xi,mi-ki)生成该索引位的环签名Si;将全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述Si进行拼接以得到所述第一交易证明。The first verification information generating module 202 is further configured to: perform binary splitting of the plaintext transaction amount m according to a preset number of digits n, to obtain Where mi =2i or mi =0, i represents the index bit, and 0≤i<n; randomly split the transaction private key x according to the preset number of bits n to obtain Among them, x0 to xn-2 are randomly generated,Foreachindexbit,calculateP(__xi , mi ) and P(xi , mi -ki ); whereki =2i ; for each index bit, use thexi , the P(xi ,mi) and the P(xi ,mi-ki ) to generate the ring signature Si of the index bit; combine all the index bits, the P(xi ,mi ), the P(xi , mi-ki ) and the S iare spliced to obtain the first transaction proof.

所述第一验证信息包括第一通信消息;The first verification information includes a first communication message;

所述第一验证信息生成模块202还用于:生成收款端固定私钥,获取付款端固定公钥,以及使用所述基点加密算法对所述收款端固定私钥与所述付款端固定公钥的乘积进行加密计算以得到共享密钥,然后将所述明文交易金额与所述交易私钥进行拼接,再使用所述共享密钥对拼接后的结果进行加密计算以生成所述第一通信消息。The first verification information generation module 202 is further configured to: generate a fixed private key of the payee, obtain a fixed public key of the payer, and use the base point encryption algorithm to pair the fixed private key of the payee with the fixed private key of the payer. The product of the public key is encrypted and calculated to obtain a shared key, and then the plaintext transaction amount is spliced with the transaction private key, and then the result after splicing is encrypted and calculated using the shared key to generate the first communication message.

在一些可选的实施例中,所述交易金额解密模块205还用于:存储所述基点值,以及使用所述基点加密算法对所述基点值进行加密计算得到所述基点校验值;生成付款端固定私钥,获取收款端固定公钥,以及使用所述基点加密算法对所述付款端固定私钥与所述收款端固定公钥的乘积进行加密计算以得到共享密钥,然后拆分使用所述共享密钥对所述第一通信消息进行解密计算的结果以得到所述明文交易金额。In some optional embodiments, the transaction amount decryption module 205 is further configured to: store the base point value, and use the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value; generate The payment end fixes the private key, obtains the payee end fixed public key, and uses the base point encryption algorithm to encrypt and calculate the product of the payer end fixed private key and the payee end fixed public key to obtain a shared key, and then Splitting the result of decrypting and calculating the first communication message by using the shared key to obtain the plaintext transaction amount.

在一些可选的实施例中,所述找零金额计算模块206还用于:从所述货币列表中选择收款方为所述付款端、且明文总金额大于或等于所述明文交易金额的数字货币然后组成所述货币子集,然后用所述明文总金额减去所述明文交易金额以得到明文找零金额。In some optional embodiments, the change amount calculation module 206 is further configured to: select from the currency list the payee as the payer and the total plaintext amount is greater than or equal to the plaintext transaction amount The digital currency is then composed of the currency subset, and the cleartext transaction amount is then subtracted from the cleartext total amount to obtain the cleartext change amount.

在一些可选的实施例中,In some optional embodiments,

所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;

所述转账数据结构生成模块209还用于:生成包含所述交易货币的哈希值、所述找零货币的哈希值和所述货币子集中各数字货币的哈希值的转账数据结构。The transfer data structure generation module 209 is further configured to: generate a transfer data structure including the hash value of the transaction currency, the hash value of the change currency, and the hash values of each digital currency in the currency subset.

图3是根据本发明另一实施例的基于数字货币的交易装置的主要模块的示意图。Fig. 3 is a schematic diagram of main modules of a transaction device based on digital currency according to another embodiment of the present invention.

如图3所示,本发明另一实施例提供一种基于数字货币的交易装置300,主要应用于具备验证功能的节点,包括:As shown in Figure 3, another embodiment of the present invention provides a transaction device 300 based on digital currency, which is mainly applied to nodes with verification functions, including:

收款请求接收模块301,用于接收收款请求;所述收款请求包括密文交易金额和第一验证信息;A payment request receiving module 301, configured to receive a payment request; the payment request includes encrypted transaction amount and first verification information;

收款请求验证模块302,用于根据所述第一验证信息确认所述密文交易金额符合规则;A collection request verification module 302, configured to confirm that the ciphertext transaction amount complies with the rules according to the first verification information;

收款请求入链模块303,用于将所述收款请求存储到区块链;Receipt request into the chain module 303, for storing the receivable request in the block chain;

收款更新模块304,用于根据所述收款请求更新货币列表;A collection update module 304, configured to update the currency list according to the collection request;

付款请求接收模块305,用于接收付款请求;所述付款请求包括密文找零金额、第二验证信息和转账数据结构;A payment request receiving module 305, configured to receive a payment request; the payment request includes ciphertext change amount, second verification information and transfer data structure;

付款请求验证模块306,用于根据所述第二验证信息确认所述密文交易金额符合规则,以及根据所述转账数据结构确认所述货币列表符合规则;A payment request verification module 306, configured to confirm that the encrypted transaction amount conforms to the rules according to the second verification information, and confirm that the currency list conforms to the rules according to the transfer data structure;

付款请求入链模块307,用于将所述付款请求存储到所述区块链;Payment request into the chain module 307, for storing the payment request in the block chain;

付款更新模块308,用于根据所述转账数据结构更新所述货币列表。A payment updating module 308, configured to update the currency list according to the transfer data structure.

在一些可选的实施例中,所述第一验证信息包括第一交易证明;In some optional embodiments, the first verification information includes a first transaction certificate;

所述收款请求验证模块302还用于:拆解所述第一交易证明,以得到全部的索引位i、P(xi,mi)、P(xi,mi-ki)和Si;确认对于每一个所述索引位,所述Si为所述P(xi,mi)和所述P(xi,mi-ki)的环签名,以及确认对于每一个所述索引位,满足P(xi,mi)-P(xi,mi-ki)=kiH,然后确认满足以确认所述密文交易金额符合规则;其中ki=2iThe collection request verification module 302 is also used to: disassemble the first transaction proof to obtain all index bits i, P(xi ,mi ), P(xi ,mi -ki ) and Si ; confirm that for each of the index bits, the Si is the ring signature of the P(xi ,mi ) and the P(xi ,mi-ki ), and confirm that for each The index bit satisfies P(xi ,mi )-P(xi ,mi -ki )=ki H, and then confirms that To confirm that the ciphertext transaction amount complies with the rules; where ki =2i .

在一些可选的实施例中,所述装置还包括货币列表建立模块309,In some optional embodiments, the device further includes a currency list establishment module 309,

所述货币列表建立模块309用于建立用来存储货币、货币哈希值及二者对应关系的货币列表;所述货币列表包括未花费货币列表、确认中货币列表和已花费货币列表;The currency list establishment module 309 is used to establish a currency list for storing currency, currency hash value and the corresponding relationship between the two; the currency list includes an unspent currency list, a confirmed currency list and a spent currency list;

所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;

所述收款更新模块304:将所述交易货币和所述交易货币的哈希值存储到所述确认中货币列表;The receipt update module 304: store the transaction currency and the hash value of the transaction currency in the confirmed currency list;

所述转账数据结构包括所述交易货币的哈希值、所述转账数据结构还包括找零货币的哈希值和所述货币子集内数字货币的哈希值;The transfer data structure includes the hash value of the transaction currency, and the transfer data structure further includes the hash value of the change currency and the hash value of the digital currency in the currency subset;

所述付款请求验证模块306还用于:根据所述交易货币的哈希值查找并确认所述交易货币存储在所述确认中货币列表,再根据所述货币子集内数字货币的哈希值查找并确认所述货币子集内的货币存储在所述未花费货币列表,以及确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额;The payment request verification module 306 is also configured to: look up and confirm that the transaction currency is stored in the currency list in the confirmation according to the hash value of the transaction currency, and then according to the hash value of the digital currency in the currency subset Find and confirm that the currency in the currency subset is stored in the unspent currency list, and confirm that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to the ciphertext of the digital currency in the currency subset total amount;

所述付款更新模块308还用于:根据所述交易货币的哈希值查找到所述交易货币后,将所述交易货币及其哈希值从所述确认中货币列表移至所述未花费货币列表,再根据所述货币子集内数字货币的哈希值查找到所述货币子集内的货币后,将所述货币子集内的货币及其哈希值从所述未花费货币列表移至所述已花费货币列表,以及将所述找零货币及其哈希值存储到所述未花费货币列表。The payment update module 308 is further configured to: after finding the transaction currency according to the hash value of the transaction currency, move the transaction currency and its hash value from the confirmed currency list to the unspent currency list Currency list, and after the currency in the currency subset is found according to the hash value of the digital currency in the currency subset, the currency and its hash value in the currency subset are removed from the unspent currency list Moving to said spent currency list, and storing said change currency and its hash value to said unspent currency list.

上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。The above specific implementation methods do not constitute a limitation to the protection scope of the present invention. It should be apparent to those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims (20)

Translated fromChinese
1.一种基于数字货币的交易方法,其特征在于,包括:1. A transaction method based on digital currency, characterized in that it comprises:收款端对收到的明文交易金额进行加密以得到密文交易金额,以及生成用于验证所述密文交易金额的第一验证信息,然后生成收款请求以及广播该收款请求;所述收款请求中包括所述密文交易金额和所述第一验证信息;The receiving end encrypts the received plaintext transaction amount to obtain the ciphertext transaction amount, and generates first verification information for verifying the ciphertext transaction amount, and then generates a payment request and broadcasts the payment request; The collection request includes the ciphertext transaction amount and the first verification information;节点在接收到所述收款请求后,根据所述第一验证信息确认所述密文交易金额符合规则,然后将所述收款请求存储到区块链,以及根据所述收款请求更新货币列表;After receiving the payment request, the node confirms that the ciphertext transaction amount complies with the rules according to the first verification information, then stores the payment request in the block chain, and updates the currency according to the payment request list;付款端从所述区块链获取到所述收款请求后,根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额,以及根据所述明文交易金额和所述货币列表计算明文找零金额,再对所述明文找零金额进行加密以得到密文找零金额,然后生成用于验证所述密文找零金额的第二验证信息,以及生成转账数据结构,接着生成付款请求以及广播该付款请求;所述付款请求中包括所述密文找零金额、所述第二验证信息和所述转账数据结构;After obtaining the payment collection request from the blockchain, the payer decrypts the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount, and according to the plaintext transaction amount and the Calculate the change amount in plaintext for the currency list, then encrypt the change amount in plaintext to obtain the change amount in ciphertext, and then generate second verification information for verifying the change amount in ciphertext, and generate a transfer data structure , then generating a payment request and broadcasting the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure;节点在接收到所述付款请求后,根据所述第二验证信息确认所述密文交易金额符合规则,以及根据所述转账数据结构确认所述货币列表符合规则,然后将所述付款请求存储到所述区块链,以及根据所述转账数据结构更新所述货币列表。After receiving the payment request, the node confirms that the ciphertext transaction amount conforms to the rules according to the second verification information, and confirms that the currency list conforms to the rules according to the transfer data structure, and then stores the payment request in The blockchain, and updating the currency list according to the transfer data structure.2.根据权利要求1所述的方法,其特征在于,收款端对收到的明文交易金额进行加密以得到密文交易金额的步骤包括:2. The method according to claim 1, wherein the receiving end encrypts the received plaintext transaction amount to obtain the ciphertext transaction amount comprising:收款端生成本次收款使用的交易私钥;The receiving end generates the transaction private key used for this payment;收款端存储基点值,以及使用基点加密算法对所述基点值进行加密计算然后得到基点校验值;The receiving end stores the base point value, and uses the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value;收款端根据公式q=xG+mH计算所述密文交易金额;其中,q为所述密文交易金额,x为所述交易私钥,m为收到的所述明文交易金额,G为所述基点值,H为所述基点校验值。The receiving end calculates the ciphertext transaction amount according to the formula q=xG+mH; wherein, q is the ciphertext transaction amount, x is the transaction private key, m is the received plaintext transaction amount, and G is The base point value, H is the base point check value.3.根据权利要求2所述的方法,其特征在于,3. The method of claim 2, wherein,所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;收款端生成用于验证所述密文交易金额的第一验证信息的步骤包括:The steps for the receiving end to generate the first verification information for verifying the ciphertext transaction amount include:收款端将所述明文交易金额m按照预设位数n进行二进制拆分,以得到其中mi=2i或mi=0,i表示索引位,并且0≤i<n;The receiving end performs binary splitting of the plaintext transaction amount m according to the preset number of digits n to obtain Where mi =2i or mi =0, i represents an index bit, and 0≤i<n;收款端将所述交易私钥x按照预设位数n进行随机拆分,以得到其中x0至xn-2均随机生成,The receiving end randomly splits the transaction private key x according to the preset number of digits n to obtain Among them, x0 to xn-2 are randomly generated,收款端对于每一个索引位,根据P(xi,mi)=xiG+miH和P(xi,mi-ki)=xiG+(mi-ki)H计算P(xi,mi)和P(xi,mi-ki);其中ki=2iFor each index bit, the payee, according to P(xi ,mi )=xi G+mi H and P(xi ,mi -ki )=xi G+(mi -ki )H Calculate P(xi , mi ) and P(xi , mi -ki ); where ki =2i ;收款端对于每一个所述索引位,使用所述xi、所述P(xi,mi)和所述P(xi,mi-ki)生成该索引位的环签名SiFor each index bit, the payee uses the xi , the P(xi ,mi ) and the P(xi ,mi -ki ) to generate the ring signature Si of the index bit ;收款端将全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述Si进行拼接以得到所述第一交易证明。The payee concatenates all the index bits, the P(xi ,mi ), the P(xi ,mi -ki ) and the Si to obtain the first transaction proof .4.根据权利要求3所述的方法,其特征在于,节点根据所述第一验证信息确认所述密文交易金额符合规则的步骤包括:4. The method according to claim 3, wherein the step of the node confirming that the encrypted transaction amount complies with the rules according to the first verification information comprises:节点拆解所述第一交易证明,以得到全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述SiThe node disassembles the first transaction proof to obtain all the index bits, the P(xi ,mi ), the P(xi ,mi-ki ) and the S i;节点确认对于每一个所述索引位,所述Si为所述P(xi,mi)和所述P(xi,mi-ki)的环签名,以及确认对于每一个所述索引位,满足P(xi,mi)-P(xi,mi-ki)=kiH,然后确认满足以确认所述密文交易金额符合规则;其中ki=2iThe node confirms that for each of the index bits, the Si is the ring signature of the P(xi ,mi ) and the P(xi ,mi -ki) , and confirms that for each of the Index bit, satisfy P(xi ,mi )-P(xi ,mi -ki )=ki H, and then confirm that To confirm that the ciphertext transaction amount complies with the rules; where ki =2i .5.根据权利要求2所述的方法,其特征在于,5. The method of claim 2, wherein,所述第一验证信息包括第一通信消息;The first verification information includes a first communication message;收款端生成用于验证所述密文交易金额的第一验证信息的步骤包括:The steps for the receiving end to generate the first verification information for verifying the ciphertext transaction amount include:收款端生成收款端固定私钥,获取付款端固定公钥,以及使用所述基点加密算法对所述收款端固定私钥与所述付款端固定公钥的乘积进行加密计算以得到共享密钥,然后将所述明文交易金额与所述交易私钥进行拼接,再使用所述共享密钥对拼接后的结果进行加密计算以生成所述第一通信消息。The receiving end generates the fixed private key of the receiving end, obtains the fixed public key of the paying end, and uses the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the paying end and the fixed public key of the paying end to obtain a shared key, and then concatenate the plaintext transaction amount with the transaction private key, and then use the shared key to encrypt and calculate the concatenated result to generate the first communication message.6.根据权利要求5所述的方法,其特征在于,付款端根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额的步骤包括:6. The method according to claim 5, wherein the step of decrypting the ciphertext transaction amount according to the first verification information at the payment end to obtain the plaintext transaction amount comprises:付款端存储所述基点值,以及使用所述基点加密算法对所述基点值进行加密计算得到所述基点校验值;The payment end stores the base point value, and uses the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value;付款端生成付款端固定私钥,获取收款端固定公钥,以及使用所述基点加密算法对所述付款端固定私钥与所述收款端固定公钥的乘积进行加密计算以得到共享密钥,然后拆分使用所述共享密钥对所述第一通信消息进行解密计算的结果以得到所述明文交易金额。The payer generates the fixed private key of the payer, obtains the fixed public key of the payee, and uses the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the payer and the fixed public key of the payee to obtain a shared secret key, and then split the result of decrypting and computing the first communication message using the shared key to obtain the plaintext transaction amount.7.根据权利要求1所述的方法,其特征在于,付款端根据所述明文交易金额和所述货币列表计算明文找零金额的步骤包括:7. The method according to claim 1, wherein the step of calculating the change amount in clear text according to the clear text transaction amount and the currency list at the payment end comprises:付款端从所述货币列表中选择收款方为所述付款端、且明文总金额大于或等于所述明文交易金额的数字货币然后组成所述货币子集,然后用所述明文总金额减去所述明文交易金额以得到明文找零金额。The payer selects the digital currency whose payee is the payer and the total plaintext amount is greater than or equal to the plaintext transaction amount from the currency list to form the currency subset, and then subtracts from the total plaintext amount The plaintext transaction amount is used to obtain the plaintext change amount.8.根据权利要求7所述的方法,其特征在于,8. The method of claim 7, wherein,所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;付款端生成转账数据结构的步骤包括:The steps for the payment terminal to generate the transfer data structure include:付款端生成包含所述交易货币的哈希值、所述找零货币的哈希值和所述货币子集中各数字货币的哈希值的转账数据结构。The payment terminal generates a transfer data structure including the hash value of the transaction currency, the hash value of the change currency, and the hash values of each digital currency in the currency subset.9.根据权利要求8所述的方法,其特征在于,9. The method of claim 8, wherein节点根据所述收款请求更新货币列表的步骤前,还包括:节点建立用于存储货币、货币哈希值及二者对应关系的货币列表;所述货币列表包括未花费货币列表、确认中货币列表和已花费货币列表;Before the step of the node updating the currency list according to the collection request, it also includes: the node establishes a currency list for storing currency, currency hash value and the corresponding relationship between the two; the currency list includes an unspent currency list, a currency in confirmation list and list of spent currency;节点根据所述收款请求更新货币列表的步骤包括:节点将所述交易货币和所述交易货币的哈希值存储到所述确认中货币列表;The step of the node updating the currency list according to the collection request includes: the node stores the transaction currency and the hash value of the transaction currency in the confirmed currency list;节点将所述付款请求存储到所述区块链的步骤前,还包括:节点根据所述交易货币的哈希值查找并确认所述交易货币存储在所述确认中货币列表,再根据所述货币子集内数字货币的哈希值查找并确认所述货币子集内的数字货币存储在所述未花费货币列表,以及确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额;Before the node stores the payment request in the block chain, it also includes: the node searches and confirms that the transaction currency is stored in the currency list in the confirmation according to the hash value of the transaction currency, and then according to the The hash value of the digital currency in the currency subset looks up and confirms that the digital currency in the currency subset is stored in the unspent currency list, and confirms that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to The total amount of ciphertext of the digital currency in the currency subset;节点根据所述转账数据结构更新所述货币列表的步骤包括:节点根据所述交易货币的哈希值查找到所述交易货币后,将所述交易货币及其哈希值从所述确认中货币列表移至所述未花费货币列表,再根据所述货币子集内数字货币的哈希值查找到所述货币子集内的货币后,将所述货币子集内的货币及其哈希值从所述未花费货币列表移至所述已花费货币列表,以及将所述找零货币及其哈希值存储到所述未花费货币列表。The step of the node updating the currency list according to the transfer data structure includes: after the node finds the transaction currency according to the hash value of the transaction currency, the transaction currency and its hash value are transferred from the confirmation currency The list is moved to the unspent currency list, and after the currency in the currency subset is found according to the hash value of the digital currency in the currency subset, the currency in the currency subset and its hash value moving from the unspent currency list to the spent currency list, and storing the change currency and its hash value in the unspent currency list.10.一种基于数字货币的交易装置,其特征在于,包括:10. A transaction device based on digital currency, comprising:交易金额加密模块,用于对收到的明文交易金额进行加密以得到密文交易金额;The transaction amount encryption module is used to encrypt the received plaintext transaction amount to obtain the ciphertext transaction amount;第一验证信息生成模块,用于生成用来验证所述密文交易金额的第一验证信息;A first verification information generating module, configured to generate first verification information used to verify the ciphertext transaction amount;收款请求发送模块,用于生成收款请求以及广播该收款请求;所述收款请求中包括所述密文交易金额和所述第一验证信息;A collection request sending module, configured to generate a collection request and broadcast the collection request; the collection request includes the encrypted transaction amount and the first verification information;收款请求接收模块,用于接收所述收款请求;A collection request receiving module, configured to receive the collection request;交易金额解密模块,用于根据所述第一验证信息对所述密文交易金额进行解密以得到所述明文交易金额;A transaction amount decryption module, configured to decrypt the ciphertext transaction amount according to the first verification information to obtain the plaintext transaction amount;找零金额计算模块,用于根据所述明文交易金额和所述货币列表计算明文找零金额;A change amount calculation module, configured to calculate a clear text change amount according to the plain text transaction amount and the currency list;找零金额加密模块,用于对所述明文找零金额进行加密以得到密文找零金额;The change amount encryption module is used to encrypt the plaintext change amount to obtain the ciphertext change amount;第二验证信息生成模块,用于生成用于验证所述密文找零金额的第二验证信息;A second verification information generating module, configured to generate second verification information for verifying the ciphertext change amount;转账数据结构生成模块,用于生成转账数据结构;The transfer data structure generation module is used to generate the transfer data structure;付款请求发送模块,用于生成付款请求以及广播该付款请求;所述付款请求中包括所述密文找零金额、所述第二验证信息和所述转账数据结构。A payment request sending module, configured to generate a payment request and broadcast the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure.11.根据权利要求10所述的装置,其特征在于,所述交易金额加密模块还用于:生成本次收款使用的交易私钥;存储基点值,以及使用基点加密算法对所述基点值进行加密计算以得到基点校验值;根据公式q=xG+mH计算所述密文交易金额;其中,q为所述密文交易金额,x为所述交易私钥,m为收到的所述明文交易金额,G为所述基点值,H为所述基点校验值。11. The device according to claim 10, wherein the transaction amount encryption module is also used to: generate the transaction private key used for this collection; store the base point value, and use the base point encryption algorithm to encrypt the base point value Carry out encryption calculation to obtain the base point check value; calculate the ciphertext transaction amount according to the formula q=xG+mH; wherein, q is the ciphertext transaction amount, x is the transaction private key, and m is the received Indicates the clear text transaction amount, G is the base point value, and H is the check value of the base point.12.根据权利要求11所述的装置,其特征在于,12. The apparatus of claim 11, wherein:所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;所述第一验证信息生成模块还用于:将所述明文交易金额m按照预设位数n进行二进制拆分,以得到其中mi=2i或mi=0,i表示索引位,并且0≤i<n;将所述交易私钥x按照预设位数n进行随机拆分,以得到其中x0至xn-2均随机生成,对于每一个索引位,根据P(xi,mi)=xiG+miH和P(xi,mi-ki)=xiG+(mi-ki)H计算P(xi,mi)和P(xi,mi-ki);其中ki=2i;对于每一个所述索引位,使用所述xi、所述P(xi,mi)和所述P(xi,mi-ki)生成该索引位的环签名Si;将全部的所述索引位、所述P(xi,mi)、所述P(xi,mi-ki)和所述Si进行拼接以得到所述第一交易证明。The first verification information generation module is also used to: perform binary splitting of the plaintext transaction amount m according to the preset number of digits n, to obtain Where mi =2i or mi =0, i represents the index bit, and 0≤i<n; randomly split the transaction private key x according to the preset number of bits n to obtain Among them, x0 to xn-2 are randomly generated,Foreachindexbit,calculateP(__xi , mi ) and P(xi , mi -ki ); whereki =2i ; for each index bit, use thexi , the P(xi ,mi) and the P(xi ,mi-ki ) to generate the ring signature Si of the index bit; combine all the index bits, the P(xi ,mi ), the P(xi , mi-ki ) and the S iare spliced to obtain the first transaction proof.13.根据权利要求11所述的装置,其特征在于,13. The apparatus of claim 11, wherein:所述第一验证信息包括第一通信消息;The first verification information includes a first communication message;所述第一验证信息生成模块还用于:生成收款端固定私钥,获取付款端固定公钥,以及使用所述基点加密算法对所述收款端固定私钥与所述付款端固定公钥的乘积进行加密计算以得到共享密钥,然后将所述明文交易金额与所述交易私钥进行拼接,再使用所述共享密钥对拼接后的结果进行加密计算以生成所述第一通信消息。The first verification information generation module is also used to: generate a fixed private key of the payment terminal, obtain a fixed public key of the payment terminal, and use the base point encryption algorithm to compare the fixed private key of the payment terminal with the fixed public key of the payment terminal. key product to obtain a shared key, then concatenate the plaintext transaction amount with the transaction private key, and then use the shared key to encrypt the concatenated result to generate the first communication information.14.根据权利要求13所述的装置,其特征在于,所述交易金额解密模块还用于:存储所述基点值,以及使用所述基点加密算法对所述基点值进行加密计算得到所述基点校验值;生成付款端固定私钥,获取收款端固定公钥,以及使用所述基点加密算法对所述付款端固定私钥与所述收款端固定公钥的乘积进行加密计算以得到共享密钥,然后拆分使用所述共享密钥对所述第一通信消息进行解密计算的结果以得到所述明文交易金额。14. The device according to claim 13, wherein the transaction amount decryption module is also used for: storing the base point value, and using the base point encryption algorithm to encrypt and calculate the base point value to obtain the base point check value; generate the fixed private key of the payment terminal, obtain the fixed public key of the payment terminal, and use the base point encryption algorithm to encrypt and calculate the product of the fixed private key of the payment terminal and the fixed public key of the payment terminal to obtain Share a key, and then split the result of decrypting and computing the first communication message using the shared key to obtain the plaintext transaction amount.15.根据权利要求10所述的装置,其特征在于,所述找零金额计算模块还用于:从所述货币列表中选择收款方为所述付款端、且明文总金额大于或等于所述明文交易金额的数字货币然后组成所述货币子集,然后用所述明文总金额减去所述明文交易金额以得到明文找零金额。15. The device according to claim 10, wherein the change amount calculation module is further configured to: select the payee from the currency list as the payment terminal, and the total amount in plain text is greater than or equal to the specified amount The digital currency of the clear text transaction amount is then formed into the currency subset, and the clear text transaction amount is then subtracted from the clear text total amount to obtain the clear text change amount.16.根据权利要求15所述的装置,其特征在于,16. The apparatus of claim 15, wherein:所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;所述转账数据结构生成模块还用于:生成包含所述交易货币的哈希值、所述找零货币的哈希值和所述货币子集中各数字货币的哈希值的转账数据结构。The transfer data structure generating module is further configured to: generate a transfer data structure including the hash value of the transaction currency, the hash value of the change currency, and the hash values of each digital currency in the currency subset.17.一种基于数字货币的交易装置,其特征在于,包括:17. A transaction device based on digital currency, characterized in that it includes:收款请求接收模块,用于接收收款请求;所述收款请求包括密文交易金额和第一验证信息;The payment request receiving module is used to receive the payment request; the payment request includes the encrypted transaction amount and the first verification information;收款请求验证模块,用于根据所述第一验证信息确认所述密文交易金额符合规则;A collection request verification module, configured to confirm that the ciphertext transaction amount complies with the rules according to the first verification information;收款请求入链模块,用于将所述收款请求存储到区块链;The collection request chain module is used to store the collection request into the block chain;收款更新模块,用于根据所述收款请求更新货币列表;A collection update module, configured to update the currency list according to the collection request;付款请求接收模块,用于接收付款请求;所述付款请求包括密文找零金额、第二验证信息和转账数据结构;The payment request receiving module is used to receive the payment request; the payment request includes the ciphertext change amount, the second verification information and the transfer data structure;付款请求验证模块,用于根据所述第二验证信息确认所述密文交易金额符合规则,以及根据所述转账数据结构确认所述货币列表符合规则;A payment request verification module, configured to confirm that the ciphertext transaction amount complies with the rules according to the second verification information, and confirm that the currency list complies with the rules according to the transfer data structure;付款请求入链模块,用于将所述付款请求存储到所述区块链;A payment request chain entry module, configured to store the payment request into the block chain;付款更新模块,用于根据所述转账数据结构更新所述货币列表。A payment update module, configured to update the currency list according to the transfer data structure.18.根据权利要求17所述的装置,其特征在于,18. The apparatus of claim 17, wherein:所述第一验证信息包括第一交易证明;The first verification information includes a first transaction certificate;所述收款请求验证模块还用于:拆解所述第一交易证明,以得到全部的索引位i、P(xi,mi)、P(xi,mi-ki)和Si;确认对于每一个所述索引位,所述Si为所述P(xi,mi)和所述P(xi,mi-ki)的环签名,以及确认对于每一个所述索引位,满足P(xi,mi)-P(xi,mi-ki)=kiH,然后确认满足以确认所述密文交易金额符合规则;其中q为所述密文交易金额,ki=2iThe collection request verification module is also used to: disassemble the first transaction certificate to obtain all index bits i, P(xi ,mi ), P(xi ,mi -ki ) and Si ; Confirm that for each of the index bits, the Si is the ring signature of the P(xi ,mi ) and the P(xi ,mi -ki) , and confirm that for each of the The index bit, satisfy P(xi ,mi )-P(xi ,mi -ki )=ki H, and then confirm that To confirm that the ciphertext transaction amount complies with the rules; where q is the ciphertext transaction amount, ki =2i .19.根据权利要求17所述的装置,其特征在于,所述装置还包括货币列表建立模块,其中,19. The device according to claim 17, further comprising a currency list building module, wherein,所述货币列表建立模块用于建立用来存储货币、货币哈希值及二者对应关系的货币列表;所述货币列表包括未花费货币列表、确认中货币列表和已花费货币列表;The currency list establishment module is used to establish a currency list for storing currency, currency hash value and the corresponding relationship between the two; the currency list includes an unspent currency list, a confirmed currency list and a spent currency list;所述收款请求中包括交易货币,该交易货币中包含所述密文交易金额和所述第一验证信息;所述付款请求中包括找零货币,该找零货币中包含所述密文找零金额和所述第二验证信息;The collection request includes transaction currency, the transaction currency includes the ciphertext transaction amount and the first verification information; the payment request includes change currency, and the change currency includes the ciphertext change currency. zero amount and said second verification information;所述收款更新模块还用于:将所述交易货币和所述交易货币的哈希值存储到所述确认中货币列表;The receipt update module is also used to: store the transaction currency and the hash value of the transaction currency in the confirmed currency list;所述转账数据结构包括所述交易货币的哈希值、所述转账数据结构还包括找零货币的哈希值和所述货币子集内数字货币的哈希值;The transfer data structure includes the hash value of the transaction currency, and the transfer data structure further includes the hash value of the change currency and the hash value of the digital currency in the currency subset;所述付款请求验证模块还用于:根据所述交易货币的哈希值查找并确认所述交易货币存储在所述确认中货币列表,再根据所述货币子集内数字货币的哈希值查找并确认所述货币子集内的货币存储在所述未花费货币列表,以及确认所述密文交易金额与所述密文找零金额的和等于所述货币子集内数字货币的密文总金额;The payment request verification module is also used to: search and confirm that the transaction currency is stored in the currency list in the confirmation according to the hash value of the transaction currency, and then search according to the hash value of the digital currency in the currency subset And confirm that the currency in the currency subset is stored in the unspent currency list, and confirm that the sum of the ciphertext transaction amount and the ciphertext change amount is equal to the total ciphertext of the digital currency in the currency subset amount;所述付款更新模块还用于:根据所述交易货币的哈希值查找到所述交易货币后,将所述交易货币及其哈希值从所述确认中货币列表移至所述未花费货币列表,再根据所述货币子集内数字货币的哈希值查找到所述货币子集内的货币后,将所述货币子集内的货币及其哈希值从所述未花费货币列表移至所述已花费货币列表,以及将所述找零货币及其哈希值存储到所述未花费货币列表。The payment update module is also used for: after finding the transaction currency according to the hash value of the transaction currency, move the transaction currency and its hash value from the confirmed currency list to the unspent currency list, and after finding the currency in the currency subset according to the hash value of the digital currency in the currency subset, move the currency in the currency subset and its hash value from the unspent currency list to the spent currency list, and store the change currency and its hash value into the unspent currency list.20.一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,其特征在于,所述计算机指令能够被计算机或计算机系统运行,从而使该计算机或计算机系统能够执行权利要求1-9中任一项所述的方法。20. A computer-readable storage medium, wherein computer instructions are stored in the computer-readable storage medium, wherein the computer instructions can be executed by a computer or a computer system, so that the computer or computer system can execute the claims The method described in any one of 1-9.
CN201710494860.9A2017-06-262017-06-26Transaction method and device based on digital currencyActiveCN107358424B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201710494860.9ACN107358424B (en)2017-06-262017-06-26Transaction method and device based on digital currency

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201710494860.9ACN107358424B (en)2017-06-262017-06-26Transaction method and device based on digital currency

Publications (2)

Publication NumberPublication Date
CN107358424Atrue CN107358424A (en)2017-11-17
CN107358424B CN107358424B (en)2020-09-29

Family

ID=60273637

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201710494860.9AActiveCN107358424B (en)2017-06-262017-06-26Transaction method and device based on digital currency

Country Status (1)

CountryLink
CN (1)CN107358424B (en)

Cited By (45)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108009441A (en)*2017-11-232018-05-08阿里巴巴集团控股有限公司Resource transfers and the method and apparatus of fund transfer
CN108241979A (en)*2017-12-202018-07-03深圳壹账通智能科技有限公司More account book transfer account methods, electronic device and readable storage medium storing program for executing based on block chain
CN108335106A (en)*2018-01-242018-07-27深圳壹账通智能科技有限公司The more account books of Zero Knowledge based on block chain exchange transfer account method, device and storage medium
CN108418689A (en)*2017-11-302018-08-17矩阵元技术(深圳)有限公司 A zero-knowledge proof method and medium suitable for blockchain privacy protection
CN108629584A (en)*2018-04-252018-10-09常海峰Mode of payment, device based on block chain and computer readable storage medium
CN108805574A (en)*2018-05-192018-11-13深圳市图灵奇点智能科技有限公司Method of commerce based on secret protection and system
CN108830716A (en)*2018-05-312018-11-16上海万向区块链股份公司The transaction system of protection privacy of user based on block chain and encryption
CN108846659A (en)*2018-06-132018-11-20深圳前海微众银行股份有限公司Transfer account method, device and storage medium based on block chain
CN108854077A (en)*2018-07-172018-11-23广州瞪羚信息科技有限公司Across game item circulation method based on block chain technology
CN108985752A (en)*2018-06-292018-12-11杭州复杂美科技有限公司A kind of method of payment and system, equipment and storage medium
CN108985933A (en)*2018-06-292018-12-11联动优势科技有限公司A kind of bookkeeping methods and device
CN108985760A (en)*2018-06-152018-12-11杭州复杂美科技有限公司Method of payment and system, equipment and storage medium
CN109064335A (en)*2018-08-272018-12-21深圳前海益链网络科技有限公司A kind of data trade method and device based on intelligent contract
CN109102286A (en)*2018-08-022018-12-28平安科技(深圳)有限公司Across account book method of commerce and device
CN109191122A (en)*2018-08-102019-01-11中国银行股份有限公司A kind of method and device obtaining Transaction Information voucher
CN109285073A (en)*2018-09-292019-01-29数字钱包(北京)科技有限公司Digital cash method of commerce and device
CN109325759A (en)*2018-09-172019-02-12简单汇信息科技(珠海)有限公司Method, management platform, device, system and storage medium are opened online
CN109472602A (en)*2018-11-232019-03-15全链通有限公司A kind of method, a kind of node and a kind of block catenary system of verifying transaction
CN109493057A (en)*2018-12-102019-03-19联动优势科技有限公司A kind of method of commerce and device based on UTXO model
CN109658216A (en)*2018-12-142019-04-19深圳美图创新科技有限公司Block chain moneytary operations method and device
CN109691013A (en)*2018-08-162019-04-26区链通网络有限公司Block chain communication method between nodes, device and storage medium, block catenary system
WO2019118123A1 (en)*2017-12-132019-06-20Mastercard International IncorporatedMethod and system for consumer-initiated transactions using encrypted tokens
CN110335042A (en)*2019-06-262019-10-15阿里巴巴集团控股有限公司Anonymous transaction method and device based on ring signature
CN110414961A (en)*2019-06-212019-11-05深圳壹账通智能科技有限公司Prevent transfer account method, device, equipment and the storage medium of the track transactions side of producing
CN110992028A (en)*2019-10-142020-04-10腾讯科技(深圳)有限公司Data processing method and device of sink-changing platform based on block chain network
CN111222860A (en)*2020-04-152020-06-02傲林科技有限公司Data asset processing method and device
CN111325493A (en)*2018-12-142020-06-23阿里巴巴集团控股有限公司 Blockchain-based logistics management method, device, equipment and storage medium
CN111539816A (en)*2020-02-192020-08-14杭州溪塔科技有限公司Method and device for determining transaction identification in block chain and electronic equipment
CN111639923A (en)*2020-05-072020-09-08杭州云象网络技术有限公司Digital currency transaction accounting method and system based on zero knowledge proof
CN111641504A (en)*2019-03-012020-09-08湖南天河国云科技有限公司Block chain digital certificate application method and system based on bit currency system
WO2020177496A1 (en)*2019-03-012020-09-10中国银联股份有限公司Transaction management method and apparatus based on associated transaction rule
US10790990B2 (en)2019-06-262020-09-29Alibaba Group Holding LimitedRing signature-based anonymous transaction
CN111738712A (en)*2020-07-172020-10-02百度在线网络技术(北京)有限公司Payment processing method, device, equipment and medium for block chain
CN111754342A (en)*2019-03-262020-10-09众安信息技术服务有限公司Method, system and device for obtaining block chain encrypted currency circulation speed
CN112001714A (en)*2020-07-282020-11-27胡祥义Digital currency implementation method based on block chain technology
WO2020258851A1 (en)*2019-06-262020-12-30创新先进技术有限公司Method and apparatus for implementing confidential blockchain transaction by using ring signature
CN112365252A (en)*2020-07-312021-02-12深圳市网心科技有限公司Account model-based privacy transaction method and device and related equipment
CN112712359A (en)*2020-12-312021-04-27深圳市证通电子股份有限公司Money receiving method, money receiving device, and readable storage medium
CN112712353A (en)*2019-12-252021-04-27深圳市文鼎创数据科技有限公司Digital currency change payment method, system and terminal
CN113052599A (en)*2021-03-312021-06-29中国人民银行数字货币研究所Method, device, equipment and system for generating, verifying and storing transaction certificate
CN113421071A (en)*2021-06-302021-09-21中国银行股份有限公司Electronic currency private key encryption and decryption method and device
US11238447B2 (en)2019-06-262022-02-01Advanced New Technologies Co., Ltd.Blockchain transactions with ring signatures
CN115222528A (en)*2021-04-162022-10-21中国人民银行数字货币研究所 A method, terminal and system for splitting digital currency during transaction
CN116187988A (en)*2021-11-262023-05-30中国人民银行数字货币研究所 Offline transaction method and device based on digital currency
CN116318760A (en)*2022-09-092023-06-23广州玉明科技有限公司Block chain and digital currency based security detection method and cloud computing device

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104392354A (en)*2014-11-052015-03-04中国科学院合肥物质科学研究院Association and retrieval method and system used for public key addresses and user accounts of crypto-currency
CN106503994A (en)*2016-11-022017-03-15西安电子科技大学Block chain private data access control method based on encryption attribute
CN106548330A (en)*2016-10-272017-03-29上海亿账通区块链科技有限公司Transaction verification method and system based on block chain
CN106549749A (en)*2016-12-062017-03-29杭州趣链科技有限公司A kind of block chain method for secret protection encrypted based on additive homomorphism
CN106651331A (en)*2016-12-222017-05-10飞天诚信科技股份有限公司Digital currency-based electronic transaction method and system
CN106779707A (en)*2016-12-232017-05-31中钞信用卡产业发展有限公司北京智能卡技术研究院Monitoring and managing method, the apparatus and system of the digital cash Transaction Information based on block chain

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104392354A (en)*2014-11-052015-03-04中国科学院合肥物质科学研究院Association and retrieval method and system used for public key addresses and user accounts of crypto-currency
CN106548330A (en)*2016-10-272017-03-29上海亿账通区块链科技有限公司Transaction verification method and system based on block chain
CN106503994A (en)*2016-11-022017-03-15西安电子科技大学Block chain private data access control method based on encryption attribute
CN106549749A (en)*2016-12-062017-03-29杭州趣链科技有限公司A kind of block chain method for secret protection encrypted based on additive homomorphism
CN106651331A (en)*2016-12-222017-05-10飞天诚信科技股份有限公司Digital currency-based electronic transaction method and system
CN106779707A (en)*2016-12-232017-05-31中钞信用卡产业发展有限公司北京智能卡技术研究院Monitoring and managing method, the apparatus and system of the digital cash Transaction Information based on block chain

Cited By (71)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108009441B (en)*2017-11-232023-05-30创新先进技术有限公司Method and apparatus for resource transfer and funds transfer
CN108009441A (en)*2017-11-232018-05-08阿里巴巴集团控股有限公司Resource transfers and the method and apparatus of fund transfer
US11443368B2 (en)2017-11-232022-09-13Advanced New Technologies Co., Ltd.Resource transfer and capital transfer method and apparatus
WO2019100865A1 (en)*2017-11-232019-05-31阿里巴巴集团控股有限公司Resource transfer and capital transfer method and apparatus
CN108418689A (en)*2017-11-302018-08-17矩阵元技术(深圳)有限公司 A zero-knowledge proof method and medium suitable for blockchain privacy protection
WO2019118123A1 (en)*2017-12-132019-06-20Mastercard International IncorporatedMethod and system for consumer-initiated transactions using encrypted tokens
US11227284B2 (en)2017-12-132022-01-18Mastercard International IncorporatedMethod and system for consumer-initiated transactions using encrypted tokens
US12093936B2 (en)2017-12-132024-09-17Mastercard International IncorporatedMethod and system for consumer-initiated transactions using encrypted tokens
CN108241979B (en)*2017-12-202021-03-16深圳壹账通智能科技有限公司Multi-account book transfer method based on block chain, electronic device and readable storage medium
CN108241979A (en)*2017-12-202018-07-03深圳壹账通智能科技有限公司More account book transfer account methods, electronic device and readable storage medium storing program for executing based on block chain
CN108335106A (en)*2018-01-242018-07-27深圳壹账通智能科技有限公司The more account books of Zero Knowledge based on block chain exchange transfer account method, device and storage medium
CN108629584A (en)*2018-04-252018-10-09常海峰Mode of payment, device based on block chain and computer readable storage medium
CN108629584B (en)*2018-04-252022-07-01常海峰 Blockchain-based payment method, device and computer-readable storage medium
CN108805574A (en)*2018-05-192018-11-13深圳市图灵奇点智能科技有限公司Method of commerce based on secret protection and system
CN108830716A (en)*2018-05-312018-11-16上海万向区块链股份公司The transaction system of protection privacy of user based on block chain and encryption
CN108846659B (en)*2018-06-132021-09-14深圳前海微众银行股份有限公司Block chain-based transfer method and device and storage medium
CN108846659A (en)*2018-06-132018-11-20深圳前海微众银行股份有限公司Transfer account method, device and storage medium based on block chain
CN108985760B (en)*2018-06-152021-07-06杭州复杂美科技有限公司 Payment method and system, device and storage medium
CN108985760A (en)*2018-06-152018-12-11杭州复杂美科技有限公司Method of payment and system, equipment and storage medium
CN108985933A (en)*2018-06-292018-12-11联动优势科技有限公司A kind of bookkeeping methods and device
CN108985752A (en)*2018-06-292018-12-11杭州复杂美科技有限公司A kind of method of payment and system, equipment and storage medium
CN108854077B (en)*2018-07-172021-05-18广州瞪羚信息科技有限公司Cross-game item circulation method based on block chain technology
CN108854077A (en)*2018-07-172018-11-23广州瞪羚信息科技有限公司Across game item circulation method based on block chain technology
CN109102286B (en)*2018-08-022023-04-07平安科技(深圳)有限公司Cross-account book transaction method and device
CN109102286A (en)*2018-08-022018-12-28平安科技(深圳)有限公司Across account book method of commerce and device
CN109191122A (en)*2018-08-102019-01-11中国银行股份有限公司A kind of method and device obtaining Transaction Information voucher
CN109691013A (en)*2018-08-162019-04-26区链通网络有限公司Block chain communication method between nodes, device and storage medium, block catenary system
WO2020034151A1 (en)*2018-08-162020-02-20区链通网络有限公司Block chain inter-node communication method and apparatus, and storage medium and block chain system
CN109064335A (en)*2018-08-272018-12-21深圳前海益链网络科技有限公司A kind of data trade method and device based on intelligent contract
CN109325759B (en)*2018-09-172023-09-19简单汇信息科技(广州)有限公司Online development method, management platform, device, system and storage medium
CN109325759A (en)*2018-09-172019-02-12简单汇信息科技(珠海)有限公司Method, management platform, device, system and storage medium are opened online
CN109285073A (en)*2018-09-292019-01-29数字钱包(北京)科技有限公司Digital cash method of commerce and device
CN109472602A (en)*2018-11-232019-03-15全链通有限公司A kind of method, a kind of node and a kind of block catenary system of verifying transaction
CN109472602B (en)*2018-11-232021-05-11全链通有限公司Transaction verification method, node and block chain system
CN109493057A (en)*2018-12-102019-03-19联动优势科技有限公司A kind of method of commerce and device based on UTXO model
CN109658216A (en)*2018-12-142019-04-19深圳美图创新科技有限公司Block chain moneytary operations method and device
CN111325493A (en)*2018-12-142020-06-23阿里巴巴集团控股有限公司 Blockchain-based logistics management method, device, equipment and storage medium
WO2020177496A1 (en)*2019-03-012020-09-10中国银联股份有限公司Transaction management method and apparatus based on associated transaction rule
CN111641504A (en)*2019-03-012020-09-08湖南天河国云科技有限公司Block chain digital certificate application method and system based on bit currency system
CN111754342A (en)*2019-03-262020-10-09众安信息技术服务有限公司Method, system and device for obtaining block chain encrypted currency circulation speed
CN111754342B (en)*2019-03-262024-05-24众安信息技术服务有限公司Method, system and device for obtaining circulation speed of block chain encrypted currency
WO2020253108A1 (en)*2019-06-212020-12-24深圳壹账通智能科技有限公司Information hiding method, apparatus, device, and storage medium
CN110414961A (en)*2019-06-212019-11-05深圳壹账通智能科技有限公司Prevent transfer account method, device, equipment and the storage medium of the track transactions side of producing
WO2020258851A1 (en)*2019-06-262020-12-30创新先进技术有限公司Method and apparatus for implementing confidential blockchain transaction by using ring signature
CN110335042A (en)*2019-06-262019-10-15阿里巴巴集团控股有限公司Anonymous transaction method and device based on ring signature
CN110335042B (en)*2019-06-262020-10-20创新先进技术有限公司 Anonymous transaction method and device based on ring signature
US11258614B2 (en)2019-06-262022-02-22Advanced New Technologies Co., Ltd.Ring signature-based anonymous transaction
US11025434B2 (en)2019-06-262021-06-01Advanced New Technologies Co., Ltd.Ring signature-based anonymous transaction
US11238447B2 (en)2019-06-262022-02-01Advanced New Technologies Co., Ltd.Blockchain transactions with ring signatures
US10790990B2 (en)2019-06-262020-09-29Alibaba Group Holding LimitedRing signature-based anonymous transaction
CN110992028A (en)*2019-10-142020-04-10腾讯科技(深圳)有限公司Data processing method and device of sink-changing platform based on block chain network
CN110992028B (en)*2019-10-142021-08-10腾讯科技(深圳)有限公司Data processing method and device of sink-changing platform based on block chain network
CN112712353A (en)*2019-12-252021-04-27深圳市文鼎创数据科技有限公司Digital currency change payment method, system and terminal
CN112712353B (en)*2019-12-252024-04-12深圳市文鼎创数据科技有限公司Digital currency zero-payment method, system and terminal
CN111539816A (en)*2020-02-192020-08-14杭州溪塔科技有限公司Method and device for determining transaction identification in block chain and electronic equipment
CN111539816B (en)*2020-02-192022-07-15杭州溪塔科技有限公司Method and device for determining transaction identification in block chain and electronic equipment
CN111222860A (en)*2020-04-152020-06-02傲林科技有限公司Data asset processing method and device
CN111639923A (en)*2020-05-072020-09-08杭州云象网络技术有限公司Digital currency transaction accounting method and system based on zero knowledge proof
CN111639923B (en)*2020-05-072023-09-29杭州云象网络技术有限公司Digital currency transaction accounting method and system based on zero knowledge proof
CN111738712A (en)*2020-07-172020-10-02百度在线网络技术(北京)有限公司Payment processing method, device, equipment and medium for block chain
CN112001714A (en)*2020-07-282020-11-27胡祥义Digital currency implementation method based on block chain technology
CN112365252A (en)*2020-07-312021-02-12深圳市网心科技有限公司Account model-based privacy transaction method and device and related equipment
CN112365252B (en)*2020-07-312024-08-06深圳市迅雷网络技术有限公司 Privacy transaction method, device and related equipment based on account model
CN112712359A (en)*2020-12-312021-04-27深圳市证通电子股份有限公司Money receiving method, money receiving device, and readable storage medium
CN112712359B (en)*2020-12-312024-01-12深圳市证通电子股份有限公司Money collection method, money collection device, and readable storage medium
CN113052599B (en)*2021-03-312024-05-28中国人民银行数字货币研究所Method, device, equipment and system for generating, verifying and storing transaction certificates
CN113052599A (en)*2021-03-312021-06-29中国人民银行数字货币研究所Method, device, equipment and system for generating, verifying and storing transaction certificate
CN115222528A (en)*2021-04-162022-10-21中国人民银行数字货币研究所 A method, terminal and system for splitting digital currency during transaction
CN113421071A (en)*2021-06-302021-09-21中国银行股份有限公司Electronic currency private key encryption and decryption method and device
CN116187988A (en)*2021-11-262023-05-30中国人民银行数字货币研究所 Offline transaction method and device based on digital currency
CN116318760A (en)*2022-09-092023-06-23广州玉明科技有限公司Block chain and digital currency based security detection method and cloud computing device

Also Published As

Publication numberPublication date
CN107358424B (en)2020-09-29

Similar Documents

PublicationPublication DateTitle
CN107358424B (en)Transaction method and device based on digital currency
CN107392603B (en) Transaction method and device using digital currency
US11936774B2 (en)Determining a common secret for the secure exchange of information and hierarchical, deterministic cryptographic keys
US12294661B2 (en)Personal device security using cryptocurrency wallets
RU2735439C2 (en)System and method for protecting information
CN109544331B (en) Blockchain-based supply chain financial application method, device, terminal equipment and storage medium
CN110582793B (en)Anonymity and traceability of digital property transactions on a distributed transaction consensus network
KR101964254B1 (en)Person to person trading method and apparatus by using blockchain and distributed hash table
TW202020710A (en) System and method for information protection
JP2020507143A (en) One-time access authorization system using blockchain
CN106897879A (en)Block chain encryption method based on the PKI CLC close algorithms of isomerization polymerization label
CN107908932B (en)Digital currency anti-counterfeiting and verification method, system and equipment based on L algorithm
CN107154850A (en)A kind of processing method and processing device of block chain data
CN114565382A (en)Transaction account anonymous payment method and system
EP4181457A1 (en)Quantum based method and system for performing cryptocurrency asset transactions
WO2020258125A1 (en)Private key recovery method and apparatus, collaborative address creation method and apparatus, collaborative address signing method and apparatus, and storage medium
Mirtskhulava et al.A BLOCKCHAIN-BASED TRUST MODEL FOR BITCOIN CRYPTOCURRENCY AND ITS POPULARITY IN GEORGIA
HK1251840B (en)Determining a common secret for the secure exchange of information and hierarchical, deterministic cryptographic keys
HK40032100A (en)Determining a common secret for the secure exchange of information and hierarchical, deterministic cryptographic keys
HK40011077B (en)System and method for information protection
HK1241544A1 (en)Determining a common secret for the secure exchange of information and hierarchical, deterministic cryptographic keys
HK1241544B (en)Determining a common secret for the secure exchange of information and hierarchical, deterministic cryptographic keys

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp