2

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

1 Answer 1

4

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?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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