|
| 1 | +--- |
| 2 | +title: MetaMask & Wallet Fundamentals |
| 3 | +description: A beginner-friendly guide to wallets, keys, gas, and DeFi basics. |
| 4 | +--- |
| 5 | + |
| 6 | +# 🦊 MetaMask & Wallet Fundamentals |
| 7 | + |
| 8 | +*A practical introduction to how wallets, keys, gas, and DeFi actually work.* |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 🤔 What Is a Wallet? (It’s not what you think) |
| 13 | + |
| 14 | +### ❌ MetaMask is NOT |
| 15 | +- A place where your money is stored |
| 16 | +- A bank |
| 17 | +- A blockchain |
| 18 | + |
| 19 | +### ✅ MetaMask IS |
| 20 | +- 🔐 **Key manager** – securely stores your private keys (encrypted) |
| 21 | +- 🌐 **RPC client** – talks to blockchains via `window.ethereum` |
| 22 | +- ✍️ **Signer** – cryptographically signs transactions and messages |
| 23 | + |
| 24 | +> **Key takeaway:** |
| 25 | +> The blockchain is the database. |
| 26 | +> MetaMask is just the communicator. |
| 27 | +> If MetaMask disappears, your account still exists. |
| 28 | +
|
| 29 | +--- |
| 30 | + |
| 31 | +## 🔑 Public vs. Private Keys |
| 32 | + |
| 33 | +- **Private Key** 🔒 |
| 34 | + - Proves ownership |
| 35 | + - Never share (outside dev/test scenarios) |
| 36 | + |
| 37 | +- **Public Key** 🔓 |
| 38 | + - Derived from the private key |
| 39 | + |
| 40 | +- **Address** 📬 |
| 41 | + - Hash of the public key |
| 42 | + - Safe to share |
| 43 | + - Used to receive funds |
| 44 | + |
| 45 | +⚠️ Blockchain transactions are **final**. |
| 46 | +There is no undo button. |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## 🌱 Seed Phrases (BIP-39) |
| 51 | + |
| 52 | +### 🧮 The math |
| 53 | +- 12 words = representation of massive entropy |
| 54 | +- Based on a fixed list of **2048 words** |
| 55 | +- Total combinations: **~5.4 × 10³⁹** |
| 56 | + |
| 57 | +### 🌳 The hierarchy |
| 58 | +Seed Phrase → Private Keys → Public Keys → Addresses |
| 59 | + |
| 60 | +### 🚨 The danger |
| 61 | +- One seed controls **all derived accounts** |
| 62 | +- Leaking the seed = total loss |
| 63 | +- Wallet passwords only protect **locally**, not on-chain |
| 64 | + |
| 65 | +> Whoever has the seed **is you**. |
| 66 | +
|
| 67 | +--- |
| 68 | + |
| 69 | +## ⛽ Gas = Compute Credits |
| 70 | + |
| 71 | +You cannot write to the blockchain for free. |
| 72 | + |
| 73 | +### The formula |
| 74 | +Transaction Fee = Gas Used × Gas Price |
| 75 | +### Key concepts |
| 76 | +- **Gas** → amount of computation |
| 77 | +- **Gas limit** → max you’re willing to pay |
| 78 | +- **Gas price (Gwei)** → priority in the network |
| 79 | +- **Nonce** → your personal transaction counter |
| 80 | + (prevents replay attacks) |
| 81 | + |
| 82 | +Higher gas price = faster inclusion ⏩ |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## 🔍 Reading the Blockchain (Etherscan) |
| 87 | + |
| 88 | +- The blockchain is a **public database** |
| 89 | +- Anyone can inspect: |
| 90 | + - Transactions |
| 91 | + - Balances |
| 92 | + - Contract interactions |
| 93 | +- Tools like **Etherscan** are just explorers — not special permissions |
| 94 | + |
| 95 | +> Sending crypto = writing to the database |
| 96 | +> Reading Etherscan = reading the database |
| 97 | +
|
| 98 | +--- |
| 99 | + |
| 100 | +## 🔁 What Is Uniswap? |
| 101 | + |
| 102 | +### 🧠 As a protocol |
| 103 | +- Smart contracts deployed on Ethereum |
| 104 | +- Runs autonomously (no servers, no company) |
| 105 | +- Can be used without a website |
| 106 | + |
| 107 | +### 🖥️ As a dApp |
| 108 | +- Website = graphical interface |
| 109 | +- Generates complex transactions for you |
| 110 | +- Your wallet signs and submits them |
| 111 | + |
| 112 | +> The frontend is optional. |
| 113 | +> The smart contracts are the real product. |
| 114 | +
|
| 115 | +--- |
| 116 | + |
| 117 | +## ✅ The “Approval” Pattern (Very Important) |
| 118 | + |
| 119 | +### The problem |
| 120 | +Smart contracts cannot move your tokens automatically. |
| 121 | + |
| 122 | +### The solution (ERC-20 standard) |
| 123 | +1. **Approve** |
| 124 | + > “I allow Uniswap to spend 100 USDC” |
| 125 | +2. **TransferFrom** |
| 126 | + > “Uniswap takes the USDC and gives ETH” |
| 127 | +
|
| 128 | +### ETH vs Tokens |
| 129 | +- **ETH** → native currency (no approval needed) |
| 130 | +- **ERC-20 tokens** → separate contracts (approval required) |
| 131 | + |
| 132 | +⚠️ Token → ETH swaps always need approval first. |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +## 🏠 To-Do (Recommended Practice) |
| 137 | + |
| 138 | +- Swap ETH → USDC on Uniswap |
| 139 | +- Supply USDC as collateral |
| 140 | +- Borrow DAI |
| 141 | +- Research: |
| 142 | + - Lending protocols (Aave) |
| 143 | + - Health factor |
| 144 | + - Liquidation risk |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## 🧠 Final Takeaways |
| 149 | + |
| 150 | +- Wallets manage **keys**, not money |
| 151 | +- Seed phrases are absolute power |
| 152 | +- Gas is payment for computation |
| 153 | +- dApps = frontend + smart contracts |
| 154 | +- Approvals are fundamental to DeFi |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +**Understand this once — avoid costly mistakes forever. 🛡️** |
0 commit comments