EOSIO RAM Market & Bancor Algorithm
By Daniel Larimer
The EOSIO blockchain software enables communities to configure the amount of RAM (Random Access Memory) that all full nodes are expected to have for maximum performance. RAM is required to store account information such as keys, balances, and contract state. Because the amount of RAM available to a single computer is limited by Moore’s Law and other technological advances, RAM is fundamentally scarce.
EOSIO adopts a free-market approach to allocating scarce resources to their highest purpose. To facilitate this market, the eosio system contract allows users to buy RAM from the system and sell RAM back to the system in exchange for the blockchains native tokens (e.g EOS). This provides liquidity in the RAM market while facilitating price discovery. The less unallocated RAM available to the market maker the higher the market maker prices the remaining RAM. The algorithm used for this market maker is known as a Bancor Relay.
A Bancor Relay does not set the price of RAM. It only offers to buy and sell at previously established market rates. Anytime the current market rate is different than the current price offered by the Bancor Relay traders will buy or sell RAM pushing to closer to the market determined price.
The eosio system contract uses the proceeds of past RAM purchased by a blockchain community to provide liquidity to those looking to sell RAM back to the system. Using the community EOS blockchain as an example: theeosio.ram account has 4.4M EOS (about $40 million dollars) at the time of this writing. This 4.4M EOS is providing liquidity to 52GB of RAM with a market value of around 25M EOS ($270 M) at current pricing. It should be obvious to all that the market maker is unable to control the value of RAM when it only holds EOS worth less than 20% of the RAM market cap.
RAM is a Commodity
While RAM can be bought and sold, it cannot be transferred from user to user. Furthermore, unlike the social consensus about maintaining artificial scarcity of traditional cryptocurrencies, the RAM supply may be increased overnight based upon community demand and technological advances. The supply of RAM is managed by voters for the benefit of developers and users which need cheap RAM to build applications. Expensive RAM makes a blockchain unviable for many business models.
The eosio system contract is operating automatically on behalf of EOS token holders who get to vote on the pricing structures. As a holder of RAM the only thing you are entitled to by the blockchain is storing data in contracts. You are not entitled to any specific repurchase price other than what the community is willing to offer you via the eosio system contract at the time you decide to sell. Because RAM is limited by technology the eosio system contract will generally offer to buy or sell RAM at market prices. Once again, the contract does not set market prices. The market prices are set by people interacting with the system contract to buy and sell.
Bancor Relay Volatility
The Bancor Relay has some parameters that impact how fast the price moves in response to incoming requests to buy and sell RAM. This effectively determines the shape of the orderbook and the degree of slippage someone would see when buying or selling a large quantity.
Due to an unintentional configuration of the Bancor Relay weights on the EOS blockchain, this parameter is set at .05% rather than 50%. This introduces some heavy slippage for buying and selling large quantities and causes more volatility than desired.
We recommend updating this parameter to the intended value of 50%. The immediate effect of this change will be to temporarily lower the spot-price offered by the market maker. Market participants will be able to interact with the market maker to push it back toward market value. Keep in mind that under both the old and new values the free market is setting the price and the market maker is merely responding. This means that changing the parameter may create a buying or selling opportunity until the price returns to market value.
As the free market pushes the Relay back to market value pricing of RAM users will experience far less slippage when buying and selling in large quantities. Reducing slippage and volatility provides a more predictable and stable market for both RAM speculators and RAM users.
Bringing Down Costs by Scaling
Blockchains have been struggling to scale since the introduction of Bitcoin. The recent price spikes in the EOS RAM market indicate that the market believes RAM is worth $4 per KB given current supply. This is a STRONG market signal that providing more RAM would be very valuable.
Dapp developers face two costs when building their system.
The cost of interacting with the blockchain
The cost of hosting a full node
Keeping RAM scarce (64 GB) lowers the cost of hosting a full node, but increases the cost of interacting with the blockchain. So much so that deploying a typical smart contract (which uses 10MB of RAM) costs about $40,000 at today’s RAM prices. A developer attempting to build a social media platform will likely want to host at least one full node of their own. For them, spending $39K on high-end hardware with sufficient RAM and $1K for storing their contract in RAM is “break even”.
RAM is about $11 per GB per server and the EOS RAM market is pricing RAM at $4M dollars per GB. This indicates that the network as a whole could buy real RAM for over 300,000 servers for the same price speculators are bidding on the limited 64 GB of RAM allocated to the EOS chain.
The network could clearly maintain significant decentralization while raising the cost of a full node. Based upon this analysis of server-cost vs chain-cost to Dapp developers, it is clear that a dramatic increase in on-chain RAM and more expensive full nodes is cheaper for the users of the overall network.
Based upon this analysis it seems reasonable to increase the cost of full nodes until it is cheaper to deploy a large contract to chain than it is to operate a full node.
20 years ago, when 128MB of RAM was considered a lot, most computers relied on virtual memory to support more applications at once. Virtual memory swaps RAM contents to disk when it hasn’t be used recently. This can dramatically slow down your computer when under RAM pressure. Fortunately for us, SSD technology has dramatically reduced the gap between RAM and disk performance. Additionally, a large percentage of RAM is infrequently used and/or held entirely for speculative purposes.
It should be possible for non-producing full nodes to rely on virtual memory to reduce costs. The vast majority of CPU capacity of the network is under-utilized so there is opportunity to trade CPU time for RAM.
Modern operating systems also support RAM compression which trades CPU cycles on idle cores for more space. It is actually faster to decompress RAM than it is to load it from disk. The combination of compression, disk-paging, and modern ultra-low-latency disks means that a blockchain community can made a tradeoff between maximum TPS and RAM. After all it doesn’t help anyone if they can do 1 billion TPS if they are limited to the 8MB of L3 cache. There is a market trade-off that all blockchains must make between memory usage, throughput, cost of a full node, and demand for scarce resources.
Transparency in RAM Market
In order for RAM speculators to do their part to balance present vs future demand for scarce resources, they need reliable projections of RAM supply growth. Sudden and unpredictable increases in RAM supply can cause them to lose money and/or stay away from the market. This leads to less efficient resource allocation.
Sudden increases in RAM supply represent inefficient distribution of new supply by the system contract and will extract less tokens from the market than could be extracted over time. The impact of less efficient extraction is a loss of revenue to the market maker and an increase in long-term volatility caused by a less-well-funded market maker.
Therefore, block.one has created an proposed update to the system contract that will add a fixed amount of bytes-per-block to the RAM supply. The elected block producers can set a sustainable rate of growth rather than instantaneous increases. As RAM supply increases are the purview of the producers, it is my opinion that no referendum is needed to automate what they could do manually today.
RAM is meant to be used for developers who want to build real things to make everyone’s lives better. The free market and blockchain communities will adopt a combination of approaches to reduce the total cost of deploying and using large-scale decentralized applications. RAM is not designed to be artificially scarce the entire market is working on ways to increase both RAM and TPS over time.