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?

2 Answers 2


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

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.

  • Electrum 3.3 tells me 19tSK8Fzeox8Rpg1z4ZAw81bvoBNG2NXXL while this code tells me mpQPcBLyTqPPCw9dhdXYm3Dvnnn58Y4dwA May 8, 2019 at 10:12

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'


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.

  • i tried this several times. i'll get "tprv8ZgxMBicQKsPetzTudFxisrLzJ5mj1nqUfGeXzREzB4xqqTLegLcw2nwdEoHPfC9NnAe9jvE98xGNk61yCK7G985ABpTThLFaKp5pqhShWD" but electrum won't let me import this.... May 8, 2019 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.