Ethers Version
6.15
Search Terms
derive address metamask
Describe the Problem
I discovered that using the same seed phrase with Ethers and MetaMask results in different addresses for child nodes. Here’s the code I use to generate multiple child addresses:
createBscDepositAddress(index: number) {
const { mnemonic, password } = this.configService.get('bsc.wallet') as EnvironmentVariables['bsc']['wallet'];
const hdNode = ethers.HDNodeWallet.fromPhrase(mnemonic, password);
const childNode = hdNode.deriveChild(index);
return childNode.address;
}
Initially, I thought the discrepancy might be due to the password, which could be acting as additional user-provided entropy. However, I tested it without the password, and it still produced different addresses compared to MetaMask.
Code Snippet
Contract ABI
Errors
Environment
node.js (v12 or newer)
Environment (Other)
No response
Ethers Version
6.15
Search Terms
derive address metamask
Describe the Problem
I discovered that using the same seed phrase with Ethers and MetaMask results in different addresses for child nodes. Here’s the code I use to generate multiple child addresses:
Initially, I thought the discrepancy might be due to the password, which could be acting as additional user-provided entropy. However, I tested it without the password, and it still produced different addresses compared to MetaMask.
Code Snippet
Contract ABI
Errors
Environment
node.js (v12 or newer)
Environment (Other)
No response