Detailed Description
In order to more clearly explain the overall concept of the present application, the following detailed description is given by way of example in conjunction with the accompanying drawings.
An embodiment of the present application provides a network system, as shown in fig. 1, the network system at least includes a block chain and a server attached to the block chain. The server attached to the blockchain refers to a server capable of providing the target platform, that is, a server corresponding to the target platform (hereinafter, referred to as a server). In the network system, a device for logging in a target platform may be further included. The target platform is used for inquiring the product quality information stored on the block chain, and a user can send a write request or an inquiry request through a second account registered on the target platform so as to write or inquire the product quality information on the block chain through a first account registered on the block chain corresponding to the second account.
It should be noted that, in consideration of registration, access, and the like on the blockchain, for a user, the operation is inconvenient, and the implementation difficulty is high, so in the embodiment of the present application, the server attached to the blockchain is provided to provide a target platform for the user, thereby providing a convenient way for the user to register and access the blockchain.
In order to implement the above functions, after the user registers the second account, the server may call an Application Programming Interface (API) preset on the blockchain, and register the first account corresponding to the second account for the user on the blockchain. And generating a private key corresponding to the first account by the blockchain according to one or more items of user information (such as a mailbox, a contact way and the like) input by the user on the target platform, the second account, a password corresponding to the second account and the like. After the server completes registration of the first account on the blockchain, the blockchain may return the first account and the private key corresponding to the first account to the user for storage by the server.
Because the product quality information is stored in the blockchain, and the server can automatically apply for the account on the blockchain system for the user registered on the target platform, after the private key corresponding to the first account is lost, the user can retrieve the private key by means of the target platform provided by the server and the second account registered on the target platform. Therefore, for the user, the establishment of the network system not only can facilitate the user to access the block chain, but also can provide guarantee for the use process of the user, so as to avoid inconvenience brought to the user due to the loss of the private key corresponding to the first account.
It should be noted that the schematic structural diagram of the network system shown in fig. 1 is only an exemplary implementation form of the network system. In the network system, more or less devices than those shown in fig. 1 may be included.
The following further describes the private key recovery method provided in the embodiment of the present application with reference to the drawings.
Fig. 2 is a flowchart of a private key recovery method according to an embodiment of the present application. The method flow comprises S101 to S103.
S101, a server corresponding to a target platform receives a request for retrieving a private key.
The private key is a private key corresponding to a first account registered on the blockchain.
After logging in the target platform, the user can initiate a request for retrieving the private key in a corresponding interface operated by the target platform. For example, the user may click a shortcut key of the corresponding interface to trigger the private key retrieving function.
Or, before logging in the target platform, the user may initiate a request for retrieving the private key in a login interface of the target platform, and then, in a manner of logging in the target platform, the server determines that the private key that the user tries to retrieve is the private key corresponding to which account in the block chain, so as to trigger the private key retrieving process.
It should be noted that the user may send the request for retrieving the private key by clicking the shortcut key, or send the request for retrieving the private key by inputting a voice command. In the embodiment of the present application, the transmission method of the request and the like are not limited.
S102, determining a second account for sending the request.
And the second account is an account for logging in the target platform.
In the embodiment of the application, the account for logging in the target platform can be preset by the user, or the user is allocated by the server when the user registers on the target platform. In the embodiment of the present application, the generation method, format, and the like of the second account are not limited.
S103, according to the second account, searching a private key corresponding to the second account from the pre-stored corresponding relation to serve as the retrieved private key corresponding to the first account.
The pre-stored corresponding relation is stored after the server automatically registers the first account on the block chain for the user. In the embodiment of the application, the corresponding relationship at least includes a corresponding relationship between the second account and the private key, where the private key is a private key corresponding to the first account registered through the second account.
In an implementation manner, the pre-stored correspondence may include a correspondence between the second account, the first account, and a private key corresponding to the first account. Therefore, the server can not only find the corresponding private key according to the second account, but also find the first account from the pre-stored corresponding relation.
It should be noted that the first account and the second account have uniqueness. That is, the second accounts registered on the target platform are different from each other, and the first accounts registered on the blockchain through the second accounts are also different from each other.
Compared with the prior art, in the case that the user cannot find the lost private key any more after losing the private key, in the technical scheme provided in the embodiment of the present application, since the first account used on the blockchain is registered by the server, and after the registration of the first account is completed, the server can store the corresponding relationship between the private key corresponding to the first account and the second account locally, the server can find the lost private key for the user by verifying the user identity under the condition that the private key is lost, so that the user can successfully log in the target platform. Therefore, the technical problem that the private key cannot be retrieved after the user loses the private key can be effectively solved by adopting the technical scheme.
Considering that the searching for the private key corresponding to the second account is performed from a pre-stored correspondence relationship, in an implementation manner of the embodiment of the present application, before performing S103, S201 to S203 may also be performed.
S201, registering a second account on the target platform.
The user may register a second account on the target platform when the user initially logs in to the target platform. After the registration of the second account is completed, the user can log in the target platform through the second account.
S202, registering the first account on the block chain according to the second account.
When the user registers the second account, the user information such as a mailbox, a contact way and the like can be filled according to the prompt provided on the target platform, so that the registration process of the second account is completed. The server may register the first account on the blockchain based on user information input when the user registers the second account, a password corresponding to the second account, and the like.
It should be noted that the server automatically registers on the blockchain instead of the user. After the registration of the first account is completed, the blockchain may return the first account to the server, along with the private key generated by the blockchain for the first account. The server may then present the first account and the private key corresponding to the first account to the user, so that the user may perform a corresponding operation on the blockchain using the first account and the private key corresponding to the first account, for example, accessing content stored on the blockchain, storing corresponding content on the blockchain, and the like.
S203, establishing and storing a corresponding relation between a private key corresponding to the first account and the second account.
In order to facilitate the user to retrieve the private key when the private key is lost, the server needs to establish and store a corresponding relationship between the private key corresponding to the first account and the second account.
It should be noted that, for the server, in order to facilitate the user to query the product quality information on the target platform through the second account, in this embodiment of the application, after the server completes registration of the first account on the blockchain instead of the user, the server needs to establish a correspondence between the second account and the first account.
In this way, after the user logs in the target platform through the second account, once the user triggers the corresponding query process, the server may search for the corresponding content from the blockchain by searching for the first account corresponding to the second account using the first account.
Therefore, in combination with the actual query requirement, when S203 is executed, the server may further establish a correspondence relationship among the first account, the second account, and the private key corresponding to the first account. Thus, in the subsequent inquiry process, the pre-stored corresponding relation can also be used.
In the actual application process, the user can register the first account through the target platform, the third party platform or the blockchain. In view of the fact that a user autonomously registers a first account (i.e., registers the first account through a third-party platform or directly registers the first account on a block chain), it is also necessary to ensure retrievability of a private key to further improve the convenience of use of the user, and therefore, in an implementation manner of an embodiment of the present application, for the first account registered by the user and the private key corresponding to the first account, the user can complete entry of the private key corresponding to the first account and the first account on a target platform, so that the first account autonomously applied by the user and the private key corresponding to the first account are bound to a second account registered by the user on the target platform, that is, a correspondence relationship between the second account and the private key corresponding to the first account is established. Therefore, when the user loses the private key corresponding to the first account which is autonomously registered on the blockchain, the user can also retrieve the private key by means of the target platform.
In order to further improve the security of retrieving the private key, in an implementation manner of the embodiment of the present application, further authentication may be selectively performed on the identity of the user retrieving the private key. That is, before executing S103, S204 may also be executed.
And S204, verifying the identity of the user using the second account, and determining that the verification is passed.
When the verification code input by the second account is the same as the verification code issued by the server aiming at the second account, the verification is determined to be passed; and/or when the answer input through the second account is the same as the answer corresponding to the prompt question saved for the second account, determining that the verification is passed.
Before the user tries to retrieve the private key, the user can log in a target platform, then identity authentication is carried out on the target platform, after the authentication is passed, a server corresponding to the target platform searches the corresponding private key from the pre-stored corresponding relation, and the private key is presented to the user through the target platform. Or the user can perform identity authentication on the interface of the login target platform, if the authentication is passed, the user can subsequently retrieve the private key, and the retrieved private key is presented to the user by the target platform, otherwise, the user cannot retrieve the private key even if the user can log in the target platform.
In the latter case, the effect of verifying the user identity is considered to be achieved in the user identity verification process, so that after the server determines that the user identity passes the verification, the private key can be retrieved after the user logs in the target platform, or the private key can be retrieved without logging in the target platform.
For the case that the user does not log in the target platform, the server may find all accounts (including the second account) registered by the user on the blockchain by using information input by the user in the user authentication process as a reference and combining the content input by the user when registering on the target platform. For the case that all accounts are one, the one account can be directly determined as a second account corresponding to the user identity; for the case where there are multiple total accounts, the user may be prompted to enter a second account. Therefore, the user can retrieve the private key only by relying on the second account which is automatically input or determined by the server under the condition of not logging in the target platform.
The following explains the implementation process of user identity authentication by combining three exemplary ways of authenticating the user identity:
for example, the user may input a mobile phone number, a mailbox, and the like provided when registering the second account on the target platform, and then the server may send the verification code to the input mobile phone number, mailbox, and the like, so that the user inputs the received verification code through the target platform. And when the verification code input through the second account is the same as the verification code issued by the server aiming at the second account, determining that the user identity passes the verification.
For another example, the user may input the registered second account on the target platform, so that the server presents the user with a prompt question preset by the user through the target platform. The prompt question can be set when the user registers the second account or logs in the second account. The user can input an answer on the target platform according to the prompting question, and when the answer input through the second account is the same as the answer corresponding to the prompting question stored aiming at the second account, the user identity is determined to be verified.
For another example, in combination with the two exemplary verification cases, in order to further improve the reliability of the verification process, in the process of verifying the user identity, the verification code may be used for verification, and the verification may be performed through a prompt question, that is, when the verification code input through the second account is the same as the verification code issued by the server for the second account, and the answer input through the second account is the same as the answer corresponding to the prompt question stored for the second account, it is determined that the user identity passes the verification.
It should be noted that, for the case that the user identity is not verified, the server may return a result of the verification failure through the target platform. Or, for the case that the user identity is not verified, the server may prompt the user to perform authentication again through the target platform. For example, the target platform may prompt the user to perform authentication again using the same authentication method, or provide the user with another authentication method to re-authenticate the user identity. And when the continuous failure times of the identity authentication reach the preset failure times, the server can return the result of the authentication failure through the target platform. The preset failure times can be preset, the preset failure times can be set by combining a specific application scene, and in the embodiment of the application, the setting mode, the value and the like of the preset failure times are not limited.
In addition, in the embodiment of the present application, the method for measuring whether the user identity is verified includes, but is not limited to, the above-mentioned three cases. In the implementation process, the user identity may also be verified by referring to the existing authentication manner or other implementation means capable of implementing authentication, which is not described herein again.
After the user completes registration of the second account on the target platform, the user can write the product quality information into the blockchain through the target platform. The specific implementation process may include S301 and S302.
S301, receiving a writing request sent by a second account and used for writing the product quality information.
After the user logs in to the target platform using the second account, the product quality information that is attempted to be stored on the blockchain may be entered on the target platform to enable sending of the write request to the server through the target platform.
Wherein the product quality information refers to content associated with the quality of the product. In the embodiment of the present application, the product quality information includes, but is not limited to, one or more of an identifier of the product, traceability information of the product, detection information of the product, and the like. Wherein, the tracing information of the product refers to the information reflecting the production and sale process of the product. In the embodiment of the present application, the traceability information of the product may include, but is not limited to, one or more items of production information, warehousing information, sales information, and the like of the product.
S302, writing the product quality information carried in the writing request into the block chain through the first account and a private key corresponding to the first account.
The server can use the corresponding first account to access the block chain according to the corresponding relation between the second account and the first account logged in by the user. The server can then sign the product quality information requested to be written in the write request by using a private key corresponding to the first account, and then write the signed product quality information into the block chain.
It should be noted that in one implementation, the blockchain may refer to a public chain such as etherhouse, or the blockchain may be a private chain or a federation chain. That means that the above implementation can be used to write product quality information into either the private chain or the federation chain. In the embodiment of the present application, there is no limitation on the type of blockchain to which the server is attached.
Therefore, the server can replace the user to access the block chain, and the user stores the product quality information which is attempted to be written into the block chain onto the block chain through the target platform, so that the uplink process of the product quality information is completed. In addition, in the process of accessing the block chain, the target platform replaces the user to use the first account to access the block chain, and replaces the user to use the private key corresponding to the first account to sign the product quality information. Therefore, from the perspective of the user, the user only needs to provide the target platform with the product quality information trying to write the block chain after logging in the target platform, and the uplink process of the product quality information can be realized without the user intervening in subsequent operations.
After the user completes registration of the second account on the target platform, the user can inquire the product quality information through the target platform. The specific implementation process may include S303 and S304.
S303, receiving an inquiry request which is sent by the second account and used for inquiring the product quality information.
For the user, after the registration of the second account is completed on the target platform, the user can log in the target platform through the second account, and then the user can effectively distinguish the identification of each product by inputting the quality code, the product serial number and the like, so as to realize the query of the product quality information of the specified product.
The query request may carry the identifier for distinguishing each product.
S304, according to the identification carried in the query request, product quality information corresponding to the identification is searched on the block chain through the first account and returned.
The server can access the content on the block chain through the first account corresponding to the second account, and search the product quality information corresponding to the identifier on the block chain by taking the identifier carried in the query request as a basis, and then can present the product quality information to the user through the target platform.
It should be noted that, when the server queries on the block chain, the server may obtain all the queried product quality information and the identified product quality information in a manner of traversing each block chain, and then selectively summarize the obtained product quality information. For example, the list format is adopted, and the list format is arranged according to the time sequence of the uplink of the product quality information, and the like, and the list format is returned to the target platform for being presented to the user. The manner of summarizing the product quality information items may include, but is not limited to, the list form mentioned above, and in the embodiment of the present application, the manner of searching for and returning the product quality information is not limited.
Therefore, for a user, the query request can be initiated after logging in the target platform, so that the server can complete query and return of the product quality information on the block chain according to the identifier carried in the query request. That is, the user does not need to directly access the content on the blockchain through the account registered on the blockchain, but the target platform is used as an intermediary to complete the query of the content instead of the user.
As shown in fig. 3, a server is provided for the embodiment of the present application. The block chain is stored with product quality information, the server provides a target platform, and the target platform is used for inquiring the product quality information stored in the block chain. The server 40 includes:
the communication module 41 is configured to receive a request for retrieving a private key, where the private key is a private key corresponding to a first account registered in the blockchain.
And the processing module 42 is configured to determine a second account for sending the request, where the second account is an account for logging in the target platform.
The processing module 42 is further configured to search, according to the second account, a private key corresponding to the second account from a pre-stored correspondence, as the retrieved private key corresponding to the first account.
In one implementation, the processing module 42 is further configured to register a second account on the target platform; registering the first account on the blockchain according to the second account; and establishing a corresponding relation between a private key corresponding to the first account and the second account.
The server 40 may also include a storage module 43.
And a storage module 43, configured to store the established correspondence.
In one implementation, the processing module 42 is further configured to verify the identity of the user using the second account and determine that the verification is successful.
When the verification code input by the second account is the same as the verification code issued by the server aiming at the second account, the verification is determined to be passed; and/or when the answer input through the second account is the same as the answer corresponding to the prompt question saved for the second account, determining that the verification is passed.
In one implementation, the communication module 41 is further configured to receive a write request sent through the second account for writing the product quality information.
And the storage module 43 is configured to write the product quality information carried in the write request into the block chain through the first account and a private key corresponding to the first account.
In one implementation, the communication module 41 is further configured to receive a query request sent through the second account for querying the product quality information.
The processing module 42 is further configured to search, according to the identifier carried in the query request, product quality information corresponding to the identifier on the block chain through the first account and return the product quality information.
It should be noted that the communication module may be implemented as a communication interface, the processing module may be implemented as a processor, and the storage module may be implemented as a memory. As shown in fig. 4, a server is provided for the embodiment of the present application. The server 50 may include a communication interface 51, a processor 52, and a memory 53. In the embodiment of the present application, the bus 54 may connect the communication interface 51, the processor 52, and the memory 53, so as to realize data transmission among the communication interface 51, the processor 52, and the memory 53.
In the embodiment of the application, the block chain stores product quality information, and the target platform is used for inquiring the product quality information stored in the block chain.
The communication interface 51 is configured to receive a request for retrieving a private key, where the private key is a private key corresponding to a first account registered in the blockchain.
A processor 52, configured to determine a second account for sending the request, where the second account is an account for logging in the target platform; and according to the second account, searching a private key corresponding to the second account from the pre-stored corresponding relation to be used as the retrieved private key corresponding to the first account.
In one implementation, prior to finding the private key corresponding to the second account, the processor 52 is further configured to register the second account on the target platform; registering the first account on the blockchain according to the second account; and establishing and storing a corresponding relation between a private key corresponding to the registered first account and the second account.
In one implementation, before looking up the private key corresponding to the second account, the processor 52 is further configured to verify the identity of the user using the second account and determine that the verification is successful. When the verification code input by the second account is the same as the verification code issued by the server aiming at the second account, the verification is determined to be passed; and/or when the answer input through the second account is the same as the answer corresponding to the prompt question saved for the second account, determining that the verification is passed.
In one implementation, the communication interface 51 is further configured to receive a write request sent through the second account for writing the product quality information.
The memory 53 is further configured to write the product quality information carried in the write request into the block chain through the first account and a private key corresponding to the first account.
In one implementation, the communication interface 51 is further configured to receive a query request for querying the product quality information, which is sent through the second account.
And the processor 52 is further configured to search, according to the identifier carried in the query request, product quality information corresponding to the identifier on the block chain through the first account, and return the product quality information.
The embodiment of the application provides a server. The server includes a memory, one or more processors, a plurality of applications, and one or more programs; wherein the one or more programs are stored in the memory; the one or more processors, when executing the one or more programs, cause the server to perform the method of any of the above.
The embodiment of the application provides a readable storage medium. The readable storage medium has stored therein instructions which, when run on a server, cause the server to perform the method of any of the above.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the physical embodiment, since it is substantially similar to the method embodiment, the description is simple, and the relevant points can be referred to the partial description of the method embodiment.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.