cryptocoinjs / hdkey

JavaScript component for Bitcoin hierarchical deterministic keys (BIP32)
MIT License
201 stars 74 forks source link

Docs: bad derive(path) example? #47

Closed coolaj86 closed 2 years ago

coolaj86 commented 2 years ago

var childkey = hdkey.derive("m/0/2147483647'/1")

I'm new to all of this, but this looks like a junk / garbage / invalid path.

Shouldn't it be something like m/44'/0'/0'/0/1?

Where

?

Again total n00b, but these docs don't match other docs I'm looking at, so this is confusing to me.

junderw commented 2 years ago
  1. This library was created before BIP43 and BIP44 (which lays out that path logic) (obligatory "get off my lawn", jk)
  2. 2147483647 is a significant number because it is the largest possible path number. All paths must be a number between 0-2147483647 with or without a ' after it. This example is to give an idea of the ranges of numbers that could be used.

I don't mind adding more examples, but it's not high priority.

If you'd like to add a new example showing something like ex. BIP44 derivation can be done as such: ... I will review your Pull Request.