Protection method for block chain shared dataTechnical Field
The invention relates to the technical field of block chains, in particular to a protection method for block chain shared data.
Background
Most of the uplink data of the current block chain adopts a mode of uplink transaction hash instead of plaintext to protect privacy of the uplink data, the uplink plaintext is not beneficial to protecting the privacy data of the transaction of both parties, and the uplink hash does not essentially store the data on the block chain network, and cannot realize the authority of sharing and controlling the sharing of the data on the chain, but only verifies the data. Moreover, the conventional transaction verification is a single transverse verification in one stroke, and the transactions are not related to each other; the scheme integrates multiple transactions into longitudinal verification, and the transactions are related to each other, such as: assuming that a plurality of transactions are initiated, the initiating parties are A, B, C, D and E respectively; the receivers are respectively a, b, c, d and e; the transaction finances are a ', b ', c ', d ', e ', respectively.
The conventional method is to separately and separately link up the verification for one transaction, and when the batch verification is required, the conventional method has many verification times, long time and low efficiency, so that a person skilled in the art provides a protection method for block chain shared data to solve the problems proposed in the background art.
Disclosure of Invention
The invention aims to provide a method for realizing data uplink sharing, protecting privacy and improving verification efficiency.
In order to achieve the purpose, the invention provides the following technical scheme:
a protection method for block chain shared data comprises the following steps:
step one, extracting the same fields in multiple transactions:
step two, merging the same fields to obtain a verification code first matrix, a verification code second matrix and a verification code third matrix;
step three, verifying the verification code first matrix, the verification code second matrix and the verification code third matrix;
and step four, extracting fields of the same transaction from the verified certificate code first matrix, the verified certificate code second matrix and the verified certificate code third matrix, and forming a transaction code matrix.
As a preferable scheme of the present invention, the specific operation steps in the step one are as follows: extracting the same fields in a plurality of transactions [ A, a ', a ], [ B, B', B ], [ C, C ', C ], [ D, D', D ], [ E, E ', E ], to obtain A, B, C, D, E, three groups of data of a', B ', C', D ', E' and a, B, C, D and E.
As a preferred embodiment of the present invention, the second step is specifically performed by combining A, B, C, D, E to generate a first matrix [ a, B, C, D, E ] of the verification code, combining a ', B ', C ', D ', E ' to generate a second matrix [ a ', B ', C ', D ', E ] of the verification code, and combining a, B, C, D, E to generate a third matrix [ a, B, C, D, E ] of the verification code.
As a preferred embodiment of the present invention, the specific operation steps in the second step include the following verification of three verification code matrices [ a, B, C, D, E ], [ a ', B', C ', D', E ], [ a, B, C, D, E ]:
a-sending a;
b-sending B-B;
c- -sending C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
d-sending D;
e-sends E-E.
[ authentication code matrix one ] [ authentication code matrix two ] [ authentication code matrix three ].
As a preferred embodiment of the present invention, the specific operations in the fourth step include the following steps:
s1, setting N to hash (a, a', a), N being known only by the transaction initiator;
s2, setting a "to hash (a, N), where a" will follow field a as a field of transaction to uplink as an identifier;
s3, setting a '═ hash (a', N), where a 'will follow field a' to be a field of transaction for uplink as an identifier;
s4, telling the N to the other side, and the other side deduces A and a according to the N, namely deducing that N (A, a', a) belongs to a transaction, so that integration is realized.
Compared with the prior art, the invention has the beneficial effects that:
according to the scheme, the information in the same transaction is split and is packaged and verified together with the same split information in other transactions, the efficiency of the transaction is not affected, the number of transaction strokes to be verified can be reduced under the condition of more transactions, for example, 10 times of verification is carried out under the conventional condition of 10 transactions, if the number of splitting times of one transaction is less than 10 times, 10 transactions do not need to be verified, only the number of splitting strokes needs to be verified, more importantly, the privacy safety of the same transaction is protected, and a verifier does not know which parts are split in the same transaction under the condition of no hash of the complete transaction of a transaction party. Therefore, the technical scheme provided by the invention can improve the transaction verification efficiency and improve the privacy protection of the transaction information.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments of the present invention, and it should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without any creative effort, shall fall within the protection scope of the present invention.
A protection method for block chain shared data comprises the following steps:
step one, extracting the same fields in multiple transactions:
step two, merging the same fields to obtain a verification code first matrix, a verification code second matrix and a verification code third matrix;
step three, verifying the verification code first matrix, the verification code second matrix and the verification code third matrix;
and step four, extracting fields of the same transaction from the verified certificate code first matrix, the verified certificate code second matrix and the verified certificate code third matrix, and forming a transaction code matrix.
Wherein, the specific operation steps in the step one are as follows: extracting the same fields in a plurality of transactions [ A, a ', a ], [ B, B', B ], [ C, C ', C ], [ D, D', D ], [ E, E ', E ], and obtaining A, B, C, D, E, three groups of data of a', B ', C', D ', E' and a, B, C, D and E.
The second step is specifically operated to combine A, B, C, D, E to generate a first verification code matrix (A, B, C, D, E), combine a ', B', C ', D', E 'to generate a second verification code matrix (a', B ', C', D ', E'), and combine a, B, C, D, E to generate a third verification code matrix (a, B, C, D, E).
The specific operation steps in the second step are to sequentially verify three verification code matrixes [ A, B, C, D, E ], [ a ', B', C ', D', E ], [ a, B, C, D, E ]:
a-sending a;
b-sending B-B;
c- -sending C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
d-sending D;
e-sends E-E.
[ authentication code matrix one ] [ authentication code matrix two ] [ authentication code matrix three ].
The specific operation in the fourth step comprises the following steps:
s1, setting N to hash (a, a', a), N being known only by the transaction initiator;
s2, setting a "to hash (a, N), where a" will follow field a as a field of transaction to uplink as an identifier;
s3, setting a '═ hash (a', N), where a 'will follow field a' to be a field of transaction for uplink as an identifier;
s4, telling the other side N, the other side deduces A and a according to N, and then deduces that N [ A, a', a ] belongs to a same transaction, and integration is realized
Example one
Assume 4 transactions: the method comprises the following steps of (1) extracting identical fields in 4 transactions [ A, a ', a ], [ B, B', B ], [ C, C ', C ], [ D, D', D ], and obtaining A, B, C, D, a ', B', C ', D' and three groups of data of a, B, C and D; a, B, C, D are combined to generate a first verification code matrix (A, B, C, D), a ', B', C ', D' are combined to generate a second verification code matrix (a ', B', C ', D'), and a, B, C, D are combined to generate a third verification code matrix (a, B, C, D); the following verification is sequentially carried out on the three verification code matrixes of [ A, B, C and D ], [ a ', B', C ', D' ], and [ a, B, C and D ]:
a-sending a;
b-sending B-B;
c- -sending C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
d-sending D;
[ authentication code matrix one ] [ authentication code matrix two ] [ authentication code matrix three ].
After verification is finished, setting N as hash (A, a', a), wherein N is only known by a transaction initiator;
setting A ═ hash (A, N), the A ″, which will follow field A as a field of transaction to carry on cochain, as the identification bit; setting a '″ as hash (a', N), the a 'will be linked up as an identification bit following the field a' as a field of transaction; telling the opposite side N, the opposite side deduces A and a according to N, and then deduces that N [ A, a', a ] belongs to a transaction, and integration is realized.
When the 5 transactions are checked by the conventional method, 5 checks are needed, but only three checks are needed by using the checking method provided by the invention.
Example two
Assume 7 transactions: three groups of data, A, B, C, D, E, F, G, a ', B', C ', a', [ B, B ', B ], [ C, C', C ], [ D, D ', D ], [ E, E', E ], [ F, F ', F ], [ G, G', G ], are obtained by extracting the same fields in 7 transactions [ A, a ', a ], [ B, B', B ], [ C, C ', C ], [ D, D', D ], [ E, E ', E ], [ F, F', [ G, G ', G ], and a, B, C, D, E, F, G'; a, B, C, D, E, F, G are combined to generate a first verification code matrix [ A, B, C, D, E, F, G ], a ', B ', C ', D ', E ', F ', G ' are combined to generate a second verification code matrix [ a ', B ', C ', D ', E ', F ', G ], a, B, C, D, E, F, G are combined to generate a third verification code matrix [ a, B, C, D, E, F, G ]; the following verification is sequentially performed on three verification code matrixes [ A, B, C, D, E, F, G ], [ a ', B ', C ', D ', E ', F ', G ' ], [ a, B, C, D, E, F and G ]:
a-sending a;
b-sending B-B;
c- -sending C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
d-sending D;
e-sending E-E;
f- -sends F- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
g-sends G-G;
[ authentication code matrix one ] [ authentication code matrix two ] [ authentication code matrix three ].
After verification is finished, setting N as hash (A, a', a), wherein N is only known by a transaction initiator;
setting A ═ hash (A, N), the A ″, which will follow field A as a field of transaction to carry on cochain, as the identification bit; setting a '″ as hash (a', N), the a 'will be linked up as an identification bit following the field a' as a field of transaction; telling the opposite side N, the opposite side deduces A and a according to N, and then deduces that N [ A, a', a ] belongs to a transaction, and integration is realized.
When the 7 transactions are checked by the conventional method, 7 checks are needed, but only three checks are needed by using the checking method provided by the invention.
EXAMPLE III
Assume 10 transactions: the same fields in [ A, a ', a ], [ B, B ', B ], [ C, C ', C ], [ D, D ', D ], [ E, E ', E ], [ F, F ', F ] G, G ', G ], [ H, H ', H ], [ I, I ', I ], and [ J, J ', J ], 10 trades [ A, a ', a ], [ B, B ', B ], [ C, C ', C, [ D, D ', D ], [ E, E ', E ], [ F, F ', F ] G, G ', G, [ H, H ', H ], [ I, I ', I ], J, J ', J ], are extracted to obtain A, B, C, D, E, F, G, H, I, J, a ', B ', H ', D ', E ], and [ E, F ', G ], G ', H ', H ], and [ I, I ', I ], G ', C ', D ', e. f, g, h, i and j; a, B, C, D, E, F, G, H, I, J are combined to generate a first verification code matrix (A, B, C, D, E, F, G, H, I, J), a ', b', c ', d', e ', f', g ', h', i ', j' are combined to generate a second verification code matrix (a ', b', c ', d', e ', f', g ', h', i ', j'), and a, b, c, d, e, f, g, h, i, j are combined to generate a third verification code matrix (a, b, c, d, e, f, g, h, i, j); the following verification is sequentially performed on three verification code matrixes in the [ A, B, C, D, E, F, G, H, I, J ], [ a ', b', c ', d', e ', f', g ', h', i ', j' ], and [ a, b, c, d, e, f, g, h, i, j ]:
a-sending a;
b-sending B-B;
c- -sending C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
d-sending D;
e-sending E-E;
f- -sends F- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
g-sends G-G;
h- -sending H- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
i-sending I-I;
j' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
[ authentication code matrix one ] [ authentication code matrix two ] [ authentication code matrix three ].
After verification is finished, setting N as hash (A, a', a), wherein N is only known by a transaction initiator;
setting A ═ hash (A, N), the A ″, which will follow field A as a field of transaction to carry on cochain, as the identification bit; setting a '″ as hash (a', N), the a 'will be linked up as an identification bit following the field a' as a field of transaction; telling the opposite side N, the opposite side deduces A and a according to N, and then deduces that N [ A, a', a ] belongs to a transaction, and integration is realized.
While the 10 transactions are checked 10 times using conventional methods, it will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, but may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.