I made a thread recently
How best to secure your Private Keys and/or Seed phrase and in it I briefly discussed; private keys, public keys and master public keys. Turned out I had so many misconceptions about these concepts I did a little research to try and correct some of those misconceptions.
The concepts include:
1) Seed Phrase
2) Private Keys
3) Master Private Keys
4) Public keys
5) Master Public Keys
Introduction:
All of the above theories are related to wallets and asset security. They are also interdependent in specific wallet types like HD Wallets
- Seed Phrases: This is also commonly called; recovery phrase, recovery seed, mnemonic phrase etcetera. A Seed phrase is a collection of 12, 18, 24 words that are used to back up a wallet address. The words are generated using BIP 39 standard from a collection of 2048 words.
A degree of randomness (entropy) is used to secure the phrase and it approximately has the same strength as a private key. * this applies to a 12 word seed phrase: 2048^12 = 2^132 and the phrase would have 132 bits of security, but as the words are not entirely randomly chosen it's actual security level is 128 bits, corresponding to private key level. Any higher number of word combination has a higher level of security.
red yellow green purple orange
Indigo violet brown pink grey white blue
A seed phrase can be used to generate all the key pairs of a deterministic wallet and can be used to recover a wallet software in case of loss.
- The words used in a seed phrase can be accurately identified from the first four letters of the word,
"The wordlist can contain native characters, but they must be encoded in UTF-8 using Normalization Form Compatibility Decomposition (NFKD)"
Master extended private key/public key: This can be represented by the acronym; xpriv and xpub respectively. They can be derived from the seed phrase, however, they do not serve the same purpose. A master extended private key is used it generates multiple private keys, however, it can not be used to sign an address. Xpriv is also used to generate the xpub (master extended private key), which in turn generates all the public addresses in the bitcoin wallet. It is used (on its own) to create a "watch only" however, it can not be used to send bitcoin from a wallet. Combined with anyone's private key of an address, it can be used to generate all the other private keys of all related public addresses.
Private keys: This is a 256-bit number, it is a collection of alphanumeric characters *depending on the encoding. They are used to spend bitcoins in a wallet and also to sign a transaction. They are generated from the xpriv and in turn used to derive the public keys. This process can not, however, be reversed, i.e, public keys can not generate the private keys.
- Private keys should never be shared with anyone.
- They should be kept in a secured place and safely backed up.
Public keys: This is derived from the private keys multiplied by the curve generator. The sequence can not be reverse engineered, i.e, public keys cannot be used to generate private keys. It is used only for receiving funds and is displayed publicly whenever a transaction is made
As mentioned earlier all these features of an HD wallet are connected, this is the hierarchical system
*Seed phrase can generate the xpriv and all other key pairs of the wallet
*The Master extended private key can generate all private keys
*The Master extended public key can generate all public keys. Xpub + any private key (nP) can be used to generate all private keys of the other addresses.
*The private key generates the public key associated with it. 1 private key = 1 public key
*The public key can not be reversed to derive the private key. It is kept public and hence the algorithm does not support it generating any key/phrase to ensure security.