
How to Create a Secure Bitcoin & EVM Wallet
Most people think a wallet is secure because it has a password. It's not. A truly secure wallet is the result of deliberate decisions at every layer — from the first moment of randomness to the final transaction signature. Miss any one of them, and the entire thing can unravel.
Step 1: Start With Unguessable Randomness — Mnemonic Generation
Every wallet begins by generating a large random number called entropy. This must be completely unpredictable — if an attacker can reproduce it, every key and address is compromised. Entropy is converted into your mnemonic phrase (12 or 24 words) following the BIP-39 standard, where each word maps to a chunk of entropy from a 2,048-word list and a checksum is embedded in the final word. The mnemonic is processed into a 512-bit seed from which all keys are derived. An optional passphrase produces a completely different wallet from the same words — a powerful second factor.
| Entropy (256-bit) | BIP-39 Mnemonic | 512-bit Seed | HD Wallet (all keys) |
| + optional passphrase → completely different wallet | |||
Diagram: Mnemonic Generation Flow
Security principle: Your mnemonic phrase is the master key to everything. Store it offline, never digitally, and never share it. A strong passphrase gives you a critical extra layer if the words are ever exposed.
Step 2: Derive All Keys From One Secure Root — HD Wallets & BIP-32
Hierarchical Deterministic (HD) wallets (BIP-32) derive every key from one root, deterministically. A master private key and chain code are generated from your seed, producing an entire tree of child keys in the same order on any device — one backup recovers everything. The chain code ensures a known child key reveals nothing about sibling keys or the parent. At the account level and above, hardened derivation requires the private key to compute, so a leaked child key cannot compromise the rest of the tree.
| Master Key | m (seed root) |
| BTC Legacy | m/44’/0’/0’/addr_index |
| BTC SegWit | m/84’/0’/0’/addr_index |
| ETH / EVM | m/44’/60’/0’/addr_index |
| ’ = hardened derivation | |
Diagram: HD Derivation Tree (hardened paths marked with ’)
Security principle: HD wallets reduce your attack surface to a single secret. Use hardened derivation at account level and above to ensure a leaked child key never endangers the rest of your wallet.
Step 3: Follow the Right Path — Derivation Paths & Standards
Derivation paths define which key to derive — consistently and correctly: m / purpose’ / coin_type’ / account’ / change / address_index. purpose sets the address format; coin_type identifies the blockchain (Bitcoin = 0’, EVM = 60’); account provides logical separation; change separates external (0) from internal change outputs (1); and address_index generates fresh addresses.
For Bitcoin, purpose determines address format:
| Standard | Type | Prefix |
|---|---|---|
| BIP-44 | Legacy (P2PKH) | 1... |
| BIP-49 | SegWit-wrapped (P2SH) | 3... |
| BIP-84 | Native SegWit (bech32) | bc1q... |
| BIP-86 | Taproot (bech32m) | bc1p... |
Native SegWit (BIP-84) and Taproot (BIP-86) are the secure, modern choices — lower fees, stronger privacy, and better long-term support. Legacy paths exist only for backwards compatibility.
Security principle: Always follow established derivation standards. Deviating makes your wallet unrecoverable by any other software — a serious risk if your application ever becomes unavailable.
Step 4: Generate Addresses Correctly — Bitcoin vs. EVM
Bitcoin: Addresses are derived from a public key through cryptographic transformations that vary by address type. Taproot addresses (bc1p...) use an additional cryptographic tweak enabling advanced features while making all addresses look identical on-chain — a meaningful privacy gain.
EVM (Ethereum, Polygon, BNB Chain, Avalanche, and others): derive a public key via elliptic curve cryptography, hash with Keccak-256, take the last 20 bytes, and prefix with 0x. The same address works across every EVM chain; the Chain ID embedded in transactions distinguishes chains — not the address. Always sign with the correct Chain ID to prevent cross-chain replay attacks.
| Private Key (256-bit) | Public Key (secp256k1) | Keccak-256 Hash | 0x Address (last 20 bytes) |
| Always apply EIP-55 checksum encoding when storing / displaying EVM addresses | |||
Diagram: EVM Address Generation
Security principle: Use EIP-55 checksum encoding when storing or displaying EVM addresses. It catches copy-paste errors that could send funds to an unintended or non-existent address.
Step 5: Never Reuse Addresses — Address Rotation
Address reuse is one of the most common and damaging security and privacy mistakes. Bitcoin's UTXO model records every transaction publicly — reusing an address links all your transactions, exposing your balance, history, and spending patterns. HD wallets prevent this by incrementing address_index with each receipt; change outputs go to a dedicated internal chain (change = 1), never shared externally. Track the gap limit (typically 20 unused consecutive addresses) during recovery, and treat change addresses as single-use only.
EVM: Address reuse has no technical downside, but privacy-aware apps can still use HD rotation. Stealth addresses (EIP-5564) enable one-time recipient addresses without sharing a new address for each transaction.
Security principle: For Bitcoin, address rotation is a core security feature — build it in from the start. For EVM, consider whether rotating addresses or stealth address support adds meaningful privacy value.
Step 6: Share Public Keys Carefully — Extended Public Keys (xpub)
An extended public key (xpub, ypub, or zpub) lets a wallet derive all public keys and addresses in a branch without private key access, enabling: watch-only wallets (monitor balances without signing); offline signing (air-gapped device holds the private key); and multisig coordination (multiple co-signers must approve every transaction). The critical caveat: an xpub cannot move funds, but it reveals every address you have ever used and will ever generate — a complete map of your transaction history. Treat it with nearly the same care as a private key.
Security principle: xpub enables powerful architectures like offline signing and multisig — use them. But never share an xpub casually; its exposure is a full privacy breach even though funds remain safe.
Step 7: Sign in a Secure Context — Transaction Signing
The private key's one job is signing transactions — it must never leave the secure environment where it lives.
- Bitcoin Legacy/SegWit: ECDSA over secp256k1. Taproot: Schnorr signatures (BIP-340) enable key aggregation via MuSig2 so multiple signers produce a single indistinguishable signature. Nonces must always be generated deterministically — nonce reuse has led to complete private key recovery in real attacks.
- EVM: ECDSA over secp256k1. EIP-155 embeds the Chain ID in every signature, preventing replay attacks. EIP-712 defines structured data signing used across DeFi and NFT apps — users verify exactly what they are approving rather than blindly signing raw data.
Security principle: Sign transactions locally. Never send a private key to a server or third-party service. For significant holdings, sign on an offline or air-gapped device and broadcast only the final signed transaction.
The Security Stack, End to End
| Layer | What Makes It Secure |
|---|---|
| Mnemonic generation | Genuine randomness + BIP-39 checksum + optional passphrase |
| HD derivation (BIP-32) | Single root, hardened derivation at account level |
| Derivation paths | Standard paths (BIP-44/84/86) ensure recoverability |
| Address generation | Correct cryptographic process per chain and address type |
| Address rotation | Fresh address per transaction (Bitcoin); privacy-aware design (EVM) |
| xpub management | Powerful for watch-only and multisig — but guard carefully |
| Transaction signing | Local signing only, deterministic nonces, EIP-155 for EVM |
A secure wallet is not a single feature — it is a chain of correct decisions, each one building on the last. Weaken any link — poor randomness, reused addresses, an exposed xpub, a key that touches the internet — and the entire chain fails. Get every layer right, and you've built something that earns the trust it receives.
Which of these layers do you think is most commonly overlooked in wallet implementations? Share your thoughts below.
