Skip to content

Different addresses from the same seed ethers v 6.15 vs Metamask #5047

@MousyCatCopilot

Description

@MousyCatCopilot

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions