Closed zatsepinvl closed 6 years ago
Same here, it happened after last transaction has been sent about 5 min.
I take a look at block explorer and figure out that all account in ganache-cli send all of eth to one address.
but that address doesn't exist in web3.eth.accounts
It's Internet Wide Ethereum JSON-RPC Attack on port 8545, DONOT listen to inbound queries!
@askysu That's right. Changing mnemonic to private one and locking all created accounts solve the problem.
Hi Vladimir, could you please give more details about it?
@backslash112, first of all generate custom mnemonic using MetaMask or other tool. Then, start ganache-cli using this mnemonic:
ganache-cli -m "<your mnemonic>" -i 4448 -n
Where -n
or --secure
: Lock available accounts by default (link).
Then, configure your truffle.json
file:
const HDWalletProvider = require("./wallet-provider.js");
module.exports = {
networks: {
testrpc: {
provider: () => {
const testrpcMnemonic = "<your mnemonic>";
return new HDWalletProvider(testrpcMnemonic, "http://localhost:8545", 0, 10);
},
network_id: "*",
gas: 4700000
}
}
Where HDWalletProvider is hard copied in local file wallet-provider.js
, because there is no actual version in npm. Of course, you can use version of HDWalletProvider from npm, but it is not supported usage of several unlocked accounts in contract deploy scripts (note the last 0 and 10 arguments, 0 - means the first acount index, 10 - means total amount of provided accounts).
Using ganache-cli via docker (https://hub.docker.com/r/trufflesuite/ganache-cli/) with latest tag and MetaMask 4.2.0 in Firefox Developer Edition from different machines simultaneously, all default account balances are set to 0 after a while (checked by command
web3.eth.getBalance(web3.eth.accounts[0]).toNumber()
through truffle console).docker-compose to start ganache:
The same behavior was discovered for https://github.com/harshjv/docker-testrpc