The aim of this article is to provide an alternative representation of the simulation results published (opens new window) by Nomadic Labs. We will also pay a bit more attention to the consequences of both the deflationary baking and the new reward formula introduction.
# Short recap
- A new family of attacks called “deflationary baking” was introduced by an anonymous researcher;
- Deflationary baking corresponds to refusing endorsements of other bakers in one’s blocks;
- Several strategies were presented to optimize the number of endorses included;
- For simplicity, we will сonsider only RSD strategy (IAR and other strategies’ results are close or worse) which combines block stealing (aka selfish baking) and deflationary baking.
# Simulation and postprocessing
In one sentence, the Emmy simulation tool by NL allows you to generate
n datasets for each value of the dishonest share for the given protocol and attack type. We tweaked it a bit so that we could receive JSON output and also adjusted the inspected range. The code used for analysis is located at this repo (opens new window)
- Total circulating volume: 800 000 000 tez;
- Staking participation: 80%;
- Simulation time: 8 hours of baking;
- Inspected range of dishonest rolls: 1000–70,000 (was 10,000–70,000);
- Number of samples per each roll size: 63,245–2390 (was 3000).
All the postprocessing (including charts) is made in Jupyter notebooks. You can play with the data yourself right in the browser:
- https://colab.research.google.com/drive/1iXzeTebAI7W7hfVpMTHSN1v2Eyo93n6m (opens new window)
- https://colab.research.google.com/drive/1OPEtGdhCezJWErse1JI1wDlZkw_njL4r (opens new window)
# Deflationary effects
A decrease in the number of endorsements results in fewer rewards i.e. lower tez emission. In addition, block stealing leads to longer block delays (forced low priority blocks) and also fewer block/endorsement rewards. All this slows down inflation, i.e. has a deflationary effect.
# Network slowdown
To give an idea of how much the attack slows down the network let’s examine the average cycle length depending on the count of dishonest rolls.
# Stealing rate
The best way to demonstrate how the adversary earns more than the rest of the network while together they earn less than if everybody behaves honestly is to look at the ROI curves:
One can note that at some point, the adversary starts to receive all the rewards.
# Share capturing
Aggressive block stealing/endorse refusing also leads to the network share redistribution: dishonest bakers gradually increase their share due to honest ones.
You may notice that relatively high speed is reached when the profitability of dishonest baking is already decreasing.
# Incentives & disincentives
# Absolute rewards
Here is a chart showing absolute rewards gained by an n-rolls baker depending on whether he chooses to be honest or not (max rewards imply all blocks have 0 priority and 32 endorses):
One can note that there are no incentives to behave dishonestly if measuring the profitability by results in tez.
# Real rate of return
A real rate of return is the annual percentage return realized on an investment, which is adjusted for changes in prices due to inflation.
However, these numbers make sense only for a solo baker who owns the whole stake. In other cases, this rate can rise significantly.
# Value at risk
Since dishonest behavior harms the network and therefore affects the value of the attacker’s stake, it makes sense to consider the risk/reward ratio instead of AR/ROI/RRR. Different types of bakers have different exposures to price volatility risk:
- Solo baker (100%)
- Public baker with 100% filled capacity (~10%)
- Baker pool administrator (< 10%)
- Private fund/exchange that uses clients’ funds as bond (0%)
**How deflationary baking affects the price?
**Although we took into account the decline in inflation, we did not take into account the impact of network health on price volatility in Tezos. As we have seen, the network can slow down quite a lot, which cannot go unnoticed. The same goes for the number of blocks stolen and endorsements missed.
Unfortunately, while we can evaluate the deflationary effect, then it is very difficult to predict the effect of the news background on the price. What can definitely be said is that VaR is growing with the size of damages made to the network, but on the other hand, high volatility is good for exchanges as it usually comes with increased trading volumes.
# Choosing sides
It seems that there are actually two types of attackers with different incentivization. The first is the one that unleashes the war, starts to bake dishonestly in the very beginning — let’s call him the villain. All followers who will later join the dark side are called minions. Minions can be either cooperative, that is, form a cartel, or not. There may also be several non-cooperative cartels.
The last two cases (non-cooperative attackers) are out of the scope of the current paper and require additional research & simulation. We will assume that all the minions and the villain act as a whole.
Suppose we are now in such a state of the network when only honest bakers operate. An adversary has to decide whether is deflationary baking more profitable than honest baking. AR indicator is useless, RRR does not consider value at stake.
One way to get a rough idea of deflationary effects in absolute numbers is to use a different settlement currency. Let’s calculate how much an attacker’s entire stake will cost in EUR in a year if he chooses the dark side or remains honest, and then take a diff:
Still, the villain should think twice considering the probable stake value loss caused by network damage he could make.
Suppose the war is already started, and the villain actively invites mid and large bakers to join the dark side. Moreover, the more minions joined, the higher their income level (but there is an upper bound).
Let’s say you are a 5k rolls baker, and you want to determine whether to join the dark side depending on the current size of the deflation pool:
The new rewards formula introduced to protect the network against deflationary attacks is moving the accent towards the block reward. This has several consequences, we will focus on the increased variance of reward amounts and the higher cost of block loss.
# Ranking criteria and reward variance
How will increased variance affect public bakers? If we do not take into account the domestic economy of bakers, a large spread in rewards from cycle to cycle can be a repulsive factor when choosing a baker. Rating sites add fuel to the fire because using criteria such as efficiency, yield, actual ROI (was used on baking-bad.org (opens new window) for some time, recently removed) gives a distorted idea of bakers’ performance. Say, you are a 10k roll baker and you will get from 1 to 12 block rights per month. If you lose one block this will be from 8% to 100% of the total number. Similarly, your monthly reward varies from 335 to 516 tez, thus the projected annual ROI can be 5.3–8.2% depending on how lucky you are. These numbers were for Babylon, in Carthage variance doubles (approx.) therefore all the observed effects increase as well. Here is a chart reflecting the yearly ROI interval depending on the rolls count:
Basically, the rule is simple: the smaller the baker, the longer the delegation term should be, that way you achieve the target ROI. Here is a chart demonstrating how many cycles you should keep your delegation (not including initial 12) to reach the annual targeted ROI ±0.1%:
# Baking entry price
One way to feel the variance is to examine the lower bound of the reward distribution. For instance, let’s calculate the lowest possible (with .95 alpha) baker rewards for a month, this value may be useful in deciding to bake for a newcomer:
In case of solo baking, your staking balance is basically the entry price, but for a public delegation service numbers change:
True speaking, it’s highly unlikely that someone does such calculations to make a decision to bake, although it’s a good enough way to asses the risk.
# Price of a block loss
Almost everyone at least sometimes loses blocks and misses endorsements — this can be due to poor network connectivity, insufficient resources, bad luck, etc. If we look at the statistics for the last year, we will see some minimum level of losses/misses in each cycle (spikes should be ignored). Of course, with each new release and change in the network contingent, these values also change.
If we dive deeper and check the distribution of losses/misses by addresses/rolls we see that large bakers tend to lose/miss less often than smaller ones. This can be due to better infrastructure and also because of little data for analysis for smaller bakers (large variance in action).
Nevertheless, we can accept that probabilities of losing a block/missing an endorsement are different, and figure out how this will be combined with the introduced asymmetry in the reward formula:
Basically this is just an interesting observation, the amounts are pretty small and can be neglected.
# Low priority rewards
Despite the fact that in the new protocol the rewards for low-priority blocks and endorses are less than in Babylon, due to the correction of a mistake in the current formula, the rewards will grow on average a little:
However, the rewards with low priority will be less than if they simply corrected the current formula.
- Deflationary baking can make significant damage to the network health and decrease honest bakers’ rewards down to zero;
- The profitability of the attack (and more importantly risk/reward ratio) is still questionable as it relies on price effects caused both by inflation and network health, and it’s hard to predict the market moves;
- The introduced change in the reward formula smooths out the negative effects of the attack and increases the entry threshold for joining a deflationary cartel;
- The network is still not secure against large deflationary pools/cartels;
- Several popular criteria used to rank public bakers are not robust against reward variance, and the variance doubling will likely exacerbate the situation for small and medium bakeries;
- It’s probably a good idea to split such controversial updates in Athens-style next time.