Storage Costs on Blockchains using EOS.IO Software
A 3D XPoint wafer. - Intel
In the EOS.IO Technical White Paper we discuss some of the features of a blockchain that adopts such software unmodified. In the paper we describe a method of resource allocation where if you own 1% of the tokens then the software will allocate 1% of the available storage capacity of the blockchain to you. If there are 1 billion tokens and 1 terrabyte (TB) of storage then each killobyte (1024 bytes) of storage would cost about 1 token. At a $3 billion dollar market cap that would represent about $3 per killobyte. If the tokens reach the market cap of Ethereum then it would could be $30 per killobyte or about 3 cents per byte.
We also know that every single account created with EOS.IO software has about 1000 bytes of data just to track the permissions, balance, and other miscellaneous overhead. This means that it would cost $30 per account which is still much too high.
Increasing Capacity to Reduce Costs
In order to bring costs down when token values are high we would need to increase capacity. In order to reduce the cost-per-account to $0.01 we would need 3000 TB of storage. If we could use SSD, this kind of storage would cost about $1M dollars. If an EOS.IO based blockchain reaches a $30 billion valuation, then $1M may be insignificant amount of money for a blockchain able to allocate $1.5 billion dollars per year to block producers (5% inflation).
Unfortunately, SSDs are about 2500x slower than RAM and forcing the operating system to “swap” to SSD can absolutely kill performance as many Steem witnesses recently discovered when Steem upgraded to chainbase.
This means we would require 3000 TB of RAM-speed storage. This is not unusual, Google keeps their entire database in RAM. What is unusual is needing that much RAM for a new platform.
New Storage Technologies
Intel recently started shipping its first Optane SSD based on the new 3D XPoint technology. This is the first SSD that can be configured for use as RAM and has performance that is dramatically faster than prior SSDs even if it is slightly slower than traditional RAM. They will be releasing these drives with 1.5TB capacities later this year.
With these new technologies we think the cost of high-performance memory should fall dramatically and block producers should be able to scale up the available memory to bring down costs. The higher the market valuation of the tokens the more memory the block producers will be able to afford.
The True Nature of the Challenge
The tokenization of RAM storage by the EOS.IO software causes it to acquire monetary value in addition to storage value. This added monetary value makes it expensive to use for actual storage relative to storage that lacks monetary use. Gold is not used in industry as much as it could be because it’s monetary value exceeds its industrial use value. Tokens created by those who use the EOS.IO software effectively monetize RAM storage capacity by demanding proof-of-performance from elected block producers.
Like gold-reserves in a bank, most of the time it sits there and is never used. Block producers could advertize a “capacity of 3000 TB” when in reality they only have 3 TB of capacity, 1000x fractional reserves. Under this model the cost of storage would be reduced the same way the value of “gold backed notes” falls under fractional reserve banking. Everything will work fine until there is a “run on the bank” when all of a sudden someone decides to buy 1% of the currency and attempt to store 30TB of data when there is less than 3TB actually available.
Preventing a Run on the Memory Bank
A network can operate with “cheap storage” per token so long as the majority never attempt to actually use the storage they are entitled to. As the available storage decreases the price will have to increase. At any time someone attempting to consume 100% of the available storage will have to pay 100% of liquid tokens; however, someone only attempting to consume 1% of the available storage may only need to pay .01% of the available liquid tokens. The exact equation that is used will require some modeling and approximation, but it should be possible to make the initial price of the first byte of storage used be 1000x cheaper per byte than consuming all available storage.
It could be as simple as starting the reserve ratio at 1000x and then reducing it to 1x as the percent of actual memory is consumed. So if you have 1TB of real RAM you start out at 1000TB of virtual RAM (1000x). After consuming the first 100GB (10%) your reserve ratio can fall to 100x resulting in a new virtual RAM of 100TB. By the time you consume 500GB (50%) your reserve ratio would fall to 20x giving virtual RAM of 20TB. As virtual RAM falls the virtual RAM per token will also fall automatically increasing the price of each additional unit of storage.
Implications of Variable Pricing
The market will naturally consume resources until supply and demand are balanced at a constantly changing market price. If the initial pricing of storage is too cheap it will rapidly be consumed until the price rises to a level where only valuable data is stored. At this point block producers can either increase capacity or the maximum reserve ratio to bring prices down. The token holders will vote for the producers who offer the most capacity for the least money and if the token is growing in value the producers will be able to afford the additional capacity.
Another factor of variable pricing is the financial incentive to release memory when it is not used. As the token value increases the opportunity cost of using those tokens to maintain storage also increases. Smart developers will design their applications to minimize memory usage and maximize opportunities to reclaim memory.
Memory Squatting Attack
A side effect of this algorithm is that someone looking to consume a lot of memory has financial incentive to be the first to consume the memory. Once they have consumed it they can repurpose it as they see fit within their contract. If they ever need their money back they can release the memory. Reserving memory “first” will quickly push the price up to a point that balances speculative demand with actual demand.
Fortunately this attack is greatly mitigated by the fact that reserved memory is “not transferrable” and that initial memory costs will still be about 100x more expensive than buying actual physical RAM. Every byte of memory used by the network is replicated and stored in over 100 full nodes and often many partial nodes. The network has to pay these people enough to justify purchasing and maintaining this real memory. Therefore, decentralized RAM replicated across 100 nodes will always be 100x more expensive than centralized RAM on a per-byte basis. Block producers should take care to keep the reserve ratio set such that the cost-per-byte doesn’t fall below the actual cost of the real memory being used by the network when factoring in desired level of redundancy.
The market will naturally and unavoidably imbue monetary properties to tokens created with the EOS.IO software. It will be necessary to implement dynamic pricing on the cost of consuming an additional unit of memory in order to keep prices practical for actual application development. This in combination with new memory technologies will ensure that the cost of storing data on EOS.IO based blockchains is reasonable for decentralized application developers.