Skip to content

Instantly share code, notes, and snippets.

@multivoltage
Created March 7, 2024 09:46
Show Gist options
  • Save multivoltage/ce88c34a789445e285b13a7faf47bd42 to your computer and use it in GitHub Desktop.
Save multivoltage/ce88c34a789445e285b13a7faf47bd42 to your computer and use it in GitHub Desktop.
simple code to get pubkey from 24 words in eth chain
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