Progress pill
The mnemonic phrase

Entropy and Random Numbers

Bitcoin Wallet Architecture

Entropy and Random Numbers

  • Definition of Entropy
  • Methods of Generating Entropy
Modern HD wallets rely on a single initial piece of information called "entropy" to deterministically generate the entire set of wallet keys. This entropy is a pseudo-random number that partly determines the security of the wallet.

Definition of Entropy

Entropy, in the context of cryptography and information, is a quantitative measure of the uncertainty or unpredictability associated with a data source or a random process. It plays an important role in the security of cryptographic systems, especially in the generation of keys and random numbers. High entropy ensures that the generated keys are sufficiently unpredictable and resistant to brute force attacks, where an attacker tries all possible combinations to guess the key.
In the context of Bitcoin, entropy is used to generate the seed. When creating an HD wallet, the construction of the mnemonic phrase is done from a random number, itself derived from a source of entropy. The phrase is then used to generate multiple private keys, in a deterministic and hierarchical manner, to create spending conditions on UTXOs.

Methods of Generating Entropy

The initial entropy used for an HD wallet is generally 128 bits or 256 bits, where:
  • 128 bits of entropy correspond to a mnemonic phrase of 12 words;
  • 256 bits of entropy correspond to a mnemonic phrase of 24 words.
In most cases, this random number is generated automatically by the wallet software using a PRNG (Pseudo-Random Number Generator). PRNGs are a category of algorithms used to generate sequences of numbers from an initial state, which have characteristics approaching that of a random number, without actually being one. A good PRNG must have properties such as output uniformity, unpredictability, and resistance to predictive attacks. Unlike true random number generators (TRNGs), PRNGs are deterministic and reproducible.
An alternative is to manually generate the entropy, which offers better control but is also much riskier. I strongly advise against generating the entropy for your HD wallet yourself.
In the next chapter, we will see how we go from a random number to a mnemonic phrase of 12 or 24 words.
Quiz
Quiz1/5
What is entropy in the context of cryptography?