Solana Wallet Generation: ed25519 Keys และ Addresses
สารบัญ
Solana เป็นหนึ่งในBlockchains ที่ใช้งานกว้างขวางที่สุดสำหรับทั้ง DeFi และ consumer applications แต่ wallet generation process แตกต่างจาก Bitcoin และ Ethereum อย่างมีนัยสำคัญ Elliptic curve ต่างกัน derivation paths ต่างกัน address encoding ต่างกัน
คู่มือนี้ครอบคลุมกระบวนการ Solana wallet generation ทั้งหมด: ed25519 elliptic curve, Solana-specific derivation paths, Base58 address encoding และ security considerations เฉพาะ Solana ecosystem
Solana ต่างจาก Bitcoin และ Ethereum อย่างไร¶
| Property | Bitcoin / Ethereum | Solana |
|---|---|---|
| Elliptic curve | secp256k1 | ed25519 |
| Signature scheme | ECDSA | EdDSA (Ed25519) |
| Private key size | 32 bytes | 64 bytes (expanded) |
| Public key size | 33 bytes (compressed) | 32 bytes |
| Address encoding | Bech32 / Hex | Base58 |
| Derivation path | m/44'/0'/0' หรือ m/44'/60'/0'/0 | m/44'/501'/0'/0' |
Design choices ของ Solana สะท้อน priorities: high throughput และ fast signature verification Ed25519 signatures verify เร็วกว่า ECDSA ราวสองเท่า สำหรับการเปรียบเทียบ curves ดู secp256k1 vs ed25519
ed25519 Curve¶
Ed25519 เป็น specific instance ของ Edwards-curve Digital Signature Algorithm (EdDSA) ทำงานบน Curve25519 Define บน prime field 2^255 - 19 Security level ประมาณ 128 bits --- เทียบเท่า secp256k1
Key Generation¶
Solana private key เริ่มจาก 32-byte random scalar hash ด้วย SHA-512 ได้ 64-byte expanded key Lower 32 bytes (หลัง bit clamping) เป็น signing scalar
Public key derive จากการ multiply clamped scalar กับ base point B ของ curve 32-byte public key ก็คือ Solana address --- ไม่มี additional hashing step เหมือน Ethereum
Random 32 bytes → SHA-512 → 64-byte expanded key
→ Lower 32 bytes (clamped) × Base point B → 32-byte public key = Solana address
Deterministic Signatures¶
ข้อดีของ ed25519: signatures เป็น deterministic ECDSA ต้องการ random nonce สำหรับทุก signature และ faulty random number generator สามารถ leak private key อย่างร้ายแรง Ed25519 derive nonce จาก message และ private key
Performance¶
Ed25519 signature verification เร็ว --- ราว 70,000 verifications ต่อวินาทีบน single modern CPU core เร็วกว่า ECDSA ราวสองเท่า
Solana Derivation Paths¶
Standard Path: m/44'/501'/0'/0'¶
Canonical Solana derivation path:
m/44'/501'/0'/0'
ตาม BIP44:
44'--- Purpose: BIP44 multi-account hierarchy501'--- Coin type: SLIP44 registered index สำหรับ Solana0'--- Account: account แรก0'--- Address index (Solana convention)
สังเกตว่าทั้งสี่ levels ใช้ hardened derivation ต่างจาก Ethereum m/44'/60'/0'/0/0 ที่ใช้ non-hardened สำหรับสอง levels สุดท้าย Solana all-hardened paths ให้ stronger isolation
Multiple Accounts¶
- Account แรก:
m/44'/501'/0'/0' - Account ที่สอง:
m/44'/501'/1'/0' - Account ที่สาม:
m/44'/501'/2'/0'
Compatibility Considerations¶
ไม่ใช่ทุก Solana wallets ใช้ derivation path เดียวกัน Solana CLI ใช้ m/44'/501' (สอง levels) ขณะที่ GUI wallets ส่วนใหญ่ใช้ m/44'/501'/0'/0' เมื่อ recover wallet ยืนยัน derivation path ที่ expected
Solana Seed Phrase Generator ของ SafeSeed แสดง exact derivation path
Step-by-Step Wallet Generation¶
Step 1: Generate Entropy¶
Produce 128 bits (12-word phrase) หรือ 256 bits (24-word phrase) entropy SafeSeed ใช้ browser Web Crypto API
Step 2: สร้าง Mnemonic¶
Append SHA-256 checksum bits แบ่งเป็น 11-bit segments map ไปยัง BIP39 word list Process เหมือน Bitcoin และ Ethereum --- BIP39 blockchain-agnostic ดู BIP39 Explained
Step 3: Derive Master Seed¶
Apply PBKDF2-HMAC-SHA512 2,048 iterations produce 512-bit master seed
Step 4: Derive Solana Key¶
Walk derivation path m/44'/501'/0'/0' Solana ใช้ ed25519 ดังนั้น child key derivation ใช้ SLIP-0010 standard (ไม่ใช่ BIP32 โดยตรง)
Output คือ 32-byte ed25519 seed
Step 5: Generate Keypair¶
Feed 32-byte seed เข้า ed25519 key generation:
- Compute SHA-512 ของ seed --- 64 bytes
- Apply bit clamping กับ lower 32 bytes
- Multiply clamped scalar กับ base point B --- 32-byte public key
Step 6: Encode Address¶
Encode 32-byte public key ด้วย Base58 ไม่มี additional hashing ไม่มี prefix byte
Generate และ inspect flow ทั้งหมดด้วย Solana Private Key Generator ของ SafeSeed
Base58 Address Format¶
Solana addresses ใช้ Base58 encoding --- alphabet เดียวกับ Bitcoin legacy addresses ที่ exclude visually confusing characters
Typical Solana address:
7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV
Properties¶
- Length: 32--44 characters (ส่วนใหญ่ 43--44)
- Character set:
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz - ไม่มี prefix: ต่างจาก Bitcoin (
1,3,bc1) หรือ Ethereum (0x) - ไม่มี embedded checksum: ต่างจาก Base58Check (Bitcoin legacy addresses)
ไม่มี checksum ทำให้ careful handling จำเป็น ใช้ copy-paste แทน manual transcription Validate ด้วย Solana Address Validator สำหรับ address formats ข้ามBlockchains ดู Crypto Address Formats Explained
Security Considerations สำหรับ Solana¶
Offline Generation สำคัญมาก¶
เพราะ Solana addresses ไม่มี embedded checksum mistakes ระหว่าง generation ตรวจจับยากกว่า Generate offline --- บนเครื่องที่ไม่มี network connection SafeSeed tools ออกแบบมาสำหรับนี้ ดู Online Seed Generator Safety
Keypair Files¶
Solana CLI เก็บ private keys เป็น JSON arrays ของ 64 bytes (ed25519 keypair) Protect keypair files ด้วย rigor เดียวกับ seed phrases
Token Accounts¶
ต่างจาก Ethereum ที่ ERC-20 tokens ถืออยู่ที่ address เดียวกับ ETH Solana ใช้ associated token accounts (ATAs) --- on-chain accounts แยกสำหรับแต่ละ token type ATAs ทั้งหมดถูกควบคุมโดย private key เดียวกัน seed phrase backup จึงเพียงพอ
Program Derived Addresses (PDAs)¶
Solana PDAs --- addresses ที่ generate แบบ deterministic จาก program ID และ seeds โดยเจตนาไม่มี corresponding private key --- smart contracts (programs) ใช้ manage on-chain state ไม่ใช่ user-controlled wallets
Private Key Security Best Practices¶
Fundamentals เหมือนกัน chain ไหนก็ตาม: อย่า share seed phrase, อย่า store digitally บน networked device, ใช้ cold storage สำหรับ holdings สำคัญ ดู Private Key Security Best Practices
Solana wallet generation process conceptually คล้าย Bitcoin และ Ethereum --- entropy กลายเป็น seed phrase, seed phrase กลายเป็น master key, derivation paths produce individual accounts แต่ underlying curve (ed25519), derivation standard (SLIP-0010) และ address format (raw Base58 ไม่มี checksum) สร้าง implementation details ที่แตกต่างซึ่งสำคัญสำหรับ interoperability, recovery และ security