There are no magic rules in the Ergo code about emission / Treasury, thus both emission and Treasury are simply boxes created before a genesis block and associated with corresponding contracts.
Emission contract appeared early, probably before ErgoScript compiler was done. Thus the contract done in ErgoTree directly, with some code generation done in Scala. Main function (using some code-generating helper function is emissionBoxProp in ErgoScriptPredef.scala (in Sigmastate repository, sigmastate-interpreter/ErgoScriptPredef.scala at bd1906e3a0a4f93039a357c8d3ca4343b135dcf2 · ScorexFoundation/sigmastate-interpreter · GitHub )
Basically, the contract, for the mainnet settings is allowing to spend on every block to special script timelocking for 720 blocks to miner’s pubkey, according to a schedule. The schedule is following:
- if height of a block is less that 525,600 + 2 * 64,800 = 655,200, then constant reward of 67.5 ERG paid
- starting from block 655,200 , reward per block is defined as 75 ERG minus number of epoch multiplied by 3 ERG, where number of epoch is defined (as block height minus 525,600 ) / 64,800 + 1. (division is integer)
For example, for height 655,200, reward = 75 - 3 * ((655,200 - 525,600) / 64,800 + 1) = 66
for height 1,000,000 reward = 75 - 3 * ((1,000,000 - 525,600) / 64,800 + 1) = 27 ERG
similarly, for block #2,080,799 reward is 3 ERG, for block #2,080,800 reward is 0
There are a lot of concerns about emission to be over in less than 6 years from now. UTXO set growth is quite good these days, but storage rent economy is still not clear.
As total supply must be preserved AT ANY COST, and hard-forks must be avoided, we need for a soft-fork way to prolong the emission. There is no very easy way to do that, but there’s a way possible with a soft-fork (only mining nodes will need to update):
- new re-emission contract to be launched, which is starting paying from block # 2,080,800 and paying 3 ERG per block (or even less, e.g. 2 or 1 ERG per block).
- we inject new tokens into current emission box (possible, as there are no contract checks for tokens there). tokens show how much ERGs should be passed to the re-emission contract
- starting from some height (e.g. 640,000), when miner is taking ERG from the emission box, he should take (in the same box) re-emission tokens according to a schedule (could be simple flat, e.g. 24 ERG per block, end re-emission tokens then to be issued while emission is not less than 27 ERG per block).
- when miner is spending rewards box, he must send amount of ERGs corresponding to re-emission tokens to re-emission contract, and burn the re-emission tokens.
Last two rules can’t be done via a contract (as the emission contract is set in stone), thus we need to impose the rules via the nodes agreement. However, only mining nodes do really need to check those rules, other clients may run the old code. Thus the change is soft-forking.
Later on, via a soft-forking change we can require storage rent to go to re-emission contract as well, for smooth storage rent payments.