Wallets & MetaMask
A wallet manages private keys and signs transactions — it does NOT store your coins (the blockchain does). MetaMask is the most widely used browser wallet and is the standard for Web3 dApp integration.
How Wallets Work
A crypto wallet is a key management tool, not a money container.
Your assets live on the blockchain. The wallet stores the private key that proves you own those assets.
BIP-39 Seed Phrase (Mnemonic):
- 12 or 24 English words
- Encodes a 128 or 256-bit entropy value
- Deterministically generates unlimited key pairs via BIP-32 HD wallet tree
- Example path: m/44'/60'/0'/0/0 → first Ethereum account
From seed phrase → private key → public key → address:
Every time. Deterministic. Same seed = same addresses forever.
MetaMask stores your encrypted seed phrase in browser storage.
Hardware wallets (Ledger, Trezor) store seed phrases on a secure chip, never exposed to the internet.MetaMask Integration in dApps
MetaMask injects window.ethereum into the browser when the extension is installed.
This object is an EIP-1193 compliant Ethereum provider:
- eth_requestAccounts → prompts user to connect wallet, returns addresses
- eth_chainId → returns current network as hex (0x1 = mainnet, 0xaa36a7 = Sepolia)
- eth_sendTransaction → prompts user to sign & send a transaction
- wallet_switchEthereumChain → prompts user to switch networks
Modern dApps use wagmi + viem (React) or ethers.js to abstract window.ethereum.Common Mistakes
- Storing private keys in .env files committed to git — use a hardware wallet for mainnet, never expose private keys in version control
- Not handling the case where MetaMask is not installed — always check for window.ethereum before calling any methods
- Not listening to accountsChanged/chainChanged events — your UI will show stale data if the user switches accounts or networks mid-session
- Using the mnemonic 'abandon abandon abandon...' on mainnet — this is a well-known test mnemonic; any ETH sent there is immediately stolen by bots
Tip
Tip
Practice Wallets MetaMask in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Once deployed, smart contracts are immutable — code is law
Practice Task
Note
Practice Task — (1) Write a working example of Wallets MetaMask from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with Wallets MetaMask is skipping edge case testing — empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready web3 code.
Key Takeaways
- A wallet manages private keys and signs transactions — it does NOT store your coins (the blockchain does).
- Storing private keys in .env files committed to git — use a hardware wallet for mainnet, never expose private keys in version control
- Not handling the case where MetaMask is not installed — always check for window.ethereum before calling any methods
- Not listening to accountsChanged/chainChanged events — your UI will show stale data if the user switches accounts or networks mid-session