I have noticed that the coinbase award for the block is not contained in the list of transactions retuned by e.g web3.eth.getBlock. Nor is it contained in its own field. I cannot even find an incoming transaction on the miners account on etherscan. I need to be able to look up each blocks coinbase award- any ideas how to do this using web3.js
Asked
Active
Viewed 1,377 times
1 Answers
3
As stated in Tjaden link, no transaction is created for the miner reward. Instead, the balance of the account in block.miner address is increased.
I'm not sure your use case but if you want to calculate the reward amount the miner received in it's account, the formula is stated in Yellow Paper eq 148:
5 ETH * (1 + block.uncles.length / 32)
Notes:
- There are also some ETH sent to uncles, not sure if you need that too
- Be careful when doing math operations, checkout https://github.com/ethereum/wiki/wiki/JavaScript-API#a-note-on-big-numbers-in-web3js
lalanv
- 300
- 1
- 2