CN112561701A - Transaction creating method, verification method and transaction equipment of blockchain system - Google Patents

Transaction creating method, verification method and transaction equipment of blockchain system Download PDF

Info

Publication number
CN112561701A
CN112561701A CN202011472572.1A CN202011472572A CN112561701A CN 112561701 A CN112561701 A CN 112561701A CN 202011472572 A CN202011472572 A CN 202011472572A CN 112561701 A CN112561701 A CN 112561701A
Authority
CN
China
Prior art keywords
transaction
user
information
public key
blockchain system
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.)
Pending
Application number
CN202011472572.1A
Other languages
Chinese (zh)
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.)
Changsha University of Science and Technology
Original Assignee
Changsha University of Science and Technology
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 Changsha University of Science and Technology filed Critical Changsha University of Science and Technology
Priority to CN202011472572.1A priority Critical patent/CN112561701A/en
Publication of CN112561701A publication Critical patent/CN112561701A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Abstract

The invention discloses a transaction establishing method, a verification method and transaction equipment of a blockchain system. After verifying whether the user has the ownership of the UTXO, the invention changes the original verification script and verifies the ownership of the UTXO by encrypting any message. And the step of executing decryption information by the transaction party can be put down on line, only the decoded plaintext message is submitted, and the private public key is not exposed at all, so that better anonymity is achieved. The transaction code is added to serve as second-layer identity verification, on one hand, the transaction code can serve as an identifier belonging to the BTC of the user in the public address, on the other hand, the UTXO can be indexed through the transaction code, the corresponding UTXO can be quickly found, the UTXO set of the whole public address does not need to be traversed every time, and therefore the speed of retrieving the UTXO is greatly improved.

Description

Transaction creating method, verification method and transaction equipment of blockchain system
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a transaction creation method, a verification method, and a transaction device for a blockchain system.
Background
In the blockchain system, the only certificate used for the transaction is the address of each user, and the completion of a transaction is realized by transferring the certificate to the address. This step of generating an address may be replaced by a blockchain wallet, where each user may generate an infinite number of addresses, each of which may access a bitcoin or other token. Each address corresponds to a private key, and the private keys and the addresses are in one-to-one correspondence. The private key can be randomly generated by the wallet and is very secure, it consists of an array of 32 bytes, 1 byte equals an 8-bit binary, i.e., a binary has only 0 or 1 possibilities, so the total number of private keys is the power of 2^256 possibilities, which has surpassed the total number of atoms in the universe. It is therefore not possible to work out the value of the private key by traversal even if the energy of the entire sun is exhausted. And the corresponding public key can be obtained according to the private key for signature in the transaction. In general, if one wants to have one address, only three steps are needed. Firstly, a private key is wanted; and secondly, obtaining a corresponding public key according to the private key. And finally, obtaining the public key hash and the address by the public key, wherein the steps can be realized by the blockchain wallet. The attached figure 1 of the invention is a graph of the conversion relationship among private keys, public key hash and addresses.
There are two accounting models in the block chain network, which are respectively a UTXO model and a common account model, also called an account balance model, the former is widely used in digital currencies of bit currency and other systems, and the latter is more used in an intelligent contract type block chain. The English language of UTXO is called Unpend Transaction Output, that is, unconsumed Transaction Output. The UTXO may be understood as a data structure in the transaction process. The unspent transaction output UTXO is a data structure containing transaction data and execution code that can be colloquially understood as encrypted digital currency that an address (analogous to the concept of an account in an account system) has received but has not been spent. Block chain based cryptographic digital currency uses UTXO to verify whether a person (who is actually an address) has unused cryptographic digital currency for payment. So there is essentially no bitcoin, only UTXO. An account has 5 bitcoins, and actually, in the current blockchain account book, the address where UTXO items for several transactions are collected is the address, and the total amount of the UTXOs is 5.
In the blockchain system, taking bitcoin transaction as an example, the life cycle of the transaction includes: creating transaction, broadcasting transaction, packaging transaction, uplink transaction and transaction rollback. The invention is mainly applied to the process of creating the transaction in the first step.
The specific process of creating transaction adopted by the prior art is as follows:
1. the wallet client paying A searches UTXO list information of the user A first to find whether the user A has enough funds to pay;
2. if the number of the UTXOs is enough, A needs to sign each UTXO by using a private key, and meanwhile, a private public key corresponding to each UTXO is added to prove that the A has the use right to the A, and the information is added to the address of the payer of A, namely an unlocking script;
a, in the process of transferring money to a money receiver B, an encryption problem is added at the tail of the transfer amount, so that the transfer fund is locked, and only persons meeting the conditions have right to use the fund, namely a locked script;
4. each output may set multiple encryption challenges and then multiple signatures are required to decrypt the output the next time it is used.
Prior art drawback (1): the security is low. In the prior art, transaction information, such as transaction amount, transfer-in address, transfer-out address, etc., of each transaction is stored in the blockchain. Due to the openness of the blockchain, everyone can see all information of each transaction on the blockchain, and through the collection of the address information, the amount of the token stored in each address can be clearly mastered, which brings the risk of attack to the addresses exposed on the blockchain to a certain extent.
Prior art drawback (2): the anonymity is weak. In the prior art, although each person can have an unlimited number of addresses, when a user pays by using bitcoins on a plurality of addresses, the user can know which addresses belong to the same user according to the transaction information. Because in bitcoin transactions, the issued bitcoin may have multiple sources of addresses. If there are multiple addresses providing bitcoins in a transaction, the user may select multiple different addresses as input for the bitcoin, almost because the user wants to send some bitcoins somewhere but one address cannot provide this amount. Thus, multiple input addresses in the same transaction are considered to belong to the same user. By analyzing the transaction information, a plurality of addresses owned by a certain user can be easily analyzed.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a transaction creating method, a verification method and transaction equipment of a blockchain system.
The invention provides a transaction creating method of a blockchain system, which is used for a first user to create a transaction in the blockchain system by taking a second user as a transaction object, wherein a public address used by any user, a public key of the public address and a public key hash of the public address are generated in the blockchain system, and the transaction creating method comprises the following steps:
receiving a transaction code sent by the second user through a line, a private public key of the second user, a public address of the second user and a public key hash of the public address; wherein the transaction code is generated by the second user through a random number generator;
generating first information, and encrypting the first information through the private public key of the second user to obtain the encrypted first information; carrying out Hash operation on the first information to obtain second information;
providing UTXO required for transaction, generating transaction information, and initiating transaction to the blockchain system; wherein the transaction information comprises a UTXO total amount required for a transaction, the transaction code, the encrypted first information, the second information, a public address of the second user, a public key hash of the public address, and a lock script; wherein the locking script is generated from a public key hash of the public address of the second user and the second information; the transaction code is used by the blockchain system to verify ownership of the UTXO by the first user; the first information is used for the second user to verify a transaction object of the first user; the second information is used for a script verification process of the blockchain system.
According to the embodiment of the invention, at least the following technical effects are achieved:
(1) the method sets the public account address, so that the information of the user is not exposed on the block chain, and the anonymity of the user is greatly enhanced.
(2) After verifying whether the user has the ownership of the UTXO, the method changes the original verification script and verifies the ownership of the UTXO by encrypting any message. And the step of executing decryption information by the transaction party can be put down on line, only the decoded plaintext message is submitted, the private public key is not exposed at all, and better anonymity can be achieved.
(3) The method adds the transaction code as second-layer identity verification, and the transaction code can be used as an identifier belonging to the BTC of the user in the public address.
In a second aspect of the present invention, there is provided a verification method based on the transaction creation method of the blockchain system in the first aspect of the present invention, for the blockchain system, including the following steps:
receiving the first information sent by the second user, a public key of the public address of the second user and the transaction code; the first information sent by the second user is obtained by the second user firstly receiving the encrypted first information sent by the first user through the offline and then decrypting the encrypted first information;
retrieving a transaction corresponding to the transaction information;
generating an unlocking script by the first information and the public key of the public address of the second user, and generating a combined verification script by the unlocking script and the locking script in the transaction information;
and verifying the combined verification script, and if the verification is passed, zeroing the transaction code and successfully unlocking.
According to the embodiment of the invention, at least the following technical effects are achieved:
(1) the method sets the public account address, so that the information of the user is not exposed on the block chain, and the anonymity of the user is greatly enhanced.
(2) After verifying whether the user has the ownership of the UTXO, the method changes the original verification script and verifies the ownership of the UTXO by encrypting any message. And the step of executing decryption information by the transaction party is put down on line, only the decoded plaintext message is submitted, and the private public key is not exposed at all, so that better anonymity is achieved.
(3) The method adds the transaction code as second-layer identity verification, and the transaction code can be used as an identifier belonging to the BTC of the user in the public address.
In a third aspect of the present invention, there is provided a verification method based on the transaction creation method of the blockchain system in the first aspect of the present invention, for the second user, including the following steps:
receiving the encrypted first information sent by a first user through a line;
decrypting the encrypted first information to obtain the first information;
and sending the first information, the public key of the public address of the second user and the transaction code to the blockchain system, wherein the first information, the public key of the public address of the second user and the transaction code are used for a verification process of the blockchain system.
According to the embodiment of the invention, at least the following technical effects are achieved:
(1) the method sets the public account address, so that the information of the user is not exposed on the block chain, and the anonymity of the user is greatly enhanced.
(2) After verifying whether the user has the ownership of the UTXO, the method changes the original verification script and verifies the ownership of the UTXO by encrypting any message. And the step of executing decryption information by the transaction party can be put down on line, only the decoded plaintext message is submitted, and the private public key is not exposed at all, so that better anonymity is achieved.
(3) The method adds the transaction code as second-layer identity verification, and the transaction code can be used as an identifier belonging to the BTC of the user in the public address.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a diagram of the prior art translation relationship between private key, public key hash and address;
FIG. 2 is a process diagram of a prior art combined script execution;
FIG. 3 is a process diagram of a prior art combined script execution;
FIG. 4 is a process diagram of a prior art combined script execution;
FIG. 5 is a process diagram of a prior art combined script execution;
FIG. 6 is a process diagram of a prior art combined script execution;
FIG. 7 is a process diagram of a prior art combined script execution;
fig. 8 is a flowchart illustrating a transaction creation method of a blockchain system according to a first embodiment of the present invention;
fig. 9 is a flowchart illustrating a transaction verification method of a blockchain system according to a second embodiment of the present invention;
fig. 10 is a flowchart illustrating a transaction verification method of a blockchain system according to a third embodiment of the present invention;
FIG. 11 is a diagram illustrating a process of executing a combination script according to a fourth embodiment of the present invention;
FIG. 12 is a diagram illustrating a process of combining script execution according to a fourth embodiment of the present invention;
FIG. 13 is a diagram illustrating a process of executing a combination script according to a fourth embodiment of the present invention;
FIG. 14 is a diagram illustrating a process of executing a combination script according to a fourth embodiment of the present invention;
FIG. 15 is a diagram illustrating a process of executing a combination script according to a fourth embodiment of the present invention;
FIG. 16 is a diagram illustrating a process of executing a combination script according to a fourth embodiment of the present invention;
FIG. 17 is a diagram illustrating a process of executing a combination script according to a fourth embodiment of the present invention;
fig. 18 is a schematic structural diagram of a transaction device according to a fifth embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
Before introducing the technical scheme of the invention, the reasons for technical problems recorded in the background technology are firstly caused to the prior art:
the type of script that bitcoin system is currently primarily using is the standard transaction script, namely P2PKH (paytoppublickeyhash). For example: when Alice transfers to Bob, the [ wallet address ] of Bob (equivalent to the [ public key hash ]) is given in the [ locking script ]; when Bob wants to transfer to Carol, he proves that he owns the private key corresponding to the wallet address, so the private public key is given in the input transaction and the signature of the transaction is signed by the private key. The specific process it performs is illustrated by the following example:
assuming that Alice now wants to make a transaction with Bob in an amount of 5BTC (bitcoin), Alice's wallet searches for two money, 4.5BTC, 1BTC, to be available for payment, where 4.5BTC is from the transaction with transaction ID 1001 and 1BTC is from the transaction with transaction ID 1003. The following is a specific flow of transaction creation:
1. the wallet client paying Alice searches UTXO list information of an Alice user to find whether Alice has enough funds to pay;
2. if the number of the UTXOs is enough, the Alice needs to sign each UTXO by using a private key, and meanwhile, a private public key corresponding to each UTXO is added to prove that the Alice has the use right of the UTXO, and the information is added to the payment party address of the Alice to form an unlocking script. (use by Alice of UTXO requiring an unlock script to unlock, also an encryption challenge previously transferred to him set for her.)
And 3, adding an encryption problem to the end of the transfer amount by Alice in the process of transferring the money to the money receiver Bob, so as to lock the transfer fund, and only the person meeting the condition has the right to use the fund (only Bob can unlock the fund) to form a locking script. The locked script contained in the output of the transaction is as follows:
OP_DUP OP_HASH160<Bob PubKeyHash>OP_EQUALVERIFY OP_CHECKSIG
if Bob were to use the asset that was locked when Alice transferred, a corresponding unlock script would have to be entered in the transaction:
<Bob Signature><Bob PubKey>;
the two scripts are combined to form a combined verification script as follows, an input script (an unlocking script) is executed firstly, an output script (a locking script) is executed secondly, and the scripts are executed from left to right:
<Bob Sig><Bob PubKey>OP_DUP OP_HASH160<Bob PubKeyHash>OP_EQUALVERIFY OP_CHECKSIG。
as shown in fig. 1 to fig. 1, the combined script performs the following specific steps:
step 1: pushing Bob's signature Sig and the private public key to the top of the stack.
Step 2: the OP _ DUP is executed, i.e. Bob's private public key is copied, forming a new top-of-stack element.
And step 3: OP _ HASH160 is performed. Popping up the PubKey, firstly carrying out SHA-256 Hash, then carrying out Ripemd160 Hash, and pressing the result PubKeyHash into the stack to form a new stack top element PubKeyHash 1.
And 4, step 4: and pushing the private public key hash of Bob to the stack to form a new stack top element PubKeyHash 2.
And 5: and executing the OP _ EQUALVERIFY, popping up a stack top element, if the two contents are consistent, returning to 'true', continuing the execution of the script, and otherwise, interrupting the execution and returning to 'false'.
Step 6: and popping two elements at the top of the stack by the OP _ CHECKSIG, checking the signature in the input by using the private public key, and verifying whether the signature is signed by the private key of the user with the private public key. If the signature is true, "true" is returned, otherwise "false" is returned.
Wherein, the following table 1 is a commonly used bitcoin script instruction list:
Figure BDA0002836290300000091
TABLE 1
As seen from the above transactions, in the transactions conducted, the transaction information has written the addresses of the sender and the recipient, and the corresponding transfer amount is also information on the addresses owned by the sender. From this information it is easy to deduce a large number of addresses, which form an important and active part of the bitcoin network.
The root cause of the above results is that the existing uplink transaction information is too much. Therefore, the present invention can properly hide a part of the information not necessarily disclosed on the blockchain to solve the above technical problem.
A first embodiment;
referring to fig. 8, an embodiment of the present invention provides a transaction creating method for a blockchain system, where a first user creates a transaction in the blockchain system with a second user as a transaction object, and the method includes the following steps:
the blockchain system of this embodiment sets a common address (not limited to one, but the embodiments of the present invention are all taken as examples), and the common address is used by any user in the blockchain system. Referring to fig. 1, in particular: firstly, the system generates a random number, then the random number is hashed, a private key is generated, a corresponding public key is generated by the private key, then the public key is used for generating public key hash, and then the public key hash is used for generating an address.
S101, a first user receives a transaction code sent by a second user through a line, a private public key of the second user, a public address of the second user and public key hash of the public address; wherein the transaction code is generated by the second user via the random number generator.
In step S101, the second user generates a transaction code by the random number generator, which is used to verify whether the user has ownership of the UTXO, here embodied as verifying whether the second user has access to the UTXO sent by the first user. The second user sends the generated transaction code, the private public key of the second user, the public address of the second user and the public key hash of the public address to the first user in an offline mode, wherein the offline mode refers to an offline communication mode of a non-blockchain system.
S102, a first user generates first information, and the first information is encrypted through a private public key of a second user to obtain the encrypted first information; and performing hash operation on the first information to obtain second information.
S103, providing UTXO required for transaction by the first user, generating transaction information, and initiating transaction to the blockchain system; the transaction information comprises UTXO total amount required by transaction, a transaction code, encrypted first information, second information, a public address of a second user, public key hash of the public address and a locking script; wherein the locking script is generated by a public key hash of a public address of the second user and the second information; the transaction code is used for verifying the ownership of the UTXO by the first user through the blockchain system; the first information is used for the second user to verify the transaction object of the first user; the second information is used for a script verification process of the blockchain system.
In step S102, on the one hand, the encrypted first information can be used by the second user to verify the transaction object of the first user, i.e. the second user verifies whether the transaction object of the first user is the second user by decrypting (the private key of the second user decrypts) the encrypted first information. In another aspect, the first user performs a hash operation on the generated first information to obtain second information, and the second information is used in a script verification process of the blockchain system, as shown in the second embodiment. As an alternative embodiment, the first information is a message plaintext of an arbitrary size.
In step S103, first, the first user will provide UTXO needed for transaction; transaction information is then generated and sent to the system. As an alternative embodiment, the first user provides the UTXO needed for the transaction, comprising the steps of: and searching UTXO list information of the first user through the wallet client to acquire the UTXO required for transaction.
Since the present embodiment sets the public address, the block-chain system traverses the entire UTXO set of the public address every time, if according to the conventional method, which increases the time-consuming cost. As an alternative embodiment, the transaction code is also used in the process of indexing UTXO by the blockchain system. As mentioned above, the transaction code is used to verify whether the user has ownership of the UTXO, and here, the transaction code may also be used in the process of indexing the UTXO by the blockchain system, so that the blockchain system can quickly find the corresponding UTXO without traversing the entire UTXO set of the public address each time, which greatly improves the speed of retrieving the UTXO.
The embodiment of the method has the beneficial effects that:
(1) because the prior art directly uses the self collection address of the user, the privacy is very weak, the address is exposed, and the safety is not strong.
(2) After verifying whether the user has the ownership of the UTXO, the method changes the original verification script and verifies the ownership of the UTXO by encrypting an arbitrary message (corresponding to the encrypted first information in step S101). And the step of the second user executing the decryption information (namely executing the decryption of the encrypted first information) can be put off line, only the decoded plaintext information is submitted, and the private public key is not exposed at all, so that better anonymity is achieved.
(3) Since the prior art directly uses the user's own collection address, the identification of the transaction code is not used naturally. In order to enable a user to unlock the BTC (bit currency) belonging to the user from the public address, the transaction code is added as the second-layer identity verification in the embodiment, on one hand, the transaction code can be used as the identification of the BTC belonging to the user in the public address, on the other hand, the UTXO can be indexed through the transaction code, the corresponding UTXO is quickly found, the UTXO set of the whole public address does not need to be traversed every time, and therefore the speed of retrieving the UTXO is greatly improved.
A second embodiment;
referring to fig. 9, an embodiment of the present invention provides a verification method for a blockchain system, which is used for the blockchain system, and includes the following steps:
s201, a block chain system receives first information sent by a second user, a public key of a public address of the second user and a transaction code; the first information sent by the second user is obtained by the second user firstly receiving the encrypted first information sent by the first user through the line and then decrypting the encrypted first information.
In this step, before the block chain system receives data sent by the second user, the second user receives the encrypted first information sent by the first user through a line, and the second user decrypts the encrypted first information by using a private key of the second user to obtain the first information; and finally, the first information, the public key of the public address where the first information is located and the transaction code are sent to the blockchain system.
S202, the blockchain system retrieves the transaction corresponding to the transaction information.
As an implementation manner of step S202, the blockchain system retrieves the corresponding transaction through the transaction code, and the specific retrieval process is as follows: the miners retrieve the UTXO in the public address according to the transaction code provided by the second user; if the corresponding UTXO is retrieved, it indicates that the transaction code has not been used.
S203, the blockchain system generates an unlocking script from the public key of the public address of the first information and the public key of the public address of the second user, and generates a combined verification script from the unlocking script and the locking script in the transaction information.
S204, the block chain system verifies the combined verification script, and if the verification is passed, the transaction code is set to zero, and the unlocking is successful.
S2041, pressing the first information and the public key of the public address to the top of the stack;
s2042, perform OP _ HASH 160: popping up a public key of a public address sent by a second user, performing SHA-256 Hash on the public key of the public address, then performing Ripemd160 Hash to obtain the Hash of the public key of the public address, and pressing the Hash of the public key of the public address into a stack to form a new stack top element PubKHash 1;
s2043, pressing the public key hash of the public address in the locking script into a stack to form a new stack top element PubKHash 2;
s2044, executing OP _ EQUALVERIFY, popping up a stack top element, if the two contents are consistent, returning to true, and continuing to execute the script; otherwise, interrupting the execution and returning to false;
s2045, perform OP _ SHA 256: popping up first information sent by a second user, carrying out SHA-256 hash on the first information, and pressing the hashed first information into a stack to form a new stack top element MH 1;
s2046, pushing second information in the locking script into a stack to form a new stack top element MH 2;
s2047, executing OP _ EQUALVERIFY, popping up a stack top element, and if the two contents are consistent, returning to true; otherwise false is returned.
The beneficial effects of this embodiment:
(1) because the prior art directly uses the self collection address of the user, the privacy is very weak, the address is exposed, and the safety is not strong.
(2) In verifying whether the user has ownership of the UTXO, this embodiment changes the verification script in the prior art, verifies ownership of the UTXO by encrypting an arbitrary message (i.e., the encrypted first information), and the step of decrypting the information is put offline (i.e., the second user performs decryption by offline in step S201), and only submits the decrypted plaintext message without exposing the private public key at all, thereby achieving better anonymity.
(3) The transaction code is added to the embodiment to serve as second-layer identity verification, on one hand, the transaction code can serve as an identifier which belongs to the BTC of the user in the public address, on the other hand, the UTXO can be indexed through the transaction code, the corresponding UTXO can be quickly found, the UTXO set of the whole public address does not need to be traversed every time, and therefore the speed of retrieving the UTXO is greatly improved.
A third embodiment;
referring to fig. 10, an embodiment of the present invention provides a verification method of a blockchain system for a second user, including the following steps:
s301, the second user receives the encrypted first information sent by the first user through the offline.
S302, the second user decrypts the encrypted first information to obtain the first information.
And S303, the second user sends the first information, the public key of the public address of the second user and the transaction code to the blockchain system, and the first information, the public key of the public address of the second user and the transaction code are used for the verification process of the blockchain system.
Since the present embodiment and the second embodiment are based on the same inventive concept, the second embodiment is an implementation process mainly based on a blockchain system, the present embodiment is an implementation process mainly based on a second user, and the detailed implementation manner can refer to the second embodiment, and the process, principle and beneficial effects thereof will not be described in detail herein.
A fourth embodiment;
in order to facilitate understanding of the present invention by those skilled in the art, an embodiment is provided, which includes that the user a takes the user B as a transaction object, a transaction process is initiated in the blockchain system, and an authentication process of the blockchain system is performed.
First, the blockchain system of the present embodiment sets a public address, which can be used by any user in the blockchain system. Referring to fig. 1, in particular: firstly, the system generates a random number, then the random number is hashed, a private key is generated, a corresponding public key is generated by the private key, then the public key is used for generating public key hash, and then the public key hash is used for generating an address.
Step S401, B generates a transaction code using a random number generator.
Step S402, B sends the transaction code, the public address of B, the public key hash of the public address of B and the private public key of B to A through a offline communication mode.
Step S403, A encrypts any Message by using the private public key of B, and the encrypted Message is represented by MC (Message cipher).
Step S404, A carries out Hash operation on the Message to obtain MH (Message Hash).
Step S405, a finds enough UTXO through the wallet client and provides an unlock script to unlock the UTXO for which payment is to be made.
Step S406, providing transaction information and initiating a transaction; the transaction information includes: the transaction code, the public addresses of MC, MH and B, the public key hash of the public address of B and the transaction amount; the locked script contained in the output of the transaction is as follows:
OP _ DUP OP _ HASH160< B public address PubKeyHash > OP _ SHA256< MH > OP _ EQUALVERIFY OP _ EQUALVERIFY.
The above steps S401 to S406 are the flow of steps in which B generates the transaction code, sends the transaction code and some information of the public address to a, and a creates the transaction.
And step S407, the MC in the transaction information is unlocked by the private key under the online condition by the B, and the Message is obtained.
Step S408, B provides Message, public key of public address of B and transaction code.
And step S409, the blockchain system miner retrieves UTXO in the public address according to the transaction code provided by B.
Step S410, the miner retrieves the corresponding UTXO, which indicates that the transaction code has not been used yet.
And S411, forming an unlocking script by the miner through the public key of the public address of the Message and the public address of the B.
And step S412, combining the unlocking script and the locking script to form a combined verification script.
And step S413, verifying that the script result is True.
And step S414, setting the transaction code to be 0.
And step S415, unlocking successfully.
In the above steps S407 to S415, the Message is obtained by B-line decryption, and then the Message, the public key of the public address of B and the transaction code are sent to the blockchain system, and the miner performs the script verification process.
The process of script verification by the miners is as follows:
to use this asset, which was locked by the transfer of A, B must enter the corresponding unlock script in the transaction:
< Message > < PubKey of B public address >;
the two scripts are combined to form a combined verification script as follows, an unlocking script is executed firstly, then a locking script is executed, and the scripts are executed from left to right:
< Message > < public address PubKey > OP _ HASH160 of B < PubKeyHash > OP _ SHA256< MH > OP _ equal value of B public address.
As shown in fig. 11 to 17, specifically:
step 1: and pressing the public address PubKey of the Message, B to the stack top.
Step 2: OP _ HASH160 is performed. And popping the public address PubKey of the B, firstly carrying out SHA-256 Hash, then carrying out Ripemd160 Hash, and pressing the public key Hash PubKeyHash of the public address of the public key B of the result public address into the stack to form a new stack top element PubKHash 1.
And step 3: the public address PubKeyHash of B is pushed onto the stack, forming a new top-of-stack element PubKHash 2.
And 4, step 4: and executing the OP _ EQUALVERIFY, popping up a stack top element, if the two contents are consistent, returning to 'true', continuing the execution of the script, and otherwise, interrupting the execution and returning to 'false'.
And 5: OP _ SHA256 is executed. Pop < Message >, perform SHA-256 hash, push the resulting Message hash onto the stack, forming a new top-of-stack element MH 1.
Step 6: the MH is pushed onto the stack forming a new top stack element MH 2.
And 7: and executing OP _ EQUALVERIFY, popping up the top element of the stack, and returning to 'true' if the two contents are consistent, otherwise, returning to 'false'.
The beneficial effects of this embodiment:
(1) because the prior art directly uses the self collection address of the user, the privacy is very weak, the address is exposed, and the safety is not strong.
(2) In verifying whether the user has ownership of the UTXO, this embodiment changes the verification script in the prior art, verifies ownership of the UTXO by encrypting an arbitrary message (i.e., the encrypted first information), and the step of decrypting the information is put offline (i.e., the second user performs decryption by offline in step S201), and only submits the decrypted plaintext message without exposing the private public key at all, thereby achieving better anonymity.
(3) The transaction code is added to the embodiment to serve as second-layer identity verification, on one hand, the transaction code can serve as an identifier which belongs to the BTC of the user in the public address, on the other hand, the UTXO can be indexed through the transaction code, the corresponding UTXO can be quickly found, the UTXO set of the whole public address does not need to be traversed every time, and therefore the speed of retrieving the UTXO is greatly improved.
A fifth embodiment;
referring to fig. 18, a transaction device is provided, which may be any type of smart terminal, such as a cell phone, tablet, personal computer, etc. Specifically, the apparatus includes: one or more control processors and memory, here exemplified by a control processor. The control processor and the memory may be connected by a bus or other means, here exemplified by a connection via a bus.
The memory, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the transaction device in embodiments of the present invention. The control processor implements the transaction creation method, or the verification method of the blockchain system of the above method embodiments by executing the non-transitory software programs, instructions, and modules stored in the memory.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the memory may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory located remotely from the control processor, and these remote memories may be connected to the transaction device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory and, when executed by the one or more control processors, perform the transaction creation method, the validation method, or the validation method of the blockchain system of the above method embodiments.
Embodiments of the present invention further provide a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used by one or more control processors to execute the transaction creation method, the verification method, or the verification method of the blockchain system in the above method embodiments.
Through the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by software plus a general hardware platform. Those skilled in the art will appreciate that all or part of the processes in the methods for implementing the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes in the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an illustrative embodiment," "an example," "a specific example," or "some examples" or the like mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an illustrative embodiment," "an example," "a specific example," or "some examples" or the like mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims (10)

1. A transaction creating method of a blockchain system is used for a first user to create a transaction in the blockchain system by taking a second user as a transaction object, wherein a public address used by any user, a public key of the public address and a public key hash of the public address are generated in the blockchain system, and the transaction creating method comprises the following steps:
receiving a transaction code sent by the second user through a line, a private public key of the second user, a public address of the second user and a public key hash of the public address; wherein the transaction code is generated by the second user through a random number generator;
generating first information, and encrypting the first information through the private public key of the second user to obtain the encrypted first information; carrying out Hash operation on the first information to obtain second information;
providing UTXO required for transaction, generating transaction information, and initiating transaction to the blockchain system; wherein the transaction information comprises a UTXO total amount required for a transaction, the transaction code, the encrypted first information, the second information, a public address of the second user, a public key hash of the public address, and a lock script; wherein the locking script is generated from a public key hash of the public address of the second user and the second information; the transaction code is used by the blockchain system to verify ownership of the UTXO by the first user; the first information is used for the second user to verify a transaction object of the first user; the second information is used for a script verification process of the blockchain system.
2. The method of claim 1, wherein the transaction code is further used by the blockchain system to index the UTXO.
3. The transaction creation method of a blockchain system according to claim 1, wherein the first information is a message plaintext of an arbitrary length within a fixed length.
4. The transaction creation method of a blockchain system according to claim 1, wherein the providing of the UTXO required for the transaction comprises the steps of:
and searching the UTXO list information of the first user through the wallet client to obtain the UTXO required for transaction.
5. A verification method for the transaction creation method based on the blockchain system of claim 1, wherein the verification method is used for the blockchain system and comprises the following steps:
receiving the first information sent by the second user, a public key of the public address of the second user and the transaction code; the first information sent by the second user is obtained by the second user firstly receiving the encrypted first information sent by the first user through the offline and then decrypting the encrypted first information;
retrieving a transaction corresponding to the transaction information;
generating an unlocking script by the first information and the public key of the public address of the second user, and generating a combined verification script by the unlocking script and the locking script in the transaction information;
and verifying the combined verification script, and if the verification is passed, zeroing the transaction code and successfully unlocking.
6. The authentication method of claim 5, wherein the corresponding transaction is retrieved by the transaction code.
7. The authentication method according to claim 6, wherein said authenticating the combined authentication script comprises the steps of:
pressing the first information and the public key of the public address to the top of the stack;
execute OP _ HASH 160: popping up the public key of the public address sent by the second user, performing SHA-256 hashing on the public key of the public address, then performing Ripemd160 hashing to obtain public key hashing of the public address, and pushing the public key hashing of the public address into a stack to form a new stack top element PubKHash 1;
pushing the public key hash of the public address in the locking script into a stack to form a new stack top element PubKHash 2;
executing OP _ EQUALVERIFY, popping up a stack top element, if the two contents are consistent, returning to true, and continuing to execute the script; otherwise, interrupting the execution and returning to false;
execute OP _ SHA 256: popping up the first information sent by the second user, performing SHA-256 hash on the first information, and pushing the hashed first information into a stack to form a new stack top element MH 1;
pushing the second information in the locking script into a stack to form a new top-of-stack element MH 2;
executing OP _ EQUALVERIFY, popping up a stack top element, and if the two contents are consistent, returning to true; otherwise false is returned.
8. A verification method for the transaction creation method based on the blockchain system of claim 1, wherein the verification method is used for the second user and comprises the following steps:
receiving the encrypted first information sent by a first user through a line;
decrypting the encrypted first information to obtain the first information;
and sending the first information, the public key of the public address of the second user and the transaction code to the blockchain system, wherein the first information, the public key of the public address of the second user and the transaction code are used for a verification process of the blockchain system.
9. A transaction device, comprising: at least one control processor and a memory for communicative connection with the at least one control processor; the memory stores instructions executable by the at least one control processor to enable the at least one control processor to perform a transaction creation method of a blockchain system as claimed in any one of claims 1 to 4, or to perform an authentication method as claimed in any one of claims 5 to 7, or to perform an authentication method as claimed in claim 8.
10. A computer-readable storage medium storing computer-executable instructions for causing a computer to perform the transaction creation method of the blockchain system according to any one of claims 1 to 4, or to perform the authentication method according to any one of claims 5 to 7, or to perform the authentication method according to claim 8.
CN202011472572.1A 2020-12-15 2020-12-15 Transaction creating method, verification method and transaction equipment of blockchain system Pending CN112561701A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011472572.1A CN112561701A (en) 2020-12-15 2020-12-15 Transaction creating method, verification method and transaction equipment of blockchain system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011472572.1A CN112561701A (en) 2020-12-15 2020-12-15 Transaction creating method, verification method and transaction equipment of blockchain system

Publications (1)

Publication Number Publication Date
CN112561701A true CN112561701A (en) 2021-03-26

Family

ID=75063438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011472572.1A Pending CN112561701A (en) 2020-12-15 2020-12-15 Transaction creating method, verification method and transaction equipment of blockchain system

Country Status (1)

Country Link
CN (1) CN112561701A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113592644A (en) * 2021-07-02 2021-11-02 中国人民银行数字货币研究所 Transaction method and device based on block chain UTXO model
CN116757849A (en) * 2023-08-14 2023-09-15 中资科技(江苏)有限公司 Asset management system and method based on block chain

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108764874A (en) * 2018-05-17 2018-11-06 深圳前海微众银行股份有限公司 Anonymous refund method, system and storage medium based on block chain
CN110335149A (en) * 2019-06-19 2019-10-15 华中科技大学 A kind of assets based on block chain really weigh transaction realization method and system
CN110473105A (en) * 2019-08-20 2019-11-19 深圳市网心科技有限公司 A kind of block chain transaction settlement method, system and relevant device
CN111552935A (en) * 2020-04-22 2020-08-18 中国银联股份有限公司 Block chain data authorization access method and device
WO2020240289A1 (en) * 2019-05-24 2020-12-03 nChain Holdings Limited Knowledge proof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108764874A (en) * 2018-05-17 2018-11-06 深圳前海微众银行股份有限公司 Anonymous refund method, system and storage medium based on block chain
WO2020240289A1 (en) * 2019-05-24 2020-12-03 nChain Holdings Limited Knowledge proof
CN110335149A (en) * 2019-06-19 2019-10-15 华中科技大学 A kind of assets based on block chain really weigh transaction realization method and system
CN110473105A (en) * 2019-08-20 2019-11-19 深圳市网心科技有限公司 A kind of block chain transaction settlement method, system and relevant device
CN111552935A (en) * 2020-04-22 2020-08-18 中国银联股份有限公司 Block chain data authorization access method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张中霞;王明文;: "区块链钱包方案研究综述", 计算机工程与应用, no. 06, 14 February 2020 (2020-02-14), pages 34 - 44 *
马春光等: "区块链中的智能合约", 技术研究, no. 11, 30 November 2018 (2018-11-30), pages 8 - 17 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113592644A (en) * 2021-07-02 2021-11-02 中国人民银行数字货币研究所 Transaction method and device based on block chain UTXO model
CN116757849A (en) * 2023-08-14 2023-09-15 中资科技(江苏)有限公司 Asset management system and method based on block chain
CN116757849B (en) * 2023-08-14 2023-10-20 中资科技(江苏)有限公司 Asset management system and method based on block chain

Similar Documents

Publication Publication Date Title
Li et al. Blockchain-based searchable symmetric encryption scheme
US20200344071A1 (en) Personal device security using cryptocurrency wallets
CN110224814B (en) Block chain data sharing method and device
US11394561B2 (en) Digital transaction signing for multiple client devices using secured encrypted private keys
CN106779636B (en) Block chain digital currency wallet based on mobile phone earphone interface
CN104065653B (en) A kind of interactive auth method, device, system and relevant device
CN107392603B (en) Transaction method and apparatus using digital money
CN110881063B (en) Storage method, device, equipment and medium of private data
CN110689349B (en) Transaction hash value storage and searching method and device in blockchain
CN107612683B (en) Encryption and decryption method, device, system, equipment and storage medium
CN108737374A (en) The method for secret protection that data store in a kind of block chain
CN110289968B (en) Private key recovery method, collaborative address creation method, collaborative address signature device and storage medium
CN105099673A (en) Authorization method, authorization requesting method and devices
CN113067699B (en) Data sharing method and device based on quantum key and computer equipment
CN111125781B (en) File signature method and device and file signature verification method and device
CN110149323B (en) Processing device with ten-million-level TPS (platform secure protocol) contract processing capacity
CN112561701A (en) Transaction creating method, verification method and transaction equipment of blockchain system
CN111314066B (en) Block chain-based data transfer method, terminal and computer-readable storage medium
CN114338038A (en) Memory system for block chain data secret inquiry and careless transmission method
CN111262852A (en) Business card signing and issuing method and system based on block chain
US20230041862A1 (en) Cloud-side collaborative multi-mode private data circulation method based on smart contract
CN114021196A (en) Fair searchable encryption method and system
CN114462088A (en) Method and device for de-identifying shared data
Joseph et al. Design a hybrid optimization and homomorphic encryption for securing data in a cloud environment
CN112580061A (en) Calling method of quantum encryption and decryption application interface and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination