Summary of the invention
The embodiment of the present invention be designed to provide a kind of block chain transaction verification method promised to undertake based on equivalent test and
Device, to realize the purpose of protection privacy of user.Specific technical solution is as follows:
In a first aspect, the embodiment of the invention provides a kind of block chain transaction verification method promised to undertake based on equivalent test,
The described method includes:
Second destination node of the amount of money, the legitimate receiver traded as second that obtain the second transaction is for the second transaction
The first commitment value, and, as first transaction reception legitimacy to be verified second user node for it is described first hand over
The second easy commitment value;Wherein, the second commitment value of first transaction is: the second user node is based upon described first
Second secret value of transaction setting, precalculates;
The first object node as the legitimate receiver of first transaction is obtained for the first of first transaction
Commitment value;Wherein, the first commitment value of first transaction is: the first object node is based upon first transaction setting
The first secret value, precalculate;
What the second commitment value of the first commitment value, first transaction based on first transaction, described second were traded
The amount of money and the first commitment value of second transaction, judge whether second secret value and first secret value are identical, such as
Fruit is, it is determined that the second user node and the first object node are same user nodes, if it is not, then described in determining
Second user node and the first object node are not same user nodes.
Optionally, first commitment value based on first transaction, the second commitment value, described of first transaction
The amount of money of second transaction and the first commitment value of second transaction, judge that second secret value is with first secret value
It is no identical, comprising:
What the second commitment value of the first commitment value, first transaction based on first transaction, described second were traded
The amount of money and the first commitment value of second transaction, judge whether preset pairing operation equation is true, if it is, determining institute
It is identical as first secret value to state the second secret value, if it is not, then determining second secret value and first secret value
It is not identical.
Optionally, first commitment value based on first transaction, the second commitment value, described of first transaction
The amount of money of second transaction and the first commitment value of second transaction, judge whether preset pairing operation equation is true, comprising:
First commitment value of the amount of money that described second is traded and second transaction, carries out character string merging, obtains the
The merging character string of two transaction;
Merging character string based on second transaction obtains the 6th cryptographic Hash using preset third hash function;
Second commitment value of the first commitment value and first transaction based on first transaction, utilizes pairing operation
Calculation formula e (a, c) obtains the first paired value;And based on the 6th cryptographic Hash, the basic point of preset elliptic curve and described
First commitment value of the first transaction obtains the second paired value using the calculation formula e (M'G, b) of pairing operation;
Judge whether first paired value and second paired value are equal, if it is, determining the pairing operation
Equation is set up, if it is not, then determining that the pairing operation equation is invalid;
Wherein, the pairing operation equation are as follows: e (a, c)=e (M'G, b),
Wherein, a and b is the first commitment value of first transaction, and the c is the second of first transaction
Commitment value, the M' are the 6th cryptographic Hash, M'=H3(T), the H3For the third hash function, the T is described the
The merging character string of two transaction, the G are the basic point of preset elliptic curve.
Optionally, the first object node is based upon the first secret value of first transaction setting, is calculated
The process of first commitment value of one transaction, comprising:
The first object node is retrieved as the first secret value of the first transaction setting;
The first object node is based on first secret value, utilizes multiple preset hash functions and preset first
The calculation formula of commitment value calculates the first commitment value of the first transaction.
Optionally, the first object node is based on first secret value, using multiple preset hash functions and in advance
If the first commitment value calculation formula, calculate first transaction the first commitment value, comprising:
The first object node is based on first secret value and obtains the first Kazakhstan using preset first hash function
Uncommon value, and the second cryptographic Hash is obtained using preset second hash function based on first secret value;
Base of the first object node based on first cryptographic Hash, second cryptographic Hash and preset elliptic curve
Point calculates the first commitment value of the first transaction using the calculation formula of preset first commitment value;
Wherein, the calculation formula of first commitment value are as follows: a=x1G and b=x2G,
Wherein, a and b is the first commitment value of first transaction, x1=H1(r1), x2=H2(r1), it is described
x1For first cryptographic Hash, the x2For second cryptographic Hash, the H1For first hash function, the H2For institute
State the second hash function, the r1For first secret value, and the r1For integer, the G is the base of preset elliptic curve
Point.
Optionally, the second user node is based upon the second secret value of first transaction setting, is calculated
The process of second commitment value of one transaction, comprising:
The second user node is retrieved as the second secret value of the first transaction setting;
The second user node obtains the amount of money of the second transaction and the second mesh of the legitimate receiver as the second transaction
Node is marked for the first commitment value of the second transaction;
The second user node is based on second secret value, the amount of money of second transaction and second transaction
First commitment value calculates the first transaction using multiple preset hash functions and the calculation formula of preset second commitment value
Second commitment value.
Optionally, the amount of money and described the of the second user node based on second secret value, second transaction
First commitment values of two transaction calculate the using multiple preset hash functions and the calculation formula of preset second commitment value
Second commitment value of one transaction, comprising:
The second user node is based on second secret value, using preset first hash function, obtains the 4th Kazakhstan
Uncommon value, and the 5th cryptographic Hash is obtained using preset second hash function based on second secret value;
First commitment value of the amount of money and second transaction that the second user node is traded described second, carries out word
Symbol string merges, and obtains the merging character string of the second transaction;
Merging character string of the second user node based on second transaction, using preset third hash function,
Obtain third cryptographic Hash;
The second user node is based on the 4th cryptographic Hash, the 5th cryptographic Hash, the third cryptographic Hash and pre-
If elliptic curve basic point, using the calculation formula of preset second commitment value, the second commitment value for calculating the first transaction is;
Wherein, the calculation formula of second commitment value are as follows:
Wherein, the c is the second commitment value of first transaction, the x'1For the 4th cryptographic Hash, the x'2For
5th cryptographic Hash, x'1=H1(r2), x'2=H2(r2), the H1For first hash function, the H2It is described second
Hash function, the r2For second secret value, and the r2For integer, the M is the third cryptographic Hash, M=H3(T),
The H3For the third hash function, the T is the merging character string of second transaction, and the G is preset oval bent
The basic point of line.
Second aspect, the embodiment of the invention provides a kind of block chain transaction verification device promised to undertake based on equivalent test,
Described device includes:
First obtains module, for obtaining the amount of money of the second transaction, the second mesh of the legitimate receiver traded as second
Node is marked for the first commitment value of the second transaction, and, the second user of the reception legitimacy to be verified as the first transaction
Second commitment value of the node for first transaction;Wherein, the second commitment value of first transaction is: the second user
Node is based upon the second secret value of first transaction setting, precalculates;
Second obtains module, for obtaining the first object node as the legitimate receiver of first transaction for institute
State the first commitment value of the first transaction;Wherein, the first commitment value of first transaction is: the first object node is based upon
First secret value of first transaction setting, precalculates;
Authentication module, for the first commitment value, the second commitment value of first transaction, institute based on first transaction
The amount of money of the second transaction and the first commitment value of second transaction are stated, judges second secret value and first secret value
It is whether identical, if it is, determine that the second user node and the first object node are same user nodes, if
It is no, it is determined that the second user node and the first object node are not same user nodes.
Optionally, the authentication module, comprising:
Judging submodule, the second commitment value of the first commitment value, first transaction for trading based on described first,
The amount of money of second transaction and the first commitment value of second transaction, judge whether preset pairing operation equation is true,
If it is, determine that second secret value is identical with first secret value, if it is not, then determine second secret value and
First secret value is not identical.
Optionally, the judging submodule, is specifically used for:
First commitment value of the amount of money that described second is traded and second transaction, carries out character string merging, obtains the
The merging character string of two transaction;
Merging character string based on second transaction obtains the 6th cryptographic Hash using preset third hash function;
Second commitment value of the first commitment value and first transaction based on first transaction, utilizes pairing operation
Calculation formula e (a, c) obtains the first paired value;And based on the 6th cryptographic Hash, the basic point of preset elliptic curve and described
First commitment value of the first transaction obtains the second paired value using the calculation formula e (M'G, b) of pairing operation;
Judge whether first paired value and second paired value are equal, if it is, determining the pairing operation
Equation is set up, if it is not, then determining that the pairing operation equation is invalid;
Wherein, the pairing operation equation are as follows: e (a, c)=e (M'G, b),
Wherein, a and b is the first commitment value of first transaction, and the c is the second of first transaction
Commitment value, the M' are the 6th cryptographic Hash, M'=H3(T), the H3For the third hash function, the T is described the
The merging character string of two transaction, the G are the basic point of preset elliptic curve.
Optionally, described device further include: the first commitment value determining module is based upon institute for the first object node
The first secret value for stating the first transaction setting, is calculated the first commitment value of the first transaction, and first commitment value determines mould
Block, comprising:
First acquisition submodule is retrieved as the first secret value of the first transaction setting for the first object node;
First computational submodule is based on first secret value for the first object node, using multiple preset
The calculation formula of hash function and preset first commitment value calculates the first commitment value of the first transaction.
Optionally, first computational submodule, is specifically used for:
The first object node is based on first secret value and obtains the first Kazakhstan using preset first hash function
Uncommon value, and the second cryptographic Hash is obtained using preset second hash function based on first secret value;
Base of the first object node based on first cryptographic Hash, second cryptographic Hash and preset elliptic curve
Point calculates the first commitment value of the first transaction using the calculation formula of preset first commitment value;
Wherein, the calculation formula of first commitment value are as follows: a=x1G and b=x2G,
Wherein, a and b is the first commitment value of first transaction, x1=H1(r1), x2=H2(r1), it is described
x1For first cryptographic Hash, the x2For second cryptographic Hash, the H1For first hash function, the H2For institute
State the second hash function, the r1For first secret value, and the r1For integer, the G is the base of preset elliptic curve
Point.
Optionally, described device further include: the second commitment value determining module is based upon institute for the second user node
The second secret value for stating the first transaction setting, is calculated the second commitment value of the first transaction, and second commitment value determines mould
Block, comprising:
Second acquisition submodule is retrieved as the second secret value of the first transaction setting for the second user node;
Third acquisition submodule obtains the amount of money of the second transaction for the second user node and as the second transaction
First commitment value of second destination node of legitimate receiver for the second transaction;
Second computational submodule is traded for the second user node based on second secret value, described second
The amount of money and the first commitment value of second transaction, utilize the calculating of multiple preset hash functions and preset second commitment value
Formula calculates the second commitment value of the first transaction.
Optionally, second computational submodule, is specifically used for:
The second user node is based on second secret value, using preset first hash function, obtains the 4th Kazakhstan
Uncommon value, and the 5th cryptographic Hash is obtained using preset second hash function based on second secret value;
First commitment value of the amount of money and second transaction that the second user node is traded described second, carries out word
Symbol string merges, and obtains the merging character string of the second transaction;
Merging character string of the second user node based on second transaction, using preset third hash function,
Obtain third cryptographic Hash;
The second user node is based on the 4th cryptographic Hash, the 5th cryptographic Hash, the third cryptographic Hash and pre-
If elliptic curve basic point, using the calculation formula of preset second commitment value, the second commitment value for calculating the first transaction is;
Wherein, the calculation formula of second commitment value are as follows:
Wherein, the c is the second commitment value of first transaction, the x'1For the 4th cryptographic Hash, the x'2For
5th cryptographic Hash, x'1=H1(r2), x'2=H2(r2), the H1For first hash function, the H2It is described second
Hash function, the r2For second secret value, and the r2For integer, the M is the third cryptographic Hash, M=H3(T),
The H3For the third hash function, the T is the merging character string of second transaction, and the G is preset oval bent
The basic point of line.
The third aspect, the embodiment of the invention provides a kind of electronic equipment, including processor and memory, wherein
The memory, for storing computer program;
The processor when for executing the program stored on the memory, realizes that the embodiment of the present invention is provided
The block chain transaction verification method promised to undertake based on equivalent test the step of.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage
Dielectric memory contains computer program, and base provided by the embodiment of the present invention is realized when the computer program is executed by processor
In the step of equivalence tests the block chain transaction verification method promised to undertake.
In scheme provided by the embodiment of the present invention, first secret value is only the legitimate receiver of first transaction
First object node known to, second secret value be only it is described first transaction reception legitimacy to be verified second user
Known to node, therefore, if second secret value is identical as first secret value, the second user node and described the
One destination node must be same user node, if second secret value and first secret value be not identical, described second
User node and the first object node must not be same user nodes.Therefore, scheme provided by the embodiment of the present invention, energy
Enough verifyings receive the legitimacy of user node identity, guarantee the safety of transaction.And scheme provided by the embodiment of the present invention
In, the first commitment value of first transaction is to be based upon the first secret value of first transaction setting to be calculated, institute
The second commitment value for stating the first transaction is to be based upon the second secret value of first transaction setting to be calculated, secret value with
Transaction is corresponding, that is to say, that for a user node in different transaction, used secret value is different, therefore, block chain
In any user node can not based on it is described first transaction the first commitment value or it is described first transaction the second commitment value, chase after
It traces back the transactions history of the user, counts the remaining sum of the user, therefore, can be realized protection privacy of user using the embodiment of the present invention
Purpose.
Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above excellent simultaneously
Point.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
For the ease of the understanding of scheme, here, first handing over the block chain of the embodiment of the present invention promised to undertake based on equivalent test
Easy process is explained, and is the block chain process of exchange schematic diagram promised to undertake based on equivalent test referring to Fig. 1, Fig. 1.
Assuming that at least there are four user nodes A, B, C and D, A is the disburser of the first transaction, B in block platform chain
For the recipient of the first transaction, while B is also the disburser of the second transaction, and C is the recipient of the second transaction, while C is also the
The disburser of three transaction, D are the recipient of third transaction.Process of exchange are as follows:
Firstly, A discloses the first Transaction Information, first Transaction Information includes: a upper transaction of the A as the first transaction
Legitimate receiver, for first transaction it is upper one transaction the second commitment value, first transaction the amount of money and B as first hand over
Easy legitimate receiver, for the first commitment value of the first transaction.Wherein, the amount of money of first transaction is the gold that A is paid to B
Volume, the identity that the first commitment value of first transaction is used for the legitimate receiver in subsequent authentication B as the first transaction are legal
Property.First commitment value of first transaction is that B is sent to A in advance.
Secondly, B discloses the second Transaction Information, second Transaction Information includes: legitimate receipt of the B as the first transaction
Person, for the legitimate receiver as the second transaction of the amount of money and C of the second commitment value of the first transaction, the second transaction, for the
First commitment value of two transaction.Wherein, the amount of money of second transaction is the amount of money that B pay to C, described first trade second
Commitment value is used for the identity legitimacy in subsequent authentication B as the legitimate receiver of the second transaction.The first of second transaction
Commitment value is used for the identity legitimacy in subsequent authentication C as the legitimate receiver of the second transaction.The first of second transaction
Commitment value is that C is sent to B in advance.
Then, using the partial information in the first Transaction Information and the second Transaction Information disclosed above, B is verified as the
The identity legitimacy of the legitimate receiver of one transaction, after being verified, B can use the amount of money of the first transaction, complete the
The payment of two transaction, that is to say, that after the legitimate verification of the identity of B passes through, the first transaction is completed, and the second transaction comes into force.It can be with
Understand, subsequent, C can also initiate to trade with the third of D, then need to verify legitimate receiver of the C as the second transaction
Identity legitimacy after, the second transaction could be completed, and third, which is traded, can just come into force, etc., it can thus be seen that in block chain
Multiple transaction successively constitute a transaction chain.
For each process of exchange in block chain, the verification method to the legitimacy for receiving user node identity is identical
, specific verification process is detailed in hereinafter.
In order to protect privacy of user, the embodiment of the invention provides a kind of block chain transaction promised to undertake based on equivalent test to test
Demonstrate,prove method, apparatus, electronic equipment and storage medium.
It should be noted that a kind of block chain transaction verification promised to undertake based on equivalent test provided by the embodiment of the present invention
The executing subject of method can run on for a kind of block chain transaction verification device promised to undertake based on equivalent test, the device
In electronic equipment.Wherein, which can be any one user node in block chain etc..
In the following, being provided for the embodiments of the invention a kind of block chain transaction verification side promised to undertake based on equivalent test first
Method is introduced.
As shown in Fig. 2, a kind of block chain transaction verification side promised to undertake based on equivalent test provided by the embodiment of the present invention
Method may include steps of:
S201, obtain the second transaction the amount of money, as the second transaction legitimate receiver the second destination node for the
First commitment value of two transaction, and, the second user node of the reception legitimacy to be verified as the first transaction is for described
Second commitment value of the first transaction.
In embodiments of the present invention, the second user node of the reception legitimacy to be verified of available first transaction discloses
The second Transaction Information, then obtain from second Transaction Information: the amount of money of the second transaction connects as the second the legal of transaction
The first commitment value that the second destination node of receipts person is traded for second, and, the reception to be verified as the first transaction is legal
Property second user node for it is described first transaction the second commitment value.It should be noted that in second Transaction Information
The format of each element be character string.
Wherein, the amount of money of second transaction are as follows: the second user node, as the disburser of the second transaction, payment
To the amount of money of second destination node.First commitment value of second transaction, in subsequent, verifying second target
Identity legitimacy of the node as the legitimate receiver of the second transaction.
It is understood that institute has been received before disclosing second Transaction Information in the second user node
The first commitment value for stating second transaction of the second destination node transmission, specifically, the second user node can receive
The second transaction request sent to second destination node, wherein contain second transaction in second transaction request
The first commitment value, certainly, in second transaction request can also containing it is described second transaction the amount of money.
In embodiments of the present invention, the second commitment value of first transaction is: the second user node is based upon institute
The second secret value for stating the first transaction setting, precalculates.Second secret value can be with second user node
The identity of user is related, can also be unrelated, this is all reasonable.Second commitment value of first transaction is used to test subsequent
Demonstrate,prove identity legitimacy of the second user node as the legitimate receiver of first transaction.It should be noted that except the second use
Except the node of family, any node in block chain all can not pass through meter using the second commitment value of disclosed first transaction
Second secret value is known in calculation.
The second user node is based upon the second secret value of first transaction setting, and the first transaction is calculated
The process of second commitment value will be described in detail below.
S202 obtains the first object node as the legitimate receiver of first transaction for first transaction
First commitment value.
In embodiments of the present invention, the first Transaction Information disclosed in the node of the disburser of available first transaction,
Again from first Transaction Information, the first object node as the legitimate receiver of first transaction is obtained for described
First commitment value of the first transaction.Certainly, the amount of money etc. in first Transaction Information also containing the first transaction, described first hands over
The easy amount of money are as follows: the node of the disburser of first transaction pays the amount of money of the first object node.It needs to illustrate
It is that the format of each element in first Transaction Information is character string.
It is understood that the node of the disburser of first transaction, before disclosing first Transaction Information,
Received the first transaction request sent to the first object node contains first transaction in first transaction request
The first commitment value, certainly, in first transaction request can also contain first transaction the amount of money.
In embodiments of the present invention, the first commitment value of first transaction is: the first object node is based upon institute
The first secret value for stating the first transaction setting, precalculates.First secret value can be with first object node
The identity of user is related, can also be unrelated, this is all reasonable.First commitment value of first transaction is used to test subsequent
Demonstrate,prove identity legitimacy of the second user node as the legitimate receiver of first transaction.It should be noted that except described the
Except one destination node, any user node in block chain can not all be promised to undertake using the first of disclosed first transaction
Value knows first secret value by calculating.
The first object node is based upon the first secret value of first transaction setting, and the first transaction is calculated
The process of first commitment value will be described in detail below.
S203, the second commitment value of the first commitment value, first transaction based on first transaction, described second are handed over
The easy amount of money and the first commitment value of second transaction, judge second secret value and first secret value whether phase
Together, if it is, determining that the second user node and the first object node are same user nodes, if it is not, then really
The fixed second user node and the first object node are not same user nodes.
In embodiments of the present invention, a kind of theory that equivalent test is promised to undertake is proposed, specifically: due to first secret value
Known to the only described first object node, second secret value is only known to the second user node, therefore, described in judgement
Whether the second commitment value of the first transaction and the secret value in the first commitment value of first transaction are identical, if it is, root
According to the probability theory in password field, determine that the second user node and the first object node are same user nodes, such as
Fruit is no, it is determined that the second user node and the first object node are not same user nodes.To complete described the
Authentication of two user nodes as the legitimate receiver of the first transaction.
In embodiments of the present invention, it can judge that second secret value is with first secret value using a variety of methods
It is no identical, it is subsequent to combine the first commitment value of the first transaction and the first transaction in order to which solution layout is clear and scheme understands
The specific implementation of this step is described in detail in the calculating process of second commitment value.
It should be noted that verify the second user node and the first object node be same user node it
Afterwards, first transaction is completed, and the amount of money that the second user node is able to use first transaction realizes the second transaction,
That is the second transaction that the second user node is initiated comes into force.It is, of course, understood that described second hands over subsequent
Easy completion is also required to the legitimacy, etc. of the reception user node identity of the second transaction of verifying.
In scheme provided by the embodiment of the present invention, first secret value is only the legitimate receiver of first transaction
First object node known to, second secret value be only it is described first transaction reception legitimacy to be verified second user
Known to node, therefore, if second secret value is identical as first secret value, the second user node and described the
One destination node must be same user node, if second secret value and first secret value be not identical, described second
User node and the first object node must not be same user nodes.Therefore, scheme provided by the embodiment of the present invention, energy
Enough verifyings receive the legitimacy of user node identity, guarantee the safety of transaction.And scheme provided by the embodiment of the present invention
In, the first commitment value of first transaction is to be based upon the first secret value of first transaction setting to be calculated, institute
The second commitment value for stating the first transaction is to be based upon the second secret value of first transaction setting to be calculated, secret value with
Transaction is corresponding, that is to say, that for a user node in different transaction, used secret value is different, therefore, block chain
In any user node can not based on it is described first transaction the first commitment value or it is described first transaction the second commitment value, chase after
It traces back the transactions history of the user, counts the remaining sum of the user, therefore, can be realized protection privacy of user using the embodiment of the present invention
Purpose.
Below with reference to the calculating process of the first commitment value and the second commitment value of the first transaction of the first transaction, retouch in detail
State the deterministic process of first secret value Yu second secret value.
1, the first object node is based upon the first secret value of first transaction setting, and the first transaction is calculated
The first commitment value process, comprising the following steps:
A1, the first object node are retrieved as the first secret value of the first transaction setting;
In embodiments of the present invention, first secret value can be set by the user of the first object node, can also
By the first object node sets, wherein first secret value can be a random number, and the random number is whole
Number.
It should be noted that first secret value is only known to the first object node.
B1, the first object node are based on first secret value, utilize multiple preset hash functions and preset
The calculation formula of first commitment value calculates the first commitment value of the first transaction.
In embodiments of the present invention, the irreversible characteristic of hash function preimage is utilized, therefore, utilizes multiple preset Kazakhstan
The calculation formula of uncommon function and preset first commitment value calculates the process of the first commitment value of the first transaction, is complicated and not
Reversible, that is to say, that any user node can not be obtained from the first commitment value of first transaction by calculating in block chain
Know first secret value.
Specifically, B1 the following steps are included:
B11, the first object node is based on first secret value, using preset first hash function, obtains the
One cryptographic Hash, and the second cryptographic Hash is obtained using preset second hash function based on first secret value;
B12, the first object node are based on first cryptographic Hash, second cryptographic Hash and preset elliptic curve
Basic point, utilize the calculation formula of preset first commitment value, calculate first transaction the first commitment value;
Wherein, the calculation formula of first commitment value are as follows: a=x1G and b=x2G,
Wherein, a and b is the first commitment value of first transaction, x1=H1(r1), x2=H2(r1), it is described
x1For first cryptographic Hash, the x2For second cryptographic Hash, the H1For first hash function, the H2For institute
State the second hash function, the r1For first secret value, and the r1For integer, the G is the base of preset elliptic curve
Point.
2, the second user node is based upon the second secret value of first transaction setting, and the first transaction is calculated
The second commitment value process, comprising the following steps:
A2, the second user node are retrieved as the second secret value of the first transaction setting;
In embodiments of the present invention, second secret value can be set by the user of the second user node, can also
By the second user node sets, wherein second secret value can be a random number, and the random number is whole
Number.
It should be noted that second secret value is only known to the second user node.
B2, the second user node obtain the second of the amount of money that second trades and the legitimate receiver as the second transaction
First commitment value of the destination node for the second transaction;
Specifically, the second target section of the available legitimate receiver as the second transaction of the second user node
Point is sent to the second transaction request of the second user node, contains in second transaction request: the amount of money of the second transaction
And second destination node for second transaction the first commitment value.
C2, the second user node are handed over based on second secret value, the amount of money of second transaction and described second
The first easy commitment value calculates first and hands over using multiple preset hash functions and the calculation formula of preset second commitment value
The second easy commitment value.
In embodiments of the present invention, the irreversible characteristic of hash function preimage is utilized, therefore, utilizes multiple preset Kazakhstan
The calculation formula of uncommon function and preset second commitment value calculates the process of the second commitment value of the first transaction, is complicated and not
Reversible, that is to say, that any user node can not be obtained from the second commitment value of first transaction by calculating in block chain
Know second secret value.
Specifically, C2 the following steps are included:
C21, the second user node is based on second secret value, using preset first hash function, obtains the
Four cryptographic Hash, and the 5th cryptographic Hash is obtained using preset second hash function based on second secret value;
C22, the first commitment value of the amount of money and second transaction that the second user node is traded described second, into
Line character string merges, and obtains the merging character string of the second transaction;
It should be noted that character string merges into two connected splicings of character string ending.
C23, merging character string of the second user node based on second transaction, utilizes preset third Hash letter
Number, obtains third cryptographic Hash;
C24, the second user node are based on the 4th cryptographic Hash, the 5th cryptographic Hash, the third cryptographic Hash
And the basic point of preset elliptic curve, using the calculation formula of preset second commitment value, calculate the first transaction second is promised to undertake
Value is;
Wherein, the calculation formula of second commitment value are as follows:
Wherein, the c is the second commitment value of first transaction, the x'1For the 4th cryptographic Hash, the x'2For
5th cryptographic Hash, x'1=H1(r2), x'2=H2(r2), the H1For first hash function, the H2It is described second
Hash function, the r2For second secret value, and the r2For integer, the M is the third cryptographic Hash, M=H3(T),
The H3For the third hash function, the T is the merging character string of second transaction, and the G is preset oval bent
The basic point of line.
The first secret value that the first object node is based upon first transaction setting is described above, is calculated
First commitment value of the first transaction and the second user node are based upon the second secret value of first transaction setting,
The process of the second commitment value of the first transaction is calculated, is described in detail below and judges second secret value and described first secret
It is close value whether identical detailed process.
In embodiments of the present invention, propose a kind of judge whether second secret value and first secret value are identical
Specific implementation mainly comprises the processes of the first commitment value, the second promise of first transaction based on first transaction
Value, it is described second transaction the amount of money and it is described second transaction the first commitment value, judge preset pairing operation equation whether at
It is vertical, if it is, determining that second secret value is identical as first secret value, if it is not, then determining that described second is secret
It is worth not identical as first secret value
Specifically, above-mentioned specific implementation the following steps are included:
The first step, the first commitment value of the amount of money that described second is traded and second transaction, carries out character string merging,
Obtain the merging character string of the second transaction;
Second step obtains the 6th Kazakhstan using preset third hash function based on the merging character string of second transaction
Uncommon value;
It should be noted that the 6th cryptographic Hash in the embodiment of the present invention is identical as the third cryptographic Hash, it is different
Title be deterministic process in order to distinguish secret value and the first transaction the second commitment value calculating process.
Third step, the second commitment value of the first commitment value and first transaction based on first transaction, using matching
To the calculation formula e (a, c) of operation, the first paired value is obtained;And the base based on the 6th cryptographic Hash, preset elliptic curve
Point and the first commitment value of first transaction obtain the second paired value using the calculation formula e (M'G, b) of pairing operation;
4th step judges whether first paired value and second paired value are equal, if it is, matching described in determining
Operation equation is set up, if it is not, then determining that the pairing operation equation is invalid;
5th step, if the pairing operation equation is set up, it is determined that second secret value and first secret value
It is identical, if the pairing operation equation is invalid, it is determined that second secret value and first secret value be not identical.
Wherein, the pairing operation equation are as follows: e (a, c)=e (M'G, b),
Wherein, a and b is the first commitment value of first transaction, and the c is the second of first transaction
Commitment value, the M' are the 6th cryptographic Hash, M'=H3(T), the H3For the third hash function, the T is described the
The merging character string of two transaction, the G are the basic point of preset elliptic curve.
Whether in this kind of specific implementation, it is true to verify the pairing operation equation, if it is, determination described the
Two secret values are identical as first secret value, if it is not, then determining second secret value and first secret value not phase
Together.This kind of implementation can quickly, easily obtain judging result, improve verification efficiency.
It should be noted that any user node in block chain can be carried out above-mentioned verification process.
The theory that the equivalent test of the embodiment of the present invention described in detail below is promised to undertake, utilizes preset pairing in order to understand
Operation equation e (a, c)=e (M'G, b) can judge second secret value and the whether identical original of first secret value
Reason.
Firstly, simply introducing some existing formula and noun that are related to:
1) operation is matched
Matching operation e () is a kind of existing calculation method, here, the calculating process of the pairing operation is no longer described in detail,
A kind of particular kind of relationship that the pairing operation is met, the relationship are only shown are as follows: e (AG, BG)=e (ABG, G)=e (G,
ABG).Wherein, A and B can be understood as the coefficient of the basic point G of elliptic curve.
2) basic point of elliptic curve
The shape of elliptic curve is not elliptical, for no other reason than that the descriptive equation of elliptic curve, is similar to and calculates one
The equation of oval perimeters, therefore the elliptic curve that hence obtains one's name.
One elliptic curve is the set for meeting all the points of Weir this special Lars equation on projective plane.
This special Lars equation of the Weir are as follows:
Y2Z+a1XYZ+a3YZ2=X3+a2X2Z+a4XZ2+a6Z3
The basic point of elliptic curve is the generation member of the Big prime factor subgroup of elliptic curve module.For oval bent
The concept of the basic point of line does not elaborate, and the basic point for obtaining an elliptic curve can use existing a variety of methods,
This is not detailed.
Can simply it understand are as follows: the basic point of elliptic curve is a two-dimensional coordinate, is indicated with symbol G, the fortune that G is supported
It calculates and there was only multiple operation and plus and minus calculation, such as 3G=G+G+G, 2G+4G=6G, 12G-4G=8G etc.;For multiplying and remove
Method operation is not supported, such as 2G*3G, 2G/3G etc..
In the following, the judgement principle of concrete analysis pairing operation equation e (a, c)=e (M'G, b).
According to a=x1G, b=x2G,x1=H1(r1), x2=H2(r1), x '1=H1(r2), x'2=H2
(r2), M=H3(T), M'=H3(T)。
It obtains on the left of pairing operation equation are as follows:Obtain pairing operation etc.
On the right side of formula are as follows: e (M'G, b)=e (H3(T)G,H2(r1)G)。
According to the relationship that pairing operation meets, obtain:
And
E (M'G, b)=e (H3(T)G,H2(r1) G)=e (H3(T)H2(r1)G,G)。
So, the problem of whether true now for verifying e (a, c)=e (M'G, b), verifying has been reformed intoWhether it is true the problem of.
VerifyIt is whether true.
Further, it verifiesIt is whether true.
For the first commitment value a=x of the first transaction1G=H1(r1) G, b=x2G=H2(r1), although a and b are open
, but since G does not support division arithmetic, so other users node can not be obtained based on b/a
Based on probability theory, if r2≠r1Difference, then can be with almost absolutely probability makes:
So, it is believed that: when a user node is not knowing r1In the case where, r can not be forged2≠r1, so thatIn other words, only know r1User node, just can know thatOther users node can not
Know
Therefore, it has reason to be concluded that completely
IfThen r2=r1;IfThen r2≠r1。
That is: if pairing operation equation is set up, second secret value is identical as first secret value, if pairing operation
Equation is invalid, then second secret value and first secret value be not identical.
Therefore, in embodiments of the present invention, the theory that equivalent test is promised to undertake is introduced, preset pairing operation equation e is utilized
(a, c)=e (M'G, b), judge first secret value it is whether identical as second secret value be effective.
Therefore, theory that the equivalent test that the embodiment of the present invention is proposed is promised to undertake, for verifying the recipient of a transaction
Identity legitimacy is effective.
Corresponding to above method embodiment, the embodiment of the invention also provides a kind of block chains promised to undertake based on equivalent test
Transaction verification device, as shown in figure 3, the device includes:
First obtains module 301, and second of the amount of money, the legitimate receiver traded as second for obtaining the second transaction
The first commitment value that destination node is traded for second, and, second of the reception legitimacy to be verified as the first transaction is used
Second commitment value of the family node for first transaction;Wherein, the second commitment value of first transaction is: described second uses
Family node is based upon the second secret value of first transaction setting, precalculates;
Second obtains module 302, for obtaining the first object node pair of the legitimate receiver as first transaction
In the first commitment value of first transaction;Wherein, the first commitment value of first transaction is: the first object node base
In the first secret value for first transaction setting, precalculate;
Authentication module 303, second for the first commitment value, first transaction based on first transaction promises to undertake
First commitment value of value, the amount of money of second transaction and second transaction, judges second secret value and described first
Whether secret value is identical, if it is, determine that the second user node and the first object node are same user nodes,
If it is not, then determining that the second user node and the first object node are not same user nodes.
Optionally, in embodiments of the present invention, the authentication module 303, comprising:
Judging submodule, the second commitment value of the first commitment value, first transaction for trading based on described first,
The amount of money of second transaction and the first commitment value of second transaction, judge whether preset pairing operation equation is true,
If it is, determine that second secret value is identical with first secret value, if it is not, then determine second secret value and
First secret value is not identical.
Optionally, in embodiments of the present invention, the judging submodule, is specifically used for:
First commitment value of the amount of money that described second is traded and second transaction, carries out character string merging, obtains the
The merging character string of two transaction;
Merging character string based on second transaction obtains the 6th cryptographic Hash using preset third hash function;
Second commitment value of the first commitment value and first transaction based on first transaction, utilizes pairing operation
Calculation formula e (a, c) obtains the first paired value;And based on the 6th cryptographic Hash, the basic point of preset elliptic curve and described
First commitment value of the first transaction obtains the second paired value using the calculation formula e (M'G, b) of pairing operation;
Judge whether first paired value and second paired value are equal, if it is, determining the pairing operation
Equation is set up, if it is not, then determining that the pairing operation equation is invalid;
Wherein, the pairing operation equation are as follows: e (a, c)=e (M'G, b),
Wherein, a and b is the first commitment value of first transaction, and the c is the second of first transaction
Commitment value, the M' are the 6th cryptographic Hash, M'=H3(T), the H3For the third hash function, the T is described the
The merging character string of two transaction, the G are the basic point of preset elliptic curve.
Optionally, in embodiments of the present invention, described device further include: the first commitment value determining module, for described the
One destination node is based upon the first secret value of first transaction setting, and the first commitment value of the first transaction, institute is calculated
State the first commitment value determining module, comprising:
First acquisition submodule is retrieved as the first secret value of the first transaction setting for the first object node;
First computational submodule is based on first secret value for the first object node, using multiple preset
The calculation formula of hash function and preset first commitment value calculates the first commitment value of the first transaction.
Optionally, in embodiments of the present invention, first computational submodule, is specifically used for:
The first object node is based on first secret value and obtains the first Kazakhstan using preset first hash function
Uncommon value, and the second cryptographic Hash is obtained using preset second hash function based on first secret value;
Base of the first object node based on first cryptographic Hash, second cryptographic Hash and preset elliptic curve
Point calculates the first commitment value of the first transaction using the calculation formula of preset first commitment value;
Wherein, the calculation formula of first commitment value are as follows: a=x1G and b=x2G,
Wherein, a and b is the first commitment value of first transaction, x1=H1(r1), x2=H2(r1), it is described
x1For first cryptographic Hash, the x2For second cryptographic Hash, the H1For first hash function, the H2For institute
State the second hash function, the r1For first secret value, and the r1For integer, the G is the base of preset elliptic curve
Point.
Optionally, in embodiments of the present invention, described device further include: the second commitment value determining module, for described the
Two user nodes are based upon the second secret value of first transaction setting, and the second commitment value of the first transaction, institute is calculated
State the second commitment value determining module, comprising:
Second acquisition submodule is retrieved as the second secret value of the first transaction setting for the second user node;
Third acquisition submodule obtains the amount of money of the second transaction for the second user node and as the second transaction
First commitment value of second destination node of legitimate receiver for the second transaction;
Second computational submodule is traded for the second user node based on second secret value, described second
The amount of money and the first commitment value of second transaction, utilize the calculating of multiple preset hash functions and preset second commitment value
Formula calculates the second commitment value of the first transaction.
Optionally, in embodiments of the present invention, second computational submodule, is specifically used for:
The second user node is based on second secret value, using preset first hash function, obtains the 4th Kazakhstan
Uncommon value, and the 5th cryptographic Hash is obtained using preset second hash function based on second secret value;
First commitment value of the amount of money and second transaction that the second user node is traded described second, carries out word
Symbol string merges, and obtains the merging character string of the second transaction;
Merging character string of the second user node based on second transaction, using preset third hash function,
Obtain third cryptographic Hash;
The second user node is based on the 4th cryptographic Hash, the 5th cryptographic Hash, the third cryptographic Hash and pre-
If elliptic curve basic point, using the calculation formula of preset second commitment value, the second commitment value for calculating the first transaction is;
Wherein, the calculation formula of second commitment value are as follows:
Wherein, the c is the second commitment value of first transaction, the x'1For the 4th cryptographic Hash, the x'2For
5th cryptographic Hash, x'1=H1(r2), x'2=H2(r2), the H1For first hash function, the H2It is described second
Hash function, the r2For second secret value, and the r2For integer, the M is the third cryptographic Hash, M=H3(T),
The H3For the third hash function, the T is the merging character string of second transaction, and the G is preset oval bent
The basic point of line.
In scheme provided by the embodiment of the present invention, first secret value is only the legitimate receiver of first transaction
First object node known to, second secret value be only it is described first transaction reception legitimacy to be verified second user
Known to node, therefore, if second secret value is identical as first secret value, the second user node and described the
One destination node must be same user node, if second secret value and first secret value be not identical, described second
User node and the first object node must not be same user nodes.Therefore, scheme provided by the embodiment of the present invention, energy
Enough verifyings receive the legitimacy of user node identity, guarantee the safety of transaction.And scheme provided by the embodiment of the present invention
In, the first commitment value of first transaction is to be based upon the first secret value of first transaction setting to be calculated, institute
The second commitment value for stating the first transaction is to be based upon the second secret value of first transaction setting to be calculated, secret value with
Transaction is corresponding, that is to say, that for a user node in different transaction, used secret value is different, therefore, block chain
In any user node can not based on it is described first transaction the first commitment value or it is described first transaction the second commitment value, chase after
It traces back the transactions history of the user, counts the remaining sum of the user, therefore, can be realized protection privacy of user using the embodiment of the present invention
Purpose.
Corresponding to above method embodiment, the embodiment of the invention also provides a kind of electronic equipment, as shown in figure 4, can be with
Including processor 401 and memory 402, wherein
The memory 402, for storing computer program;
The processor 401 when for executing the program stored on the memory 402, realizes the embodiment of the present invention
The step of provided block chain transaction verification method promised to undertake based on equivalent test.
Above-mentioned memory may include RAM (Random Access Memory, random access memory), also may include
NVM (Non-Volatile Memory, nonvolatile memory), for example, at least a magnetic disk storage.Optionally, memory
It can also be that at least one is located away from the storage device of above-mentioned processor.
Above-mentioned processor can be general processor, including CPU (Central Processing Unit, central processing
Device), NP (Network Processor, network processing unit) etc.;Can also be DSP (Digital Signal Processor,
Digital signal processor), ASIC (Application Specific Integrated Circuit, specific integrated circuit),
FPGA (Field-Programmable Gate Array, field programmable gate array) or other programmable logic device are divided
Vertical door or transistor logic, discrete hardware components.
By above-mentioned electronic equipment, can be realized: first secret value is only the legitimate receiver of first transaction
First object node known to, second secret value be only it is described first transaction reception legitimacy to be verified second user
Known to node, therefore, if second secret value is identical as first secret value, the second user node and described the
One destination node must be same user node, if second secret value and first secret value be not identical, described second
User node and the first object node must not be same user nodes.Therefore, scheme provided by the embodiment of the present invention, energy
Enough verifyings receive the legitimacy of user node identity, guarantee the safety of transaction.And scheme provided by the embodiment of the present invention
In, the first commitment value of first transaction is to be based upon the first secret value of first transaction setting to be calculated, institute
The second commitment value for stating the first transaction is to be based upon the second secret value of first transaction setting to be calculated, secret value with
Transaction is corresponding, that is to say, that for a user node in different transaction, used secret value is different, therefore, block chain
In any user node can not based on it is described first transaction the first commitment value or it is described first transaction the second commitment value, chase after
It traces back the transactions history of the user, counts the remaining sum of the user, therefore, can be realized protection privacy of user using the embodiment of the present invention
Purpose.
In addition, corresponding to the block chain transaction verification method promised to undertake provided by above-described embodiment based on equivalent test, this
Inventive embodiments provide a kind of computer readable storage medium, and computer journey is stored in the computer readable storage medium
Sequence when computer program is executed by processor, realizes the block chain promised to undertake provided by the embodiment of the present invention based on equivalent test
The step of transaction verification method.
Above-mentioned computer-readable recording medium storage has at runtime, executes provided by the embodiment of the present invention based on equivalence
The application program for testing the block chain transaction verification method promised to undertake, therefore can be realized: first secret value is only described the
Known to the first object node of the legitimate receiver of one transaction, second secret value is only that first the to be verified of transaction connects
Known to the second user node for receiving legitimacy, therefore, if second secret value is identical as first secret value, described the
Two user nodes and the first object node must be same user nodes, if second secret value and first secret value
Not identical, then the second user node and the first object node must not be same user nodes.Therefore, the present invention is implemented
Scheme provided by example is able to verify that the legitimacy for receiving user node identity, guarantees the safety of transaction.And the present invention is real
It applies in scheme provided by example, the first commitment value of first transaction is to be based upon the first secret of first transaction setting
What value was calculated, the second commitment value of first transaction is to be based upon the second secret value calculating of first transaction setting
It obtains, secret value is corresponding with transaction, that is to say, that a user node is in different transaction, used secret value
Difference, therefore, any user node in block chain can not the first commitment value or first friendship based on first transaction
The second easy commitment value, traces the transactions history of the user, counts the remaining sum of the user, therefore, using energy of the embodiment of the present invention
Enough purposes for realizing protection privacy of user.
For electronic equipment and computer readable storage medium embodiment, method content base as involved in it
Originally it is similar to embodiment of the method above-mentioned, so being described relatively simple, referring to the part explanation of embodiment of the method in place of correlation
?.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.