This mechanism is unique to Monero because it's the only cryptocurrency to have both blocksize and transaction fee dictated by an algorithm, how was this achieved and what is the rationale behind such system?

up vote 8 down vote accepted

In addition to the excellent summary by ArticMine already given, here below is shortened & updated version of my research on the topic.

Dynamic Blocksize Penalty

This is the penalty which will be subtracted from the block reward. In practice it means that whenever a penalty is triggered, the start of tail emission will be slightly postponed (it will start later to "give back" the penalized amount), and once tail emission kicks in it will be an effective coin burn because the block emission will no longer depend on current emission as it will be fixed at 0.6 monero per 2-minute-block, as explained by ArticMine.

It can be written as:

P = R * (W - 1) ^ 2,

where P is the dynamic blocksize penalty (monero), R the block emission (monero), and W the blocksize expansion factor (unitless).

The expansion factor is W = B / M where B is the blocksize (kB) of the examined block, and M the blocksize median of previous 100 blocks (kB). For example, an expansion factor of 1.10 means a 10% increase so if the median is 300kB, the expanded block would be 330kB.

At its simplest form, it could be rewritten as:

p = (W - 1) ^ 2

where p = P / R, and can be called relative blocksize penalty (unitless).

For example, blocksize increase of 20% above the median would mean 4% (= 20 ^ 2 / 100%) penalty, increase of 40% would mean 16% (= 40 ^ 2 / 100%) penalty, regardless of the actual value of current median and block emission. This is always true, and easy to remember.

Note that there are no arbitrary constants. The only special treatment is for M < M_0, where M_0 is the minimum penalty-free blocksize, presently at 300kB. The function of this is to prevent unwanted edge cases, too high fee/TX and allow some number of transactions to fit in a block regardless of the current median. While it is a constant, it will become irrelevant once M is stable above it due to regular network use.

To illustrate, imagine if there were 100 empty blocks. The median would be 0 and nobody could transact since there's a hard cap at 2 * M and 2 * 0 == 0. For this reason, M_0 is introduced and used in place of M until M > M_0, allowing normal functioning of the network even after times of no or minimal use. Once the network grows big enough, the median will likely never drop below M_0 and it will become completely irrelevant.

The relationship can also be observed in the below chart.

Block Reward Penalty

Dynamic Neutral Fee Formula

This is the fee (monero / kB) needed to compensate the penalty for a given blocksize increase. It can be written as:

F_n = (R / M) * (W - 1).

where R, M and W have been defined above.

We can also express the fee in relative terms normalized to size of block median:

f_n = (W - 1),

where f_n = (F_n * M) / R.

This means that if there are transactions in the TX-pool offering such fee with which the total fees in a 100% full block would be some % of current block emission, the miner could increase the block for the same % and earn the same block reward.

We can plot the relationship for various f_n, as seen below.

enter image description here

Wherever the parabolas cross the x-axis, is the point of neutral blocksize increase. The "sweet spot" is the tip of each parabola, where the miner would earn the maximum possible for a given fee. These are joined by a curve called the optimum curve. For any given TX-pool state, a miner should arrange his block such that it lies as close as possible to that curve.

The current dynamic minimum fee is the curve for f_n = 1.2% which is arbitrarily chosen. It could be any other. It matches priority = 1 in the wallet setting. This means that if everyone offered the minimum fee, miners would still have incentive to increase the blocksize up to 1.2% if the TX-pool is full.

Practical Consequences

  • The best strategy for the miner is to keep blocks 100%+ full with other people's TX-es. This doesn't necessarily mean increasing the blocksize. -
  • If the TX-pool is full, he'd want a 100%+ blocksize to earn more on the extra fee-paying transactions.
  • If the median is already elevated due to some previous rush period and is now under utilized, like blocks being 50% full because there's not enough TX-es in the TX-pool to fill them up, a miner would earn more if he lowered the median as it would bring the fees up. This is important because it means a miner is not motivated to stuff his own dummy TX-es just to keep the median elevated.
  • A miner has no incentive to reduce the blocksize while the TX-pool is full. While reducing the median would increase the fees, the miner wouldn't earn more in total since he could fit less transactions in a block. He would actually actually earn less, because the fee increase lags behind so he'd initially be filling smaller blocks with same fees/kB, while competing miner could take all those TX-es and earn more than him.
  • The normalized relative fee is actually constant, ie regardless of the current blocksize, the total fees per block will always be some % of the block reward. This means that the fees will reduce as the block reward reduces. This also means that the cost of a block is shared among those who transacted. The bigger the block, more people share the fee, and individual fee/Tx will be lower.

I posted on BCT back in 2016 some of the basics: https://bitcointalk.org/index.php?topic=753252.msg13591241#msg13591241

The penalty paid by the miner is equal to the block reward multiplied by the percentage increase of the blocksize over the median squared. This is the Cryptonote penalty function which is present in all Cryptonote coins. There are important consequences for this.

1) A rational miner will not pay any additional penalty unless she is compensated for the penalty loss in fees

2) A rational miner will order transactions in order of profitability so it is the least profitable transaction that is used to test the penalty

3) 1 and 2 mean that the miner profits from the penalty and consequently has an incentive to keep the blocksize small.

4) The law of supply and demand will keep the total amount of fees per block in a range that over time is proportional to the block reward. The position in the range is determined by the demand for transactions vs price in fees to overcome the penalty.

5) There is an effective coin burn in order to increase the block size or to maintain a block size over the minimum.This occurs because there is no refund for mining a block smaller then the median. This coin burn occurs because during the regular emission, the onset of the tail emission is delayed, and during the tail emission the penalty coins are not replaced.

6) A spam attack to bloat the Monero blockchain becomes economically equivalent to a 51% attack.

4 above is critical. It caps the total fees per block to a range that falls with the emission. This means that if the emission falls to zero so do the fees and the coin becomes insecure. It means that Cryptonote coins, such as Bytecoin, that do not have a tail emission will eventually become insecure, since their fees all also fall to zero. It also means that scaling proportions that have a less severe penalty than in Monero or no penalty will also makes a coin without a tail emission such as Bitcoin insecure. A good example of this is Bitcoin Unlimited.

4 also allows the creation of dynamic fees in Monero by setting the per byte fees to be proportional to the block reward divided by median blocksize. This allows for the setting of fee levels that correspond to various points in the penalty or how much penalty the sender is willing to pay in order to get her transaction mined.

In order for the dynamic blocksize to work one needs both the penalty and the tail emission. One cannot add a Monero style penalty on a permanent basis to coins such as Bitcoin, Litecoin, Ethereum Classic or Dash. It could be added with some risk for a fixed number of blocks by requiring the the block reward be over a certain threshold in order the adaptive blocksize to operate. It could be added to coins such as Ethereum or Dogecoin because they have a tail emission; however to my knowledge this has not been done. A much weaker scaling requirement as was done in Ethereum could fail to a spam attack, as could adding something like Bitcoin Unlimited to Dogecoin.

Source: ArticMine

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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