HD Wallets และ Derivation Paths อธิบาย (BIP44)
สารบัญ
เมื่อคุณตั้งค่า cryptocurrency wallet และได้รับ seed phrase 12 คำ backup เดียวนั้นให้คุณเข้าถึงทุก account ที่ wallet จะสร้าง --- บน Bitcoin, Ethereum, Solana และ chain อื่นๆ ที่รองรับ กลไกที่ทำให้สิ่งนี้เป็นไปได้เรียกว่า HD wallet และระบบ addresses ที่ใช้ถูกกำกับโดย derivation paths
คู่มือนี้อธิบายว่า HD wallets เปลี่ยน seed เดียวเป็น keys ไม่จำกัดได้อย่างไร, derivation path เช่น m/44'/60'/0'/0/0 หมายความว่าอะไร และทำไมการใช้ path ที่ถูกต้องจึงสำคัญเมื่อย้ายระหว่าง wallets หรือ blockchains
HD Wallet คืออะไร?¶
HD ย่อมาจาก Hierarchical Deterministic เทอมนี้มาจาก BIP32 ซึ่ง define วิธี derive tree ของ cryptographic key pairs จาก root เดียว
Hierarchical หมายถึง keys จัดระเบียบในโครงสร้าง tree --- parent key สร้าง child keys ได้ และ children เหล่านั้นสร้าง grandchildren ได้
Deterministic หมายถึงกระบวนการทำซ้ำได้ เมื่อให้ root เดียวกัน (master seed) จะสร้าง tree of keys เดียวกันทุกครั้ง ในทุก wallet ที่ทำตามมาตรฐาน
ก่อน HD wallets ทุก address ใหม่ต้องสร้างและ backup private key แบบสุ่มแยกต่างหาก HD wallets กำจัดปัญหานี้ backup seed ครั้งเดียว และทุก key ที่ wallet derive ในอนาคตครอบคลุมโดย backup นั้นแล้ว
root ของ tree มาจาก BIP39 seed phrase mnemonic ถูกแปลงเป็น 512-bit binary seed ผ่าน PBKDF2 (ตามที่อธิบายใน BIP39 Explained)
วิเคราะห์ m/44'/60'/0'/0/0¶
derivation path คือ address ใน tree ที่ระบุ key เฉพาะ decode m/44'/60'/0'/0/0 path มาตรฐานสำหรับ Ethereum address แรก:
m / 44' / 60' / 0' / 0 / 0
│ │ │ │ │ │
│ │ │ │ │ └── Address index (0 = address แรก)
│ │ │ │ └────── Change (0 = external/receiving, 1 = internal/change)
│ │ │ └─────────── Account (0 = account แรก)
│ │ └───────────────── Coin type (60 = Ethereum)
│ └──────────────────────── Purpose (44 = BIP44 standard)
└──────────────────────────── Master key (root ของ tree)
m --- Master key จุดเริ่มต้นของทุก derivation path
44' --- Purpose เลข 44 ระบุว่า path นี้ทำตาม BIP44 standard apostrophe (') mark ว่าเป็น "hardened" derivation
60' --- Coin type cryptocurrency แต่ละตัวได้รับเลขจาก SLIP-44 Ethereum คือ 60, Bitcoin คือ 0, Solana คือ 501
0' --- Account index คิดว่าเป็น wallet แยกใน wallet Account 0 คือ default
0 --- Change level ใน Bitcoin UTXO model, 0 หมายถึง external (receiving) addresses, 1 หมายถึง internal (change) addresses
0 --- Address index เลขสุดท้ายที่เพิ่มขึ้นเพื่อสร้าง addresses ใหม่
BIP44 และ SLIP-44 Coin Types¶
BIP44 กำหนดมาตรฐาน derivation path structure SLIP-44 ดูแล registry ของ coin type numbers assignments ที่พบบ่อย:
| Coin Type | Blockchain | Default Path |
|---|---|---|
| 0 | Bitcoin | m/44'/0'/0'/0/0 |
| 2 | Litecoin | m/44'/2'/0'/0/0 |
| 60 | Ethereum (และ EVM chains) | m/44'/60'/0'/0/0 |
| 144 | XRP | m/44'/144'/0'/0/0 |
| 195 | Tron | m/44'/195'/0'/0/0 |
| 501 | Solana | m/44'/501'/0'/0' |
สังเกตว่า Avalanche C-Chain ใช้ coin type 60 (ของ Ethereum) เพราะ C-Chain เป็น EVM-compatible เช่นเดียวกับ Polygon, Arbitrum, Optimism และ Base --- ทั้งหมดใช้ m/44'/60'/0'/0/0
Chains ต่างกัน Paths ต่างกัน¶
Bitcoin Paths¶
Bitcoin มีหลาย address formats:
| Standard | Path | Address Type | Prefix |
|---|---|---|---|
| BIP44 | m/44'/0'/0'/0/0 |
Legacy (P2PKH) | 1... |
| BIP49 | m/49'/0'/0'/0/0 |
Nested SegWit (P2SH-P2WPKH) | 3... |
| BIP84 | m/84'/0'/0'/0/0 |
Native SegWit (bech32) | bc1q... |
| BIP86 | m/86'/0'/0'/0/0 |
Taproot | bc1p... |
ถ้าคุณ restore seed แล้ว funds ไม่แสดง wallet อาจกำลังสแกน derivation path ที่ผิด สำหรับรายละเอียด Bitcoin address formats ดู Crypto Address Formats Explained
Solana Paths¶
Solana ใช้ ed25519 แทน secp256k1 ดังนั้น derivation แตกต่างโครงสร้าง path มาตรฐานคือ m/44'/501'/0'/0' สำหรับ walkthrough โดยละเอียดดู Solana Wallet Generation Guide
Step-by-Step Key Derivation¶
จาก seed phrase ถึง Ethereum address ที่ใช้ได้:
Step 1: Mnemonic สู่ Seed¶
12-word mnemonic ผ่าน PBKDF2-HMAC-SHA512 ด้วย 2,048 iterations และ salt "mnemonic" output คือ 512-bit binary seed
Step 2: Seed สู่ Master Key¶
512-bit seed ผ่าน HMAC-SHA512 ด้วย key "Bitcoin seed" 256 bits ซ้ายเป็น master private key, 256 bits ขวาเป็น master chain code
Step 3: Master Key สู่ Child Keys¶
เริ่มจาก master key แต่ละระดับของ derivation path ทำ child key derivation (CKD) function
Step 4: Private Key สู่ Public Key¶
ที่ level สุดท้าย child private key ถูกแปลงเป็น public key ผ่าน elliptic curve multiplication
Step 5: Public Key สู่ Address¶
public key ถูก hash เพื่อสร้าง blockchain address สำหรับ Ethereum hash ด้วย Keccak-256 และเอา 20 bytes สุดท้ายพร้อม prefix 0x
ดูกระบวนการทั้งหมดใน Ethereum Address Generator หรือ Bitcoin Address Generator ของ SafeSeed
ทำไมสิ่งนี้สำคัญในทางปฏิบัติ¶
- Restore wallet ใน software ต่างกัน ตรวจสอบว่า derivation path match กัน seed เดียว + path ต่าง = addresses ต่าง
- เข้าถึงหลาย chains seed phrase ของคุณครอบคลุม Polygon, Arbitrum และ EVM chains อื่นแล้ว
- Debug missing funds ถ้า restore Bitcoin seed แล้วไม่เห็น balance ลอง toggle ระหว่าง BIP44, BIP49 และ BIP84 paths
- สร้าง addresses สำหรับวัตถุประสงค์เฉพาะ โดยเพิ่ม account index สร้าง wallets ที่แยกกัน logically จาก seed phrase เดียวกัน
ระบบ derivation path คือสิ่งที่เปลี่ยน seed phrase เดียวเป็น multi-chain, multi-account wallet เมื่อคุณเข้าใจแล้ว คุณสามารถย้ายระหว่าง wallets, chains และ address formats ได้อย่างมั่นใจ