generate HD addresses using publicKey Bip44

2

1

I'm just wondering if it's possible to generate HD address using xPub?

I tried to create HD address using BitWASP-PHP with the following path:

m / purpose' / coin_type' / account' / change / address_index

m/44/0'/0'/0/1

but the response is:

Can't derive a hardened key without the private key

I know that I can do it with Bip32 with the following path: 0/addressIndex

but I would like to use bip44.

Adam

Posted 2018-01-16T19:25:54.083

Reputation: 3 369

Answers

2

Any derivation path with an apostrophe (') signifies that that index should use hardened derivation. Hardened derivation means that you can only use the master private key. So with just an xpub, you cannot derive the full path.

Usually what happens with BIP 44 is that you generate a master private key, derive the keys for the hardened parts of the path, and then use the public key of the last hardened part to derive the addresses using non-hardened derivation.

So you would derive the private key for m/44'/0'/0' using the master private key. Then take the xpub of that derived private key and derive the remaining keys with path m/0/i.

Andrew Chow

Posted 2018-01-16T19:25:54.083

Reputation: 50 267

How to derive change address from m/0/i? – Adam – 2018-01-22T03:12:42.400

1The change addresses would be at m/1/i. – Andrew Chow – 2018-01-22T03:21:17.757