0 0 0

BIP84 mnemonic to private key

rinayhiron
1月前 322

The process of converting BIP84 mnemonics to private keys is not directly implemented through the BIP84 specification itself, because BIP84 (or its similar BIPs, such as BIP32, BIP39, etc.) mainly defines the key derivation method and the mnemonic generation rules, rather than directly specifying the conversion algorithm from mnemonics to private keys. However, BIP39 is a specification closely related to mnemonic generation and conversion of private keys. Therefore, we can understand and explain this process based on the BIP39 process. Although BIP84 may differ in details, the general idea is similar.

The general process of converting BIP39 mnemonics to private keys is as follows:

1. Mnemonic generation:
First, generate a 128-256-bit random number, and the number of bits must be a multiple of 32.
Perform SHA256 hash operation on the random number, and take the first X bits as the check bit (X=random number of bits/32).
Add the check bit to the end of the random number.
Group the random number after adding the check bit into groups of 11 bits each.
According to the value of each group (0~2047), the corresponding word is searched in the mnemonic dictionary to obtain the mnemonic sequence.

2. Mnemonic to private key:
The mnemonic and a salt (usually "mnemonic" plus a user-defined password) are normalized and encoded using NFKD.
The result of the previous step is processed using the PBKDF2 algorithm (HMAC-SHA512 as a hash function and multiple iterations, such as 2048 times) to obtain a 512-bit seed.
Of the 512-bit seed, the first 256 bits are the private key. The last 256 bits are usually not used to directly generate private keys, but are used when using derived keys such as BIP32.

It should be noted that BIP84 focuses mainly on the derivation of Bitcoin addresses (especially the P2WPKH and P2WSH types of SegWit addresses), and does not directly define the conversion process from mnemonics to private keys. However, in actual applications, the private key of the BIP84 address is likely to be derived from the master private key through the BIP32 (or similar hierarchical deterministic wallet HD Wallet) protocol, and the master private key may be obtained through the BIP39 mnemonic conversion.

Therefore, although BIP84 does not directly involve the conversion of mnemonics to private keys, we can use BIP39 to convert mnemonics to private keys, and then derive the private keys and addresses required by BIP84 according to BIP32 (or other related protocols).

In addition, due to the rapid development of cryptocurrency and blockchain technology, relevant standards and specifications may be constantly updated and changed, so the latest documents and guidelines should be referred to in actual operations.

Mnemonic to private key

最新回复 (0)

    暂无评论

请先登录后发表评论!

返回
  • 请先登录后发表评论!