Deploy to a public testnet using OpenZeppelin SDK

I have found out my issue!

It is caused by incompatibilities in the HD derivation paths between MyCrypto and truffle-hdwallet-provider.

When we import a mnemonic into MyCrypto for Ropsten-Network, it derives the address with the following path: m/44'/1'/0'/0, while truffle-hdwallet-provider constantely is using m/44'/60'/0'/0/ no matter wich network will be used.

Therefor, I get a different address as the first address as it will be used by truffle-hdwallet-provider.

So, when I use also m/44'/60'/0'/0/ for address derivation, I end up with the following address:

0xC0306fe5c3E90025AD56832A4399670be51b3Eec
instead of
0x9dbFAFB5Edd1D69aCaC1C104C526C4ACDc20F3Ae

After I have send Test-Ether to 0xC0306fe5c3E90025AD56832A4399670be51b3Eec on Ropsten, the deployment works fine.

Fortunately the constructor of truffle-hdwallet-provider offers an argument containing the wallet_hdpath. So for using Ropster addresses properly with MyCrypto / MyEtherWallet, the following constructor helps:

ropsten: {
  provider: () => new HDWalletProvider(
    process.env.DEV_MNEMONIC, "https://ropsten.infura.io/v3/" + infuraProjectId, 
        0, 1, true, "m/44'/1'/0'/0/"
    ),
  networkId: 3,       // Ropsten's id
},

0 = start with first address
1 = derive only 1 addresses
true = sharedNonce (default)

"m/44'/1'/0'/0/" = BIP44 derivation path that is used for test networks (across all coins)

For debugging purposes, we can find out the address with the method "getAddresses()":

const x = new HDWalletProvider(
  process.env.DEV_MNEMONIC, "https://ropsten.infura.io/v3/" + infuraProjectId, 0, 1,
  true, "m/44'/1'/0'/0/"
  )

console.log(x.getAddresses())
3 Likes