Storing Transaction Data - Who Pays?
One of the changes that have been made to domains between Stake Wars 1 and Stake Wars 2 is that the concept of a storage fee fund has been introduced. Each operator spawns a nomination pool and each nomination pool has a storage fee fund. The reason these funds have been introduced is to allow us to increase the number of nominators each operator is allowed to have in their pool. Previously, this number was capped at 256 due to the way it was necessary to calculate each operator’s earnings. Storage fee funds enable the network to scale without limitation.
Let’s take a closer look…
Storing Transaction Data
When an operator produces a bundle, the transaction data it holds has to be stored somewhere. It is stored in the blockchain history which our network of farmers are holding in their plots. Adding data to the blockchain history incurs a storage fee - farmers have to be paid for their work of course! Storage fee funds allow the domain operator to pay for that storage without there being a chance that a malicious operator is abusing this mechanism and including the user transaction multiple times and overcharging them without repercussions.
Paying For a Transaction
To understand this process it’s necessary to consider the lifecycle of a transaction:
- A user submits a transaction on a domain.
- The user’s transaction fees are locked in their account. They cannot be transferred to the operator (to pay for storage and execution) in case the operator is malicious and wants to claim them without executing or storing the transaction.
- The operator processes the transaction and pays the farmer the storage fee for the processed bundle with the user’s transaction in. This comes from the storage fee fund (remember the user’s payment is still locked in their account).
- After the transaction is processed, a challenge period has to pass. It is during this time a malicious operator would be identified thanks to the comprehensive suite of fraud proofs the protocol employs. It only requires a single honest operator to be online to identify dishonest behaviour.
- After the challenge period has passed (currently 14,400 blocks or around 1 day), the locked fees are transferred to the operator. This is referred to as a refund in the Autonomys Academy staking section.
- It is expected that the unlocked transaction fees (refund) after the challenge period will be slightly higher than the true cost of the storage and transaction processing cost.
Storage fee deposits are withdrawn along with, and proportional to, the stake a nominator withdraws. There are a couple of edge cases where a storage fee withdrawal could be slightly lower than the original deposit but in general it is expected that for the most part, the storage fee fund of the nomination pool will grow over time, as will each nominator’s deposit. Exceptions include when a nominator withdraws after contributing to paying for a transaction but withdrawing before the challenge period is up (only a problem for funds that are staked and withdrawn very quickly) and some more obscure/rare cases such as duplicate bundles both paying for storage but only one being rewarded the user’s transaction fees. This is a pretty complex subject we will not cover exhaustively in this article.
One of the goals of Stake Wars 2 is to test that all the participants (farmers and operators) are refunded fairly and users are not overcharged.
Storage Fee Fund Deposits and Withdrawals
A big change our Stake Wars 2 participants will notice is that when a token holder stakes as an operator or a nominator, 20% of their stake is deposited into the nomination pool storage fee fund. Before anyone panics, this is not a tax, and the tokens have not disappeared, they are held in the fund. This deposit is not locked in the nominator’s account, instead it is actually transferred to the operator’s storage fee fund. This is why it does not appear as stake on Astral. As everyone is subject to the same deposit percentage, everyone’s proportional staking power and therefore earning power is maintained regardless of the deposit.
Similarly, when a nominator withdraws stake, they will also withdraw the same portion of their storage fee fund deposit. So if a nominator withdraws half of their stake, they will also get half of their deposit back. There is a great worked example on the Academy if you want to get into the math behind this.
Note that 20% has been set as a value we want to run Stake Wars 2 with. This is the testnet and we want to see how domains perform with the deposit percentage set at this level - it’s one of our goals for the contest. It may change and it’s very likely that this figure will change before becoming a mainnet parameter.
Conclusions and Takeaways
To draw this together and understand how all this will affect your staking here are the important points.
- Staking as an operator or a nominator is now subject to depositing 20% of the staked amount to a storage fee fund.
- Everyone is subject to this so it does not affect your proportional staking power. It does not affect the stake distribution.
- The storage fee fund is expected to grow over time as the transaction fees users pay will include a storage portion paid at a rate slightly higher than paid to the farmers. 20% of an operator’s tax is also paid into the storage fee fund.
- The storage deposit is withdrawn along with stake as a matching proportion of that stake.
- While this primer aims to provide an approachable explanation, the subject of storage fee funds does have a number of relatively complex nuances. We encourage those who want to know more, including the detailed math and a worked example, check out the relevant page over on the academy.