Blockchain key generation methods, devices, equipment, media and products
By acquiring hardware operation information and generating random number sequences using a quantum random number generator, and combining the Mason tween rotation algorithm and elliptic curve algorithm to generate key pairs, the problems of high resource requirements and low efficiency in existing technologies are solved, and efficient key generation is achieved.
Patent Information
- Application Number
- CN202410455770.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2044-04-16
AI Technical Summary
Existing elliptic curve cryptography methods using quantum random numbers suffer from excessive resource requirements and low key generation efficiency, making them unsuitable for real-time or high-throughput applications.
By acquiring hardware operation information, a random number sequence is generated using a quantum random number generator, and a master key pair is generated using the Mason twitch algorithm and elliptic curve algorithm. Multiple sub-key pairs are generated using a key derivation algorithm and stored in a hierarchical deterministic wallet.
It reduces resource requirements and improves the efficiency of random number sequence generation, thereby improving key generation efficiency and meeting the needs of real-time and high-throughput applications.
Smart Images

Figure CN118316601B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain, and more particularly to a method, apparatus, device, medium, and product for generating blockchain keys. Background Technology
[0002] As elliptic curve cryptography (ECC) becomes increasingly prevalent, the quality of random numbers generated in its applications significantly impacts encryption security. This is because the private key in ECC is generated from a secret set of random numbers. However, these random numbers are actually generated by deterministic algorithms, making them highly insecure. In recent years, with the continuous development of science and technology, the computing resources and capabilities available to third parties have increased dramatically, making existing information encryption technologies that rely on specific algorithms to generate random numbers increasingly easier to crack.
[0003] To address the issue that the quality of random numbers affects the security of information encryption, existing technologies propose an elliptic curve encryption method using quantum random numbers. Specifically, an unpredictable random number is generated by a quantum random number generator, and then the random number is input into an elliptic curve. A public-private key pair is obtained through a public-private key pair generation algorithm.
[0004] However, existing elliptic curve cryptography methods using quantum random numbers have the following problems: they require too many resources, as quantum random number generation requires a dedicated quantum computer, which is expensive; the generation of random numbers takes a long time and is inefficient, resulting in low efficiency in key generation, which cannot meet the needs of real-time or high-throughput applications. Summary of the Invention
[0005] This application provides a method, apparatus, device, storage medium, and product for generating blockchain keys, in order to solve the problems of excessive resource requirements and low efficiency in key generation of existing elliptic curve cryptography methods using quantum random numbers.
[0006] Firstly, this application provides a method for generating blockchain keys, comprising:
[0007] Obtain the current operating information of the hardware, and encode the operating information to obtain a first random number;
[0008] A second random number is generated by calling a quantum random number generator;
[0009] A target random number sequence is generated based on the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by the Mason rotation algorithm;
[0010] The target random number sequence is processed using the elliptic curve algorithm to obtain a master key pair. The master private key in the master key pair is then processed using a key derivation algorithm to obtain multiple sub-key pairs.
[0011] Optionally, generating the target random number sequence based on the first random number and the second random number includes:
[0012] The first and second random numbers are combined to obtain the third random number;
[0013] The third random number is used as the seed of the Mason twisting algorithm, and the seed is subjected to cyclic shifting and XOR operation to obtain the target seed;
[0014] The target seed is extracted multiple times to generate multiple fourth random numbers, and the multiple fourth random numbers are merged to obtain the target random number sequence.
[0015] Optionally, the master key pair includes: a master private key and a master public key. The process of calculating the target random number sequence based on the elliptic curve algorithm to obtain the master key pair includes:
[0016] The target random number sequence is hashed to obtain the master private key;
[0017] Based on the target elliptic curve in the elliptic curve algorithm, determine the target base point on the target elliptic curve;
[0018] Based on the target base point and the master private key, a master public key is generated using the elliptic curve algorithm.
[0019] Optionally, the master private key in the master key pair is processed using a key derivation algorithm to obtain multiple sub-key pairs, including:
[0020] The master private key is divided into segments according to a preset byte size to obtain the parent private key and the parent chain encoding;
[0021] Based on the key derivation algorithm, the parent private key and the parent chain encoding are processed to obtain multiple child private keys;
[0022] The elliptic curve algorithm is used to process the multiple sub-private keys and the target base point to obtain multiple sub-public keys, and the sub-public keys correspond to the sub-private keys.
[0023] Optionally, the step of performing operations on the parent private key and parent chain encoding based on the key derivation algorithm to obtain multiple child private keys includes:
[0024] Input the parent private key, the parent chain code, and the first index value into the key derivation function to obtain the first child private key and the first child chain code output by the key derivation function. The index value is the sequence number value corresponding to the increasing order of the child key pair derivation.
[0025] The parent private key, the parent chain code, and the second index value are input into the key derivation function to obtain the second child private key and the second child chain code output by the key derivation function.
[0026] Optionally, the method further includes:
[0027] The address of each sub-public key is generated based on the index value and identification information corresponding to the multiple sub-public keys;
[0028] The address of each sub-private key is generated based on the index value and identification information corresponding to the multiple sub-private keys;
[0029] Based on the address of each sub-private key and the address of each sub-public key, the multiple sub-key pairs are stored in a hierarchical deterministic wallet.
[0030] Optionally, the method further includes:
[0031] The multiple sub-private keys are calculated and processed based on the key derivation algorithm to generate multiple grandchild key pairs;
[0032] Based on the addresses corresponding to the multiple grandchild key pairs, the multiple grandchild key pairs are stored in the hierarchical deterministic wallet, and the addresses of the grandchild key pairs are determined based on the identification information and index value of the grandchild key pairs.
[0033] Optionally, the step of calculating and processing the multiple sub-private keys based on the key derivation algorithm to generate multiple grandchild key pairs includes:
[0034] Based on the key derivation algorithm, the multiple sub-private keys and the sub-chain encodings corresponding to the multiple sub-private keys are processed to obtain multiple grandchild private keys;
[0035] The elliptic curve algorithm is used to calculate and process the multiple grandson private keys to obtain multiple grandson public keys, and there is a correspondence between the grandson public keys and the grandson private keys.
[0036] Secondly, this application provides a key generation device for a blockchain, comprising:
[0037] The acquisition module is used to obtain the current operating information of the hardware;
[0038] The processing module is used to encode the running information to obtain a first random number;
[0039] The processing module is also used to generate a second random number by calling a quantum random number generator;
[0040] The processing module is further configured to generate a target random number sequence based on the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by the Mason tween algorithm;
[0041] The processing module is further configured to perform calculations on the target random number sequence based on the elliptic curve algorithm to obtain a master key pair, and to perform calculations on the master private key in the master key pair using a key derivation algorithm to obtain multiple sub-key pairs.
[0042] Optionally, the processing module is further configured to merge the first random number and the second random number to obtain a third random number;
[0043] The processing module is further configured to use the third random number as the seed of the Mason twisting algorithm, and to perform cyclic shifting and XOR operations on the seed to obtain the target seed;
[0044] The processing module is further configured to perform multiple extraction processes on the target seed to generate multiple fourth random numbers, and to merge the multiple fourth random numbers to obtain the target random number sequence.
[0045] Optionally, the processing module is further configured to perform a hash operation on the target random number sequence to obtain the master private key;
[0046] The processing module is further configured to determine the target base point on the target elliptic curve based on the target elliptic curve in the elliptic curve algorithm.
[0047] The processing module is further configured to generate a master public key based on the target base point and the master private key, using the elliptic curve algorithm.
[0048] Optionally, the processing module is further configured to divide the master private key according to a preset byte size to obtain the parent private key and the parent chain encoding;
[0049] The processing module is further configured to perform calculations on the parent private key and parent chain encoding based on the key derivation algorithm to obtain multiple child private keys;
[0050] The processing module is further configured to perform calculations on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm to obtain a plurality of sub-public keys, wherein the sub-public keys correspond to the sub-private keys.
[0051] Optionally, the processing module is further configured to input the parent private key, the parent chain code, and the first index value into the key derivation function to obtain the first child private key and the first child chain code output by the key derivation function, wherein the index value is the sequence number value corresponding to the increasing order of the child key pair derivation;
[0052] The processing module is further configured to input the parent private key, the parent chain code, and the second index value into the key derivation function to obtain the second sub-private key and the second sub-chain code output by the key derivation function.
[0053] Optionally, the apparatus further includes: a generation module;
[0054] The generation module is used to generate the address of each sub-public key based on the index value and identification information corresponding to the plurality of sub-public keys;
[0055] The generation module is further configured to generate the address of each sub-private key based on the index value and identification information corresponding to the plurality of sub-private keys;
[0056] The processing module is further configured to store the plurality of subkey pairs into a hierarchical deterministic wallet based on the address of each sub-private key and the address of each sub-public key.
[0057] Optionally, the processing module is further configured to perform calculations on the plurality of sub-private keys based on the key derivation algorithm to generate a plurality of grandchild key pairs;
[0058] The processing module is further configured to store the plurality of grandchild key pairs into the hierarchical deterministic wallet according to the addresses corresponding to the plurality of grandchild key pairs, wherein the addresses of the grandchild key pairs are determined according to the identification information and index value of the grandchild key pairs.
[0059] Optionally, the processing module is further configured to perform calculations on the plurality of sub-private keys and the sub-chain encodings corresponding to the plurality of sub-private keys based on the key derivation algorithm to obtain a plurality of grandchild private keys;
[0060] The processing module is further configured to perform calculations on the multiple grandchild private keys based on the elliptic curve algorithm to obtain multiple grandchild public keys, wherein there is a correspondence between the grandchild public keys and the grandchild private keys.
[0061] Thirdly, this application provides a key generation device for a blockchain, comprising:
[0062] Memory;
[0063] processor;
[0064] The memory stores computer-executed instructions;
[0065] The processor executes computer execution instructions stored in the memory to implement the blockchain key generation method as described in the first aspect and various possible implementations of the first aspect above.
[0066] Fourthly, this application provides a computer storage medium storing computer execution instructions thereon, which are executed by a processor to implement the blockchain key generation method as described in the first aspect and various possible implementations of the first aspect.
[0067] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the blockchain key generation method as described above.
[0068] The blockchain key generation method provided in this application obtains a first random number by acquiring the current operating information of the hardware and encoding the operating information. A second random number is generated by calling a quantum random number generator. A target random number sequence is generated based on the first and second random numbers. The target random number sequence is then processed using an elliptic curve algorithm to obtain a master key pair. Finally, a key derivation algorithm is used to process the master private key in the master key pair to obtain multiple sub-key pairs. This method not only solves the problem of excessive resource requirements for generating long random number sequences using quantum computers but also improves the efficiency of random number sequence generation, thereby improving the efficiency of key generation. Attached Figure Description
[0069] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0070] Figure 1 A flowchart illustrating the blockchain key generation method provided in this application. Figure 1 ;
[0071] Figure 2 A flowchart illustrating the blockchain key generation method provided in this application. Figure 2 ;
[0072] Figure 3 A schematic diagram of the key generation device for the blockchain provided in this application;
[0073] Figure 4 A schematic diagram of the key generation device for the blockchain provided in this application.
[0074] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0075] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0076] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation portals for users to choose to authorize or refuse.
[0077] It should be noted that the key generation method, apparatus, device, medium and product of the blockchain in this application can be used in the field of artificial intelligence, or in any field other than artificial intelligence. The application fields of the key generation method, apparatus, device, medium and product of the blockchain in this application are not limited.
[0078] As elliptic curve cryptography (ECC) becomes increasingly prevalent, the quality of random numbers generated in its applications significantly impacts encryption security. This is because the private key in ECC is generated from a secret set of random numbers. However, these random numbers are actually generated by deterministic algorithms, making them highly insecure. In recent years, with the continuous development of science and technology, the computing resources and capabilities available to third parties have increased dramatically, making existing information encryption technologies that rely on specific algorithms to generate random numbers increasingly easier to crack.
[0079] To address the issue that the quality of random numbers affects the security of information encryption, existing technologies propose an elliptic curve encryption method using quantum random numbers. Specifically, an unpredictable random number is generated by a quantum random number generator, and then the random number is input into an elliptic curve. A public-private key pair is obtained through a public-private key pair generation algorithm.
[0080] However, existing elliptic curve cryptography methods using quantum random numbers have the following problems: they require too many resources, as quantum random number generation requires a dedicated quantum computer, which is expensive; the generation time is long and the efficiency is low, making it unsuitable for real-time or high-throughput applications.
[0081] To address the aforementioned issues, this application provides a method for generating blockchain keys.
[0082] First, the implementation scenarios involved in this application will be explained.
[0083] The basic process of data encryption involves processing plaintext files or data using a certain algorithm to transform them into unreadable code called "ciphertext." This ciphertext can only be displayed after a specific key is entered, thus protecting the data from unauthorized access and reading. The reverse process is decryption, which involves converting the encoded information back into its original form. The key is a specific parameter used in encryption or decryption, determining how the encryption algorithm is applied. The key is one of the core elements of cryptography; without it, encryption algorithms cannot function properly.
[0084] In general, to ensure anonymity, users in blockchains often generate multiple private keys to prevent transactions from being traced. Non-deterministic wallets randomly generate multiple public-private key pairs, requiring repeated backups and imports for signing, which is space-consuming and inconvenient. Therefore, hierarchical deterministic wallet technology has emerged, using a "seed" and a one-way hash function to generate a set of private keys. This allows the generation of a series of related key pairs from a single seed, including a master account key and an unlimited number of sub-account keys. These sub-accounts have a hierarchical relationship, forming a tree structure with the master account as the root node. Therefore, the randomness of the "seed" is crucial for key generation.
[0085] This application provides a key generation method for blockchain. It obtains hardware-encoded random numbers by acquiring and encoding hardware operating information, generates quantum random numbers by calling a quantum random number generator, combines the hardware-encoded random numbers and the quantum random numbers to generate a new random number sequence, and uses this sequence as a seed to generate a master key pair. Based on a key derivation algorithm, it performs hierarchical derivation processing on the master private key in the master key pair to obtain multiple sub-key pairs. This method not only solves the problem of excessive resource requirements for generating long random number sequences using quantum computers, but also improves the efficiency of random number sequence generation, thereby improving the efficiency of key generation.
[0086] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0087] Figure 1 A flowchart illustrating the blockchain key generation method provided in this application embodiment. Figure 1 The implementing entity in this embodiment can be, for example, a technical modification system equipped with auxiliary modification function modules. For example... Figure 1 As shown, the blockchain key generation method provided in this embodiment includes:
[0088] S101. Obtain the current operating information of the hardware and encode the operating information to obtain a first random number.
[0089] Among them, the operation information is used to indicate the operating status of the hardware device. The operation information can be, for example, temperature information, voltage information, fan speed information, etc.
[0090] For example, instructions can be sent to hardware sensors on a computer to obtain operational information, thereby acquiring the status and data of the corresponding hardware, such as CPU temperature, voltage, or fan speed. The acquired operational information can then be encoded using hardware encoding to obtain a first random number.
[0091] S102. Generate a second random number by calling the quantum random number generator.
[0092] A quantum random number generator is a device that generates random numbers based on the probabilistic nature of quantum mechanics rather than a computer program. Quantum random number generators can statistically analyze microscopic phenomena of random "noise" signals, such as thermal noise, the photoelectric effect involving beam splitters, and other quantum phenomena.
[0093] For example, by calling a quantum random number generator, the measurement device in the quantum random number generator can measure and process entropy sources such as environmental noise to obtain initial data. This initial data is affected by factors such as environmental noise, non-ideal entropy sources, and measurement noise, and thus has a certain bias and correlation. It is necessary to estimate the entropy of the initial data and then extract the randomness through a post-processing algorithm to finally obtain a complete quantum random number, i.e., the second random number.
[0094] S103. Generate a target random number sequence based on the first random number and the second random number.
[0095] The target random number sequence is a random number sequence generated by the Mason rotation algorithm. The Mason rotation algorithm is an algorithm that initializes and iteratively updates the random number seed, and extracts and converts random numbers within the required range from the updated data.
[0096] For example, the first and second random numbers can be used as the initial seeds for the Mason twisting algorithm. The algorithm initializes the state of the seed value using the Mason twisting algorithm. For instance, the array composed of the first and second random numbers can be initially transformed using a linear congruential method to obtain an initialized state array. Then, the Mason twisting algorithm is used for iterative processing to generate a new state array. The target random number is extracted and output from the updated state array. The sequence of random numbers obtained from multiple outputs of the target random number is the target random number sequence. The iterative processing includes shifting and rotating the state elements in the state array, mixing the rotated state elements with other elements, and then filling the mixed state elements back into the same position in the state array, overwriting the original values.
[0097] The purpose of this step is to generate a target random number sequence by combining the first and second random numbers, thereby meeting the application requirements that need longer random number sequences and solving the problem of the rate of generating long random sequences using quantum random numbers.
[0098] S104. The target random number sequence is processed using the elliptic curve algorithm to obtain a master key pair, and the master private key in the master key pair is processed using the key derivation algorithm to obtain multiple sub-key pairs.
[0099] The master key pair includes a master public key and a master private key, and there is a corresponding relationship between the master public key and the master private key. The subkey pair includes a sub private key and a sub public key, and there is also a corresponding relationship between the sub public key and the sub private key.
[0100] Elliptic curve cryptography (ECC) is a public-key encryption algorithm based on elliptic curve mathematics. ECC utilizes the mathematical properties of elliptic curves to protect the security of transactions and data. The security of ECC relies on the difficulty of solving the discrete logarithm problem of elliptic curves, such as point addition and scalar multiplication.
[0101] For example, the secp256k1 elliptic curve can be used, and the target random number sequence can be used as the private key d. A base point P on the secp256k1 elliptic curve can be selected, and the product Q of the base point P and the target random number sequence can be calculated. The resulting Q can be used as the public key corresponding to the private key d. The private key d and the public key Q are corresponding, that is, the master key pair.
[0102] Key derivation algorithms refer to algorithms that derive multiple keys from a single key using a key derivation function. The master key recursively generates other keys in the tree using the key derivation function and specific derivation path information. Each level of derivation may introduce new input parameters (such as indices, tags, context information, etc.) to ensure that the derived key is closely associated with its level and position. Similarly, hierarchical key derivation algorithms utilize strong cryptographic hash functions such as PBKDF2, HKDF, and scrypt. These functions are unidirectional and irreversible, meaning that the original master key or intermediate keys cannot be easily derived from the derived keys, thus protecting key security. Key derivation functions can be, for example, the HMAC-SHA512 function. By processing the master private key using the key derivation algorithm, multiple sub-private keys corresponding to the master private key can be obtained, and each sub-private key can also have its corresponding sub-public key calculated, because there is a mathematical relationship between the sub-private keys and the sub-public keys.
[0103] Understandably, the master private key can be used to encrypt and decrypt data, the master public key is used to verify signatures and encrypt data, and the master key pair can be used to manage the main account of a blockchain-based wallet account. In real-world applications, a user may have multiple accounts, so the sub-key pair can be used to manage the sub-accounts of a blockchain wallet account.
[0104] The blockchain key generation method provided in this embodiment obtains the current operating information of the hardware and encodes the operating information to obtain a first random number. A second random number is generated by calling a quantum random number generator. Based on the first and second random numbers, a target random number sequence is generated. The target random number sequence is then processed using an elliptic curve algorithm to obtain a master key pair. Finally, the master private key in the master key pair is processed using a key derivation algorithm to obtain multiple sub-key pairs. This method not only solves the problem of excessive resource requirements for generating long random number sequences using quantum computers, but also improves the efficiency of random number sequence generation, thereby improving the efficiency of key generation.
[0105] Figure 2 A flowchart illustrating the blockchain key generation method provided in this application embodiment. Figure 2 .like Figure 2 As shown, in this embodiment... Figure 1 Based on the embodiments, the key generation method for blockchain is described in detail. The key generation method for blockchain shown in this embodiment includes:
[0106] S201. Obtain the current operating information of the hardware, and encode the operating information to obtain a first random number.
[0107] Step S201 is similar to step S101 above, and will not be repeated here.
[0108] S202. Generate a second random number by calling the quantum random number generator.
[0109] Step S202 is similar to step S2102 above, and will not be described again here.
[0110] S203. Combine the first random number and the second random number to obtain the third random number.
[0111] The purpose of merging the first and second random numbers to obtain the third random number is to increase the length of the random number, thereby improving its quality. Compared with existing methods for generating long-sequence random numbers using quantum computers, this method produces long-sequence random numbers that are more efficient and require fewer resources.
[0112] S204. The third random number is used as the seed of the Mason twisting algorithm, and the seed is subjected to cyclic shifting and XOR operation to obtain the target seed.
[0113] Before performing cyclic shift processing on the third random number, the state of the third random number can be initialized to obtain the state vector corresponding to the third random number. Then, the elements in the state vector are rotated to the right by cyclic right shift processing. The result of the rotation is XORed with a fixed constant matrix. The value obtained from the XOR operation is then filled back into the position of the element in the state vector to overwrite the original element. After multiple shift processing and XOR operations on the seed, multiple random numbers are obtained, and these random numbers are used as the target seed. XOR operation processing refers to the logical operation method of comparing two inputs and returning a new binary bit as the output based on the comparison result.
[0114] S205. The target seed is extracted multiple times to generate multiple fourth random numbers, and the multiple fourth random numbers are merged to obtain the target random number sequence.
[0115] In this process, multiple random numbers, or target seeds, are obtained by cyclically shifting and XORing the third random number. These random numbers may not be within the range of values required by the user. Therefore, the target seeds need to be extracted multiple times, and the extracted elements need to be truncated, i.e., only a portion of the bits of the element is taken. The truncated values are then mapped to the range of values required by the user to obtain multiple fourth random numbers. Finally, the multiple fourth random numbers are concatenated and merged to obtain the target random number sequence.
[0116] S206. Perform a hash operation on the target random number sequence to obtain the master private key.
[0117] Hash operation refers to inputting a target random number sequence into a hash function to obtain the hash value output by the hash function, and using this hash value as the master private key. Hash functions can be, for example, SHA-224, SHA-256, SHA-384, SHA-512, etc.
[0118] S207. Determine the target base point on the target elliptic curve according to the target elliptic curve in the elliptic curve algorithm.
[0119] The elliptic curve algorithm uses the target elliptic curve. Based on the type and domain parameters of the elliptic curve, the equation of the target elliptic curve can be determined, and a fixed point on the target elliptic curve equation is taken as the target base point. The target base point is used to generate all non-infinite points on the elliptic curve. That is, every point on the target elliptic curve can be represented as an integer multiple of the target base point.
[0120] S208. Generate a master public key based on the target base point and the master private key using the elliptic curve algorithm.
[0121] For example, by performing an addition operation on the target base point and the master private key, the master public key corresponding to the master private key can be obtained.
[0122] S209. The master private key is divided into segments according to a preset byte size to obtain the parent private key and the parent chain code.
[0123] The preset bytes can be, for example, 32 bytes. Since the master private key is a random number sequence, it can be divided into two 32-byte sequences, with the left sequence as the parent private key and the right sequence as the parent chain encoding.
[0124] S210. Based on the key derivation algorithm, the parent private key and the parent chain encoding are processed to obtain multiple child private keys.
[0125] The key derivation algorithm is a hierarchical key derivation algorithm based on the key derivation function in the BIP32 protocol. For example, the parent private key, the parent chain code, and the first index value can be input into the key derivation function to obtain the first child private key and the first child chain code output by the key derivation function. The index value is the sequence number corresponding to the increasing order of the child key pair derivation. For example, the first index value corresponding to the first child private key can be 0.
[0126] Input the parent private key, the parent chain code, and the second index value into the key derivation function to obtain the second child private key and the second child chain code output by the key derivation function. The second index value can be, for example, 1.
[0127] S211. Based on the elliptic curve algorithm, the multiple sub-private keys and the target base point are processed to obtain multiple sub-public keys.
[0128] For example, based on the mathematical relationship between the sub-private key and the sub-public key in the elliptic curve algorithm, the coordinates of the resulting point on the elliptic curve corresponding to the sub-private key can be used to construct the sub-public key.
[0129] S212. Generate the address of each sub-public key based on the index value and identification information corresponding to the multiple sub-public keys, and generate the address of each sub-private key based on the index value and identification information corresponding to the multiple sub-private keys.
[0130] For example, if the identifier of the first sub-private key is m and the first index value is 0, then the address of the first sub-private key is m / 0. If the identifier of the first sub-public key is M and the first index value is 0, then the address of the first sub-public key is M / 0.
[0131] S213. Store the multiple subkey pairs in a hierarchical deterministic wallet according to the address of each sub-private key and the address of each sub-public key.
[0132] As is understandable, digital assets in a blockchain account are stored in wallet addresses derived from private keys and placed on the blockchain network. Only those with the private key corresponding to the address have the authority to operate on them. Therefore, a hierarchical deterministic wallet is essentially a tool for generating and storing key pairs; it does not store assets, all of which reside on the blockchain. Subkey pairs can be used for managing sub-accounts within a blockchain-based wallet account.
[0133] The advantage of this combination is that by using a key derivation algorithm, a large number of subkey pairs can be easily managed and backed up without having to back up each subkey pair individually. At the same time, the security and efficiency provided by the elliptic curve algorithm can enable more robust encryption and signing capabilities in a hierarchical deterministic wallet.
[0134] Optionally, after generating multiple sub-key pairs, the multiple sub-private keys can be processed based on the key derivation algorithm to generate multiple grandchild key pairs. The multiple grandchild key pairs are then stored in the hierarchical deterministic wallet according to their corresponding addresses. The addresses of the grandchild key pairs are determined based on their identifier information and index values.
[0135] For example, here is a possible implementation of calculating and processing the multiple sub-private keys based on the key derivation algorithm to generate multiple grandchild key pairs: performing calculation and processing on the multiple sub-private keys and the sub-chain encoding corresponding to the multiple sub-private keys based on the key derivation algorithm to obtain multiple grandchild private keys;
[0136] The elliptic curve algorithm is used to calculate and process the multiple grandson private keys to obtain multiple grandson public keys, and there is a correspondence between the grandson public keys and the grandson private keys.
[0137] The blockchain key generation method provided in this embodiment obtains the current operating information of the hardware and encodes the operating information to obtain a first random number. A second random number is generated by calling a quantum random number generator. The first and second random numbers are merged to obtain a third random number. This third random number is used as the seed for the Mason twisting algorithm. The seed is then subjected to cyclic shifting and XOR operations to obtain a target seed. Multiple extractions are performed on the target seed to generate multiple fourth random numbers. These multiple fourth random numbers are merged to obtain the target random number sequence. A hash operation is performed on the target random number sequence to obtain the master private key. Based on the target elliptic curve in the elliptic curve algorithm, a target base point on the target elliptic curve is determined. Based on the target base point and the master private key, the key generation method is performed... The master public key is generated using the elliptic curve algorithm. The master private key is then divided into parent private keys and parent chain codes according to a preset byte size. The parent private key and parent chain codes are processed using the key derivation algorithm to obtain multiple child private keys. These child private keys and the target base point are then processed using the elliptic curve algorithm to obtain multiple child public keys. An address for each child public key is generated based on its index value and identifier information. Similarly, an address for each child private key is generated based on its index value and identifier information. Finally, the multiple child key pairs are stored in a hierarchical deterministic wallet based on their addresses. This approach not only solves the problem of excessive resource requirements for generating long random number sequences using quantum computers but also improves the efficiency of random number sequence generation, thereby increasing the efficiency of key generation.
[0138] Figure 3 A schematic diagram of the blockchain key generation device provided in this application. Figure 3 As shown, this application provides a blockchain key generation device 300, which includes:
[0139] The acquisition module 301 is used to acquire the current operating information of the hardware;
[0140] Processing module 302 is used to encode the running information to obtain a first random number;
[0141] The processing module 302 is also used to generate a second random number by calling a quantum random number generator;
[0142] The processing module 302 is further configured to generate a target random number sequence based on the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by the Mason twisting algorithm;
[0143] The processing module 302 is further configured to perform calculation processing on the target random number sequence based on the elliptic curve algorithm to obtain a master key pair, and to perform calculation processing on the master private key in the master key pair using a key derivation algorithm to obtain multiple sub-key pairs.
[0144] Optionally, the processing module 302 is further configured to merge the first random number and the second random number to obtain a third random number;
[0145] The processing module 302 is further configured to use the third random number as the seed of the Mason twisting algorithm, and to perform cyclic shifting and XOR operations on the seed to obtain the target seed;
[0146] The processing module 302 is further configured to perform multiple extraction processes on the target seed to generate multiple fourth random numbers, and to merge the multiple fourth random numbers to obtain the target random number sequence.
[0147] Optionally, the processing module 302 is further configured to perform a hash operation on the target random number sequence to obtain the master private key;
[0148] The processing module 302 is further configured to determine the target base point on the target elliptic curve based on the target elliptic curve in the elliptic curve algorithm;
[0149] The processing module 302 is further configured to generate a master public key based on the target base point and the master private key using the elliptic curve algorithm.
[0150] Optionally, the processing module 302 is further configured to divide the master private key according to a preset byte size to obtain the parent private key and the parent chain encoding;
[0151] The processing module 302 is further configured to perform calculations on the parent private key and parent chain encoding based on the key derivation algorithm to obtain multiple child private keys;
[0152] The processing module 302 is further configured to perform calculations on the plurality of sub-private keys and the target base point based on the elliptic curve algorithm to obtain a plurality of sub-public keys, wherein the sub-public keys correspond to the sub-private keys.
[0153] Optionally, the processing module 302 is further configured to input the parent private key, the parent chain code, and the first index value into the key derivation function to obtain the first child private key and the first child chain code output by the key derivation function, wherein the index value is the sequence number value corresponding to the increasing order of the child key pair derivation;
[0154] The processing module 302 is further configured to input the parent private key, the parent chain code, and the second index value into the key derivation function to obtain the second sub-private key and the second sub-chain code output by the key derivation function.
[0155] Optionally, the device further includes: a generation module 303;
[0156] The generation module 303 is used to generate the address of each sub-public key according to the index value and identification information corresponding to the plurality of sub-public keys;
[0157] The generation module 303 is further configured to generate the address of each sub-private key based on the index value and identification information corresponding to the plurality of sub-private keys;
[0158] The processing module 302 is further configured to store the plurality of subkey pairs into a hierarchical deterministic wallet according to the address of each sub-private key and the address of each sub-public key.
[0159] Optionally, the processing module 302 is further configured to perform calculations on the plurality of sub-private keys based on the key derivation algorithm to generate a plurality of grandchild key pairs;
[0160] The processing module 302 is further configured to store the plurality of grandchild key pairs into the hierarchical deterministic wallet according to the addresses corresponding to the plurality of grandchild key pairs, wherein the addresses of the grandchild key pairs are determined according to the identification information and index value of the grandchild key pairs.
[0161] Optionally, the processing module 302 is further configured to perform calculations on the plurality of sub-private keys and the sub-chain codes corresponding to the plurality of sub-private keys based on the key derivation algorithm to obtain a plurality of grandchild private keys;
[0162] The processing module 302 is further configured to perform calculations on the multiple grandchild private keys based on the elliptic curve algorithm to obtain multiple grandchild public keys, wherein there is a correspondence between the grandchild public keys and the grandchild private keys.
[0163] Figure 4 A schematic diagram of the blockchain key generation device provided in this application. Figure 4 As shown, this application provides a blockchain key generation device 400, which includes: a receiver 401, a transmitter 402, a processor 403, and a memory 404.
[0164] Receiver 401 is used to receive instructions and data;
[0165] Transmitter 402 is used to send commands and data;
[0166] Memory 404 is used to store instructions executed by the computer;
[0167] The processor 403 is used to execute computer execution instructions stored in the memory 404 to implement the various steps of the blockchain key generation method in the above embodiments. For details, please refer to the relevant descriptions in the foregoing embodiments of the blockchain key generation method.
[0168] Optionally, the memory 404 can be either standalone or integrated with the processor 403.
[0169] When the memory 404 is set up independently, the electronic device also includes a bus for connecting the memory 404 and the processor 403.
[0170] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement a blockchain key generation method executed by the blockchain key generation device described above.
[0171] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the blockchain key generation method as described above.
[0172] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0173] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0174] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0175] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0176] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0177] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0178] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as these combinations of technical features do not contradict each other, they should be considered within the scope of this specification.
[0179] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0180] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for generating blockchain keys, characterized in that, The method includes: Obtain the current operating information of the hardware, and encode the operating information to obtain a first random number; A second random number is generated by calling a quantum random number generator; A target random number sequence is generated based on the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by the Mason rotation algorithm; The target random number sequence is processed using the elliptic curve algorithm to obtain a master key pair. The master private key in the master key pair is then processed using a key derivation algorithm to obtain multiple sub-key pairs.
2. The method according to claim 1, characterized in that, The step of generating a target random number sequence based on the first random number and the second random number includes: The first and second random numbers are combined to obtain the third random number; The third random number is used as the seed of the Mason twisting algorithm, and the seed is subjected to cyclic shifting and XOR operation to obtain the target seed; The target seed is extracted multiple times to generate multiple fourth random numbers, and the multiple fourth random numbers are merged to obtain the target random number sequence.
3. The method according to claim 1, characterized in that, The master key pair includes a master private key and a master public key. The master key pair is obtained by processing the target random number sequence using an elliptic curve algorithm, including: The target random number sequence is hashed to obtain the master private key; Based on the target elliptic curve in the elliptic curve algorithm, determine the target base point on the target elliptic curve; Based on the target base point and the master private key, a master public key is generated using the elliptic curve algorithm.
4. The method according to claim 3, characterized in that, The master private key in the master key pair is processed using a key derivation algorithm to obtain multiple sub-key pairs, including: The master private key is divided into segments according to a preset byte size to obtain the parent private key and the parent chain encoding; Based on the key derivation algorithm, the parent private key and the parent chain encoding are processed to obtain multiple child private keys; The elliptic curve algorithm is used to process the multiple sub-private keys and the target base point to obtain multiple sub-public keys, and the sub-public keys correspond to the sub-private keys.
5. The method according to claim 4, characterized in that, The key derivation algorithm is used to process the parent private key and parent chain encoding to obtain multiple child private keys, including: Input the parent private key, the parent chain code, and the first index value into the key derivation function to obtain the first child private key and the first child chain code output by the key derivation function. The index value is the sequence number value corresponding to the increasing order of the child key pair derivation. The parent private key, the parent chain code, and the second index value are input into the key derivation function to obtain the second child private key and the second child chain code output by the key derivation function.
6. The method according to claim 5, characterized in that, The method further includes: The address of each sub-public key is generated based on the index value and identification information corresponding to the multiple sub-public keys; The address of each sub-private key is generated based on the index value and identification information corresponding to the multiple sub-private keys; Based on the address of each sub-private key and the address of each sub-public key, the multiple sub-key pairs are stored in a hierarchical deterministic wallet.
7. The method according to claim 6, characterized in that, The method further includes: The multiple sub-private keys are calculated and processed based on the key derivation algorithm to generate multiple grandchild key pairs; Based on the addresses corresponding to the multiple grandchild key pairs, the multiple grandchild key pairs are stored in the hierarchical deterministic wallet, and the addresses of the grandchild key pairs are determined based on the identification information and index value of the grandchild key pairs.
8. The method according to claim 7, characterized in that, The calculation and processing of the multiple sub-private keys based on the key derivation algorithm to generate multiple grandchild key pairs includes: Based on the key derivation algorithm, the multiple sub-private keys and the sub-chain encodings corresponding to the multiple sub-private keys are processed to obtain multiple grandchild private keys; The elliptic curve algorithm is used to calculate and process the multiple grandson private keys to obtain multiple grandson public keys, and there is a correspondence between the grandson public keys and the grandson private keys.
9. A key generation device for blockchain, characterized in that, The device includes: The acquisition module is used to obtain the current operating information of the hardware; The processing module is used to encode the running information to obtain a first random number; The processing module is also used to generate a second random number by calling a quantum random number generator; The processing module is further configured to generate a target random number sequence based on the first random number and the second random number, wherein the target random number sequence is a random number sequence generated by the Mason tween algorithm; The processing module is further configured to perform calculations on the target random number sequence based on the elliptic curve algorithm to obtain a master key pair, and to perform calculations on the master private key in the master key pair using a key derivation algorithm to obtain multiple sub-key pairs.
10. An electronic device, characterized in that, The electronic device includes: a processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the blockchain key generation method as described in any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the blockchain key generation method as described in any one of claims 1-8.
12. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the key generation method for the blockchain according to any one of claims 1-8.
Citation Information
Patent Citations
Blockchain account processing method and apparatus, and storage medium
CN109716375A
Key generation method and device
CN114124370A