-
Notifications
You must be signed in to change notification settings - Fork 161
Description
The world as is it today
Storage staking
Today contracts need to stake NEAR tokens to pay for the storage that they are using. The more state an account is using, the more tokens it needs to hold. The actual payment is the opportunity cost of not being able to stake the tokens that are now locked up to support the storage that the contract is using. The basic idea is that the opportunity cost would create an incentive for the contract owners to remove state that does not need to exist on the chain anymore. And this incentive would help in ensuring that users will remove garbage state from the chain.
Zero balance account
An additional factoid to keep in mind is that since the zero balance account NEP was stabilised, for up to 770 bytes of storage, accounts do not have to stake any tokens. The payment for this storage happens when the account is created (in the form of the account creation fee) and then the account has this much storage available to use in perpetuity.
The potential problem that this has created is that there is no motivation to cleanup the storage (up to 770 bytes) that an account is using because removing that state or deleting that account does not actually allow the user to recover any tokens. In general though, we are not as worried about this problem because the thinking has been that the number of accounts needed to create a large enough amount of garbage state to truly impact the protocol is going to be quite large.
Where are we moving to?
There is a new NEP currently being discussed that is going to add some twists to above. This NEP is effectively proposing that for a one time fee, I can buy an arbitrary amount of storage in perpetuity.
The problem
The problem arises because of one of the use cases that wants to use this feature. The use case is that a third party wants to onboard users to NEAR; so they create accounts for them; and then give control of the accounts to the users. This is all well and fine. However, imagine if after trying out the service, 50% of the users lose interest in it and decide to stop using it or if the third party goes bankrupt and stops supporting their users. The users do not have any incentive to delete their state because as proposed by the NEP, they will not stand to gain any refunds from doing so. So chances are that the users will simply walk away and there will be garbage state left on the protocol which it will have to maintain in perpetuity.
One could argue that the third party could create an incentive for the users to clean up their state before they walk away. However, I see one of two things happening here:
- The incentive per user will be around the number of NEAR tokens for a single account and might be worth a few dollars at most. So it might not be enough incentive for the users to actually go through with the process (e.g. how do they collect the refund; do they have to do KYC; provide bank details; etc.)
- If the third party creates an incentive to delete the accounts, then they are also creating an attack vector. As seen in this comment, this incentive can lead to malicious users creating and deleting accounts to try to steal the small amount of tokens per account.
Problem summary
To summarise, currently there is a problem on the protocol: there is no incentive for users to clean up the storage that their accounts are using up to 770 bytes leading to accumulation of garbage state on the protocol. The understanding is that this will probably not lead to a lot of garbage state on the protocol though. And if the proposed NEP is accepted, then chances of garbage state accumulating on the protocol is further increased.
Alternative approach
If we look at related works, there is a common approach adopted by other systems. Instead of selling storage; the protocol could rent it. This is how almost all cloud storage services and many other blockchains also work. Users of storage need to keep paying on regular intervals for the storage that they are using and if they ever stop paying for it, eventually the storage will be deleted.
In this mechanism, someone is actively interested in keeping state on the chain and will continue to pay for it and if no one is interested in keeping the state on the chain, then eventually it will be deleted when the rental payments stop.
This post is already quite long so I will not go into further details on how such a rental system could look like. But happy to expand if there is interest in pursuing this approach.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status