Last active
February 22, 2022 20:43
-
-
Save pierrenoizat/5f4238f3d3a03653cf1a9af508f712cb to your computer and use it in GitHub Desktop.
Generate your eth address and private key from mnemonic passphrase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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