# Formula to calculate current block reward

#### rango

##### Active member
Guys, what would be the formulae to calculate current block reward going to the miners? That's what i have currently got. Is this calculation correct?

---
\$masternode reward=0.75;
\$reward = 2222222/pow(((\$difficulty+2600)/9),2)*\$masternode reward;
if (\$reward < 5) {
\$reward = 5*\$masternode reward;
}
---

Where was the post listing the increasing masternode payments? Is the increase of masternode payments tied to a specific block height?

Thank you,
Rango

Guys, what would be the formulae to calculate current block reward going to the miners?
[...]
Is the increase of masternode payments tied to a specific block height?

Code:
``````  nSubsidy = (2222222.0 / (pow((dDiff+2600.0)/9.0,2.0)));
if (nSubsidy > 25) nSubsidy = 25;
if (nSubsidy < 5) nSubsidy = 5;``````

You forgot the ">25" part. This is the block reward.
Subtract from this the amount the Masternodes get and you have what the miners will get (minus the fees of course).

Masternode Payments:
Code:
``````  int64_t ret = blockValue/5; // start at 20%

if(nHeight > 158000)  ret += blockValue / 20;  //25.0%  - 2014-10-23
if(nHeight > 158000+((576*30)*1)) ret += blockValue / 20;  //30.0%  - 2014-11-23
if(nHeight > 158000+((576*30)*2)) ret += blockValue / 20;  //35.0%  - 2014-12-23
if(nHeight > 158000+((576*30)*3)) ret += blockValue / 40;  //37.5%  - 2015-01-23
if(nHeight > 158000+((576*30)*4)) ret += blockValue / 40;  //40.0%  - 2015-02-23
if(nHeight > 158000+((576*30)*5)) ret += blockValue / 40;  //42.5%  - 2015-03-23
if(nHeight > 158000+((576*30)*6)) ret += blockValue / 40;  //45.0%  - 2015-04-23
if(nHeight > 158000+((576*30)*7)) ret += blockValue / 40;  //47.5%  - 2015-05-23
if(nHeight > 158000+((576*30)*9)) ret += blockValue / 40;  //50.0%  - 2015-07-23
if(nHeight > 158000+((576*30)*11)) ret += blockValue / 40; //52.5%  - 2015-09-23
if(nHeight > 158000+((576*30)*13)) ret += blockValue / 40; //55.0%  - 2015-11-23
if(nHeight > 158000+((576*30)*15)) ret += blockValue / 40; //57.5%  - 2016-01-23
if(nHeight > 158000+((576*30)*17)) ret += blockValue / 40; //60.0%  - 2016-03-23``````

Last edited by a moderator:
• rango, vertoe and fernando
OK, what is this 'pow' and how big is 'dDiff' today?

pow(x, y) = x^y ?

And how is max number of coins restricted if production changes daily? OK, what is this 'pow' and how big is 'dDiff' today?

pow(x, y) = x^y ?

And how is max number of coins restricted if production changes daily? yes: power ( base , exponent ) := base ^ exponent
http://www.cplusplus.com/reference/cmath/pow/

Code:
``````int64_t GetBlockValue(int nBits, int nHeight, int64_t nFees)
{
double dDiff = (double)0x0000ffff / (double)(nBits & 0x00ffffff);

/* ... */
}``````
https://github.com/darkcoin/darkcoin/blob/master/src/main.cpp#L1382

• maky
crowning
Thank you very much for your help.

Looking at block http://explorer.darkcoin.io/block/00000000000b7ca7c2b5b1e902a6579a46fdccdc478ae6549edf5338cc703c01
which has a difficulty of 2796.435, the block reward should be 2222222/((2796.435+2600)/9)^2 = 6.18099740 Dash. http://www.wolframalpha.com/input/?i=2222222/((2796.435+2600)/9)^2

Instead the block reward is 4.64285715 Dash. Can someone elaborate? Which difficulty is used to calculate the Block Reward if not the current difficulty?

Also, the block reward mentioned on www.reddit.com/r/dashpay is:

Block reward is controlled by Moore's law: 2222222/(((Difficulty+2600)/9)2)

There is a ^ missing there.

• flare
Looking at block http://explorer.darkcoin.io/block/00000000000b7ca7c2b5b1e902a6579a46fdccdc478ae6549edf5338cc703c01
which has a difficulty of 2796.435, the block reward should be 2222222/((2796.435+2600)/9)^2 = 6.18099740 Dash. http://www.wolframalpha.com/input/?i=2222222/((2796.435+2600)/9)^2

Instead the block reward is 4.64285715 Dash. Can someone elaborate? Which difficulty is used to calculate the Block Reward if not the current difficulty?

Also, the block reward mentioned on www.reddit.com/r/dashpay is:

Block reward is controlled by Moore's law: 2222222/(((Difficulty+2600)/9)2)

There is a ^ missing there.

Short answer: -the miner destroyed some reward-

EDIT: The difficulty of the previous block is used, see below Like you pointed out the formula is 2222222/((2796.435+2600)/9)^2 = 6.18099740 DASH

As we are using int64_t for the calculation only the integer value is used --> 6 DASH

Now we are in 2nd year of Dash, which means this is reduced by 1/14 ~= 7.1% --> 6 * (1-(1/14)) = 5.57142857 DASH

So the matching reward for difficulty 2796.435 is 5.57142858 DASH, which will be mined in the next block.

Which means
whoever mined this block left out 0.91857142 DASH, which may appear weird, but still makes
up a valid block.
The formula does only calculate the maximum amount ("ceiling function") to
be mined, the miner is free to claim everything below. The unclaimed coins from the coinbase are lost/destroyed.

Btw: The next block http://explorer.darkcoin.io/block/0000000000076a1a29de640d7f16f962a271c967aaae1dec3f0f1b0ac40b4366
with difficulty 2723.625 generated the maximum number of coins: 5.57142858 DASH

Hope that helps

Last edited by a moderator:
• wsmithston
Short answer: this block destroyed some reward Like you pointed out the formula is 2222222/((2796.435+2600)/9)^2 = 6.18099740 DASH

As we are using int64_t for the calculation only the integer value is used --> 6 DASH

Now we are in 2nd year of Dash, which means this is reduced by 1/14 ~= 7.1% --> 6 * (1-(1/14)) = 5.57142857 DASH

So the matching reward for difficulty 2796.435 is 5.57142857 DASH, which means
whoever mined this block left out 0.91857142 DASH, which may appear weird, but still makes
up a valid block - the formula does only calculate the maximum amount ("ceiling function") to
be mined, the miner can claim everything below.

Btw: The next block http://explorer.darkcoin.io/block/0000000000076a1a29de640d7f16f962a271c967aaae1dec3f0f1b0ac40b4366
with difficulty 2723.625 generated the maximum number of coins: 5.57142858 DASH

Hope that helps
When you calculate reward you should use difficulty of previous block:
Code:
``````2222222/((3036.93+2600)/9)^2 = 5,6648338721 = 5 (int)
5 * (1 - 1/14) = 4,6428571429``````
Generation: 4.64285715 + 0 total fees

• wsmithston, Sub-Ether and flare
When you calculate reward you should use difficulty of previous block:
Code:
``````2222222/((3036.93+2600)/9)^2 = 5,6648338721 = 5 (int)
5 * (1 - 1/14) = 4,6428571429``````
Gotcha, of course - but rest of of my explantion was OK  • wsmithston
Looking at block http://explorer.darkcoin.io/block/00000000000b7ca7c2b5b1e902a6579a46fdccdc478ae6549edf5338cc703c01
which has a difficulty of 2796.435, the block reward should be 2222222/((2796.435+2600)/9)^2 = 6.18099740 Dash. http://www.wolframalpha.com/input/?i=2222222/((2796.435+2600)/9)^2
Instead the block reward is 4.64285715 Dash. Can someone elaborate? Which difficulty is used to calculate the Block Reward if not the current difficulty?
Lol, was still working this out, I took off the 7% per year deduction, and I tried previous block difficulty, but I didn't try previous block and -7% Example block: 376191 payout 4.17857144, previous block 376190 had a difficulty of 4748.128

2222222/((4748.128+2600)/9)^2 = 3.33364259018 = 3 (int)
3 * (1 - 1/14) = 2.78571428571

Why?

And, is there any API where I get the current masternode count without hosting my own deamon?
If not would you mind crowning, when I grab from your site, lets say once every hour for a little project (simple monitor showing the value of all your Dash addresses, daily and monthly interest in your local currency)? 'Estimated Payment per Masternode / day' is what I need.

Last edited by a moderator:
• pille
Example block: 376191 payout 4.17857144, previous block 376190 had a difficulty of 4748.128

2222222/((4748.128+2600)/9)^2 = 3.33364259018 = 3 (int)
3 * (1 - 1/14) = 2.78571428571

Why?

....
Because there is a limit for minimum reward
Code:
``if (nSubsidy < 5) nSubsidy = 5;``
and there is also 10% reduction because of DGBB

• pille