Join the open discussion on Feb 1
We are going to have an open discussion on Feb 1st 3pm UTC (7am PT), to join the call add this Google Calendar invite: Google Calendar - Sign in to Access & Edit Your Schedule
It will also be streamed on Youtube and you can also ask questions / comment there: Decision Discussion: Reducing Storage Cost - YouTube
Join the call if you have a strong opinion, watch stream if you just want to be informed.
TLDR
This is opening a discussion to reduce storage staking price per byte from 1E20
yN to 1E19
yN based on adjusting the assumptions from initial calculations.
Additional ideas for addressing experience issues are also proposed for discussion, like burning storage cost and including it into gas instead of as a separate cost.
Parameters of the decision:
- Proposed: Jan 18
- Decision deadline: Feb 1
- Parties whose input should be included: active developers, validators and token holders with economic background or active position on economics.
Details
Problem
Currently the price of the storage becoming unrealistic for storing larger contracts. Rust contracts that take 300kb would require 30N, which at price of 2.5 $USD 2.5 per $NEAR is 75 $USD. Clearly this is already very expensive and directly correlates with any potential price increase.
Adding extra key (e.g. NEAR Wallet ālog inā) to the account is ~100 bytes, currently 0.01N. Compare this with tx fee - 0.00004N.
Similarly, things like storing information about userās token holding, currently can take 168 bytes or 0.0168N.
Developer side, itās also means that all these operations need to contain extra payment included in the call to other contracts. Which makes the development more complicated. The exact cost of storage may be unclear from the caller perspective. The balance on the account is now also needs to be split between āactiveā and āused for storageā (in addition to āstakedā).
Another point, is that even though NEAR is āstakedā for storage, for the most cases itās not expected that storage will be deleted. E.g. accounts, contracts and userās account info inside the other contracts. E.g. the amount āstakedā is almost never returned.
Historical context
State cost is one of the harder problems in blockchains.
Storage staking came in early 2020 as an alternative to storage rent that was implemented in NEAR protocol. Storage rent was highly unintuitive for users and complex to support in the tooling. Contracts potentially could run out of payment for storage and become deletable. Same for userās accounts, which user potentially could loose an account if didnāt have keep enough or didnāt top off at the right time. Even worse, someone potentially could re-create it and claim all the assets that this user had in other contracts.
Ethereum uses a form of storage staking & burning, where gas gets burned when things get stored and 75% of gas gets released when data gets deleted. The important piece here is that itās valuing storage in gas instead of in the base currency. But Ethereum doesnāt have any long term mechanics alignment for storage with storage size growing linearly for past years to over 100 GB.
One of the ideas in Ethereum, is to switch to stateless validation, which indeed provides a convenient way to avoid state storage problem for miners / validatorsā¦ But really just shifts the problem to whoever will be composing blocks, requiring them to have a separate economic model to store data. One idea there is that block composers are professional āfrontrunnersā (MEV) and hence extract value by forming blocks. Generally it allows a smaller subset of full nodes to maintain data and set of application specific nodes that contain data for specific applications.
Storage staking cost
The assumptions were made for calculating the cost of storage to account for rate of replication R
and current cost C
in $USD of the active cloud storage of 1 byte per year. Exchange rate E
of $USD to $N was used.
The model used was:
- Given network must store 1 byte for next year, the validators must be paid
X
$N to store it. - If $N is ālockedā inside the account for this year, it pretty much āgeneratesā inflation on it (as alternatively it could have been delegated and earn the rewards instead), which is global parameter
I
.
E.g I * X = R * C * E
Parameters used:
-
R = 100
(nodes per shard) -
C =
1.12E-9` (High-Performance Block Storageā Amazon EBS Pricing ā Amazon Web Services gp2 is $0.1 GB/mo) E = 1
I = 0.05
Solving for X
=> 0.05 * X = 100 * 1 * 1.12E-9
=> X = 2.24E-6
or 2.24E19
yN.
Given there is pretty large overhead for storing state data (merkle tree, various meta data, etc), it was rounded up to 1E20
yN.
Proposals
This is still TODO to figure out all the details based on the feedback and information.
Proposal 1
Description: reduce cost by 10x
Impact: minimal
Implementation time: couple of weeks
Reasoning: current costs are too high for users and developers
Proposal 2
Description: reduce cost by 100x
Impact: potentially people filling in cheaper storage and then release it later to get back NEAR
Implementation time: couple of weeks
Reasoning: current costs are too high for users and developers
Proposal 3
Description: reduce cost by 100x and burn the storage cost, including it in gas spent
Impact: reduces complexity of building applications, reduces complexity of frotnends like wallets and explorer by removing āminimum balanceā concept; there is no motivation to release storage.
Implementation: 1-2 months
Reasoning: current costs are too high for users and developers; developer experience suffers from needing to send storage $NEAR around; people are not releasing storage anyway which leads to the $NEAR effectively being burnt
This proposal can be split into one step to reduce costs in short term and second step to include storage cost into gas which will take more to implement.
The storage cost can be measured still in $NEAR or in gas. If itās measured in $NEAR, the charging will only charge amount of gas to cover storage cost (e.g. gas_spent = bytes_added * storage_byte_cost / gas_cost
).
Potentially, gas can be returned to the transaction which releases storage.
This is pretty much Ethereum model. Itās known limitations are mainly around lack of motivation to release storage and issues around high gas prices to use āstorageā as reserve of cheaper gas. The problem with reserving gas can be minimized by using formula above where charging happens at fixed $NEAR cost instead of current gas cost.
Motivation around releasing storage seems missing in general. It seems like a more advanced technical solution is needed to handle growing size of the active state in the blockchain. For example, stateless validation mentioned in āHistorical Contextā.