3

I have a cold storage where I installed BTC-Electrum and LTC-Electrum wallets. So I have took extended master public keys and have generating addresses in my online service. Now I want to generate addresses for Ethereum but how can I understood the electrum core doesnt give xpub. So I need to use any wallets like MetaMask or MyEtherWallet. But I can not found how can I took xpub from those wallets.Can somebody help me to solve this problem? Thanks!

1 Answer 1

0

Ethereum keys are similar to Bitcoin's and are part of the Hierarchical Deterministic tree structure (HD wallets). These were introduced by BIP 32 and later improved by BIP 44. An HD wallet tree is represented by derivation paths to the first address node. For example, the default for Ethereum is m/44'/60'/0'/0 or incl. the trailing /[address_index]

  • 44 — BIP 44 Purpose
  • 60 — Ethereum’s coin type
  • 0 — Account
  • 0 — Chain
  • 0 — Address index

More details here .

You can't retrieve your xpub directly from Metamask, MEW, or any other online wallet that I'm aware of. You could retrieve it with a library such as ethers.js or ethereumjs-wallet.

Example

let HDNode = require('ethers').utils.HDNode;
let mnemonic = "radar blur cabbage chef fix engine embark joy scheme fiction master release";
let masterNode = HDNode.fromMnemonic(mnemonic);
let standardEthereum = masterNode.derivePath("m/44'/60'/0'/0/0");

// Get the extended private key
let xpriv = node.extendedKey;

// Get the extended public key
let xpub = node.neuter().extnededKey;

References

1
  • when you have the xpriv, what do you need in order to get to the ethereum address ? Could you add that to your snippet ?
    – Ced
    Oct 15, 2021 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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