Skip to content

Instantly share code, notes, and snippets.

@pierrenoizat
Last active February 22, 2022 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pierrenoizat/5f4238f3d3a03653cf1a9af508f712cb to your computer and use it in GitHub Desktop.
Save pierrenoizat/5f4238f3d3a03653cf1a9af508f712cb to your computer and use it in GitHub Desktop.
Generate your eth address and private key from mnemonic passphrase
require 'bitcoin'
require 'money-tree'
require 'eth'
require 'bip44'
require 'bip_mnemonic'
require 'bip44/utils'
require 'bip44/bitcoin'
require 'bip44/ethereum'
require 'bip44/wallet'
mnemonic = "beyond satoshi" # enter your own 24-word passphrase here
seed = BipMnemonic.to_seed(mnemonic: mnemonic)
@eth_wallet = Bip44::Wallet.from_seed(seed, "m/44'/60")
@eth_node = @eth_wallet.sub_wallet "m/2/0"
priv_key_hex = @eth_node.private_key # key = Eth::Key.new priv:priv_key_hex
eth_address = @eth_node.ethereum_address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment