From bf34ca018e0e029a0192b1417e88f2fb18ed5d69 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 11 Dec 2021 19:10:19 -0300 Subject: [PATCH 1/2] add nip-06, generating keys from mnemonic codes. --- nips/06.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 nips/06.md diff --git a/nips/06.md b/nips/06.md new file mode 100644 index 0000000..da19d31 --- /dev/null +++ b/nips/06.md @@ -0,0 +1,19 @@ +NIP-06 +====== + +Key derivation from mnemonic +---------------------------- + +`draft` `optional` `author:fiatjaf` + +This combines [BIP39](https://bips.xyz/39) and a modified [BIP32](https://bips.xyz/32) into a scheme that allows the generation of a private key from a list of seed words. + +BIP32 is modified to use the key `Nostr seed` instead of `Bitcoin seed` in the HMAC function. + +This document specifies the creation of a single Nostr private key, but it can be expanded in the future if "HD Wallets" ever become a relevant use case. + +Steps for generating the private key: + +1. Follow the steps on BIP39 for generating the `mnemonic` and then the `seed` (512 bytes); +2. Calculate `result = hmac-sha512(key = 'Nostr seed', data = seed)`; +3. Use the first 32 bytes of `result` as the private key. From 756e6af84e948c9200d3e7542705a76aa855d5e0 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 30 Dec 2021 06:25:11 -0300 Subject: [PATCH 2/2] nip-06: just a basic derivation path. --- nips/06.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/nips/06.md b/nips/06.md index da19d31..9b6a7b8 100644 --- a/nips/06.md +++ b/nips/06.md @@ -1,19 +1,15 @@ NIP-06 ====== -Key derivation from mnemonic ----------------------------- +Basic key derivation from mnemonic seed phrase +---------------------------------------------- `draft` `optional` `author:fiatjaf` -This combines [BIP39](https://bips.xyz/39) and a modified [BIP32](https://bips.xyz/32) into a scheme that allows the generation of a private key from a list of seed words. +[BIP39](https://bips.xyz/39) is used to generate mnemonic seed words and derive a binary seed from them. -BIP32 is modified to use the key `Nostr seed` instead of `Bitcoin seed` in the HMAC function. +[BIP32](https://bips.xyz/32) is used to derive the path `m/44'/1237'/0'/0'` (according to the Nostr entry on [SLIP44](https://github.com/satoshilabs/slips/blob/master/slip-0044.md)). -This document specifies the creation of a single Nostr private key, but it can be expanded in the future if "HD Wallets" ever become a relevant use case. +This is the default for a basic, normal, single-key client. -Steps for generating the private key: - -1. Follow the steps on BIP39 for generating the `mnemonic` and then the `seed` (512 bytes); -2. Calculate `result = hmac-sha512(key = 'Nostr seed', data = seed)`; -3. Use the first 32 bytes of `result` as the private key. +Other types of clients can still get fancy and use other derivation paths for their own other purposes.