Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and a system for managing a transaction key of a user on a blockchain. The technical scheme is as follows:
in one aspect, a method for managing a transaction key of a user on a blockchain includes the following steps:
the user sends a transaction key retrieval request, and inputs a user account and an authentication key;
responding to a transaction key retrieval request initiated by a user, and comparing and verifying a user account input by the user and a user account stored in an information derivative chain;
after the user account passes the verification, performing collaborative verification on at least two blocks storing transaction key fragments on the block chain main chain to restore the transaction key;
and feeding back the transaction key obtained by reduction to the user.
Further, before the steps of sending a transaction key recovery request, inputting a user account and verifying a key by a user, the method further comprises the following steps:
the information derivative chain stores user characteristic information and generates a user account according to a preset rule;
fragmenting the transaction key, wherein the generated transaction key fragments at least comprise one piece of user characteristic information;
and distributing and storing the transaction key fragments and the user characteristic information in blocks of a block chain main chain, and establishing an association relation.
Further, the user account is generated according to the following algorithm:
S=ln(Y/H+D)/T+k,
wherein S is a user account, Y is a user name, H is user registration time, D is user registration date, T is a user registration sequence number, and k is a check code.
Further, after the user account passes the verification, the step of cooperatively verifying at least two blocks storing the transaction key fragments on the block chain main chain and restoring the transaction key specifically includes:
sending out at least two pieces of user characteristic information for verification;
responding to the verification feedback of the block storing the user characteristic information, and extracting transaction key fragments containing the user characteristic information;
when transaction key fragments with the number larger than or equal to the set threshold value are received, all transaction key fragments are called according to the established incidence relation;
and restoring the transaction key.
Further, the transaction key fragments with the same user characteristic information are at least one; the block for storing the user characteristic information and the block for storing the transaction key fragment containing the user characteristic information are different blocks.
On the other hand, the management system of the user transaction key on the blockchain comprises a client, a blockchain main chain and an information derivative chain, wherein a user account is stored on the information derivative chain, transaction key fragments are stored on the blockchain main chain, and the client is used for sending a transaction key retrieval request, inputting the user account and verifying the key.
Further, the information derivation chain specifically includes:
the verification module is used for responding to the transaction key retrieval request and comparing and verifying the input user account and the user account stored in the information derivative chain;
the recovery module is used for performing collaborative verification on at least two blocks with transaction key fragments stored on the block chain main chain after the user account passes the verification, and recovering the transaction key;
and the feedback module is used for feeding back the transaction key obtained by reduction to the user.
Further, the information derivation chain further comprises:
the characteristic information module is used for storing user characteristic information in the information derivative chain and generating a user account according to a preset rule;
the key fragmenting module is used for fragmenting the transaction key, and the generated transaction key fragments at least comprise one piece of user characteristic information;
and the association module is used for distributing and storing the transaction key fragments and the user characteristic information in the blocks of the block chain main chain and establishing an association relationship.
Further, the user account is generated according to the following algorithm:
S=ln(Y/H+D)/T+k,
wherein S is a user account, Y is a user name, H is user registration time, D is user registration date, T is a user registration sequence number, and k is a check code.
Further, the reduction module specifically includes:
the authentication unit is used for sending out at least two pieces of user characteristic information for authentication;
the response unit is used for responding to the verification feedback of the block storing the user characteristic information and extracting the transaction key fragments containing the user characteristic information;
the calling unit is used for calling all transaction key fragments according to the established association relationship after receiving the transaction key fragments of which the number is greater than or equal to the set threshold value;
and the restoring unit is used for restoring the transaction key.
Further, the transaction key fragments with the same user characteristic information are at least one; the block for storing the user characteristic information and the block for storing the transaction key fragment containing the user characteristic information are different blocks.
The technical scheme provided by the embodiment of the invention has the following beneficial effects: according to the management method and the system for the user transaction key on the blockchain, the user information, the user account and the transaction key are stored and managed by utilizing the property of the blockchain, the transaction key is stored on the blockchain in a scattered manner, the user information is verified in the system in the key retrieving process, and the transaction key can be retrieved conveniently.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The invention provides an implementation mode of a user transaction key management method on a block chain, as shown in fig. 1, comprising the following steps:
s101, a user sends a transaction key retrieving request and inputs a user account and an authentication key.
After a user registers on the blockchain, the blockchain generates a user account and a transaction key, stores the user account on an information derivative chain of the blockchain, generates a verification key according to the information derivative chain storing the user account, and then sends the user account, the transaction key and the verification key back to the user. The user uses the user account and the transaction key to conduct transaction operation on the blockchain, and when the user forgets the transaction key, the transaction key can be retrieved through the user account and the verification key. When a user wants to retrieve a transaction key, a user account for retrieving the transaction key and a verification key corresponding to the user account are input on the blockchain, and a transaction key retrieval request is initiated to the blockchain.
And S102, responding to a transaction key retrieval request initiated by a user, and comparing and verifying a user account input by the user and a user account stored in an information derivative chain.
And the blockchain receives a retrieval request sent by a user, responds to the request, finds out a corresponding user account stored on the information derivative chain according to a verification key input by the user, and then compares and verifies the user account stored on the information derivative chain with the user account input by the user. If the two user account information are completely the same, the verification is passed, and the transaction key can be continuously retrieved; if the two user account information are different, the verification fails, and the transaction key recovery is stopped.
And S103, after the user account passes the verification, performing collaborative verification on at least two blocks in which the transaction key fragments are stored on the block chain main chain, and restoring the transaction key.
After the user account is verified, the transaction key may be restored by specifically referring to the steps shown in fig. 2, where fig. 2 is a specific flowchart of step S103.
And S1031, issuing at least two pieces of user characteristic information for verification.
The information derivative chain of the block chain sends user characteristic information to blocks on the main chain for verification, and the blocks on the main chain can be blocks in which the user characteristic information is stored or blocks in which the user characteristic information is not stored. The user characteristic information sent by the information derivation chain includes at least two pieces, or may be more, and the present invention is not limited in this respect.
S1032, the verification feedback of the block storing the user characteristic information is responded, and the transaction key fragment containing the user characteristic information is extracted.
And each block of the main chain of the block chain compares the user characteristic information stored in the block with the user characteristic information sent by the information derivative chain, and feeds back the compared result serving as a verification result to the information derivative chain. The verification result is divided into two types, one type is that one or more pieces of user characteristic information consistent with the user characteristic information sent by the information derivative chain are stored in the block of the main chain, and the other type is that the user characteristic information consistent with the user characteristic information sent by the information derivative chain is not stored in the block of the main chain.
And for the feedback that the verification result is that one or more pieces of user characteristic information consistent with the user characteristic information sent by the information derivative chain are stored in the block of the main chain, the information derivative chain searches the block storing the transaction key fragment comprising the user characteristic information from the main chain of the block chain, and extracts the transaction key fragment stored in the block.
And S1033, after the transaction key fragments with the number larger than or equal to the set threshold number are received, calling all transaction key fragments according to the established association relation.
In this embodiment, it is necessary to set the information derivative chain to obtain at least two or more transaction key fragments, and after the information derivative chain receives more than or equal to the two transaction key fragments, according to the user feature information stored in the information derivative chain, find the corresponding user feature information stored in different blocks of the main chain of the blockchain, and then according to the association relationship between the transaction key fragments in the main chain of the blockchain and the user feature information, retrieve all the transaction key fragments associated with the user feature information, so as to obtain all the transaction key fragments.
S1034, the transaction key is restored.
And the information derivative chain restores all the obtained transaction key fragments to obtain a complete transaction key.
And S104, feeding back the transaction key obtained by reduction to the user.
And the information derivative chain sends the restored complete transaction key to the user.
As shown in fig. 3, in another embodiment of the method for managing a user transaction key on a blockchain according to the present invention, steps S101 to S104 are the same as those in fig. 1, and before step S101, the method further includes the following steps:
step S301, the information derivation chain stores the user characteristic information and generates a user account according to a preset rule.
The user registers on the block chain, fills in user characteristic information, such as name, birthday, city of residence, work unit, nationality, academic information and the like, and stores the user characteristic information on an information derivative chain of the block chain. According to the characteristic information of the user, generating a user account according to the following algorithm:
S=ln(Y/H+D)/T+k,
wherein S is a user account, Y is a user name, H is user registration time, D is user registration date, T is a user registration sequence number, and k is a check code.
For example, the user a registers the user name of zhang san, transcodes to 53374093 through GB2312 code, registers the date to 20160621, registers the time to 15:43, registers the sequence number 1926, and randomly generates the check code 7 at the time of registration, so that S ═ ln (53374093/1543+20160621)1926+ 7.
Step S302, the transaction key is fragmented, and the generated transaction key fragments at least comprise a piece of user characteristic information.
The block chain generates a transaction key after the user finishes registration, then the transaction key is fragmented and divided into a plurality of transaction key fragments, and at least one piece of user characteristic information is added into each transaction key fragment.
Step S303, the transaction key fragments and the user feature information are distributed and stored in the blocks of the block chain main chain, and an association relationship is established.
The block chain stores the transaction key fragments carrying the user characteristic information and the user characteristic information in different blocks of a block chain main chain in a distributed mode, and association is established between the transaction key fragments and the user characteristics.
The present invention further provides an embodiment of a system 10 for user transaction key management on a blockchain, as shown in fig. 4, comprising a blockchain main chain 100, an information derivation chain 200, and a client 300. The user account is stored on the information derivation chain 200, the transaction key fragment is stored on the blockchain main chain 100, and the client 300 is used for sending a transaction key retrieval request, inputting the user account and verifying the key.
The information derivation chain 200 specifically further includes: a verification module 201, a restoration module 202 and a feedback module 203.
The verification module 201 is configured to respond to the transaction key retrieval request, and compare and verify the input user account and the user account stored in the information derivative chain; the restoring module 202 is configured to perform collaborative verification on at least two blocks in which the transaction key fragments are stored on the block chain main chain after the user account passes verification, and restore the transaction key; the feedback module 203 is used for feeding back the transaction key obtained by the restoration to the user.
When the user forgets the transaction key and needs to retrieve the transaction key, the user account and the corresponding verification key are input through the client 300, and a transaction key retrieval request is initiated. After receiving the request sent by the client 300, the information derivation chain 200 first finds the user account stored in the information derivation chain according to the authentication key input by the user through the authentication module 201, and then compares and authenticates the user account stored in the information derivation chain and the user account input by the user. When the two user account information are completely the same and the verification passes, the restoring module 202 performs collaborative verification on at least two blocks storing transaction key fragments on the block chain main chain to restore the transaction key. The feedback module 203 feeds back the transaction key restored by the restoring module 202 to the user.
In the present invention, the client 300 may be a mobile terminal or a fixed terminal such as a mobile phone, a computer, a smart watch or a PDA.
As shown in fig. 5, in this embodiment, the restoring module 202 specifically includes: a verification unit 2021, a response unit 2022, a retrieval unit 2023, and a restoration unit 2024.
The verification unit 2021 is configured to send at least two pieces of user feature information for verification; the response unit 2022 is configured to extract the transaction key fragments containing the user feature information in response to the verification feedback of the block storing the user feature information; the retrieving unit 2023 is configured to retrieve all transaction key fragments according to the established association relationship after receiving the transaction key fragments of which the number is greater than or equal to the set threshold number; the restoring unit 2024 is configured to restore the transaction key.
After the verification module 201 passes the verification, the verification unit 2021 in the restoring module 202 sends at least two pieces of user feature information to the main chain of the block chain to verify each block on the main chain of the block chain, verifies whether the user feature information sent by the verification unit 2021 is stored on the block, and feeds back the verification result to the response module 2022. After receiving the verification feedback, the response module 2022 finds the block storing the transaction key fragment including the user feature information according to the block storing the user feature information, extracts the transaction key fragment stored in the block, and sends the extracted transaction key fragment to the retrieving unit 2023. After the retrieval unit 2023 receives the transaction key fragments with the set threshold number, according to the user feature information stored in the information derivative chain, the corresponding user feature information stored in different blocks of the main chain of the blockchain is found, and then according to the association relationship between the transaction key fragments in the main chain of the blockchain and the user feature information, all the transaction key fragments associated with the user feature information are retrieved to obtain all the transaction key fragments, and all the transaction key fragments are sent to the restoration unit 2024. And after receiving all the transaction key fragments, the restoring unit restores the transaction key fragments into a complete transaction key. In the present invention, the number threshold of transaction key fragments received by the retrieving unit 2023 is two.
As shown in fig. 6, in another embodiment of the system 10 'for managing user transaction keys on a blockchain provided by the present invention, the information derivation chain 200' further includes: a characteristic information module 204', a key fragmentation module 205', and an association module 206 '.
The characteristic information module 204' is used for storing user characteristic information in the information derivation chain and generating a user account according to a preset rule. The key fragmentation module 205' is configured to perform fragmentation processing on the transaction key, where the generated transaction key fragmentation includes at least one piece of user characteristic information. The association module 206' is configured to store the transaction key fragments and the user feature information in blocks of the block chain main chain in a distributed manner, and establish an association relationship.
After the feature information module 204' stores the user feature information in the information derivation chain, a user account is generated according to the user feature information and the following algorithm:
S=ln(Y/H+D)/T+k,
wherein S is a user account, Y is a user name, H is user registration time, D is user registration date, T is a user registration sequence number, and k is a check code.
The key fragmentation module 205 'divides the transaction key obtained after the user registration is completed into a plurality of transaction key fragments, then adds at least one piece of user characteristic information into each transaction key fragment, and sends the transaction key fragment to the association module 206'. The association module 206' distributes the transaction key fragments carrying the user feature information and the user feature information to different blocks of the block chain main chain, and then establishes an association between the transaction key fragments and the user feature information.
According to the management method and the system for the user transaction key on the blockchain, the user information, the user account and the transaction key are stored and managed by utilizing the property of the blockchain, the transaction key is stored on the blockchain in a scattered manner, the user information is verified in the system in the key retrieving process, and the transaction key can be retrieved conveniently.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.