Web3js – Interacting with Coinbase and Accounts[0] in Web3.js

coinbaseweb3js

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

Best Answer

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?

Related Topic