


Series: Zero to Zero Knowledge
Mnemonic seed phrases underpin one of the most important aspects of cryptocurrency - self-custody.
Today we learn how a seed phrase is generated and used in wallets.
Recovery phrases are defined by the BIP-39 specification, the most common type of recovery phrase used today.
The creation of recovery phrases starts by generating randomness. More entropy means higher security. 128 bits of entropy is considered sufficient for most users.

Depending on the length of initial entropy, the recovery phrase will be 12 to 24 words long.
We start by generating 128 bits of entropy.
We hash the entropy using SHA256. The first few bits of this hash become the checksum.
This gives us a unique fingerprint for our entropy.

The total 132 bits (128 entropy + 4 checksum) are separated into chunks of 11 bits.
Each 11-bit sequence is converted to a decimal number (0-2047).
BIP-39 wordlists contain exactly 2048 words (English, Spanish, Chinese, etc.).
These numbers are used to find the corresponding word in the wordlist.

Result: We now have a secure, human-readable 12-word recovery phrase!
Using the recovery phrase, a wallet can generate keys to create payment addresses and different wallet accounts.
Keys generated are deterministic - the same input always produces the same output.
The wallet seed is derived from the mnemonic phrase using a Key Derivation Function (KDF):
This produces a 64-byte (512-bit) seed.

The seed is split into two 32-byte sequences:
These are used in Hierarchical Deterministic (HD) Wallets for child key derivation.
In Zcash, viewing authority or spending authority can be delegated independently for sub-trees without compromising the master seed.
ZIP-32 defines the hierarchical deterministic key generation standard adapted for Zcash's privacy features.
From an Expanded Spending Key we derive:
Different derivation mechanisms produce external addresses suitable for giving out to senders across shielded pools (Sapling & Orchard).

Zcash also supports internal addresses for wallet operations such as Auto-Shielding.
Original Thread by ZecHub (@ZecHub)
https://x.com/ZecHub/status/1624125037945946145
This page was compiled from the original Zero to Zero Knowledge thread for the ZecHub wiki.