Skip to main content
3 of 3
added 9 characters in body
Nick ODell
  • 29.5k
  • 11
  • 73
  • 132

It uses m/0/<n> for receiving addresses, and m/1/<n> for change addresses.

Here's some example bitcoinj code to generate receiving addresses from an extended public key.

String serialized_xpub = "xpub.....";
unsigned int address_num = 4;
NetworkParameters params = MainNetParams.get();
DeterministicKey root_xpub = DeterministicKey.deserializeB58(null, serialized_xpub, params);

DeterministicKey receiving = HDKeyDerivation.deriveChildKey(root_xpub, new ChildNumber(0, false));
DeterministicKey new_address_key = HDKeyDerivation.deriveChildKey(receiving, new ChildNumber(address_num, false));
String new_address = new_address_key.toAddress().toString();
Nick ODell
  • 29.5k
  • 11
  • 73
  • 132