<p>Did you try this section from their documentation?</p>
<p><a href="https://github.com/libbitcoin/libbitcoin-system/wiki/Addresses-and-HD-Wallets" rel="nofollow noreferrer">https://github.com/libbitcoin/libbitcoin-system/wiki/Addresses-and-HD-Wallets</a></p>
<pre><code>// Load mnemonic sentence into word list
std::string my_sentence = &quot;market parent marriage drive umbrella custom leisure fury recipe steak have enable&quot;;
auto my_word_list = split(my_sentence, &quot; &quot;, true);

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

// 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
</code></pre>

CC BY-SA 4.0
2021-04-12T00:09:40.623Z
2021-04-12T00:09:40.623Z
m1xolyd1an
<p>Well, I am really new to this. Just installed libbitcoin and I am reading trough the wiki and everything.</p>
<p>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?</p>
<p>I know that it can be done in bitcoin core, however I would like to give libbitcoin a try.
Thank you very much.</p>

<address><public-key><xpub><libbitcoin>
Libbitcoin How to generate addresses on demand from xpub?
Dan
# Libbitcoin How to generate addresses on demand from xpub?

(Asked by: username_0 on 2021-04-11)

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.

**Tags:** address, public-key, xpub, libbitcoin


---

## 1 answers

### Answer by username_1 on 2021-04-12. Score: 1 | Accepted answer

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

```


---

