1

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?

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.

| improve this answer | |
  • Electrum 3.3 tells me 19tSK8Fzeox8Rpg1z4ZAw81bvoBNG2NXXL while this code tells me mpQPcBLyTqPPCw9dhdXYm3Dvnnn58Y4dwA – Tim Kretschmer May 8 '19 at 10:12
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.

| improve this answer | |
  • i tried this several times. i'll get "tprv8ZgxMBicQKsPetzTudFxisrLzJ5mj1nqUfGeXzREzB4xqqTLegLcw2nwdEoHPfC9NnAe9jvE98xGNk61yCK7G985ABpTThLFaKp5pqhShWD" but electrum won't let me import this.... – Tim Kretschmer May 8 '19 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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