Fundamentals ·

secp256k1 vs ed25519: Crypto में Elliptic Curves


हर cryptocurrency transaction के लिए digital signature चाहिए --- mathematical proof कि funds भेजने वाला वास्तव में account control करता है। वह signature एक algorithm produce करता है जो elliptic curve की properties पर rely करता है। Blockchain world में dominate करने वाली दो curves हैं secp256k1 और ed25519। ये same fundamental purpose serve करती हैं, लेकिन designs, performance characteristics और adoption histories बहुत different हैं।

यह गाइड explain करती है कि elliptic curves cryptography में क्या करती हैं, secp256k1 और ed25519 कैसे differ करती हैं, और उन differences का key generation, wallet security और blockchains पर क्या मतलब है।

Elliptic Curves क्या हैं?

Cryptography context में elliptic curve y^2 = x^3 + ax + b (secp256k1 जैसी curves के लिए) form के equation से defined mathematical structure है। Security Elliptic Curve Discrete Logarithm Problem (ECDLP) पर rest करती है: curve पर point P और point Q = k * P दिए जाने पर, P और Q से k determine करना computationally infeasible है।

Cryptocurrency terms में:

  • k आपकी private key --- secret number
  • P generator point --- fixed, publicly known point
  • Q आपकी public key --- private key से derived

ECC same security RSA जैसी provides करता है बहुत smaller key sizes के साथ। 256-bit elliptic curve key roughly 3,072-bit RSA key जितनी security offer करती है।

secp256k1: Bitcoin और Ethereum की Curve

secp256k1 वह elliptic curve है जो Bitcoin, Ethereum और उनके ecosystem की अधिकांश blockchains उपयोग करती हैं।

Curve equation: y^2 = x^3 + 7

Satoshi Nakamoto ने 2009 में Bitcoin के लिए secp256k1 choose किया। उस समय यह unusual choice थी। अधिकांश systems NIST P-256 curve उपयोग करती थीं। कुछ cryptographers ने worry किया है कि NIST curves के parameters NSA से influenced हो सकते हैं। Secp256k1 इस suspicion से पूरी तरह बचता है क्योंकि इसके parameters simple और transparent हैं: a = 0, b = 7

Signatures: ECDSA

secp256k1 के साथ paired signature algorithm ECDSA है। ECDSA signatures 64 bytes (two 32-byte values, commonly r और s) plus recovery byte हैं।

ECDSA quirk signature malleability है: valid signature (r, s) दी गई, pair (r, -s mod n) भी valid है। Bitcoin ने BIP66 और बाद में SegWit से address किया।

ed25519: Solana की Modern Choice

ed25519 Daniel J. Bernstein और collaborators द्वारा designed elliptic curve है, 2011 में published। यह newer generation curve design represent करती है जो security और performance दोनों prioritize करती है।

Solana ने ed25519 को अपनी signature curve choose किया, जैसा कई अन्य modern blockchains ने भी।

Signatures: EdDSA

ed25519 के साथ paired signature algorithm EdDSA है। EdDSA ECDSA की pitfalls avoid करने के लिए design किया गया:

  • Signing के दौरान कोई randomness required नहीं। EdDSA signatures inherently deterministic हैं
  • कोई signature malleability नहीं
  • Faster batch verification
  • Simpler implementation --- side-channel attacks के लिए कम surface area

Performance

Ed25519 consistently ECDSA-secp256k1 से benchmarks में faster है। Signing approximately 2-3 times faster है, और batch verification में Ed25519 significantly shine करता है।

ECDSA vs EdDSA: Direct Comparison

Property ECDSA (secp256k1) EdDSA (ed25519)
Curve type Short Weierstrass Twisted Edwards
Key size 256 bits 256 bits
Signature size 64-65 bytes 64 bytes
Security level ~128 bits ~128 bits
Signing speed Fast Faster (2-3x)
Verification speed Fast Comparable (single), faster (batch)
Deterministic signing Optional (RFC 6979) Built-in
Signature malleability Possible (mitigated) None
Nonce vulnerability Yes (bad RNG leaks key) No
Adoption Bitcoin, Ethereum, BNB Chain, Tron, Dogecoin, Litecoin Solana, XRP (partial), Cardano, Polkadot

दोनों algorithms approximately 128 bits of security provide करते हैं। Private Key Security Best Practices देखें।

कौन सी Chains कौन सी उपयोग करती हैं?

secp256k1 Chains

ed25519 Chains

  • Solana --- Exclusively Ed25519
  • XRP --- secp256k1 और ed25519 दोनों support
  • Cardano --- Ed25519 (Ed25519-BIP32, extended variant)
  • Polkadot --- Primarily Sr25519

Split largely generational है। 2015 से पहले designed blockchains secp256k1 tend करती हैं। 2017 के बाद designed blockchains increasingly ed25519 favor करती हैं।

Key Generation पर Impact

secp256k1 Key Generation

  1. Random 256-bit number (private key) generate करें
  2. Private key को secp256k1 generator point G से multiply करके public key compute करें
  3. Public key hash करके address produce करें (Bitcoin: SHA-256 + RIPEMD-160; Ethereum: Keccak-256)

Bitcoin Private Key Generator या Ethereum Private Key Generator से generate करें।

ed25519 Key Generation

  1. Random 32-byte seed generate करें
  2. SHA-512 से hash करके 64 bytes produce करें। पहले 32 bytes (specific bits clamped) signing scalar बनते हैं
  3. Scalar को base point B से multiply करके 32-byte compressed public key compute करें
  4. Solana पर public key ही (Base58-encoded) address है

Solana Private Key Generator से generate करें।

Cross-Curve Implications

secp256k1 और ed25519 mathematically incompatible हैं, इसलिए एक curve पर valid private key दूसरी पर कोई meaningful relationship नहीं रखती। जब seed phrase restore करते हैं जो Bitcoin और Solana दोनों support करता है, wallet same master seed से दो completely separate derivation processes run करता है।

Derivation path coin type include करता है: Bitcoin (m/44'/0'/0'/0/0) और Solana (m/44'/501'/0'/0') coin-type level पर branch करते हैं। HD Wallets and Derivation Paths Explained पढ़ें।

Quantum Computing के बारे में

दोनों secp256k1 और ed25519 Shor's algorithm चलाने वाले sufficiently powerful quantum computer के लिए equally vulnerable हैं। न तो curve "more quantum-resistant" है। Quantum Computing and the Crypto Threat देखें।

सही Tool चुनना

User के रूप में आप secp256k1 और ed25519 में directly choose नहीं करते। Blockchain करती है। SafeSeed के generators automatically handle करते हैं। Bitcoin Seed Phrase Generator secp256k1 keys derive करता है। Solana Seed Phrase Generator ed25519 keys derive करता है। सभी client-side run करते हैं, Web Crypto API उपयोग करते हैं। कोई private key material device नहीं छोड़ता।