What is an HD wallet?

 VPS

 1.jpg

In the past few days, headlines such as "Bitcoin plummeted by 30% in a single day", "Bitcoin evaporated by 1 trillion", "Bitcoin bubble burst" and so on have repeatedly appeared on the home pages of major media. The family and friends of the intelligence agents who were involved in the event asked with concern, "Is there a small loss?", and the intelligence agents could only smile helplessly and continue to eat noodles The self muttered, "If you don't sell, you won't lose.".

The slump in the bear market is the biggest positive, accelerating the departure of speculators and helping believers to hoard coins at low prices. So this brings a problem to believers - how to keep their digital currency? It is impossible to put it on the exchange. It is impossible to put it on the exchange in this life. It means that the exchange may fail before the bull market comes? With the experience of Mentougou, I believe that most coin holders are more willing to keep digital currency in their own hands.

Moreover, with the rise of decentralized exchanges and the emergence of various types of Dapps, wallets are likely to replace exchanges in the future and become the largest portal for the preservation and use of digital assets. Therefore, it is very important to understand the use principle of wallet, which is directly related to the immediate interests of coin holders.

According to different forms of private key storage, mobile wallet apps on the market can be roughly divided into two types: one is pure private key storage, and the other is seed storage (mnemonic storage).

Pure private key storage is well understood. We all know that public key and private key are a pair of keys formed by asymmetric encryption technology. The private key can sign the transaction on the public key, and then prove that it has control over the public key. Therefore, early wallets and most public chain wallets now support the import of private keys.

So what is seed preservation (mnemonic preservation)? Before explaining this problem, we should first clarify a mistake that most people have about mnemonics. Many people used to think (including young spies) that mnemonics are a way of saving private keys created by the wallet company. For example, before you enter a newly installed wallet app, the wallet will prompt you to record a string of words and tell you that recording these words is equivalent to mastering the private key of Bitcoin and Ethereum in the wallet.

In fact, this statement is ambiguous, which makes most people think that mnemonics are transformed from the private key in the wallet through a series of encryption technologies. But in fact, mnemonics are not derived from private keys. On the contrary, private keys are derived from mnemonics, and mnemonics are derived from seeds.

Before introducing the relationship among seed, mnemonic and private key, we should first describe the BIP protocol.

The full name of BIP protocol is Bitcoin Improve Protocol, which means Bitcoin Upgrade Protocol. It is a protocol used to improve the usability of Bitcoin.

In the BIP protocol, BIP32, BIP39, and BIP44 are the protocols for improving the usability of private key management in Bitcoin. More specifically, they are the underlying protocols of HD wallet technology.

The Bitcoin community advocates the Principle Of Avoiding Reuse, that is, the used Bitcoin address should not be used again, which is conducive to the protection of transaction privacy and address security. After all, if an address has too many transaction records, and the address has a large number of contacts with someone, it is equivalent to that person's large number of transaction records are made public. Another advantage of frequent address changes is to improve security. It is also difficult for quantum technology to launch a computing attack on an unknown address. It can also be recognized that the variable transaction output of UTXO is a major guarantee for the improvement of Bitcoin security.

However, if only the old private key management technology is used, it means that the user must preset a lot of Bitcoin addresses in the wallet. These addresses are randomly generated. When the user transfers from one address, in order to ensure the Principle Of Avoiding Reuse, after each transfer, the transaction output will be directed to another address.

One of the biggest problems with this method is the management and storage of private keys. You should know that the number of addresses needs to reach hundreds or thousands to ensure sufficient transactions, which is obviously unfriendly to ordinary traders. This kind of wallet used to store the address without any connection is called uncertainty wallet.


Therefore, BIP32 proposes a set of deterministic wallet solution protocol, namely HD wallet protocol. The full name of HD wallet is the Hierarchical Deterministic Wallet, which is translated as the tree shaped deterministic wallet. As the name implies, the addresses managed in the HD wallet are related, and the generation of addresses is like the relationship of tree species, trunk and branch.

How to understand it?

In BIP32, it specifies how a seed is formed and how the seed generates a series of private keys. Once you master the seed, you control the private key generated from the seed.

Randomly generate a seed for demonstration: [233232995d0e556517d11125ec3e7d1fff8eeae0c36fd9fd91e05832a71451a502e572aa3b118a21a312f9e8c777e2f66e6d83be002dd9ea5bbc9914d7be1d99]. A series of private keys can be derived from this seed, such as [KxV8YyTQ6Agkbtc83kGrEUuH54GxsdqtSKjV8wgP5tBzPPC bbCz7], [KxSoFoyzY1ZMqZUbg2KeCf2aHPGaSKNS2Zd9f3PPenh65sNEc917] 、【L3toyntWFZWqfpuZNr1tMYP8z1v8jGCsAfdikwkoQhsdE3WmFcYc】...

Once you master the seed, you will master these private keys and the Bitcoin controlled by these private keys. The relationship between the seed and the private key is just like the relationship between tree species, trunk and branch. It can be seen that the name of HD wallet is vivid.

It is obviously more convenient to master seeds than hundreds of private keys, but it is obviously not easy to remember 128 bit characters. So the Bitcoin development community proposed a mnemonic scheme in BIP39. The solution proposed in BIP39 is to generate digital mnemonics at random, and seed can be obtained through these words and their order.

The specific solution of BIP39 is to define a word list containing 2048 words (refer to the link: https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt )After generating a series of random sequences, do some algorithm evolution on the series of random sequences to get a new sequence. After dividing the sequence into several parts, correspond each part to a word in the word list to get a mnemonic. And mnemonics can generate seeds through the key generation function PBKDF2.

At this point, the generation process of mnemonic - seed - private key is completed. The BIP32 and BIP39 schemes enable ordinary digital currency holders to manage countless addresses as long as they remember a series of mnemonics.

Of course, the BIP protocol is not only applicable to Bitcoin. In BIP44, a multi currency solution is also proposed, that is, a mnemonic and seed can be used to manage multiple digital currencies, including Bitcoin. For example, Ethereum also supports BIP44. However, it should be noted that a series of protocols of HD Wallet are naturally the most suitable for Bitcoin, but not for other digital currencies. The reason lies in the UTXO feature of Bitcoin, while other public chains, including Ethereum and EOS, are all account systems. The account system means that the balance will be kept in the old account, and if transferred to the new account, an additional handling fee will be required.

At the end of the article, I will add some knowledge about brain wallet. Although it feels like a mnemonic, the brain wallet remembers a string of characters through a string of words and phrases, but the brain wallet generates a string of private keys, not seeds, and the phrase generation of the brain wallet is not random, but largely depends on human language logic.

For example, if you put the sentence "At 7 o'clock this evening, you can see Bond's articles again." into the brain wallet generator, you can get a series of private keys [12ZRkBHjfubmotwyfkzff78AScEkXnhDhb], but as said earlier, "At 7 o'clock this evening, you can see Bond's articles again." This sentence is too logical, and logic and randomness are conflicting things, Only randomness can guarantee safety.

Finally, two interesting addresses are posted for everyone to play:

Web address generated by mnemonics【 https://iancoleman.io/bip39/

Web address generated by brain wallet【 https://www.bitaddress.org

Comment:

◎ Welcome to participate in the discussion. Please express your views and exchange your views here.

 VPS

Related recommendations

  • What is an HD wallet?
    In the past few days, headlines such as "Bitcoin plummeted by 30% in a single day", "Bitcoin evaporated by 1 trillion", "Bitcoin bubble burst" and so on have repeatedly appeared on the home pages of major media, and the family and friends of the intelligence agents came to ask with concern, "Did you lose a lot?"
  • Simple and understandable cryptography
    What is cryptography? The research on the underlying algorithm of cryptography belongs to the field of mathematics, not the focus of our discussion. At the same time, cryptography also implies that people communicate on the Internet
  • What is a hash algorithm?
    The basic meaning of hash algorithm Hash is the basis of cryptography. Understanding hash is a necessary prerequisite for understanding digital signature and encryption communication technologies.     &...