<p>You can do it the other way around.</p>

<p>Generate a new master node</p>

<pre><code>@master = MoneyTree::Master.new
</code></pre>

<p>and then import into electrum the 'Master private key'</p>

<pre><code>@master.to_bip32(:private)
</code></pre>

<p>If you create a new wallet in Electrum and select: 'Standard Wallet' >'use public or private keys', there you'll be able to put the BIP32 private key.</p>

<p>I was also having problems passing the electrum seed as a parameter.</p>

CC BY-SA 4.0
2019-05-08T10:17:05.980Z
i tried this several times. i'll get "tprv8ZgxMBicQKsPetzTudFxisrLzJ5mj1nqUfGeXzREzB4xqqTLegLcw2nwdEoHPfC9NnAe9jvE98xGNk61yCK7G985ABpTThLFaKp5pqhShWD"  but electrum won't let me import this....
Tim Kretschmer
CC BY-SA 3.0
2018-02-12T17:43:48.580Z
2018-02-12T17:43:48.580Z
Gmae
<p>Create a new wallet in Electrum.  Copy the 'Master Public Key' and pass it to the money-tree gem like this:</p>

<pre><code>require 'money-tree'

@node = MoneyTree::Node.from_bip32("YOUR_MASTER_PUBLIC_KEY")

i = 0
20.times do
  @child = @node.node_for_path "m/0/#{i}"
  puts @child.to_address
  i+= 1
end
</code></pre>

<p>This will give you the first 20 child nodes of the first child of the master public key.  These addresses should be the same as your "Receiving" addresses in your Electrum wallet.</p>

CC BY-SA 4.0
2019-05-08T10:12:40.940Z
Electrum 3.3 tells me 19tSK8Fzeox8Rpg1z4ZAw81bvoBNG2NXXL while this code tells me mpQPcBLyTqPPCw9dhdXYm3Dvnnn58Y4dwA
Tim Kretschmer
CC BY-SA 3.0
2016-05-02T00:09:32.787Z
2016-05-02T00:09:32.787Z
Ben
<p>I am looking for a way to use HD wallets with ruby. This is what I have found: <a href="https://github.com/GemHQ/money-tree" rel="nofollow">https://github.com/GemHQ/money-tree</a>. However I am having trouble generating a wallet and getting the seed to reload it in the program though that. I would like to be able to create many addresses in this wallet. I am also looking for a way to load my electrum wallet using the ruby money-tree gem, or any other you happen to know of.</p>

<p>How would I do this?</p>

<wallet><bip32-hd-wallets><ruby>
Ruby: How do I create a wallet and import an electrum seed using money-tree gem
Pabi
# Ruby: How do I create a wallet and import an electrum seed using money-tree gem

(Asked by: username_0 on 2016-03-09)

I am looking for a way to use HD wallets with ruby. This is what I have found: <https://github.com/GemHQ/money-tree>. However I am having trouble generating a wallet and getting the seed to reload it in the program though that. I would like to be able to create many addresses in this wallet. I am also looking for a way to load my electrum wallet using the ruby money-tree gem, or any other you happen to know of.

How would I do this?

**Tags:** wallet, bip32-hd-wallets, ruby


---

## 2 answers

### Answer by username_1 on 2018-02-12. Score: 1

You can do it the other way around.
Generate a new master node
@master = MoneyTree::Master.new

and then import into electrum the 'Master private key'
@master.to_bip32(:private)

If you create a new wallet in Electrum and select: 'Standard Wallet' >'use public or private keys', there you'll be able to put the BIP32 private key.
I was also having problems passing the electrum seed as a parameter.

> **Comments:**
> **username_2**: i tried this several times. i'll get "tprv8ZgxMBicQKsPetzTudFxisrLzJ5mj1nqUfGeXzREzB4xqqTLegLcw2nwdEoHPfC9NnAe9jvE98xGNk61yCK7G985ABpTThLFaKp5pqhShWD"  but electrum won't let me import this....  

---

### Answer by username_3 on 2016-05-02. Score: 1

Create a new wallet in Electrum.  Copy the 'Master Public Key' and pass it to the money-tree gem like this:
require 'money-tree'

@node = MoneyTree::Node.from_bip32("YOUR_MASTER_PUBLIC_KEY")

i = 0
20.times do
  @child = @node.node_for_path "m/0/#{i}"
  puts @child.to_address
  i+= 1
end

This will give you the first 20 child nodes of the first child of the master public key.  These addresses should be the same as your "Receiving" addresses in your Electrum wallet.

> **Comments:**
> **username_2**: Electrum 3.3 tells me 19tSK8Fzeox8Rpg1z4ZAw81bvoBNG2NXXL while this code tells me mpQPcBLyTqPPCw9dhdXYm3Dvnnn58Y4dwA  

---

