In this post I am going to reveal some details about storage rent.
Ergo has pretty aggressive emission curve with all the ergs being emitted in just 8 years. To provide stability after the emission being done, Ergo is introducing storage rent, which is pretty flexible and sophisticated. There are two basic mechanisms in regards with the storage rent:
It is impossible to create a box holding less ergs than some minimum value per byte (of the box). Value by default is 360 nanoergs per byte. Miners can set a value in a range [0, 10000] (nanoergs per byte, inclusive) by voting on value 2 (to increase) or -2 (to decrease), per-epoch step is 10 nanoergs/byte (so if majority of miners vote to increase the default value per an epoch 1,024 blocks, on next epoch the value will be 370 nanoergs/block).
every four years a miner can charge storage rent fee by spending the box and recreating it with all the registers preserved except of R0 (holding monetary value) and R3 (holding creation height and reference to transaction identifier and output index where the box was created). Storage rent fee is defined by network consensus by voting on storage rent fee per byte value. The default value for the parameter is 1,250,000 nanoergs / byte. Miners can vote on changing this parameter within [0…2,500,000] range by voting for 1 or -1, the step is 25,000.
Modelling the storage rent
There’s FeeSimulator.scala runnable application printing some modelling results to the console.
In particular, it is calculating “standard box” size by averaging sizes of two P2PK-protected boxes, one holding only ergs, another one additional asset also. Then:
Box size: 105 B
Storage fee for ordinary box: 0.13125
So a simple box will pay ~0.13 ergs every four years.
Then the big question is how miners will tie transaction fees with the storage fee. For example, consider that they will require transaction to pay for input boxes byte proportionally to their lifetimes. Then miners will get from UTXO set of constant size a constant reward for 4 years, and then reward from block will be perOutputFee * (numberOfBoxes / (4 * BlockPerYear)). Considering Ergo UTXO set size to be like Bitcoin’s (~60M), we’re getting
Reward per block: 7.49 Erg + tx fees
Storage period to be changed?
Storage period is set in stone and can not be changed via voting or soft-fork. However , withe 8 years emission and storage period of 4 years time around emission end could be messy, as near year 8 a miner will charge only boxes created around years 4. In case of storage period equal to 2 years, the miner will charge boxes created around years (2,4,6). So if HF will be performed I would like to propose to decrease the storage period to 2 years.
How expired outputs being spent
It is possible to spend a box if height from preheader (so height of upcoming block) exceeds reported creation height of the box by storage fee period at least (and a box with creation height more than the current height can not be included into a block, so a user can’t cheat by reporting a height from future in order to save on storage fee):
context.preHeader.height - context.self.creationHeight >= Constants.StoragePeriod
(ErgoInterpreter, line 64)
Also, to spend the expired box, spending proof must be empty.
Then, anyone can spend the expired box by providing in context extension variable #127 (stored in input) an index of a recreated box (or index of any box of the expired box hasn’t enough to pay for the storage fee).