stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3k stars 659 forks source link

add coinbase rewards and total fees to `/new_block` event #4204

Open rafaelcr opened 7 months ago

rafaelcr commented 7 months ago

We are looking to add a value to Hiro's Blockchain API block response that gives users the total coinbase rewards and transaction fees that the miner won for that block (something like coinbase_rewards and total_fees). However, IIUC the Stacks node only sends this info to the API once those rewards have matured (like 100 blocks afterwards or so).

If we want to expose that data beforehand, we could calculate the total fees by adding the fee rates of confirmed transactions per block, but we can't know for sure the coinbase amount for that block if there was a missed sortition.

Is it possible for the Stacks node to give us the expected coinbase and fee total in the /new_block event so we can track it?

rafaelcr commented 7 months ago

Blocks https://github.com/hirosystems/stacks-blockchain-api/issues/1777