# Block reward calculation in Babylon

There seems to be a bug in the block reward calculation in Babylon.

For example, in block 664451 there were 26 endorsements. So the reward should be `16 * (0.8 + 0.2 * 26 / 32) = 15.4 XTZ` (source). But the baker got 14.4 XTZ.

Can someone explain how the reward is actually calculated, and why there is a discrepancy between the expected amount and the actual reward?

The exact formula used in Babylon can be found here:

https://gitlab.com/tezos/tezos/blob/mainnet/src/proto_005_PsBabyM1/lib_protocol/baking.ml#L190

This comes to:

((16 000 000 * (8 + 2 * e / 32)) / 10) / (1 + p)

But note that these are integer divisions, hence, in your example:

8 + 2 * 26 / 32 = 8 + 52 / 32 = 8 + 1 = 9

16 000 000 μꜩ * 9 = 144 000 000 μꜩ

144 000 000 μꜩ / 10 = 14 400 000 μꜩ = 14.4 ꜩ

Edit: This feedback is from the Tezos developers TG group. You can view this spreadsheet to better understand the calculation of block rewards: https://files.fm/u/hb5eazkk

• Correct formula ought to be Oct 28, 2019 at 10:55
• (16 000 000 * (256 + 2 * e)) / (320 * (1 + p)) Oct 28, 2019 at 10:55
• Thanks! Could you please add sources/reference to some description and implementation ?
– Ezy
Oct 28, 2019 at 11:19

This is a bug in babylon caused by using an integer division in a wrong place and will be fixed in the next proposal.
For now you can use the following formula to calculate the rewards :
The formula is : `((16 000 000 * (8 + floor(2 * e / 32))) / 10) / (1 + p)`