WO2020103573A1 - Block chain-based network transaction signature method and device, and terminal equipment - Google Patents
Block chain-based network transaction signature method and device, and terminal equipmentInfo
- Publication number
- WO2020103573A1 WO2020103573A1 PCT/CN2019/108540 CN2019108540W WO2020103573A1 WO 2020103573 A1 WO2020103573 A1 WO 2020103573A1 CN 2019108540 W CN2019108540 W CN 2019108540W WO 2020103573 A1 WO2020103573 A1 WO 2020103573A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- input
- transaction
- value
- transaction message
- output
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3825—Use of electronic signatures
Definitions
- the present application belongs to the field of network transaction technology, and particularly relates to a signature method, signature device, terminal device and computer-readable storage medium based on a blockchain network transaction.
- the calculation formula for the handling fee is: the sum of the amount of each transaction input-the output of each transaction The sum of the amounts.
- the amount of each transaction input used by user A is 2 Bitcoin and 5 bitcoin, and user A 1 Bitcoin was transferred to user B, and the blockchain network changed 5.5 Bitcoins to user A (although the 5.5 Bitcoin was returned to user A, but still counted as the transaction output of this transaction), then in this transaction , User A needs to pay a handling fee of 0.5 Bitcoin.
- the first aspect of the present application provides a signature method based on a blockchain network transaction.
- the above-mentioned blockchain network transaction message includes an input field corresponding to each transaction input and an output field corresponding to each transaction output.
- Each input field includes the TxOutHash value of the output hash
- each legal input corresponds to the previous transaction message
- the previous transaction message corresponding to each legal input is that there is an output field
- the output The output corresponding to the field is the legal input
- the TxOutHash value corresponding to each legal input is the same as the hash hash value of the previous transaction message corresponding to the legal input;
- the above signature methods include:
- the second aspect of the present application provides a signature device based on a blockchain network transaction.
- the above-mentioned blockchain network transaction message includes an input field corresponding to each transaction input and an output field corresponding to each transaction output.
- Each input field includes the TxOutHash value of the output hash
- each legal input corresponds to the previous transaction message
- the previous transaction message corresponding to each legal input is that there is an output field
- the output The output corresponding to the field is the legal input
- the TxOutHash value corresponding to each legal input is the same as the hash hash value of the previous transaction message corresponding to the legal input;
- the above signature device includes:
- the TxOutHash acquisition module is used to obtain the TxOutHash value under the input field corresponding to each input required for this transaction in this transaction message.
- the above transaction message is the transaction message of this transaction;
- the previous message acquisition module is used to obtain the previous transaction message corresponding to each input required for this transaction;
- the hash value calculation module is used to calculate the hash value of each previous transaction message to obtain the hash value corresponding to each input;
- the judgment module is used to judge whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;
- the signature module is used to sign the above transaction message if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input.
- a third aspect of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor.
- the processor executes the computer program to implement the method of the first aspect. A step of.
- a fourth aspect of the present application provides a computer-readable storage medium.
- the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method of the first aspect described above are implemented.
- a fifth aspect of the present application provides a computer program product.
- the computer program product includes a computer program.
- the computer program is executed by one or more processors, the steps of the method of the first aspect described above are implemented.
- this application provides a signature method based on the blockchain network transaction.
- each legal input corresponds to the previous transaction message, and each legal input
- the Hash value of the corresponding previous transaction message is the same as the TxOutHash value corresponding to the input.
- the signature method provided in this application calculates the TxOutHash value corresponding to an input in the transaction message and the previous transaction report corresponding to the input. Whether the hash value of the text is the same to determine whether the input is legal and traverse all inputs of the transaction message. Only sign the transaction message when it is judged that all inputs of the transaction message are legal .
- the blockchain node where the user is located needs to send a signed transaction message to the blockchain transaction platform.
- the signature operation is used to indicate that the transaction message is legal
- the blockchain trading platform will only perform transfer operations when it receives legitimate messages. Therefore, the technical solution provided in this application can determine whether each transaction input of this transaction is legal, and can check the illegal transaction input embedded in the transaction message to a certain extent, only when it is determined that all transaction inputs are legal Only when the signature operation is executed, that is, the transaction message is determined to be legal, which makes the blockchain transaction platform perform the transfer operation, to a certain extent, it can avoid the illegal embedding of the transaction message when the user transfers the account. Multiple transaction inputs cause the user to pay more processing fees. Therefore, the signature method provided in this application can better protect the user's funds to a certain extent.
- FIG. 1 is a schematic diagram of an application scenario of a signature method based on a blockchain network transaction provided by this application;
- Figure 2 is a schematic diagram of the common transaction message format when conducting transactions based on the blockchain network
- FIG. 3 is a schematic diagram of an implementation process of a signature method based on a blockchain network transaction provided by Embodiment 1 of the present application;
- Embodiment 4 is a schematic diagram of judging whether each transaction input is legal provided by Embodiment 1 of the present application;
- FIG. 5 is a schematic diagram of an implementation process of another signature method based on a blockchain network transaction provided by Embodiment 2 of the present application;
- FIG. 6 is a schematic diagram of a calculation process of a handling fee provided in Example 2 of the present application.
- FIG. 7 is a schematic structural diagram of a signature device based on a blockchain network transaction provided by Embodiment 3 of the present application.
- FIG. 8 is a schematic structural diagram of a terminal device according to Embodiment 4 of the present application.
- FIG. 1 is a schematic diagram of an application scenario of a signature method based on a blockchain network transaction provided by this application.
- the application scenario includes a blockchain node 1 and a blockchain transaction platform 2.
- a transaction message 3 will be generated first.
- the transaction message 3 includes the accounts of each payee and the size of the transfer amount to each account of the payee.
- the transaction message 3 includes the account x of the blockchain node X, the amount transferred to the account x, the account y of the blockchain node Y, and the transfer amount.
- the blockchain node 1 sends the transaction message 3 to the blockchain transaction platform 2.
- the blockchain transaction platform 2 judges that the transaction message 3 is legal, it will assist the blockchain node 1 to complete the transfer transaction.
- the format of the transaction message is usually different.
- the following uses Figure 2 to illustrate a more commonly used transaction message format.
- the blockchain network that uses Bitcoin as the transaction currency adopts the transaction message format shown in FIG. 2.
- the transaction message includes the input field corresponding to each transaction input input and the output field corresponding to each transaction output output.
- the transaction message also includes the Input-Counter field and the Output-Counter field, Input -The size of the Counter field is used to indicate the number of input fields in the current transaction message, and the size of the Output-Counter field is used to indicate the number of output fields in the current transaction message.
- Input -The size of Counter and Output-Counter should be 2.
- the TxOutHash value is the hash hash value of the previous transaction message of the input corresponding to the input field, as shown in FIG.
- the TxOutHash value in the first input field should be the transaction input input1
- the Hash value of the corresponding previous transaction message I where the previous transaction message corresponding to each input has an output field, and the output corresponding to the output field is the input transaction message (for example, for transactions Input input1, if the previous transaction message corresponding to input1 is the previous transaction message I, then the previous transaction message I includes an output field, and the transaction output corresponding to the output field is the input1);
- the TxOutIndex value under an input field is used to indicate which output field in the previous transaction message the corresponding input corresponds to, for example, the previous transaction message corresponding to the transaction input input1 in FIG.
- the previous transaction message I is the previous transaction message I, assuming that the previous transaction message I includes two output fields, namely outputA field and outputB field, if the transaction output corresponding to the outputA field is input1, then the output of the previous transaction message I corresponding to the input1
- the field is specifically the outputA field.
- the TxOutIndex value in the input field corresponding to the input1 can be used to obtain the outputA field corresponding to the previous transaction message I; the ScriptLen under each input field The value is used to indicate the field length of the Sign & PubKey value in the input field; the Sign & Pubkey under each input field is the transaction signature and transaction public key of this transaction.
- each output field it includes the amount Value value, script length ScriptLen value, and PKScript value.
- the Value value under each output field is used to indicate the amount of the corresponding output; the ScriptLen value under each output field is used to indicate the field length of the PKScript value in the output field; the PKScript value under each output field is used to indicate Payee's account public key or account address (the account address is the payee account). If the PKScript under the output field is used to indicate the account public key of the beneficiary, the blockchain trading platform can calculate the account address of the beneficiary from the account public key, so as to conduct the transfer transaction.
- the signature method based on the blockchain network transaction provided by this application can be applied to the blockchain network using the transaction message format as shown in FIG. 2, such as the blockchain network with Bitcoin as the currency in.
- the signature method based on the blockchain network transaction provided by this application does not have to be applied to the blockchain network using the transaction message format as shown in FIG. 2.
- FIG. 2 For details, please refer to this application The description of Embodiment 1 and Embodiment 2.
- the following describes a signature method based on blockchain network transactions provided in Embodiment 1 of the present application.
- the signature method is applied to the following blockchain network:
- the transaction message of the blockchain network includes an input field corresponding to each transaction input input and an output field corresponding to each transaction output output.
- Each input field includes a TxOutHash value
- each legal input corresponds to Last transaction message
- the output corresponding to the output field is the legal input
- the TxOutHash value corresponding to each legal input is the The corresponding hash value of the previous transaction message is the same (the main reason why the input is limited to "legal" here is: when the input field corresponding to the illegal input is embedded in the transaction message, the illegal input is not necessarily Corresponding to the previous transaction message, even if there is a previous transaction message, the TxOutHash value corresponding to the illegal input is not necessarily the same as the Hash value of the previous transaction message).
- the packet format of the blockchain network to which the signature method provided in Embodiment 1 of the present application does not necessarily include the Input-Counter field, Output-Counter field, nor under the input field. It must contain the ScriptLen value, and the Value and ScriptLen values may not necessarily be under the output field.
- the signature method provided in the first embodiment of the present application needs to sign the transaction message, it can be the same as FIG. 2, and the Sign & PubKey can be included under each input field in the transaction message, but please ask a person skilled in the art Note that the field corresponding to the signature of the transaction message in the embodiment of the present application is not necessarily the same as that in FIG. 2.
- the signature method provided in Embodiment 1 of this application is shown in FIG. 3 and includes:
- step S101 in this transaction message, the TxOutHash value under the input field corresponding to each input required for this transaction is obtained.
- the above transaction message is the transaction message of this transaction;
- the transaction message includes three input fields, namely input field 1, input field 2, and input field 3, in step S101, the input field is read from the transaction message The TxOutHash value in 1, the TxOutHash value in the input field 2, and the TxOutHash value in the input field 3.
- the step S101 may include: determining whether the above-mentioned transaction message conforms to a preset message format, and if it matches, then in the transaction message, obtain the transaction request The TxOutHash value under the input field corresponding to each input of. That is, first check whether the transaction message conforms to the preset message format. For example, check whether the transaction message includes the preset fields and whether the length of each field matches the preset length. After the secondary transaction message conforms to the preset message format, let's read the TxOutHash value under each input field.
- step S102 obtain the previous transaction message corresponding to each input required for this transaction
- the previous transaction message may be obtained by communicating with a preset server, and this step S102 may include the following steps S1021-S1022:
- step S1021 the identification information of each input required for this transaction is acquired, and the identification information of each input is sent to the preset server to instruct the preset server to perform an operation of searching for the previous transaction message corresponding to each input;
- the identification information of each input may be the input time, the amount of the input, the account number and / or the payment account of the input, etc.
- the input information of the inputX may include: 2018 10 At 5:10 pm on the 30th of the month, 5 bitcoin, the deposit account is X, and the payment account is Y.
- the above preset server After receiving the identification information of each input, the above preset server searches for the previous transaction message corresponding to each input according to the identification information of each input.
- the preset server searches for a transaction corresponding to Output outputX transaction message, the outputX is the transaction output at 5:10 pm on October 30, 2018, the amount is 5 bitcoin, the receiving account is X and the sending account is Y, corresponding to the transaction with the outputX
- the message is the last transaction message of inputX.
- step S1022 receive the previous transaction message corresponding to each input sent by the preset server respectively;
- this step S1022 may include: after sending the identification information of each input to the preset server, determining whether a previous transaction message corresponding to each input returned by the preset server is received within a preset time period; If the previous transaction message corresponding to each input is received, the subsequent step S103 is performed; if the previous transaction message corresponding to each input is not received, it is considered that there is an illegal input in this transaction.
- the previous transaction message corresponding to input1 of this transaction message is the previous transaction message A
- the previous transaction message corresponding to input2 is the previous transaction message B
- the previous transaction corresponding to input3 The message is the last transaction message C.
- step S103 calculate the hash value of each previous transaction message to obtain the hash value corresponding to each input;
- the method for calculating the hash value of the message may use a currently commonly used method, such as the SHA256 algorithm, etc.
- the present application does not limit the method for calculating the hash value.
- this step S103 may further include a step of determining whether a previous transaction message corresponding to each input required for this transaction is obtained.
- a prompt for notifying the user that the transaction is illegal may be output Information to remind the user whether to sign the transaction message; or, can output a prompt message to remind the user that the transaction is illegal, and terminate the signing operation of the transaction message; or, you can directly terminate the transaction message Signature; or, you can directly terminate the transaction, that is, do not send the transaction message to the blockchain trading platform.
- this step S103 is specifically: if the previous transaction message corresponding to each input required for this transaction is obtained, then the hash hash value of each previous transaction message is calculated to obtain the hash corresponding to each input value.
- this step S103 may also include:
- the hash hash value of each previous transaction message is calculated to obtain the hash value corresponding to each input.
- the transaction message may include the Sign & PubKey shown in FIG. 2 in this case.
- the step S103 may also include: After the previous transaction message, determine whether each previous transaction message is a legal message based on the signature value and public key (can be Sign & PubKey) in each previous transaction message; when judging each previous transaction message When the messages are all legitimate messages, calculate the hash value of each previous transaction message to obtain the hash value corresponding to each input.
- a previous transaction message is illegal (does not conform to the preset message format, or based on the signature value and public key to determine that it is not a legal message)
- step S104 it is determined whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;
- each input in the transaction message can be considered legal, otherwise, if it is in each input required for this transaction ,
- the Hash value corresponding to one or more inputs is inconsistent with the TxOutHash value under the corresponding input field (for example, the TxOutHash under input field 2 is not the same as the Hash value of the previous transaction message B), then it can be output for Prompt information to remind the user that the transaction is illegal, to remind the user whether to sign the transaction message; or, you can output a prompt message to remind the user that the transaction is illegal, and terminate the signature of the transaction message Operation; or, you can directly terminate this signature, or you can directly terminate this transaction, that is, do not send this transaction message to the blockchain transaction review.
- step S105 if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message is signed;
- TxOutHash under input field 1 is consistent with the hash value of the previous transaction message A
- TxOutHash under input field 2 is consistent with the hash value of the previous transaction message B
- TxOutHash under input field 3 is consistent
- the hash value of the previous transaction message C is the same, it is considered that all inputs of the transaction message are legal, and then sign the transaction message (if the input field of the transaction message as defined in this application example includes Sign & PubKey, you can write the transaction signature and transaction public key of this transaction into the Sign & PubKey in the input field of the transaction message), so that the blockchain trading platform can help complete the transaction.
- Example 1 of this application can determine whether each transaction input of this transaction is legal, and can check the illegal transaction input embedded in this transaction message to a certain extent, only when judged Only when all transaction inputs are legal, will the signature operation be performed, that is, the transaction message will be deemed legal, which will enable the blockchain transaction platform to perform this transfer operation, which can avoid the user's transfer due to the transaction report to a certain extent.
- Multiple transaction inputs are illegally embedded in the article, which causes the user to pay more processing fees. Therefore, the signature method provided by this application can better protect the user's funds to a certain extent.
- Embodiment 2 of this application describes another signature method based on blockchain network transactions provided in Embodiment 2 of this application.
- the signature method described in Embodiment 2 of this application is applied to the following blockchain network:
- the transaction message of the blockchain network includes each input field and each output field, each input field includes a TxOutHash value, and each output field includes an amount Value, which is used to indicate the amount of the corresponding output
- the TxOutIndex value under each input field is also included under each input field.
- the TxOutIndex value under each input field is used to indicate the position of the output field corresponding to the corresponding input in the corresponding previous transaction message.
- FIG. 2 For the format of the transaction message of the blockchain network defined in the first embodiment of the application, please refer to FIG. 2 and the corresponding text description part.
- the signature method provided in the second embodiment of the present application needs to sign the transaction message, it can be the same as in FIG. 2, and the transaction message can include Sign & PubKey under each input field.
- the field corresponding to the signature of the transaction message in the embodiment of the present application is not necessarily the same as FIG. 2.
- the signature method described in Embodiment 2 of this application is shown in FIG. 5 and includes:
- step S201 in this transaction message, the TxOutHash value under the input field corresponding to each input required for this transaction is obtained.
- the above transaction message is the transaction message of this transaction;
- step S202 obtain the previous transaction message corresponding to each input required for this transaction
- step S203 calculate the hash value of each previous transaction message to obtain the hash value corresponding to each input;
- step S204 it is determined whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;
- step S205 if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, then according to the above transaction message, each output field of the above transaction message is obtained Under the Value value, get the amount corresponding to each output in this transaction;
- the transaction fee to be paid for this transaction can be further calculated and displayed to facilitate the user Know the transaction fee of this transaction, and enable users to determine whether to continue the transaction based on the transaction fee of this transaction.
- the value of each transaction output is determined by reading the Value value under each output field in the transaction message, for example, the Value value under output field 1 is used to indicate the transaction The amount of output1 is output, and the Value value under output field 2 is used to indicate the amount of output2 of the transaction.
- step S206 among each input required for the transaction, an input is selected as the target input;
- this transaction requires three inputs, namely input1, input2, and input3. You can select any input from input1, input2, and input3 as the target input, for example, select input1 as the target input.
- step S207 according to the TxOutIndex value under the input field corresponding to the target input, in the previous transaction message corresponding to the target input, search for the target output field, and the output corresponding to the target output field is the target input;
- step S206 If in step S206, input1 is selected as the target input, in this transaction message, the TxOutIndex value in input field 1 corresponding to input1 is obtained, and the TxOutIndex value in input field 1 is used to indicate that input1 corresponds to the previous time
- the TxOutIndex value in input field 1 is used to indicate that input1 corresponds to the previous time
- step S208 obtain the Value value under the target output field to obtain the amount of the target input
- the value of the value in the output field A1 in the previous transaction message A is used as the amount of input1.
- step S209 it is determined whether the selected input has traversed all the inputs required for the transaction, if not, step S210 is executed, and if so, step S211 is executed;
- step S210 remove the selected input, and in each input of this transaction, select an input as the target input, and return to step S207;
- step S209 it is determined whether the amount of each input of the transaction message is obtained, if not, then select an input as the target input, and return to step S207;
- step S211 according to the amount of money corresponding to each input in this transaction and the amount of money corresponding to each output in this transaction, the transaction fee for this transaction is determined;
- the method for calculating the handling fee can use the existing technology to calculate the sum of the amount of each input and the sum of the amount of each output, minus the sum of the amount of each input minus the amount of each output The sum of the size and the transaction fee for this transaction.
- step S212 the user is shown the above handling fee so that the user can confirm whether they are willing to continue the transaction;
- step S213 if an instruction indicating that the user is willing to continue the transaction is received, the transaction message of this time is signed.
- the user is shown the size of the handling fee, and when receiving the instruction of the user willing to continue the transaction, the transaction message is signed; when the instruction of the user refusing to continue the transaction is received, it can be Terminate this signature.
- the second embodiment of the present application can further inform the user of the transaction fee of the transaction. Therefore, compared with the first embodiment, the second embodiment of the present application can make the user know the size of the transaction fee for each transaction. Can guarantee the user's right to know, and further improve the user experience.
- the second embodiment of the present application is the same as the first embodiment, which can check the illegal transaction input embedded in the transaction message to a certain extent, so as to avoid that when the user transfers money, because the transaction message is illegally embedded Input of a transaction, causing the user to pay more processing fees.
- Embodiment 3 of the present application provides a signature device based on a blockchain network transaction.
- the above-mentioned blockchain network transaction message includes an input field corresponding to each transaction input and an output field corresponding to each transaction output.
- Each input field includes the TxOutHash value of the output hash
- each legal input corresponds to the previous transaction message
- the previous transaction message corresponding to each legal input is that there is an output field.
- the output corresponding to the field is the legal input
- the TxOutHash value corresponding to each legal input is the same as the hash hash value of the previous transaction message corresponding to the legal input;
- the signature device 300 includes:
- the TxOutHash obtaining module 301 is used to obtain the TxOutHash value under the input field corresponding to each input required for this transaction in this transaction message.
- the above transaction message is the transaction message of this transaction;
- the previous message acquisition module 302 is used to obtain the previous transaction message corresponding to each input required for this transaction;
- the hash value calculation module 303 is used to calculate the hash value of each previous transaction message to obtain the hash value corresponding to each input;
- the judgment module 304 is used to judge whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;
- the signature module 305 is configured to sign the transaction message if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input.
- each output field in the transaction message of the above-mentioned blockchain network includes an amount Value value, the above Value value is used to indicate the amount of the corresponding output amount, and each input field also includes a send output index TxOutIndex value , The TxOutIndex value under each input field is used to indicate the position of the output field corresponding to the corresponding input in the corresponding previous transaction message;
- the above-mentioned signature module 305 includes:
- the output amount determination unit is used to obtain each of the above transaction messages according to the above transaction message if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input Value value under the output field to get the amount of money corresponding to each output in this transaction;
- Target input selection unit used to select any input as the target input among each input required for this transaction
- the target output determining unit is used to search for the target output field in the previous transaction message corresponding to the target input according to the TxOutIndex value under the input field corresponding to the target input, wherein the output corresponding to the target output field is the target input;
- the target input amount determination unit is used to obtain the Value value under the target output field to obtain the amount of the target input amount
- the traversal judgment unit is used to judge whether the selected input traverses all inputs required for this transaction
- the target input reselection unit is used to remove the selected input if the selected input has not traversed all the inputs required for this transaction, and select another input as the target input among each input of this transaction;
- the handling fee determination unit is used to determine the cost of the selected input according to the amount of each input in this transaction and the amount of each output in this transaction if the selected input traverses all the inputs required for this transaction. Handling fee for each transaction;
- the handling fee display unit is used to display the above handling fee to the user so that the user can confirm whether they are willing to continue the transaction;
- the signature unit is used to sign the transaction message if an instruction indicating that the user is willing to continue the transaction is received.
- the above TxOutHash acquisition module 301 includes:
- the first format judgment unit is used to judge whether the message format of the above transaction message conforms to the preset message format
- the TxOutHash obtaining unit is used to obtain the TxOutHash value under the input field corresponding to each input required for this transaction in this transaction message if it conforms to the above-mentioned preset message format.
- the above-mentioned signature device 300 further includes:
- the previous message judgment module is used to judge whether the previous transaction message corresponding to each input required for this transaction is obtained;
- the above-mentioned hash value calculation module 303 is specifically used for:
- the hash hash value of each previous transaction message is calculated to obtain the hash value corresponding to each input.
- the above hash value calculation module 303 includes:
- the second format judgment unit is used to judge whether the message format of each previous transaction message conforms to the preset message format
- the hash value calculation unit is configured to calculate a hash hash value of each previous transaction message if it conforms to the above-mentioned preset message format to obtain a hash value corresponding to each input.
- the foregoing previous message acquisition module 302 includes:
- the communication sending unit is used to obtain the identification information of each input required for this transaction, and send the identification information of each input to the preset server to instruct the preset server to perform the operation of searching for the previous transaction message corresponding to each input ;
- the communication receiving unit is configured to receive the previous transaction message corresponding to each input sent by the preset server.
- the above-mentioned signature device 300 further includes:
- the signature termination module is used to terminate the signature if the Hash value corresponding to one or more inputs is inconsistent with the TxOutHash value under the corresponding input field in each input required for this transaction.
- FIG. 8 is a schematic diagram of a terminal device provided in Embodiment 4 of the present application.
- the terminal device is a blockchain node applied in a blockchain network, where the transaction message of the blockchain network includes various transaction inputs
- each legal input corresponds to the previous transaction message
- each legal The previous transaction message corresponding to input has an output field
- the output corresponding to the output field is the legal input.
- the TxOutHash value corresponding to each legal input and the hash of the previous transaction message corresponding to the legal input Hash value is the same.
- the terminal device 4 of this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40.
- the steps in the above method embodiment are implemented, for example, steps S101 to S105 shown in FIG. 1.
- the processor 40 executes the computer program 42, the functions of each module / unit in the above-described device embodiment are realized, for example, the functions of the modules 301 to 305 shown in FIG. 7.
- the computer program 42 may be divided into one or more modules / units.
- the one or more modules / units are stored in the memory 41 and executed by the processor 40 to complete the application.
- the one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 42 in the terminal device 4.
- the above computer program 42 can be divided into a TxOutHash acquisition module, a previous message acquisition module, a hash value calculation module, a judgment module, and a signature module.
- the specific functions of each module are as follows:
- the terminal device 4 may be a computing device such as a desktop computer, a notebook, a palmtop computer and a cloud server.
- the above terminal device may include, but is not limited to, the processor 40 and the memory 41.
- FIG. 8 is only an example of the terminal device 4 and does not constitute a limitation on the terminal device 4, and may include more or less components than those illustrated, or a combination of certain components, or different components.
- the above terminal device may further include an input and output device, a network access device, a bus, and the like.
- the so-called processor 40 may be a central processing unit (Central Processing Unit (CPU), can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application-specific integrated circuits (Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
- the above-mentioned memory 41 may be an internal storage unit of the above-mentioned terminal device 4, such as a hard disk or a memory of the terminal device 4.
- the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, and a flash memory provided on the terminal device 4 Card (Flash Card) etc.
- the memory 41 may include both the internal storage unit of the terminal device 4 and the external storage device.
- the memory 41 is used to store the computer program and other programs and data required by the terminal device.
- the above-mentioned memory 41 may also be used to temporarily store data that has been output or will be output.
- each functional unit and module is used as an example for illustration.
- the above-mentioned functions may be allocated by different functional units
- Module completion means that the internal structure of the above device is divided into different functional units or modules to complete all or part of the functions described above.
- the functional units and modules in the embodiments may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the above integrated unit may use hardware It can also be implemented in the form of software functional units.
- the specific names of each functional unit and module are only for the purpose of distinguishing each other, and are not used to limit the protection scope of the present application.
- the disclosed device / terminal device and method may be implemented in other ways.
- the device / terminal device embodiments described above are only schematic.
- the above-mentioned division of modules or units is only a division of logical functions.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the above integrated unit may be implemented in the form of hardware or software functional unit.
- the above integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
- the present application can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing relevant hardware through a computer program.
- the above computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the foregoing method embodiments may be implemented.
- the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code, executable file or some intermediate form.
- the above computer readable medium may include: any entity or device capable of carrying the above computer program code, recording medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media.
- ROM Read-Only Memory
- RAM Random Access Memory
- electrical carrier signals telecommunication signals
- software distribution media any entity or device capable of carrying the above computer program code
- recording medium U disk, removable hard disk, magnetic disk, optical disk
- computer memory read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media.
- ROM Read-Only Memory
- RAM Random Access Memory
- electrical carrier signals telecommunication signals
- software distribution media software distribution media.
Abstract
Description
Claims (20)
- 一种基于区块链网络交易的签名方法,其特征在于,所述区块链网络的交易报文中包括有各个交易输入input分别对应的input字段以及各个交易输出output分别对应的output字段,每个input字段中均包括有发送输出哈希TxOutHash值,每个合法的input均对应有前次交易报文,每个合法的input对应的前次交易报文为存在有一output字段,该output字段对应的output为该合法的input,每个合法的input对应的TxOutHash值与该合法的input对应的前次交易报文的哈希Hash值相同;A signature method based on a blockchain network transaction, characterized in that the transaction message of the blockchain network includes an input field corresponding to each transaction input input and an output field corresponding to each transaction output output, each Each input field includes the TxOutHash value of the sent output hash. Each legal input corresponds to the previous transaction message. Each legal input corresponds to the previous transaction message. There is an output field, which corresponds to the output field. Is the legal input, and the TxOutHash value corresponding to each legal input is the same as the hash hash value of the previous transaction message corresponding to the legal input;所述签名方法包括:The signature method includes:在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,所述本次交易报文为本次交易的交易报文;In this transaction message, obtain the TxOutHash value under the input field corresponding to each input required for this transaction, which is the transaction message of this transaction;获取本次交易所需的各个input分别对应的前次交易报文;Get the previous transaction message corresponding to each input required for this transaction;计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值;Calculate the hash hash value of each previous transaction message to get the hash value corresponding to each input;判断计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值是否一致;Determine whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对所述本次交易报文进行签名。If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message of this time is signed.
- 如权利要求1所述的签名方法,其特征在于,所述区块链网络的交易报文中每个output字段中均包括金额Value值,所述Value值用于指示对应的output的金额大小,每个input字段下还包括发送输出索引TxOutIndex值,每个input字段下的TxOutIndex值用于指示对应的input所对应的output字段在对应的前次交易报文中的位置;The signature method according to claim 1, wherein each output field in the transaction message of the blockchain network includes an amount Value value, and the Value value is used to indicate the amount of the corresponding output amount, Each input field also includes a send output index TxOutIndex value. The TxOutIndex value under each input field is used to indicate the position of the output field corresponding to the corresponding input in the corresponding previous transaction message;所述若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对本次交易报文进行签名,包括:If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message is signed, including:若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则:If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, then:根据所述本次交易报文,获取所述本次交易报文的各个output字段下的Value值,得到本次交易中每个output对应的金额大小;According to the transaction message, obtain the Value value under each output field of the transaction message to obtain the amount of money corresponding to each output in the transaction;在本次交易所需的各个input中,选取任一input作为目标input;In each input required for this transaction, select any input as the target input;根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input;According to the TxOutIndex value under the input field corresponding to the target input, search for the target output field in the previous transaction message corresponding to the target input, where the output corresponding to the target output field is the target input;获取所述目标output字段下的Value值,得到所述目标input的金额大小;Obtain the Value value under the target output field to obtain the amount of the target input amount;判断所选取的input是否遍历完本次交易所需的所有input;Determine whether the selected input traverses all the inputs required for this transaction;若所选取的input没有遍历完本次交易所需的所有input,则:If the selected input does not traverse all the inputs required for this transaction, then:除去已选取的input,在本次交易的各个input中,再选取一input作为目标input,并返回执行所述根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input的步骤以及后续步骤,从而得到本次交易中每个input对应的金额大小;Remove the selected input, in each input of this transaction, select another input as the target input, and return to execute the TxOutIndex value under the input field corresponding to the target input, in front of the corresponding target input In the transaction message, search for the target output field, where the output corresponding to the target output field is the step and subsequent steps of the target input, so as to obtain the amount of money corresponding to each input in this transaction;若所选取的input遍历完本次交易所需的所有input,则:If the selected input traverses all inputs required for this transaction, then:根据本次交易中各个input对应的金额大小,以及本次交易中各个output对应的金额大小,确定本次交易的手续费;Determine the transaction fee for this transaction based on the amount of money corresponding to each input in this transaction and the amount of money corresponding to each output in this transaction;向用户展示所述手续费,以便用户确认是否愿意继续交易;Show the user the handling fee so that the user can confirm whether they are willing to continue the transaction;若接收到用于指示用户愿意继续交易的指令,则对本次交易报文进行签名。If an instruction indicating that the user is willing to continue the transaction is received, the transaction message is signed.
- 如权利要求1所述的签名方法,其特征在于,所述在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,包括:The signature method according to claim 1, wherein, in the transaction message, obtaining the TxOutHash value under the input field corresponding to each input required for the transaction includes:判断所述本次交易报文的报文格式是否符合预设报文格式;Determine whether the message format of the transaction message conforms to the preset message format;若符合所述预设报文格式,则在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值。If the preset message format is met, then in this transaction message, the TxOutHash value under the input field corresponding to each input required for this transaction is obtained.
- 如权利要求1所述的签名方法,其特征在于,在所述计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值的步骤之前,所述签名方法还包括:The signature method according to claim 1, wherein before the step of calculating the hash value of each previous transaction message to obtain a hash value corresponding to each input, the signature method further comprises:判断是否获取到本次交易所需的各个input分别对应的前次交易报文;Determine whether the previous transaction message corresponding to each input required for this transaction is obtained;相应地,所述计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值,包括:Correspondingly, the hash hash value of each previous transaction message is calculated to obtain a hash value corresponding to each input, including:若获取本次交易所需的各个input分别对应的前次交易报文,则计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值。If the previous transaction message corresponding to each input required for this transaction is obtained, the hash hash value of each previous transaction message is calculated to obtain the hash value corresponding to each input.
- 如权利要求1所述的签名方法,其特征在于,所述计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值,包括:The signature method according to claim 1, wherein the calculating a hash value of each previous transaction message to obtain a hash value corresponding to each input includes:判断各个前次交易报文的报文格式是否符合预设报文格式;Determine whether the message format of each previous transaction message conforms to the preset message format;若符合所述预设报文格式,则计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值。If the preset message format is met, then the hash hash value of each previous transaction message is calculated to obtain the hash value corresponding to each input.
- 如权利要求1所述的签名方法,其特征在于,所述获取本次交易所需的各个input分别对应的前次交易报文,包括:The signature method according to claim 1, wherein the previous transaction message corresponding to each input required to obtain the transaction includes:获取本次交易所需的各个input的标识信息,将各个input的标识信息发送至预设服务器,以指示所述预设服务器执行查找各个input对应的前次交易报文的操作;Obtain the identification information of each input required for this transaction, and send the identification information of each input to a preset server to instruct the preset server to perform the operation of searching for the previous transaction message corresponding to each input;接收所述预设服务器发送的各个input分别对应的前次交易报文。Receiving the previous transaction message corresponding to each input sent by the preset server respectively.
- 如权利要求1至6中任一项所述的签名方法,其特征在于,在所述判断计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值是否一致的步骤之后,还包括:The signature method according to any one of claims 1 to 6, wherein after the step of determining whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input ,Also includes:在本次交易所需的各个input中,若存在有一个或多个input对应的Hash值与对应的input字段下的TxOutHash值不一致,则终止本次签名。In each input required for this transaction, if there is a hash value corresponding to one or more inputs that is inconsistent with the TxOutHash value under the corresponding input field, the signature is terminated.
- 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如下基于区块链网络交易的签名方法:A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it is implemented as follows based on a blockchain Network transaction signature method:其中,所述区块链网络的交易报文中包括有各个交易输入input分别对应的input字段以及各个交易输出output分别对应的output字段,每个input字段中均包括有发送输出哈希TxOutHash值,每个合法的input均对应有前次交易报文,每个合法的input对应的前次交易报文为存在有一output字段,该output字段对应的output为该合法的input,每个合法的input对应的TxOutHash值与该合法的input对应的前次交易报文的哈希Hash值相同;Among them, the transaction message of the blockchain network includes an input field corresponding to each transaction input input and an output field corresponding to each transaction output output, and each input field includes a send output hash TxOutHash value, Each legal input corresponds to a previous transaction message. The previous transaction message corresponding to each legal input has an output field. The output corresponding to the output field is the legal input, and each legal input corresponds to The TxOutHash value is the same as the hash hash value of the previous transaction message corresponding to the legal input;所述签名方法包括:The signature method includes:在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,所述本次交易报文为本次交易的交易报文;In this transaction message, obtain the TxOutHash value under the input field corresponding to each input required for this transaction, which is the transaction message of this transaction;获取本次交易所需的各个input分别对应的前次交易报文;Get the previous transaction message corresponding to each input required for this transaction;计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值;Calculate the hash hash value of each previous transaction message to get the hash value corresponding to each input;判断计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值是否一致;Determine whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对所述本次交易报文进行签名。If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message of this time is signed.
- 如权利要求8所述的终端设备,其特征在于,所述区块链网络的交易报文中每个output字段中均包括金额Value值,所述Value值用于指示对应的output的金额大小,每个input字段下还包括发送输出索引TxOutIndex值,每个input字段下的TxOutIndex值用于指示对应的input所对应的output字段在对应的前次交易报文中的位置;The terminal device according to claim 8, wherein each output field in the transaction message of the blockchain network includes an amount Value value, and the Value value is used to indicate the amount of the corresponding output amount, Each input field also includes a send output index TxOutIndex value. The TxOutIndex value under each input field is used to indicate the position of the output field corresponding to the corresponding input in the corresponding previous transaction message;所述若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对本次交易报文进行签名,包括:If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message is signed, including:若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则:If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, then:根据所述本次交易报文,获取所述本次交易报文的各个output字段下的Value值,得到本次交易中每个output对应的金额大小;According to the transaction message, obtain the Value value under each output field of the transaction message to obtain the amount of money corresponding to each output in the transaction;在本次交易所需的各个input中,选取任一input作为目标input;In each input required for this transaction, select any input as the target input;根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input;According to the TxOutIndex value under the input field corresponding to the target input, search for the target output field in the previous transaction message corresponding to the target input, where the output corresponding to the target output field is the target input;获取所述目标output字段下的Value值,得到所述目标input的金额大小;Obtain the Value value under the target output field to obtain the amount of the target input amount;判断所选取的input是否遍历完本次交易所需的所有input;Determine whether the selected input traverses all the inputs required for this transaction;若所选取的input没有遍历完本次交易所需的所有input,则:If the selected input does not traverse all the inputs required for this transaction, then:除去已选取的input,在本次交易的各个input中,再选取一input作为目标input,并返回执行所述根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input的步骤以及后续步骤,从而得到本次交易中每个input对应的金额大小;Remove the selected input, and in each input of this transaction, select another input as the target input, and return to execute the TxOutIndex value under the input field corresponding to the target input, before the target input In the transaction message, search for the target output field, where the output corresponding to the target output field is the step and subsequent steps of the target input, so as to obtain the amount of money corresponding to each input in this transaction;若所选取的input遍历完本次交易所需的所有input,则:If the selected input traverses all inputs required for this transaction, then:根据本次交易中各个input对应的金额大小,以及本次交易中各个output对应的金额大小,确定本次交易的手续费;Determine the transaction fee for this transaction based on the amount of money corresponding to each input in this transaction and the amount of money corresponding to each output in this transaction;向用户展示所述手续费,以便用户确认是否愿意继续交易;Show the user the handling fee so that the user can confirm whether they are willing to continue the transaction;若接收到用于指示用户愿意继续交易的指令,则对本次交易报文进行签名。If an instruction indicating that the user is willing to continue the transaction is received, the transaction message is signed.
- 如权利要求8所述的终端设备,其特征在于,所述在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,包括:The terminal device according to claim 8, wherein, in the transaction message, obtaining the TxOutHash value under the input field corresponding to each input required for the transaction includes:判断所述本次交易报文的报文格式是否符合预设报文格式;Determine whether the message format of the transaction message conforms to the preset message format;若符合所述预设报文格式,则在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值。If the preset message format is met, then in this transaction message, the TxOutHash value under the input field corresponding to each input required for this transaction is obtained.
- 如权利要求8所述的终端设备,其特征在于,在所述计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值的步骤之前,所述处理器执行所述计算机程序时,还执行如下步骤:The terminal device according to claim 8, wherein before the step of calculating the hash value of each previous transaction message to obtain a hash value corresponding to each input, the processor executes When performing a computer program, the following steps are also performed:判断是否获取到本次交易所需的各个input分别对应的前次交易报文;Determine whether the previous transaction message corresponding to each input required for this transaction is obtained;相应地,所述计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值,包括:Correspondingly, the hash hash value of each previous transaction message is calculated to obtain a hash value corresponding to each input, including:若获取本次交易所需的各个input分别对应的前次交易报文,则计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值。If the previous transaction message corresponding to each input required for this transaction is obtained, the hash hash value of each previous transaction message is calculated to obtain the hash value corresponding to each input.
- 如权利要求8所述的终端设备,其特征在于,所述计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值,包括:The terminal device according to claim 8, wherein the calculating a hash value of each previous transaction message to obtain a hash value corresponding to each input includes:判断各个前次交易报文的报文格式是否符合预设报文格式;Determine whether the message format of each previous transaction message conforms to the preset message format;若符合所述预设报文格式,则计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值。If the preset message format is met, then the hash hash value of each previous transaction message is calculated to obtain the hash value corresponding to each input.
- 如权利要求8所述的终端设备,其特征在于,所述获取本次交易所需的各个input分别对应的前次交易报文,包括:The terminal device according to claim 8, wherein the previous transaction message corresponding to each input required to obtain the transaction includes:获取本次交易所需的各个input的标识信息,将各个input的标识信息发送至预设服务器,以指示所述预设服务器执行查找各个input对应的前次交易报文的操作;Obtain the identification information of each input required for this transaction, and send the identification information of each input to a preset server to instruct the preset server to perform the operation of searching for the previous transaction message corresponding to each input;接收所述预设服务器发送的各个input分别对应的前次交易报文。Receiving the previous transaction message corresponding to each input sent by the preset server respectively.
- 如权利要求8至13中任一项所述的终端设备,其特征在于,在所述判断计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值是否一致的步骤之后,所述处理器执行所述计算机程序时,还执行如下步骤:The terminal device according to any one of claims 8 to 13, wherein after the step of determining whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input When the processor executes the computer program, it also performs the following steps:在本次交易所需的各个input中,若存在有一个或多个input对应的Hash值与对应的input字段下的TxOutHash值不一致,则终止本次签名。In each input required for this transaction, if there is a hash value corresponding to one or more inputs that is inconsistent with the TxOutHash value under the corresponding input field, the signature is terminated.
- 一种基于区块链网络交易的签名装置,其特征在于,所述区块链网络的交易报文中包括有各个交易输入input分别对应的input字段以及各个交易输出output分别对应的output字段,每个input字段中均包括有发送输出哈希TxOutHash值,每个合法的input均对应有前次交易报文,每个合法的input对应的前次交易报文为存在有一output字段,该output字段对应的output为该合法的input,每个合法的input对应的TxOutHash值与该合法的input对应的前次交易报文的哈希Hash值相同;A signature device based on a blockchain network transaction, characterized in that the transaction message of the blockchain network includes an input field corresponding to each transaction input input and an output field corresponding to each transaction output output, each Each input field includes the TxOutHash value of the sent output hash. Each legal input corresponds to the previous transaction message. Each legal input corresponds to the previous transaction message. There is an output field, which corresponds to the output field. Is the legal input, and the TxOutHash value corresponding to each legal input is the same as the hash hash value of the previous transaction message corresponding to the legal input;所述签名装置包括:The signature device includes:TxOutHash获取模块,用于在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,所述本次交易报文为本次交易的交易报文;The TxOutHash acquisition module is used to obtain the TxOutHash value under the input field corresponding to each input required for this transaction in this transaction message, which is the transaction message of this transaction;前次报文获取模块,用于获取本次交易所需的各个input分别对应的前次交易报文;The previous message acquisition module is used to obtain the previous transaction message corresponding to each input required for this transaction;哈希值计算模块,用于计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值;The hash value calculation module is used to calculate the hash value of each previous transaction message to obtain the hash value corresponding to each input;判断模块,用于判断计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值是否一致;The judgment module is used to judge whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;签名模块,用于若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对所述本次交易报文进行签名。The signature module is used to sign the transaction message if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input.
- 如权利要求15所述的签名装置,其特征在于,所述区块链网络的交易报文中每个output字段中均包括金额Value值,所述Value值用于指示对应的output的金额大小,每个input字段下还包括发送输出索引TxOutIndex值,每个input字段下的TxOutIndex值用于指示对应的input所对应的output字段在对应的前次交易报文中的位置;The signature device according to claim 15, wherein each output field in the transaction message of the blockchain network includes an amount Value value, and the Value value is used to indicate the amount of the corresponding output amount, Each input field also includes a send output index TxOutIndex value. The TxOutIndex value under each input field is used to indicate the position of the output field corresponding to the corresponding input in the corresponding previous transaction message;相应地,所述签名模块包括:Correspondingly, the signature module includes:输出金额确定单元,用于若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则:根据所述本次交易报文,获取所述本次交易报文的各个output字段下的Value值,得到本次交易中每个output对应的金额大小;The output amount determination unit is used to: if the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, then: according to the transaction message, obtain the transaction report The Value value under each output field of the article can get the amount of money corresponding to each output in this transaction;目标输入选取单元,用于在本次交易所需的各个input中,选取任一input作为目标input;Target input selection unit, used to select any input as the target input among each input required for this transaction;目标输出确定单元,用于根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input;The target output determining unit is used to search for the target output field in the previous transaction message corresponding to the target input according to the TxOutIndex value under the input field corresponding to the target input, wherein the output corresponding to the target output field Input for the target;目标输入金额确定单元,用于获取所述目标output字段下的Value值,得到所述目标input的金额大小;A target input amount determining unit, used to obtain the Value value under the target output field to obtain the amount of the target input amount;遍历判断单元,用于判断所选取的input是否遍历完本次交易所需的所有input;The traversal judgment unit is used to judge whether the selected input traverses all inputs required for this transaction;目标输入再选单元,用于若所选取的input没有遍历完本次交易所需的所有input,则:除去已选取的input,在本次交易的各个input中,再选取一input作为目标input,并返回执行所述根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input的步骤以及后续步骤,从而得到本次交易中每个input对应的金额大小;The target input reselection unit is used to select all input required for this transaction if the selected input does not traverse all the inputs required for this transaction, and then select one input as the target input among each input of this transaction. And return to execute the TxOutIndex value under the input field corresponding to the target input, search for the target output field in the previous transaction message corresponding to the target input, wherein the output corresponding to the target output field is Describe the steps and subsequent steps of the target input to obtain the amount of money corresponding to each input in this transaction;手续费确定单元,用于若所选取的input遍历完本次交易所需的所有input,则:根据本次交易中各个input对应的金额大小,以及本次交易中各个output对应的金额大小,确定本次交易的手续费;The handling fee determination unit is used to determine if the selected input traverses all inputs required for this transaction: according to the amount of money corresponding to each input in this transaction and the amount of money corresponding to each output in this transaction Handling fee for this transaction;手续费展示单元,用于向用户展示所述手续费,以便用户确认是否愿意继续交易;The handling fee display unit is used to display the handling fee to the user so that the user can confirm whether they are willing to continue the transaction;签名单元,用于若接收到用于指示用户愿意继续交易的指令,则对本次交易报文进行签名。The signature unit is used to sign the transaction message if an instruction indicating that the user is willing to continue the transaction is received.
- 如权利要求15所述的签名装置,其特征在于,所述TxOutHash获取模块包括:The signature device according to claim 15, wherein the TxOutHash acquisition module includes:第一格式判断单元,用于判断所述本次交易报文的报文格式是否符合预设报文格式;A first format judgment unit, used for judging whether the message format of the transaction message conforms to the preset message format;TxOutHash获取单元,用于若符合所述预设报文格式,则在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值。The TxOutHash obtaining unit is used to obtain the TxOutHash value under the input field corresponding to each input required for this transaction in this transaction message if it conforms to the preset message format.
- 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如下基于区块链网络交易的签名方法:A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the following signature method based on a blockchain network transaction is implemented:其中,所述区块链网络的交易报文中包括有各个交易输入input分别对应的input字段以及各个交易输出output分别对应的output字段,每个input字段中均包括有发送输出哈希TxOutHash值,每个合法的input均对应有前次交易报文,每个合法的input对应的前次交易报文为存在有一output字段,该output字段对应的output为该合法的input,每个合法的input对应的TxOutHash值与该合法的input对应的前次交易报文的哈希Hash值相同;Among them, the transaction message of the blockchain network includes an input field corresponding to each transaction input input and an output field corresponding to each transaction output output, and each input field includes a send output hash TxOutHash value, Each legal input corresponds to a previous transaction message. The previous transaction message corresponding to each legal input has an output field. The output corresponding to the output field is the legal input, and each legal input corresponds to The TxOutHash value is the same as the hash hash value of the previous transaction message corresponding to the legal input;所述签名方法包括:The signature method includes:在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,所述本次交易报文为本次交易的交易报文;In this transaction message, obtain the TxOutHash value under the input field corresponding to each input required for this transaction, which is the transaction message of this transaction;获取本次交易所需的各个input分别对应的前次交易报文;Get the previous transaction message corresponding to each input required for this transaction;计算每个前次交易报文的哈希Hash值,得到每个input对应的Hash值;Calculate the hash hash value of each previous transaction message to get the hash value corresponding to each input;判断计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值是否一致;Determine whether the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input;若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对所述本次交易报文进行签名。If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message of this time is signed.
- 如权利要求18所述的计算机可读存储介质,其特征在于,所述区块链网络的交易报文中每个output字段中均包括金额Value值,所述Value值用于指示对应的output的金额大小,每个input字段下还包括发送输出索引TxOutIndex值,每个input字段下的TxOutIndex值用于指示对应的input所对应的output字段在对应的前次交易报文中的位置;The computer-readable storage medium of claim 18, wherein each output field in the transaction message of the blockchain network includes an amount Value value, and the Value value is used to indicate the corresponding output The amount of money, each input field also includes the sending output index TxOutIndex value, the TxOutIndex value under each input field is used to indicate the position of the corresponding input field in the corresponding previous transaction message;所述若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则对本次交易报文进行签名,包括:If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, the transaction message is signed, including:若计算得到的每个input对应的Hash值与该input对应的input字段下的TxOutHash值均一致,则:If the calculated Hash value corresponding to each input is consistent with the TxOutHash value under the input field corresponding to the input, then:根据所述本次交易报文,获取所述本次交易报文的各个output字段下的Value值,得到本次交易中每个output对应的金额大小;According to the transaction message, obtain the Value value under each output field of the transaction message to obtain the amount of money corresponding to each output in the transaction;在本次交易所需的各个input中,选取任一input作为目标input;In each input required for this transaction, select any input as the target input;根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input;According to the TxOutIndex value under the input field corresponding to the target input, search for the target output field in the previous transaction message corresponding to the target input, where the output corresponding to the target output field is the target input;获取所述目标output字段下的Value值,得到所述目标input的金额大小;Obtain the Value value under the target output field to obtain the amount of the target input amount;判断所选取的input是否遍历完本次交易所需的所有input;Determine whether the selected input traverses all the inputs required for this transaction;若所选取的input没有遍历完本次交易所需的所有input,则:If the selected input does not traverse all the inputs required for this transaction, then:除去已选取的input,在本次交易的各个input中,再选取一input作为目标input,并返回执行所述根据所述目标input对应的input字段下的TxOutIndex值,在所述目标input对应的前次交易报文中,查找目标output字段,其中,所述目标output字段对应的output为所述目标input的步骤以及后续步骤,从而得到本次交易中每个input对应的金额大小;Remove the selected input, in each input of this transaction, select another input as the target input, and return to execute the TxOutIndex value under the input field corresponding to the target input, in front of the corresponding target input In the transaction message, search for the target output field, where the output corresponding to the target output field is the step and subsequent steps of the target input, so as to obtain the amount of money corresponding to each input in this transaction;若所选取的input遍历完本次交易所需的所有input,则:If the selected input traverses all inputs required for this transaction, then:根据本次交易中各个input对应的金额大小,以及本次交易中各个output对应的金额大小,确定本次交易的手续费;Determine the transaction fee for this transaction based on the amount of money corresponding to each input in this transaction and the amount of money corresponding to each output in this transaction;向用户展示所述手续费,以便用户确认是否愿意继续交易;Show the user the handling fee so that the user can confirm whether they are willing to continue the transaction;若接收到用于指示用户愿意继续交易的指令,则对本次交易报文进行签名。If an instruction indicating that the user is willing to continue the transaction is received, the transaction message is signed.
- 如权利要求18所述的计算机可读存储介质,其特征在于,所述在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值,包括:The computer-readable storage medium of claim 18, wherein, in the transaction message, obtaining the TxOutHash value under the input field corresponding to each input required for the transaction includes:判断所述本次交易报文的报文格式是否符合预设报文格式;Determine whether the message format of the transaction message conforms to the preset message format;若符合所述预设报文格式,则在本次交易报文中,获取本次交易所需的各个input分别对应的input字段下的TxOutHash值。If the preset message format is met, then in this transaction message, the TxOutHash value under the input field corresponding to each input required for this transaction is obtained.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811390264.7 | 2018-11-21 | ||
CN201811390264.7A CN111210345B (en) | 2018-11-21 | 2018-11-21 | Signature method and device based on block chain network transaction and terminal equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020103573A1 true WO2020103573A1 (en) | 2020-05-28 |
Family
ID=70773071
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/108540 WO2020103573A1 (en) | 2018-11-21 | 2019-09-27 | Block chain-based network transaction signature method and device, and terminal equipment |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111210345B (en) |
WO (1) | WO2020103573A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11039317B2 (en) * | 2018-12-31 | 2021-06-15 | T-Mobile Usa, Inc. | Using a blockchain to determine trustworthiness of messages within a telecommunications network for a smart city |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106385319A (en) * | 2016-09-29 | 2017-02-08 | 江苏通付盾科技有限公司 | Verification method for information in block chain network and verification system thereof |
CN106789920A (en) * | 2016-11-25 | 2017-05-31 | 深圳前海微众银行股份有限公司 | The joint connecting method and device of block chain |
CN107180353A (en) * | 2017-06-29 | 2017-09-19 | 飞天诚信科技股份有限公司 | The implementation method and device of a kind of revocable intelligent contract transaction |
CN108712263A (en) * | 2018-06-11 | 2018-10-26 | 北京京东尚科信息技术有限公司 | Information Authentication method, apparatus, system and computer readable storage medium |
CN108805571A (en) * | 2018-06-11 | 2018-11-13 | 北京京东尚科信息技术有限公司 | Data guard method, platform, block chain node, system and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7882036B1 (en) * | 2006-05-01 | 2011-02-01 | Data-Pac Mailing Systems Corp. | System and method for postal indicia printing evidencing and accounting |
CN104992329B (en) * | 2015-05-14 | 2018-05-11 | 飞天诚信科技股份有限公司 | A kind of method for safely issuing transaction message |
CN105956923B (en) * | 2016-04-20 | 2022-04-29 | 上海如鸽投资有限公司 | Asset transaction system and digital authentication and transaction method of assets |
CN107947935B (en) * | 2017-11-09 | 2021-09-17 | 深圳市文鼎创数据科技有限公司 | Message signature method, system and terminal equipment |
CN107994995A (en) * | 2017-11-29 | 2018-05-04 | 深圳市文鼎创数据科技有限公司 | A kind of method of commerce, system and the terminal device of lower security medium |
CN108009810A (en) * | 2017-12-27 | 2018-05-08 | 光载无限(北京)科技有限公司 | A kind of Trusted Digital transaction in assets method |
-
2018
- 2018-11-21 CN CN201811390264.7A patent/CN111210345B/en active Active
-
2019
- 2019-09-27 WO PCT/CN2019/108540 patent/WO2020103573A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106385319A (en) * | 2016-09-29 | 2017-02-08 | 江苏通付盾科技有限公司 | Verification method for information in block chain network and verification system thereof |
CN106789920A (en) * | 2016-11-25 | 2017-05-31 | 深圳前海微众银行股份有限公司 | The joint connecting method and device of block chain |
CN107180353A (en) * | 2017-06-29 | 2017-09-19 | 飞天诚信科技股份有限公司 | The implementation method and device of a kind of revocable intelligent contract transaction |
CN108712263A (en) * | 2018-06-11 | 2018-10-26 | 北京京东尚科信息技术有限公司 | Information Authentication method, apparatus, system and computer readable storage medium |
CN108805571A (en) * | 2018-06-11 | 2018-11-13 | 北京京东尚科信息技术有限公司 | Data guard method, platform, block chain node, system and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111210345A (en) | 2020-05-29 |
CN111210345B (en) | 2023-02-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109064334B (en) | Intelligent contract accounting method, computer device and readable storage medium | |
EP3594884A1 (en) | Electronic bill management method, device, and storage medium | |
JP2019523495A (en) | Digital goods management in a distributed transaction consensus network | |
CN110517145B (en) | Data transaction method based on multi-block chain and related equipment | |
CN114788222A (en) | Method and system for secure and verifiable offline blockchain transactions | |
EP4358000A1 (en) | Digital currency-based payment method, platform, terminal, and payment system | |
CN112116334A (en) | Cross-block-chain third-party arbitration performance guarantee system and method thereof | |
WO2020220740A1 (en) | Blockchain-based invoice creation method, apparatus and electronic device | |
TW202018655A (en) | Blockchain-based property execution method and system | |
US20220036351A1 (en) | Method and apparatus for resource exchange | |
CN111709777A (en) | Payment mode recommendation method, system, terminal device and storage medium | |
CN112184240A (en) | Refund request processing method and device | |
CN112132674A (en) | Transaction processing method and device | |
CN113297594A (en) | Cross-chain transaction method and device, electronic equipment and storage medium | |
WO2020103573A1 (en) | Block chain-based network transaction signature method and device, and terminal equipment | |
CN112788555B (en) | Cross-operator telephone charge transfer settlement method, device and computing equipment | |
CN116029825B (en) | Block chain transaction method, device and system, electronic equipment and storage medium | |
CN111612616A (en) | Block chain account evaluation method and device, terminal device and computer readable medium | |
CN111815444A (en) | Block chain transaction method, electronic device and storage medium | |
CN111105238A (en) | Transaction risk control method and device | |
WO2023154203A1 (en) | Method and system for transfer of ownership of nft (non-fungible token) upon refund transaction in payment network | |
CN112712353B (en) | Digital currency zero-payment method, system and terminal | |
CN109271564A (en) | Declaration form querying method and equipment | |
CN112819464B (en) | Intelligent contract processing method, processing device, terminal equipment and storage medium | |
CN112785299B (en) | Method and device for roaming transaction based on blockchain |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19886111 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19886111 Country of ref document: EP Kind code of ref document: A1 |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 29/09/2021) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19886111 Country of ref document: EP Kind code of ref document: A1 |