trufflesuite / ganache-cli-archive

Fast Ethereum RPC client for testing and development. See https://github.com/trufflesuite/ganache for current development.
https://www.trufflesuite.com/ganache
MIT License
3.36k stars 696 forks source link

Testrpc 2.1.0 broke BIP44 compliance #131

Closed danfinlay closed 8 years ago

danfinlay commented 8 years ago

Previously, (as recently as 2.0.9), testrpc's mnemonic and -m flag used the BIP44 standard to derive keys, making it compatible with MetaMask, for a really smooth developer experience.

Expected Behavior

When passing a mnemonic to testrpc, like testrpc -m "pistol fancy fresh belt always pet tourist walnut crumble have lens inform", it should generate BIP44 compliant keys, in this case, account 0 should be 0xDc0eb274099922D49ECFC57263356Ce5fD4cAA9f.

Current Behavior

Right now that same mnemonic generates account 0 as 0x47ddf9fc9c7d85f126c4d620fad07abf86063642.

Your Environment

Mac OS X 10.11.6 TestRPC 2.1.0 Node.js v6.3.1

kumavis commented 8 years ago

cc @digitaldonkey

danfinlay commented 8 years ago

I think I found the commit.

axic commented 8 years ago

I believe https://github.com/ethereumjs/testrpc/blob/master/lib/blockchain_double.js#L96 should be:

var acct = this.wallet.derivePath(this.wallet_hdpath + '/' + index) // index is a number

So that the actual derivation path becomes m/44'/60'/0'/0/0 and not m/44'/60'/0'/00.

danfinlay commented 8 years ago

That does it. Preparing a PR now. Adding it to the original path instead, for less concatenation logic.