{"id":"6330a10e2aa4fde4083dcdd15f03c4bbf3419ba2f8cb2dd7cb9d0aff134265e1","pubkey":"2e17b86d692c979bb5b7c2ddb9f70e02e76bbc358afa95ac68135047bbe10e02","created_at":1783088436,"kind":30817,"tags":[["d","nostr-secret-key-seed-derivation-for-hd-wallets"],["title","Nostr Secret Key Seed Derivation for Hierarchical Deterministic Wallets (Draft)"],["alt","Nostr Implementation Possibility: Nostr Secret Key Seed Derivation for Hierarchical Deterministic Wallets (Draft)"],["client","NostrHub"]],"content":"# Nostr Secret Key Seed Derivation for Hierarchical Deterministic Wallets (Draft)\n\n## Abstract\n\nThis proposal specifies a deterministic method for deriving a standard 64-byte BIP32 master seed from a Nostr secret key (`nsec`).\n\nThe purpose is to allow existing Nostr identities to serve as the root secret for Bitcoin Hierarchical Deterministic (HD) wallets while remaining fully compatible with the existing BIP32/BIP44/BIP84/BIP86 ecosystem.\n\nThis proposal defines only the seed generation process.\n\nAll subsequent key derivation SHALL follow existing Bitcoin standards.\n\n---\n\n# Motivation\n\nMany users already possess a securely backed-up Nostr secret key (`nsec1...`).\n\nToday that key can authenticate across numerous applications, yet it cannot directly initialize a standard HD Bitcoin wallet.\n\nCurrent wallets require one of:\n\n* BIP39 mnemonic\n* imported private key\n* hardware-generated seed\n\nImporting a single private key does not provide deterministic address generation.\n\nThis proposal enables:\n\n* deterministic HD wallet recovery from an existing Nostr identity\n* optional passphrase protection\n* complete compatibility with existing BIP32 wallet infrastructure\n* a simple wallet import workflow requiring only an `nsec` and optional passphrase\n\n---\n\n# Design Goals\n\n* No new elliptic curve algorithms\n* No changes to BIP32\n* No changes to BIP44/BIP84/BIP86\n* Simple implementation\n* Deterministic\n* Cross-wallet interoperable\n* Independent of any specific wallet vendor\n\n---\n\n# Terminology\n\n**Nostr Secret Key**\n\nA Bech32-encoded Nostr private key beginning with:\n\n```\nnsec1...\n```\n\ndefined by NIP-19.\n\n---\n\n**Canonical Secret**\n\nThe decoded 32-byte private key contained within the `nsec`.\n\n---\n\n**Passphrase**\n\nAn optional UTF-8 string supplied by the user.\n\nAn empty passphrase is permitted.\n\n---\n\n# Seed Generation\n\nWallets SHALL accept an `nsec1...` string as input.\n\nThe wallet SHALL:\n\n1. Decode the Bech32 Nostr secret.\n2. Verify that exactly 32 bytes are produced.\n3. Apply PBKDF2-HMAC-SHA512.\n\nParameters:\n\n```\nPassword:\n    canonical 32-byte secret\n\nSalt:\n    \"nostr\" || passphrase\n\nPRF:\n    HMAC-SHA512\n\nIterations:\n    2048\n\nOutput:\n    64 bytes\n```\n\nThe resulting 64-byte value SHALL be interpreted as a standard BIP32 master seed.\n\n---\n\n# Master Key Generation\n\nThe seed SHALL be converted into a BIP32 master key exactly as defined by BIP32.\n\n```\nI = HMAC-SHA512(\n    key = \"Bitcoin seed\",\n    data = seed\n)\n\nmaster_private_key = I[0:32]\n\nmaster_chain_code = I[32:64]\n```\n\nNo modifications are introduced.\n\n---\n\n# Child Key Derivation\n\nAll child derivation SHALL follow BIP32.\n\nRecommended derivation paths include:\n\nLegacy\n\n```\nm/44'/0'/0'/0/0\n```\n\nNested SegWit\n\n```\nm/49'/0'/0'/0/0\n```\n\nNative SegWit\n\n```\nm/84'/0'/0'/0/0\n```\n\nTaproot\n\n```\nm/86'/0'/0'/0/0\n```\n\nNothing in this proposal alters existing derivation paths.\n\n---\n\n# Wallet Import Procedure\n\nUser interface example:\n\n```\nImport Wallet\n\nNostr Secret\n\nnsec1...\n\nPassphrase (optional)\n\n********\n```\n\nInternally:\n\n```\nnsec1...\n      │\n      ▼\nBech32 Decode\n      │\n      ▼\n32-byte Secret\n      │\n      ▼\nPBKDF2-HMAC-SHA512\n      │\n      ▼\n64-byte Seed\n      │\n      ▼\nBIP32\n      │\n      ▼\nBIP44/BIP84/BIP86\n```\n\n---\n\n# Reference Algorithm\n\n```\nseed = PBKDF2(\n    password = decoded_nsec,\n    salt = \"nostr\" || passphrase,\n    iterations = 2048,\n    hash = SHA512,\n    output = 64 bytes\n)\n\n(master_key, chain_code) =\n    BIP32_Master(seed)\n```\n\n---\n\n# Security Considerations\n\nThe security of the derived wallet depends entirely upon the entropy of the original Nostr private key.\n\nNostr private keys are uniformly random 256-bit values and therefore exceed the entropy requirements of typical mnemonic-based wallets.\n\nBecause the derivation is deterministic:\n\n* loss of the `nsec` results in loss of wallet recovery\n* compromise of the `nsec` compromises both Nostr identity and all wallets derived under this specification\n\nUsers SHOULD employ a passphrase when additional protection is desired.\n\nWallets SHOULD clearly warn users that importing an existing Nostr secret creates a cryptographic relationship between their Nostr identity and Bitcoin wallet.\n\n---\n\n# Compatibility\n\nThis proposal is fully compatible with:\n\n* BIP32\n* BIP43\n* BIP44\n* BIP49\n* BIP84\n* BIP86\n\nOnly the generation of the initial seed differs.\n\nNo existing wallet functionality requires modification beyond accepting an `nsec` as an import source.\n\n---\n\n# Test Vector Format\n\nEach implementation SHOULD publish test vectors including:\n\n```\nInput nsec\n\nPassphrase\n\nDecoded Secret\n\nDerived Seed\n\nMaster Private Key\n\nMaster Chain Code\n\nm/44'/0'/0'/0/0\n\nm/84'/0'/0'/0/0\n\nm/86'/0'/0'/0/0\n```\n\n---","sig":"260a6d81b798dc32de37538e896ab4e27b8a70832d350e099c7c39191a7138bbfb9015a6b4d4e750d5c3e8c9c4b6b1b57b4b2b7ab2aff2286c3f4f204b4bb20b"}