Block chain transaction generation method and device, equipment and storage medium
By using the combination of client private key sharding and management party private key sharding in blockchain transactions to generate private keys, the complexity of private key management during private key leakage and device replacement is solved, and higher transaction security and user experience are achieved.
Patent Information
- Application Number
- CN202411931473.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
AI Technical Summary
In blockchain transactions, the secure storage and use of private keys are of great significance. The existing technology has the risk of asset losses caused by private key leakage, and the problem of users requiring cumbersome private key export and import operations when replacing equipment.
Obtain the user account and password through the client, generate the client's private key shard, and send a private key shard acquisition request to t of the N private key management parties, and receive and combine the management party's private key shard to generate the private key for encryption of blockchain transactions.
It improves the security of private key generation, prevents private key managers from forging private keys, improves the security of blockchain transactions, and supports users to modify passwords, simplifies the private key management process when device replacement, and improves user experience and convenience.
Smart Images

Figure CN119887384A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain transaction generation method, device, equipment and storage medium. Background Art
[0002] In the development of Internet technology, Web2 and Web3 have significant differences in user experience. The core feature of Web2 is to log in through an account and password, that is, when a user visits a website or application, he needs to enter a pre-registered user account and password for identity authentication. It is simple and direct, and the user only needs to remember the user account and password to complete the login.
[0003] When Web3 introduced blockchain technology, users conduct transactions through private keys. Users need to use signatures generated by private keys to complete transactions to ensure the uniqueness and security of transactions. Specifically, before sending any transaction request to the blockchain, users need to use their own private keys to generate signatures, and then send the transaction request and signature to the blockchain. After that, the blockchain can obtain the user's identity by verifying the signature, so as to conduct authorized interactions. If the user's private key is leaked, it will lead to irreversible asset losses. Therefore, in blockchain transactions, the safe storage and use of private keys are of great significance. Summary of the invention
[0004] The present application provides a blockchain transaction generation method, device, equipment and storage medium to improve the security of blockchain transactions.
[0005] In a first aspect, the present application provides a blockchain transaction generation method, the method comprising:
[0006] The client obtains the user account and user password entered by the user when triggering the blockchain transaction, and generates a client private key shard based on the user password;
[0007] The client sends a private key shard acquisition request to t private key managers among the N private key managers respectively, wherein the private key shard acquisition request includes the user account; N is a positive integer, t is a positive integer and t is less than or equal to N;
[0008] The client receives t manager private key shards returned by the t private key managers; wherein any one manager private key shard is iteratively generated by the client for the N private key managers in advance based on the user password;
[0009] The client generates a private key according to the client private key shard and the t management party private key shards, and uses the private key to encrypt the blockchain transaction.
[0010] In the blockchain transaction generation method provided by the present application, the private key for encrypting the blockchain transaction is generated based on the client private key shard and t management party private key shards. It is impossible to generate a private key for encrypting the blockchain transaction based only on the management party private key shard, and the client private key shard is generated based on the user password entered by the user; in this way, it is avoided that multiple private key managers work together for evil, and private keys can be generated to encrypt blockchain transactions without the participation of users, which can prevent private key managers from forging private keys, improve the security of private key generation, and thus improve the security of blockchain transactions; in addition, users can still maintain the operating habits of Web2, generate private keys by entering user accounts and user passwords to encrypt blockchain transactions, realize interaction with the blockchain, and improve user experience; and the client does not need to save private key-related content, and users do not need to perform cumbersome private key export and import operations when changing devices, thereby improving ease of use.
[0011] In a possible design, any one of the manager private key shards is iteratively generated by the client for the N private key managers based on the user password in advance, including:
[0012] The client generates a client private key fragment based on the user password;
[0013] The client iteratively generates N first management-side random numbers corresponding to N private key managers based on the client private key shards; wherein the first management-side random number corresponding to the first private key manager is generated based on the client private key shards, and the first management-side random number corresponding to the i-th private key manager is generated based on the first management-side random number corresponding to the i-1-th private key manager; i is a positive integer and i is less than or equal to N;
[0014] The client determines N management party private key shards according to the N first management side random numbers.
[0015] In a possible design, the client determines N management party private key shards according to the N first management side random numbers, including:
[0016] For any private key manager, the client determines the manager private key shard of the private key manager based on the first management side random number corresponding to the private key manager and a preset t-1 order polynomial; the t-1 order polynomial uses the sequential number of the private key manager among N private key managers as a parameter.
[0017] In a possible design, the administrator private key shard of the private key administrator is determined by the following formula:
[0018] d i =f(i)+hash(d0,i)
[0019] d0=hash(pwd)
[0020] hash(d0,1)=hash(d0)
[0021] hash(d0,i)=hash(hash(d0,i-1))
[0022] f(i)=a1+a2i+a3i 2 +...+a t i t-1
[0023] Among them, d i is the private key shard of the private key manager, i is the sequence number of the private key manager among the N private key managers, pwd is the user password, d0 is the client private key shard, f(i) is the preset t-1 order polynomial, a1, a2...a t Is a random number.
[0024] In one possible design, the method further includes:
[0025] The client obtains the modified user password;
[0026] The client updates the client private key fragment based on the modified user password;
[0027] The client generates N second management-side random numbers iteratively based on the updated client private key fragments;
[0028] The client determines N change values based on the N first management side random numbers and the N second management side random numbers;
[0029] The client sends the user account and the i-th change value among the N change values to the i-th private key manager among the N private key managers; the N change values are used by the N private key managers to update the manager private key fragment identified as the user account.
[0030] This application supports users to modify their user passwords. After the user password is modified, the client will send the change value determined based on the modified user password to N private key managers so that the private key managers can update the stored manager private key shards in a timely manner to ensure the accuracy and real-time nature of the manager private key shards.
[0031] In a second aspect, the present application provides a blockchain transaction generation method, the method comprising:
[0032] The i-th private key manager among the N private key managers receives a private key shard acquisition request sent by the client, wherein the private key shard acquisition request is generated after the user triggers a blockchain transaction on the client, and the private key shard acquisition request includes a user account input by the user when triggering the blockchain transaction; N is a positive integer, i is a positive integer and i is less than or equal to N;
[0033] The i-th private key manager determines the i-th manager private key shard according to the user account, and sends the i-th manager private key shard to the client; the i-th manager private key shard is the i-th one of the N manager private key shards iteratively generated by the client for the N private key managers based on the user password in advance;
[0034] Among them, the i-th administrator private key shard is used for the client to generate a private key; the private key is generated by the client based on the client private key shard and t administrator private key shards, and the client private key shard is generated based on the user password; t is a positive integer and t is less than or equal to N.
[0035] After receiving the private key shard acquisition request, the private key manager determines the corresponding manager private key shard according to the user account included in the private key shard acquisition request, and sends the determined manager private key shard to the client. The t manager private key shards sent to the client are used by the client to generate a private key based on the client private key shard and the t manager private key shards. The private key manager cannot jointly generate a private key privately, which improves the security of the private key and thereby improves the security of the blockchain transaction.
[0036] In a possible design, before the i-th private key manager among the N private key managers receives the private key shard acquisition request sent by the client, the method further includes:
[0037] The i-th private key manager among the N private key managers receives the user account and the i-th manager private key fragment sent by the client;
[0038] The i-th private key manager stores the received i-th manager private key fragment using the received user account as an identifier;
[0039] Among them, the i-th management party private key shard is determined by the client based on the i-th first management side random number; the i-th first management side random number is generated based on the i-1-th first management side random number; the first first management side random number is generated by the client based on the user password.
[0040] Each private key manager may receive private key shards of multiple users. Therefore, when the private key manager receives the user account and the manager's private key shard sent by the client, the user account is used as an identifier to store the manager's private key shard to avoid confusion.
[0041] In one possible design, the method further includes:
[0042] The i-th private key management party receives the user account and the i-th change value among the N change values sent by the client;
[0043] The i-th private key manager updates the stored manager private key fragment identified as the user account according to the i-th change value;
[0044] Among them, the N change values are determined by the client based on the N first management side random numbers and the N second management side random numbers; the N second management side random numbers are iteratively generated by the client based on the modified user password.
[0045] After receiving the user account and the change value, the private key manager promptly updates the manager's private key shard identified as the user account, ensuring the accuracy and real-time performance of the manager's private key shard.
[0046] In a possible design, the i-th private key manager updates the stored manager private key fragment identified as the user account according to the i-th change value, including:
[0047] The i-th private key manager subtracts the stored manager private key fragment identified as the user account from the received i-th change value, and determines an updated manager private key fragment identified as the user account according to the subtraction result.
[0048] The private key manager can directly determine the updated manager private key shard by subtracting the change value from the previously stored manager private key shard. The calculation is simple, making the update efficiency of the manager private key shard higher.
[0049] In a third aspect, the present application also provides a blockchain transaction generation device, the device comprising a processing unit and a transceiver unit;
[0050] The transceiver unit is used to obtain the user account and user password input by the user when triggering the blockchain transaction, and the processing unit is used to generate a client private key fragment based on the user password;
[0051] The transceiver unit is used to send a private key shard acquisition request to t private key managers among the N private key managers, respectively, wherein the private key shard acquisition request includes the user account; N is a positive integer, t is a positive integer and t is less than or equal to N;
[0052] The transceiver unit is further used to receive t manager private key fragments returned by the t private key managers; wherein any one manager private key fragment is iteratively generated in advance by the client for the N private key managers based on the user password;
[0053] The processing unit is further used to generate a private key according to the client private key shard and the t management party private key shards, and use the private key to encrypt the blockchain transaction.
[0054] In one possible design, the processing unit is specifically used to: generate a client private key shard based on the user password; iteratively generate N first management-side random numbers corresponding to N private key managers based on the client private key shard; wherein the first management-side random number corresponding to the first private key manager is generated based on the client private key shard, and the first management-side random number corresponding to the i-th private key manager is generated based on the first management-side random number corresponding to the i-1-th private key manager; i is a positive integer and i is less than or equal to N; and N manager private key shards are determined based on the N first management-side random numbers.
[0055] In one possible design, the processing unit is used to determine N manager private key shards based on the N first management side random numbers, and is specifically used to: for any private key manager, determine the manager private key shard of the private key manager based on the first management side random number corresponding to the private key manager and a preset t-1 order polynomial; the t-1 order polynomial uses the sequential number of the private key manager among the N private key managers as a parameter.
[0056] In a possible design, the administrator private key shard of the private key administrator is determined by the following formula:
[0057] d i =f(i)+hash(d0,i)
[0058] d0=hash(pwd)
[0059] hash(d0,1)=hash(d0)
[0060] hash(d0,i)=hash(hash(d0,i-1))
[0061] f(i)=a1+a2i+a3i 2 +...+a t i t-1
[0062] Among them, d iis the private key shard of the private key manager, i is the sequence number of the private key manager among the N private key managers, pwd is the user password, d0 is the client private key shard, f(i) is the preset t-1 order polynomial, a1, a2...a t Is a random number.
[0063] In a possible design, the transceiver unit is also used to obtain a modified user password; the processing unit is also used to update the client private key shard based on the modified user password; iteratively generate N second management side random numbers based on the updated client private key shard; determine N change values based on the N first management side random numbers and the N second management side random numbers; the transceiver unit is also used to send the user account and the i-th change value among the N change values to the i-th private key manager among the N private key managers; the N change values are used by the N private key managers to update the manager private key shard identified as the user account.
[0064] In a fourth aspect, the present application also provides a blockchain transaction generation device, the device comprising a processing unit and a transceiver unit;
[0065] The transceiver unit is configured to receive a private key shard acquisition request sent by a client, wherein the private key shard acquisition request is generated after a user triggers a blockchain transaction on the client, and the private key shard acquisition request includes a user account input by the user when triggering the blockchain transaction; N is a positive integer, i is a positive integer and i is less than or equal to N;
[0066] The processing unit is used to determine the i-th administrator private key shard according to the user account, and the transceiver unit is used to send the i-th administrator private key shard to the client; the i-th administrator private key shard is the i-th of the N administrator private key shards iteratively generated by the client for the N private key administrators based on the user password in advance;
[0067] Among them, the i-th administrator private key shard is used for the client to generate a private key; the private key is generated by the client based on the client private key shard and t administrator private key shards, and the client private key shard is generated based on the user password.
[0068] In a possible design, before receiving a private key shard acquisition request sent by a client, the transceiver unit is also used to receive the user account and the i-th management party private key shard sent by the client; the processing unit is used to store the received i-th management party private key shard using the received user account as an identifier; wherein the i-th management party private key shard is determined by the client based on the i-th first management side random number; the i-th first management side random number is generated based on the i-1-th first management side random number; and the first first management side random number is generated by the client based on the user password.
[0069] In a possible design, the transceiver unit is also used to receive the user account and the i-th change value among the N change values sent by the client; the processing unit is also used to update the stored administrator private key shard identified as the user account according to the i-th change value; wherein the N change values are determined by the client based on the N first management side random numbers and the N second management side random numbers; and the N second management side random numbers are iteratively generated by the client based on the modified user password.
[0070] In one possible design, the processing unit is used to update the stored administrator private key fragment identified as the user account according to the i-th change value, and is specifically used to: subtract the stored administrator private key fragment identified as the user account from the received i-th change value, and determine the updated administrator private key fragment identified as the user account according to the difference result.
[0071] In a fifth aspect, the present application also provides a blockchain transaction generation device, the device comprising: a processor, and a memory communicatively connected to the processor;
[0072] The memory stores computer-executable instructions;
[0073] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect or the second aspect.
[0074] In a sixth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a program, and when the program is executed on a device, the device executes a method as described in any one of the first aspect or the second aspect above.
[0075] In a seventh aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the method described in the first aspect or the second aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0077] Figure 1 A flowchart of a blockchain transaction generation method provided in an embodiment of the present application;
[0078] Figure 2 A schematic diagram of the structure of the blockchain transaction generation device provided in the embodiment of the present application Figure 1 ;
[0079] Figure 3 A schematic diagram of the structure of the blockchain transaction generation device provided in the embodiment of the present application Figure 2 . DETAILED DESCRIPTION
[0080] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0081] The application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more.
[0082] Before a user sends any transaction to the blockchain, he needs to use his private key to generate a signature, encrypt the transaction with the signature, and then send it to the blockchain. Since the signature is generated based on the private key, it is equivalent to encrypting the transaction with the private key. The signature generated by the private key is recorded as (r, s, v), where r, s, and v are determined as follows: ① Generate a random number k, and generate a different value each time you sign; ② Calculate the point (R x , R y )=k×G, G is the base point of the elliptic curve algorithm in the field of cryptography and is a fixed value; ③r=R x mod n, n is the order of the elliptic curve algorithm, which is also a fixed value; ④s=k -1 ×(txHash+R x×d)mod n, txHash is the transaction hash value, different transactions correspond to different txHash, d is the user's private key; ⑤ When R y When is an even number, v is equal to 1; otherwise, v is equal to 0.
[0083] The process of generating a signature based on the user's private key is roughly the same, as described in steps ① to ⑤ above. The main difference is that the generation process of the user's private key in step ④ is different. Currently, there are mainly the following ways to generate a user's private key:
[0084] (1) Use the hash value of the user's password as the private key;
[0085] (2) The random number is used as the user's private key, and the private key is encrypted with the user's password to obtain the private key ciphertext, which is then sent to the private key manager for storage. Before the user sends a transaction to the blockchain, the private key ciphertext is obtained from the private key manager, and then the private key ciphertext is decrypted with the user's password to obtain the private key.
[0086] (3) The random number is used as the user's private key, and the user's private key is sharded through secure multi-party computing technology. Each of the n private key managers holds a private key shard. Before the user sends a transaction to the blockchain, the user needs to obtain private key shards from at least t private key managers, and then synthesize the private key based on the private key shards obtained from the t private key managers;
[0087] The above methods all have certain disadvantages. Method (1) does not use a private key manager to save the private key. Therefore, the user needs to save the private key. When the user changes the device, the import and export operations of the private key are cumbersome and inconvenient. Method (2) does not support users to change passwords, because once the user's private key is generated, it cannot be changed. If the user's password is changed, the user's private key will also change. In addition, different users who set the same password may be identified as the same user by the blockchain. In method (3), multiple private key managers can work together to generate private keys without the user's participation, which has poor security.
[0088] In order to solve the problems existing in the above-mentioned methods, the present application proposes the following Figure 1 The blockchain transaction generation method shown in the figure is executed by a client or a private key manager, and the method specifically includes:
[0089] Step 101: The client obtains the user account and user password entered by the user when triggering the blockchain transaction, and generates a client private key shard based on the user password.
[0090] For example, blockchain transactions are digital asset transactions that are carried out with the help of blockchain exchanges, which are digital asset trading platforms that use blockchain technology to achieve the sale and exchange of digital assets. The process of blockchain transactions can be divided into the following steps:
[0091] (1) Transaction generation: Use the private key to generate a signature, and then use the signature to encrypt the blockchain transaction. At this point, the blockchain transaction is generated; (2) Transaction propagation: Broadcast the transaction to the entire network. Each blockchain node will collect several unverified transaction hash values into a block. Each block can contain hundreds or thousands of transactions; (3) Proof of work: Each blockchain node performs proof of work calculations to determine who can verify the transaction. The blockchain node that calculates the result the fastest verifies the transaction; (4) Full node verification: All blockchain nodes in the entire network verify whether the transactions contained in the block are valid. After the verification is passed, the block is officially connected to the blockchain and the data cannot be modified; (5) Blockchain records.
[0092] The blockchain transaction generation method proposed in the present application is applied to the above step (1), where the client is a device used by the user, such as a server or a tablet computer. When the user triggers a blockchain transaction through the client, the user needs to enter the user account and user password. The client can obtain the user password entered by the user, and then generate a client private key shard based on the user password. For example, the user password can be input into a hash algorithm, and the output result of the hash algorithm is used as the client private key shard. The present application does not limit the type of hash algorithm. For example, the hash algorithm can be the SHA256 algorithm in the Secure Hash Algorithm 2 (SHA-2).
[0093] For example, suppose the user account entered by the user is "1234" and the user password is "abc123". After inputting "abc123" into the hash algorithm, the output result is 405, then the client private key shard is 405.
[0094] Step 102: The client sends private key shard acquisition requests to t private key managers among N private key managers respectively; accordingly, the i-th private key manager among the N private key managers receives the private key shard acquisition request sent by the client; the private key shard acquisition request includes a user account; N is a positive integer, t is a positive integer and t is less than or equal to N, and i is a positive integer and i is less than or equal to N.
[0095] Exemplarily, the private key manager can be regarded as a cloud server. When generating private keys, not all private key managers need to participate, and a few private key managers are allowed to be offline or the manager's private key shards are lost.
[0096] Exemplarily, t private key managers out of N private key managers are randomly selected by the client to send private key shard acquisition requests. In actual applications, if the security of blockchain transactions is expected to be higher, t can be set to be larger, but correspondingly, the larger t is set, the more manager private key shards are received, and the amount of calculation for generating private keys based on client private key shards and manager private key shards is larger, and the efficiency is lower; if there is no strict requirement for the security of blockchain transactions, t can be set to be smaller. In this way, the amount of calculation for generating private keys based on client private key shards and fewer manager private key shards is smaller, and the efficiency is higher.
[0097] Exemplarily, each private key manager may store multiple private key shards corresponding to different users. Therefore, when the client sends a private key shard acquisition request to t private key managers, the private key shard acquisition request should include the user account so that the private key manager can determine the corresponding private key shard according to the user account, thereby improving the accuracy and efficiency of the private key manager in determining the private key shard.
[0098] Step 103: The i-th private key manager determines the i-th manager private key shard based on the user account, and sends the i-th manager private key shard to the client; accordingly, the client receives t manager private key shards returned by t private key managers; wherein any one manager private key shard is iteratively generated by the client in advance for N private key managers based on the user password.
[0099] Exemplarily, the generation of the manager's private key shards is first described. The client generates the client private key shards based on the user password, and then iteratively generates N first management-side random numbers corresponding to N private key managers based on the client private key shards; wherein, the first management-side random number corresponding to the first private key manager is generated based on the client private key shards, and the first management-side random number corresponding to the i-th private key manager is generated based on the first management-side random number corresponding to the i-1-th private key manager; i is a positive integer and i is less than or equal to N.
[0100] The client determines N private key shards based on N first management side random numbers. Specifically, the client determines the manager private key shard of the private key manager based on the first management side random number corresponding to the private key manager and a preset t-1 order polynomial; wherein the t-1 order polynomial uses the sequential number of the private key manager among the N private key managers as a parameter.
[0101] Exemplarily, the present application provides the following calculation formula for determining N first management side random numbers and N management party private key shards:
[0102] d i =f(i)+hash(d0,i)
[0103] d0=hash(pwd)
[0104] hash(d0,1)=hash(d0)
[0105] hash(d0,i)=hash(hash(d0,i-1))
[0106] f(i)=a1+a2i+a3i 2 +...+a t i t-1
[0107] Among them, d i is the private key shard of the i-th private key manager, i is the sequence number of the i-th private key manager among the N private key managers, for example, the private key manager with the sequence number 1 is the first private key manager among the N private key managers, the private key manager with the sequence number 2 is the second private key manager among the N private key managers...the private key manager with the sequence number N is the N-th private key manager among the N private key managers; pwd is the user password, d0 is the client private key shard, f(i) is the preset t-1 order polynomial, a1, a2...a t is a random number, hash(d0,i) is the i-th first management side random number, which is determined according to the i-1-th first management side random number hash(d0,i-1).
[0108] Different clients have different calculation limits. If the calculation result of any of the above formulas exceeds the calculation limit of the client, the modulo result of the calculation result and the calculation limit can be used as the final result of the formula; for example, assuming the calculation limit is 1000, d i =f(i)+hash(d0,i) is calculated to be 1050, which is greater than 1000. i =f(i)+hash(d0,i)=(f(i)+hash(d0,i))mod 1000=50.
[0109] One point that needs to be explained is that the present application does not impose any restrictions on the calculation formula used to iteratively generate N first management side random numbers and N management party private key shards, as long as the first management side random number corresponding to the next private key manager is generated based on the first management side random number corresponding to the previous private key manager.
[0110] The following example explains in detail the process of using the above calculation formula to determine the management party's private key sharding:
[0111] Assume that there are 4 private key managers, that is, N is 4; Assume that the participation of 3 private key managers is required to generate a private key, that is, t = 3, therefore, f(i) = a1 + a2i + a3i2 +...+a t i t-1 =a1+a2i+a3i 2 , assuming a1=111,a2=222,a3=333,therefore, f(i)=a1+a2i+a3i 2 =111+222i+333i 2 ; Assume d0=hash(pwd)=hash(abc123)=405, hash(d0,1)=hash(d0)=100, hash(d0,2)=hash(hash( d0,1))=200, hash(d0,3)=hash(hash(d0,2))=300, hash(d0,4)=hash(hash(d0,3))=400, then:
[0112] d1=f(1)+hash(d0,1)=(111+222+333)+100=766
[0113] d2=f(2)+hash(d0,2)=(111+222×2+333×4)+200>1000
[0114] =((111+222×2+333×4)+200)mod 1000=87
[0115] d3=f(3)+hash(d0,3)=(111+222×3+333×9)+300>1000
[0116] =((111+222×3+333×9)+300)mod 1000=74
[0117] d4=f(4)+hash(d0,4)=(111+222×4+333×16)+400>1000
[0118] =((111+222×4+333×16)+40)mod 1000=727
[0119] d0 is the client private key shard, hash(d0,1) is the first management side random number corresponding to the first private key manager, and d1 is the manager private key shard of the first private key manager; hash(d0,2) is the first management side random number corresponding to the second private key manager, and d2 is the manager private key shard of the second private key manager; hash(d0,3) is the first management side random number corresponding to the third private key manager, and d3 is the manager private key shard of the third private key manager; hash(d0,4) is the first management side random number corresponding to the fourth private key manager, and d4 is the manager private key shard of the fourth private key manager.
[0120] Exemplarily, after the client determines N manager private key shards according to N first manager-side random numbers, the client sends the user account and the N manager private key shards to the N private key managers respectively. For example, the user account and d1 are sent to the first private key manager, the user account and d2 are sent to the second private key manager, the user account and d3 are sent to the third private key manager, and the user account and d4 are sent to the fourth private key manager.
[0121] Correspondingly, the i-th private key manager among the N private key managers receives the user account and the i-th manager private key fragment sent by the client, and uses the received user account as an identifier to store the received i-th manager private key fragment. For example, the first private key manager uses the user account as an identifier to store d1, the second private key manager uses the user account as an identifier to store d2, the third private key manager uses the user account as an identifier to store d3, and the fourth private key manager uses the user account as an identifier to store d4.
[0122] The administrator's private key shard is sent to the private key administrator for storage. The client does not need to store private key related content. When a private key needs to be generated, the client private key shard is generated according to the user password, and then the administrator's private key shard is obtained by sending a private key shard acquisition request to the private key administrator. In this way, even if the user changes the device, there is no need to export or import the private key, which is very convenient.
[0123] Further exemplarily, the i-th private key manager determines the i-th manager private key shard according to the user account, and sends the i-th manager private key shard to the client. Since the client sends a private key shard acquisition request to t private key managers, the client can receive the manager private key shards returned by t private key managers and obtain t manager private key shards. For example, assuming that the client sends a private key shard acquisition request to the first private key manager and the second private key manager, the first private key manager and the second private key manager respectively determine the corresponding manager private key shard according to the user account included in the private key shard acquisition request, and send it to the client. Therefore, the client can obtain two manager private key shards.
[0124] In addition, the present application also supports users to modify user passwords. After the user modifies the user password on the client, the client obtains the modified user password, and then updates the client private key shard based on the modified user password, and iteratively generates N second management side random numbers based on the updated client private key shard. Then, the client determines N change values based on the N first management side random numbers and the N second management side random numbers, and sends the user account and the i-th change value of the N change values to the i-th private key manager among the N private key managers; for example, assuming that the change value is recorded as δd i , then δd i It can be expressed by δd i = hash(d0,i)-hash(d0 new ,i) formula, where hash(d0,i) is the random number of the first management side of the ith one, hash(d0 new ,i) is the i-th second management side random number.
[0125] Correspondingly, the i-th private key manager receives the user account and the i-th change value among the N change values sent by the client. Since the client sends the manager's private key shard and the change value to the private key manager through different interfaces, for example, sending the user account and the manager's private key shard to the private key manager through the first interface, and sending the user account and the change value to the private key manager through the second interface, when the i-th private key manager receives the user account and the i-th change value through the second interface, it can determine that the stored manager's private key shard identified as the user account should be updated according to the i-th change value. Specifically, the i-th private key manager subtracts the stored manager's private key shard identified as the user account from the received i-th change value, and determines the updated manager's private key shard identified as the user account according to the result of the subtraction; for example, the manager's private key shard identified as the user account stored by the i-th private key manager is d i , the received i-th change value is δd i, then the difference between the stored private key fragment of the administrator identified as the user account and the received i-th change value is d i -δd i , you can use d i -δd i The updated administrator private key shard identified as the user account.
[0126] It should be noted that, since the private key is a number greater than or equal to 0, when the ith private key manager subtracts the stored admin private key shard identified as the user account from the ith change value received and the result is less than 0, the subtraction result should be modulo-operated with the calculated upper limit, and the modulo-operation result should be used as the updated admin private key shard identified as the user account; for example, assuming d i -δd i =-30<0, the upper limit of calculation is 1000, then d i -δd i =-30mod1000=970.
[0127] For example, assuming that the user changes the user password from "abc123" to "xyz321", the corresponding client private key shard d0 before the user password is updated is hash(abc123)=405, and the four first management side random numbers determined according to d0 are: hash(d0,1)=100, hash(d0,2)=hash(hash(d0,1))=200, hash(d0,3)=hash(hash(d0,2))=300, hash(d0,4)=hash(hash(d0,3))=400; assuming that the corresponding updated client private key shard d0 after the user password is updated new = hash(xyz321) = 506, the four second management side random numbers determined by the updated client private key shards are: hash(d0 new ,1)=10,hash(d0 new ,2)=hash(hash(d0 new ,1))=20,hash(d0 new ,3)=hash(hash(d0 new ,2))=30,hash(d0 new ,4)=hash(hash(d0 new ,3))=40; then the four change values determined by the above four first management side random numbers and the four second management side random numbers are: δd1=hash(d0,1)-hash(d0 new ,1)=100-10=90, δd2=hash(d0,2)-hash(d0new ,2)=200-20=180, δd3=hash(d0,3)-hash(d0 new ,3)=300-30=270, δd4=hash(d0,4)-hash(d0 new ,4)=400-40=360.
[0128] The client sends the user account and the first change value δd1 to the first private key manager, sends the user account and the second change value δd2 to the second private key manager, sends the user account and the third change value δd3 to the third private key manager, and sends the user account and the fourth change value δd4 to the fourth private key manager. After the first private key manager receives the user account and the first change value δd1, it determines that the stored manager private key fragment identified as the user account is d1=766 according to the user account, d1-δd1=766-90=676. Therefore, the first private key manager determines that the updated manager private key fragment identified as the user account is 676; after the second private key manager receives the user account and the second change value δd2, it determines that the stored manager private key fragment identified as the user account is d2=87 according to the user account, d2-δd2=87-180=-93<0=-93mod 1000=907, therefore, the second private key manager determines that the updated manager private key shard identified as the user account is 907; after the third private key manager receives the user account and the second change value δd3, it determines that the stored manager private key shard identified as the user account is d3=74 according to the user account, d3-δd3=74-270=-196<0=-196mod1000=804, therefore, the third private key manager determines that the updated manager private key shard identified as the user account is 804; after the fourth private key manager receives the user account and the fourth change value δd4, it determines that the stored manager private key shard identified as the user account is d4=727 according to the user account, d4-δd4=727-360=367, therefore, the fourth private key manager determines that the updated manager private key shard identified as the user account is 367.
[0129] Step 104: The client generates a private key based on the client private key shard and t management party private key shards and uses the private key to encrypt blockchain transactions.
[0130] Exemplarily, through step 103, the client obtains t administrator private key shards, and then the client can generate a private key according to the client private key shards and the t administrator private key shards. The private key can be calculated using the following calculation formula:
[0131]
[0132] Wherein, T is the set of sequential numbers of t private key managers among N private key managers. For example, assuming that the client sends a private key shard acquisition request to the first private key manager, the second private key manager, and the fourth private key manager, then T = [1, 2, 4]; d i and hash(d0,i) is the private key shard and the first management side random number corresponding to each private key manager in the set T. For example, taking T = [1,2,4] as an example, then d i -hash(d0,i) is d1-hash(d0,1), d2-hash(d0,2) and d4-hash(d0,4).
[0133] For example, assuming that the client sends a private key shard acquisition request to the first private key manager, the second private key manager, and the third private key manager, that is, T = [1,2,3], then the t manager private key shards received by the client are d1 = 766, d2 = 87, and d3 = 74, respectively, the client private key shard d0 = hash (abc123) = 405, and the four first management side random numbers determined according to the client private key shards are: hash (d0,1) = 100, hash (d0,2) = 200, hash (d0,3) = 300, hash (d0,4) = 400, then:
[0134]
[0135] That is, the private key generated by the client based on the client private key shard and the first private key manager, the second private key manager, and the manager private key shard returned by the third private key manager is 111.
[0136] For example, assuming that the client sends a private key shard acquisition request to the first private key manager, the third private key manager, and the fourth private key manager, that is, T = [1,3,4], then the t manager private key shards received by the client are d1 = 766, d3 = 74, and d4 = 727, respectively, the client private key shard d0 = hash (abc123) = 405, and the four first management side random numbers determined according to the client private key shards are: hash (d0,1) = 100, hash (d0,2) = 200, hash (d0,3) = 300, hash (d0,4) = 400, then:
[0137]
[0138] That is, the private key generated by the client based on the client private key shard and the first private key manager, the third private key manager, and the manager private key shard returned by the fourth private key manager is 111.
[0139] It can be seen that even if the client sends private key shard acquisition requests to different private key managers and obtains private key shards from different managers, the private key generated by the client is the same.
[0140] The blockchain transaction generation method proposed in this application is that users only need to log in with their user account and user password to generate a private key to encrypt blockchain transactions and generate blockchain transactions, which is consistent with the Web2 experience; and the client does not need to save private key related content. The client private key shards are generated according to the user password entered by the user, and the management party private key shards are stored in the private key management party. Therefore, it supports users to log in on any device without having to perform tedious private key export and import operations, which greatly improves convenience; in addition, this application also supports users to modify user passwords, ensuring flexibility of use.
[0141] Figure 2 and Figure 3 A schematic diagram of the structure of a possible blockchain transaction generation device provided for an embodiment of the present application. These blockchain transaction generation devices can be used to implement the functions of the client or private key manager in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments.
[0142] like Figure 2 As shown, the blockchain transaction generation device 200 includes a processing unit 210 and a transceiver unit 220. The blockchain transaction generation device 200 is used to implement the above Figure 1 The functions of the client or private key manager in the method embodiment shown.
[0143] When the blockchain transaction generating device 200 is used to implement Figure 1 The functions of the client in the method embodiment shown are:
[0144] The transceiver unit 220 is used to obtain the user account and user password input by the user when triggering the blockchain transaction, and the processing unit is used to generate a client private key fragment based on the user password;
[0145] The transceiver unit 220 is used to send a private key shard acquisition request to t private key managers among the N private key managers, respectively, where the private key shard acquisition request includes the user account; N is a positive integer, t is a positive integer and t is less than or equal to N;
[0146] The transceiver unit 220 is further configured to receive t manager private key fragments returned by the t private key managers; wherein any one manager private key fragment is iteratively generated in advance by the client for the N private key managers based on the user password;
[0147] The processing unit 210 is further configured to generate a private key according to the client private key shard and the t management party private key shards, and use the private key to encrypt the blockchain transaction.
[0148] In one possible design, the processing unit 210 is specifically used to: generate a client private key shard based on the user password; iteratively generate N first management-side random numbers corresponding to N private key managers based on the client private key shard; wherein the first management-side random number corresponding to the first private key manager is generated based on the client private key shard, and the first management-side random number corresponding to the i-th private key manager is generated based on the first management-side random number corresponding to the i-1-th private key manager; i is a positive integer and i is less than or equal to N; and N manager private key shards are determined based on the N first management-side random numbers.
[0149] In one possible design, the processing unit 210 is used to determine N manager private key shards based on the N first management side random numbers, and is specifically used to: for any private key manager, determine the manager private key shard of the private key manager based on the first management side random number corresponding to the private key manager and a preset t-1 order polynomial; the t-1 order polynomial uses the sequential number of the private key manager among the N private key managers as a parameter.
[0150] In a possible design, the administrator private key shard of the private key administrator is determined by the following formula:
[0151] d i =f(i)+hash(d0,i)
[0152] d0=hash(pwd)
[0153] hash(d0,1)=hash(d0)
[0154] hash(d0,i)=hash(hash(d0,i-1))
[0155] f(i)=a1+a2i+a3i 2 +...+a t i t-1
[0156] Among them, d i is the private key shard of the private key manager, i is the sequence number of the private key manager among the N private key managers, pwd is the user password, d0 is the client private key shard, f(i) is the preset t-1 order polynomial, a1, a2...a t Is a random number.
[0157] In a possible design, the transceiver unit 220 is also used to obtain a modified user password; the processing unit 210 is also used to update the client private key shard based on the modified user password; iteratively generate N second management side random numbers based on the updated client private key shard; determine N change values based on the N first management side random numbers and the N second management side random numbers; the transceiver unit 220 is also used to send the user account and the i-th change value among the N change values to the i-th private key manager among the N private key managers; the N change values are used by the N private key managers to update the manager private key shard identified as the user account.
[0158] When the blockchain transaction generating device 200 is used to implement Figure 1 The functions of the private key manager in the method embodiment shown are:
[0159] The transceiver unit 220 is used to receive a private key shard acquisition request sent by a client, wherein the private key shard acquisition request is generated after a user triggers a blockchain transaction on the client, and the private key shard acquisition request includes a user account entered by the user when triggering the blockchain transaction; N is a positive integer, i is a positive integer and i is less than or equal to N;
[0160] The processing unit 210 is used to determine the i-th administrator private key shard according to the user account, and the transceiver unit 220 is used to send the i-th administrator private key shard to the client; the i-th administrator private key shard is the i-th of the N administrator private key shards iteratively generated by the client for the N private key administrators based on the user password in advance;
[0161] Among them, the i-th administrator private key shard is used for the client to generate a private key; the private key is generated by the client based on the client private key shard and t administrator private key shards, and the client private key shard is generated based on the user password.
[0162] In a possible design, before receiving a private key shard acquisition request sent by a client, the transceiver unit 220 is also used to receive the user account and the i-th administrator private key shard sent by the client; the processing unit 210 is used to store the received i-th administrator private key shard using the received user account as an identifier; wherein the i-th administrator private key shard is determined by the client based on the i-th first management side random number; the i-th first management side random number is generated based on the i-1-th first management side random number; and the first first management side random number is generated by the client based on the user password.
[0163] In a possible design, the transceiver unit 220 is also used to receive the user account and the i-th change value among the N change values sent by the client; the processing unit 210 is also used to update the stored administrator private key shard identified as the user account according to the i-th change value; wherein the N change values are determined by the client based on the N first management side random numbers and the N second management side random numbers; and the N second management side random numbers are iteratively generated by the client based on the modified user password.
[0164] In one possible design, the processing unit 210 is used to update the stored administrator private key fragment identified as the user account according to the i-th change value, and is specifically used to: subtract the stored administrator private key fragment identified as the user account from the received i-th change value, and determine the updated administrator private key fragment identified as the user account according to the difference result.
[0165] For more detailed description of the processing unit 210 and the transceiver unit 220, please refer to Figure 1 The relevant description in the method embodiment shown is directly obtained and will not be repeated here.
[0166] like Figure 3 As shown, the blockchain transaction generation device 300 includes a processor 310 and an interface circuit 320. The processor 310 and the interface circuit 320 are coupled to each other. It is understood that the interface circuit 320 can be a transceiver or an input-output interface. Optionally, the blockchain transaction generation device 300 may also include a memory 330 for storing instructions executed by the processor 310 or storing input data required by the processor 310 to run the instructions or storing data generated after the processor 310 runs the instructions.
[0167] When the blockchain transaction generating device 300 is used to implement Figure 1 When the method is shown, the processor 310 is used to implement the function of the processing unit 210, and the interface circuit 320 is used to implement the function of the transceiver unit 220.
[0168] The division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0169] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0170] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A blockchain transaction generation method, characterized in that: The method comprises: The client obtains the user account and user password entered by the user when triggering the blockchain transaction, and generates a client private key shard based on the user password; The client sends a private key shard acquisition request to t private key managers among the N private key managers respectively, wherein the private key shard acquisition request includes the user account; N is a positive integer, t is a positive integer and t is less than or equal to N; The client receives t manager private key shards returned by the t private key managers; wherein any one manager private key shard is iteratively generated by the client for the N private key managers in advance based on the user password; The client generates a private key according to the client private key shard and the t management party private key shards, and uses the private key to encrypt the blockchain transaction.
2. The method according to claim 1, characterized in that Any one of the manager private key shards is iteratively generated by the client for the N private key managers based on the user password in advance, including: The client generates a client private key fragment based on the user password; The client iteratively generates N first management-side random numbers corresponding to N private key managers based on the client private key shards; wherein the first management-side random number corresponding to the first private key manager is generated based on the client private key shards, and the first management-side random number corresponding to the i-th private key manager is generated based on the first management-side random number corresponding to the i-1-th private key manager; i is a positive integer and i is less than or equal to N; The client determines N management party private key shards according to the N first management side random numbers.
3. The method according to claim 2, characterized in that The client determines N management party private key fragments according to the N first management side random numbers, including: For any private key manager, the client determines the manager private key shard of the private key manager based on the first management side random number corresponding to the private key manager and a preset t-1 order polynomial; the t-1 order polynomial uses the sequential number of the private key manager among N private key managers as a parameter.
4. The method according to claim 3, characterized in that The private key shard of the private key manager is determined by the following formula: d i =f(i)+hash(d0,i) d0=hash(pwd) hash(d0,1)=hash(d0) hash(d0,i)=hash(hash(d0,i-1)) f(i)=a1+a2i+a3i 2 +...+a t i t-1 Among them, d i is the private key shard of the private key manager, i is the sequence number of the private key manager among the N private key managers, pwd is the user password, d0 is the client private key shard, f(i) is the preset t-1 order polynomial, a1, a2...a t Is a random number.
5. The method according to claim 2, characterized in that The method further comprises: The client obtains the modified user password; The client updates the client private key fragment based on the modified user password; The client generates N second management-side random numbers iteratively based on the updated client private key fragments; The client determines N change values based on the N first management side random numbers and the N second management side random numbers; The client sends the user account and the i-th change value among the N change values to the i-th private key manager among the N private key managers; the N change values are used by the N private key managers to update the manager private key fragment identified as the user account.
6. A blockchain transaction generation method, characterized in that: The method comprises: The i-th private key manager among the N private key managers receives a private key shard acquisition request sent by the client, wherein the private key shard acquisition request is generated after the user triggers a blockchain transaction on the client, and the private key shard acquisition request includes a user account input by the user when triggering the blockchain transaction; N is a positive integer, i is a positive integer and i is less than or equal to N; The i-th private key manager determines the i-th manager private key shard according to the user account, and sends the i-th manager private key shard to the client; the i-th manager private key shard is the i-th one of the N manager private key shards iteratively generated by the client for the N private key managers based on the user password in advance; Among them, the i-th administrator private key shard is used for the client to generate a private key; the private key is generated by the client based on the client private key shard and t administrator private key shards, and the client private key shard is generated based on the user password; t is a positive integer and t is less than or equal to N.
7. The method according to claim 6, characterized in that Before the i-th private key manager among the N private key managers receives the private key shard acquisition request sent by the client, the method further includes: The i-th private key manager among the N private key managers receives the user account and the i-th manager private key fragment sent by the client; The i-th private key manager stores the received i-th manager private key fragment using the received user account as an identifier; Among them, the i-th management party private key shard is determined by the client based on the i-th first management side random number; the i-th first management side random number is generated based on the i-1-th first management side random number; the first first management side random number is generated by the client based on the user password.
8. The method according to claim 7, characterized in that The method further comprises: The i-th private key management party receives the user account and the i-th change value among the N change values sent by the client; The i-th private key manager updates the stored manager private key fragment identified as the user account according to the i-th change value; Among them, the N change values are determined by the client based on the N first management side random numbers and the N second management side random numbers; the N second management side random numbers are iteratively generated by the client based on the modified user password.
9. The method according to claim 8, characterized in that The i-th private key manager updates the stored manager private key fragment identified as the user account according to the i-th change value, including: The i-th private key manager subtracts the stored manager private key fragment identified as the user account from the received i-th change value, and determines an updated manager private key fragment identified as the user account according to the subtraction result.
10. A blockchain transaction generation device, characterized in that: The device comprises a processing unit and a transceiver unit; The transceiver unit is used to obtain the user account and user password input by the user when triggering the blockchain transaction, and the processing unit is used to generate a client private key fragment based on the user password; The transceiver unit is used to send a private key shard acquisition request to t private key managers among the N private key managers, respectively, wherein the private key shard acquisition request includes the user account; N is a positive integer, t is a positive integer and t is less than or equal to N; The transceiver unit is further used to receive t manager private key fragments returned by the t private key managers; wherein any one manager private key fragment is iteratively generated in advance by the client for the N private key managers based on the user password; The processing unit is further used to generate a private key according to the client private key shard and the t management party private key shards, and use the private key to encrypt the blockchain transaction.
11. A blockchain transaction generation device, characterized in that: The device comprises a processing unit and a transceiver unit; The transceiver unit is configured to receive a private key shard acquisition request sent by a client, wherein the private key shard acquisition request is generated after a user triggers a blockchain transaction on the client, and the private key shard acquisition request includes a user account input by the user when triggering the blockchain transaction; N is a positive integer, i is a positive integer and i is less than or equal to N; The processing unit is used to determine the i-th administrator private key fragment according to the user account, and the transceiver unit is used to send the i-th administrator private key fragment to the client; The i-th administrator private key shard is the i-th one of the N administrator private key shards iteratively generated in advance by the client for the N private key administrators based on the user password; Among them, the i-th administrator private key shard is used for the client to generate a private key; the private key is generated by the client based on the client private key shard and t administrator private key shards, and the client private key shard is generated based on the user password; t is a positive integer and t is less than or equal to N.
12. A blockchain transaction generation device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.
14. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 9 when being executed by a processor.