What is the difference between web3.eth.coinbase and web3.eth.accounts[0]? Which is the best method to get the current address? I am new to this community and I know this may be a silly question


web3.eth.accounts[0] refers to very first address created on an Ethereum node. web3.eth.coinbase returns you the coinbase. Coinbase or the Etherbase is the account in which your mining Ether i.e Block Reward will be credited. When there is one account, it is same as accounts[0] but you can also set it for other available address of same node.

Related: What is coinbase?

  • To check whether the Metamask is locked or not, which one is suitable? – Muhzin Jan 4 at 6:26
  • I will suggest web3.eth.accounts[0] – Aniket Jan 4 at 6:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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