1

Well, I am really new to this. Just installed libbitcoin and I am reading trough the wiki and everything.

Could someone really quick hint me how to generate addresses whenever I want from xpub that was exported from Electrum wallet? And/or Ledger wallet - if someone knows?

I know that it can be done in bitcoin core, however I would like to give libbitcoin a try. Thank you very much.

Dan
  • 27
  • 4

1 Answers1

1

Did you try this section from their documentation?

https://github.com/libbitcoin/libbitcoin-system/wiki/Addresses-and-HD-Wallets

// Load mnemonic sentence into word list
std::string my_sentence = "market parent marriage drive umbrella custom leisure fury recipe steak have enable";
auto my_word_list = split(my_sentence, " ", true);

// Create an optional secret passphrase
std::string my_passphrase = "my secret passphrase";

// Create 512bit seed (without optional secret passphrase)
auto hd_seed = decode_mnemonic(my_word_list);
data_chunk seed_chunk(to_chunk(hd_seed));
hd_private m(seed_chunk, hd_private::mainnet);

// Derivation of master public key M
hd_public M = m.to_public();

// Derive public children of master key M
auto M0 = M.derive_public(0); //Depth 1, Index 0
auto M1 = M.derive_public(1); //Depth 1, Index 1
auto M2 = M.derive_public(2); //Depth 1, Index 2

// Derive further public children
auto M10 = M1.derive_public(0); //Depth 2, Index 0
auto M11 = M1.derive_public(1); //Depth 2, Index 1
m1xolyd1an
  • 5,566
  • 2
  • 14
  • 30