diff --git a/704.md b/704.md index 9b944020..18522c1e 100644 --- a/704.md +++ b/704.md @@ -22,18 +22,24 @@ This means that each participant has to: Each client has a `master` key (denoted with `m`). This key can be the profile `nsec...`, but it is not mandatory. ## Derive the direct message parent key -[BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) is used to derive the paths. A client can generate multiple `direct message parent keys`, one for each peer that it is communicating with. Nostr `coin_type'` is `1237'` (see [NIP-06](https://github.com/nostr-protocol/nips/blob/master/06.md)). In this NIP we define the purpose `25709'` (`dm` -> `0x646d` -> `25709`) for deriving `Direct Messages` related keys. +A client must generate multiple `direct message parent keys`, one for each peer that it is communicating with. The [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) structure to be used is: +``` +m / purpose' / conin_type'`/ part1' / part2' / ... / part8' +``` + +- this NIP defines the `purpose` `25709'` (`dm` -> `0x646d` -> `25709`) for deriving `Direct Messages` related keys +- nostr `coin_type'` is `1237'` (see [NIP-06](https://github.com/nostr-protocol/nips/blob/master/06.md)) +- `part1' / part2' / ... / part8'` is the public key hex string (of the peer) split in 8 chunks: + - the reason for splitting is that each level of the path can have a max value of 232-1 + - the reason for using the peer's (`Bob`) public key is to always arive at the same value even if prio state is lost When client `Alice` wants to build its `dm parent key` for `Bob` it has to: - get the public key of `Bob` (in hex). Eg: `3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d`. - split the public key hex string in 8 chunks: - `3bf0c63f`, `cb934634`, `07af97a5`, `e5ee64fa`, `883d107e`, `f9e55847`, `2c4eb9aa`, `aefa459d` - - derive the `dm parent key`: `m/25709'/1237'/p1'/p2'/.../p8'` + - derive the `dm parent key`: `m/25709'/1237'/3bf0c63f'/cb934634'/.../aefa459d'` -> **Note** the reason for using the peer's public key (`Bob`) in the `dm parent key` derivation is to always arive at the same value even if prio state is lost. -> -> **Note** the reason for splitting is that each level of the path can have a max value of 232-1. dm//index send, receive, marketplace