At truffle.js I set the account to the third ganache's account

enter image description here

Then I run truffle console and coinbase was set to the first account and defaultAccount to undefined. Not only that, I've tried to change the coinbase to the second account and it also didn't work

enter image description here

The most interesting part is: I ran a function from a contract that stores a mapping(address=>A) v (let's say A is a contract and v the mapping name). The expected outcome from v(web3.eth.coinbase) would be the contract's address, but there was the empty address. And when I ran v(web3.eth.address[2]), there was the contract's address, meaning I just have to trust the truffle's config.

But I'd like to solve this anyways, for presentation's sake

1 Answer 1


From the web3.eth.coinbase documentation:

This property is read only and returns the coinbase address where the mining rewards go to.

To modify the miner address you have to call miner.setEtherbase

Can't help with the issue with your mapping without access to your contracts and the deployment scripts.

Not the answer you're looking for? Browse other questions tagged or ask your own question.