HD wallets with Nimiq
As I was experimenting with the Entropy and ExtendedPrivateKey classes in Nimiq core, I eventually came up with detailed overview how you could use them in your new application.
HD wallets are based on the BIP32 and BIP44 proposals for creating a fixed structure and deriving ‘infinite’ addresses based on a hierarchical and deterministic way.
Following those proposals gives rise to having one seed needed for all your addresses. And since it’s deterministic, you can easily derive all your addresses and funds with only that one seed. It removes the pain of storing every privatekey for every new address you generate. When you want to import all your addresses again, you only have import your given seed and all your corresponding addresses (including funds) will be detected and imported.
Note that at this time of writing, Nimiq only uses the first account derived from the seed: m/44'/242'/0'
(called a path
) and its corresponding addresses. I explain what a path
is in the Github example.
Click here for my Github example.