HD Wallets — How to Generate and Save Crypto Keys the Right Way

One mnemonic. Bitcoin, Ethereum, Solana. Zero trust required.

 ·  crypto · security · self-custody · bip39

Most people lose crypto in one of two ways: their keys are stolen, or they lose access themselves. Both failures share the same root cause — they never understood what they were actually holding.

This guide explains HD wallets from first principles, then walks through exactly how to generate and store keys so you stay in control forever.

Open the key generator → Everything runs inside your browser. No data ever leaves your device.


What is an HD wallet?

A hierarchical deterministic (HD) wallet is a system that generates an unlimited number of key pairs — Bitcoin addresses, Ethereum addresses, Solana addresses — from a single secret: a 12–24 word recovery phrase.

The phrase is the root. Every address you'll ever use is derived from it mathematically. Lose the phrase, lose everything. Keep the phrase, recover everything — on any device, with any compatible wallet app, forever.

The standards that make this work:

StandardWhat it does
BIP39Converts random bytes into a human-readable word list
BIP32Derives a tree of child keys from a master key
BIP44/84Defines the derivation path per coin (m/44'/0'/… for Bitcoin, m/44'/60'/… for Ethereum)
SLIP-0010Ed25519 variant used for Solana

The magic is that the derivation is deterministic and one-way. Given the phrase, you always get the same addresses. Given an address, you cannot go back to the phrase.


The key hierarchy

24-word mnemonic  (your only real secret)
    │
    ├── Bitcoin Legacy   m/44'/0'/0'/0/0    1A…
    ├── Bitcoin SegWit   m/84'/0'/0'/0/0    bc1q…
    ├── Ethereum         m/44'/60'/0'/0/0   0x…
    └── Solana           m/44'/501'/0'/0'   …base58…

All four addresses come from one phrase. You only need to back up one thing.


How to generate keys securely

1. Use a browser-only tool

The gold standard for key generation is a tool that:

hd-keygen meets all four criteria. The cryptographic libraries (noble/secp256k1, noble/hashes) are inlined in the HTML — there is no CDN dependency, no tracking, no backend.

2. Add your own randomness (optional but good practice)

Open the "Add extra randomness" section before generating. Type anything — keyboard mash, random characters, whatever. Your input is SHA-256 hashed and XOR'd with crypto.getRandomValues. Even if you type nothing, the system entropy alone is cryptographically strong. Adding your own entropy ensures that even a compromised random number generator cannot predict your keys.

3. Choose 24 words

12 words give 128 bits of entropy — technically secure, but 24 words give 256 bits. For long-term cold storage there is no reason to use fewer than 24 words.

4. Generate offline when the stakes are high

For significant amounts, open the tool page, then disconnect from the internet before generating. This eliminates any possibility of a network-layer attack observing your keys as they are generated. You can run it from a local file:

# Download the single HTML file
curl -O https://raw.githubusercontent.com/7feilee/7feilee.github.io/main/hd-keygen/index.html
open index.html

How to save keys safely

This is where most people fail. The threat model has three parts:

  1. Loss — fire, flood, forgotten password, dead hard drive
  2. Theft — physical break-in, malware, phishing
  3. Inaccessibility — you die and no one you trust can recover the funds

A single backup solves none of these. You need redundancy with separation.

The two-layer system

Layer 1: Physical backup (what you write down)

Write all 24 words on paper or stamp them into metal. Metal survives fire and water; paper does not. Number each word. Store in at least two separate physical locations — for example, your home and a safety deposit box.

Never store the phrase digitally in plaintext. No photos, no notes app, no email to yourself, no password manager field labeled "seed phrase."

Layer 2: Encrypted digital backup (what you save to the cloud)

Use the "Save encrypted backup" function in the tool. It encrypts your recovery phrase with AES-256-GCM and 600,000 PBKDF2-SHA256 iterations — the same standard used by password managers. Save the .enc file to:

The encrypted file is useless without the passphrase. The passphrase should be:

The separation principle

ItemLocation
24-word paper backupHome safe
Duplicate paper backupSafety deposit box or trusted person
master_key.encCloud (Google Drive / iCloud)
master_key.enc duplicateUSB drive, third location
Encryption passphrasePhysical notebook, separate from above

No single location holds enough to reconstruct your keys. An attacker who steals your laptop gets the encrypted file but not the passphrase. A burglar who finds your notebook gets the passphrase but not the encrypted file. A fire that destroys your home doesn't destroy the cloud copy or the safety deposit box.

Verify your backups

After saving, test that you can recover. Clear the tool, then reimport the phrase from your paper backup and re-derive your addresses. Confirm they match. Do this once a year.

You can also verify the encrypted file can be decrypted offline without a browser:

# Node.js
node -e "const d=require('fs').readFileSync('master_key.enc'),c=require('crypto');const k=c.pbkdf2Sync('YOUR_PASSPHRASE',d.slice(5,37),600000,32,'sha256'),g=c.createDecipheriv('aes-256-gcm',k,d.slice(37,49));g.setAuthTag(d.slice(-16));process.stdout.write(g.update(d.slice(49,-16),'','utf8')+g.final('utf8'))"

# Python
python3 -c "import hashlib;from cryptography.hazmat.primitives.ciphers.aead import AESGCM;d=open('master_key.enc','rb').read();k=hashlib.pbkdf2_hmac('sha256',b'YOUR_PASSPHRASE',d[5:37],600000);print(AESGCM(k).decrypt(d[37:49],d[49:],None).decode())"

What not to do


Quick-start checklist

One afternoon of setup. A lifetime of control.


Built on noble cryptography — audited, dependency-free JavaScript. Source: github.com/7feilee/7feilee.github.io.