Skip to content

Commit 0d68f8d

Browse files
authored
Merge pull request #18 from CicadaBank/fix/bip44-doc-readme
Add BIP 44 derivation path documentation and example in the README
2 parents 984e904 + 89ddf0f commit 0d68f8d

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,46 @@ Reference
203203
---------
204204

205205
- https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
206+
207+
BIP44
208+
=====
209+
210+
This proposal defines a logical hierarchy for deterministic wallets
211+
based on an algorithm described in BIP-0032.
212+
213+
Example
214+
-------
215+
216+
The example below generates a BIP 44 derivation path for a specific
217+
key within an HD wallet.
218+
219+
The first argument, "BTC", specifies the coin type. In this case,
220+
"BTC" stands for Bitcoin. The second argument, 0, specifies the
221+
account index. The third argument, :external, specifies the type of
222+
derivation. :external specifies that the derivation path should be for
223+
the external chain, which is used for receiving payments. The final
224+
argument, 0, specifies the address index within the external chain.
225+
226+
The resulting output of the function is the string "m/44'/0'/0'/0/0",
227+
which is a BIP 44 derivation path. The m at the beginning of the
228+
string stands for "master", and the subsequent numbers and single
229+
quotes (') represent child derivation steps. The 44' specifies that
230+
the key being derived is a hardened key at the 44th index of the BIP
231+
44 purpose field. The subsequent numbers 0'/0'/0/0 specify the account
232+
index, external chain index, and address index, respectively. The
233+
single quotes indicate that the keys at these indices are hardened
234+
keys.
235+
236+
In this specific example, the derivation path would represent the
237+
first external address (address index 0) in the first account (account
238+
index 0) of the Bitcoin coin type (coin type "BTC").
239+
240+
```clojure
241+
(derivation-path "BTC" 0 :external 0)
242+
;; => "m/44'/0'/0'/0/0"
243+
```
244+
245+
Reference
246+
---------
247+
248+
- https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

0 commit comments

Comments
 (0)