diff --git a/rfc/0015_Dubp_HD_Wallet.md b/rfc/0015_Dubp_HD_Wallet.md new file mode 100644 index 0000000000000000000000000000000000000000..bc4192326b4629066f4a42bcc882092328eef5cf --- /dev/null +++ b/rfc/0015_Dubp_HD_Wallet.md @@ -0,0 +1,53 @@ +# DUBP conventions for Hierarchical Deterministic Wallet + +## Master seed generation + +Master seed should be generated from a [Dubp-Mnemonic]. + +## Key derivation + +Key derivation should use [BIP-Ed25519] specifications. + +## Key derivation scheme + +First derivation step should be an hardened derivation and represent an `account_id`. + +`account_id` is an integer beetween `0` and `(2^24) - 1`. + +There are 4 types of accounts : + +| Account type | `account_id` value conditions | +|-|-| +| Member | `account_id == 0` | +| Transparent | `account_id != 0 && account_id % 3 == 0` | +| Semi-opaque | `account_id % 3 == 1` | +| Opaque | `account_id % 3 == 2` | + +### Account types + +Transparent: classic non-member wallet +Semi-opaque: A wallet that uses a single-use public key for each payment to itself (cash back and change transaction), but always uses the same public key for all payments received. +Opaque: A wallet using single-use public keys for each payment received and for each payment to oneself (cash back and change transaction). + +### Semi-opaque account derivation scheme + +The payment receipt keypair is obtained by derivation `0'` from the semi-opaque account keypair. + +For self-payment, it is first necessary to derive the so-called "internal keypair", by derivation `1'` from the semi-opaque account keypair. + +Then, each single-use public key is obtained by soft derivation of the "internal public key". + +So, the ith payment to oneself is made on the `m/a'/1'/i` keypair, where `a` is the `account_id` of the semi-opaque account. + +### Opaque account derivation scheme + +For payments to oneself, the scheme is identical to the semi-opaque account scheme. + +For external payments, it is first necessary to derive the so-called "external keypair", by derivation `0'` from the opaque account keypair. + +Then, each single-use public key is obtained by soft derivation of the "external public key". + +So, the ith outward payment is made on the `m/a'/0'/i` keypair, where `a` is the `account_id` of the opaque account. + +[Dubp-Mnemonic]: https://git.duniter.org/documents/rfcs/blob/dubp-mnemonic/rfc/0014_Dubp_Mnemonic.md +[BIP-Ed25519]: https://drive.google.com/file/d/0ByMtMw2hul0EMFJuNnZORDR2NDA/view