I want to access MyEtherWallet account address from truffle-hdwallet-provider.
This is the code.
```
var HDWalletProvider = require("truffle-hdwallet-provider");
var privateKey = process.env.KEY;
var infuraApiKey = process.env.INFURA;
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*"
},
mainnet: {
provider: function () {
return new HDWalletProvider(
privateKey,
"https://mainnet.infura.io/" + infuraApiKey
);
},
network_id: 1,
gas: 2000000,
gasPrice: 3000000000 // 3 Gwei
}
}
};
```
In process.env.KEY, there are correct private key. It is correct because I can access my account using this private key.
However, I run truffle console --network mainnet
and chek my address web3.eth.getAccounts(function(err, res){console.log(res)})
, it returns wrong address.
Why??
The private key is correct, but I can't access another address I don't know. Why??
Thanks in advance.