1

I make a get_block_template request to a monerod using a RPC interface.

From response of this request I can get the a value of expected_reward:

expected_reward = block_reward + tx_fees_amount

But I would like to know just a value of block_reward:

block_reward = expected_reward - tx_fees_amount

To do this, I need to know a value of transaction fees in this potential block.

1) How can I get the amount for transaction fees in a potential block?

2) Am I moving in the right way to get a block reward without the transaction fees in it? Maybe there are easier ways?

3) Before writing this question, I looked at the answers to similar questions. There are many formulas for calculation block rewards using a value of coins emission. Should I move in that direction? But having a only RPC of my monero node I don't know how to request the current emission of monero's coins. Is it possible?

3

1) How can I get the amount for transaction fees in a potential block?

The easiest method (and just using the RPC interface) to get the block emission separate to the tx fees is probably to subtract the last mined blocks emission (emission_amount of get_coinbase_tx_sum) from the expected_reward (of get_block_template). It's not perfectly accurate but probably accurate enough for most needs.

If you need something more accurate, you would have to calculate the emission for a given block height. An example of calculating emission can be found here, which could easily be rewritten to output the emission for a given height.

As you are wanting to do this from the block template, another approach is simply parsing the block and adding up the tx fees. That obviously requires code to parse a block and transactions though.

2) Am I moving in the right way to get a block reward without the transaction fees in it? Maybe there are easier ways?

I can't speak to why you want to know the emission and tx fees separately, but the above methods are ways to achieve it.

3) ... There are many formulas for calculation block rewards using a value of coins emission. Should I move in that direction?

Again, this is difficult to answer without knowing precisely why you want to split the block reward.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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