Created
March 7, 2024 09:46
-
-
Save multivoltage/ce88c34a789445e285b13a7faf47bd42 to your computer and use it in GitHub Desktop.
simple code to get pubkey from 24 words in eth chain
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
const bip39 = require("bip39"); | |
const hdkey = require("ethereumjs-wallet").hdkey; | |
async function find() { | |
const mnemonic = "word1 word2 ... word24" | |
const buf = await bip39.mnemonicToSeed(mnemonic); | |
const hdwallet = hdkey.fromMasterSeed(buf); | |
const path = "m/44'/60'/0'/0/0"; | |
const wallet = hdwallet.derivePath(path).getWallet(); | |
const address = `0x${wallet.getAddress().toString("hex")}`; | |
console.log(`Address: ${address}`); | |
} | |
find(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment