The Mechanics Behind EOSIO RAM Allocation

EOS has been on the news quite a lot lately because of the sheer amount of intrigue that has surrounded its mainnet launch and ICO. In this article today, we will talk about RAM trading in EOS, which has become quite a contentious subject of debate in the crypto-community. However, before we do so, let’s give you a small introduction.

Resource Allocation and EOS

EOS plans to become a decentralized operating system, that Dapp developers can utilize to create and code various Dapps. The EOS tokens basically act as a toll booth and holding them gives you access to various resources such as Bandwidth, Computation, RAM etc. Now, since these resources are scarce, EOS doesn’t want you to hold on to their tokens for too long.

In fact, the company behind EOS,, has explicitly mentioned in the platform constitution that EOS members who don’t use their tokens for three years would get their account terminated.

So, the way it works is, you stake some of your EOS tokens and get some of the resources in exchange. However, it is not this straightforward when it comes to RAM.

The RAM Quandary

RAM is an extremely powerful and critical resource for blockchains. Since scalability and performance is all the rage nowadays, you can see why the “hunt for more RAM” will eventually become the most important issue for all EOS based Dapps.

In Dawn 3.0, RAM pretty much acted the same way as the other resources. If you staked a certain amount of EOS tokens to get RAM, then you can sell it for the exact same amount of tokens. Early adopters are obviously going to get the resources for pretty cheap, since the demand will be comparatively low, however, this is where we face the first problem.

As more and more users join the EOS network, the supply for RAM will go down, which will in turn shoot the demand off the charts. “Supply and Demand” is one of the most basic features of microeconomics.

The supply-demand graph looks like this:

Image Credit: Blockgeeks

The sweet spot where both the curves intersect is the equilibrium. To simplify things, as the demand for a particular asset increases and its supply deceases, its price should increase appropriately.

However, with the Dawn 3.0 model, holders were forced to sell off their RAM for the same amount of tokens that they bought it for in the first place, regardless of the supply and demand for RAM. As such, they had absolutely no financial and economic incentive to sell off their RAM.

Plus, also keep in mind that has already determined in their testing that the way the EOSIO System Contract was allocating RAM to stakeholders would inevitably lead to shortages down the road.

Dan Larimer and the Block.One team realized that a more incentivized cryptoeconomics-driven ecosystem needed to be created which will ensure RAM availability.

The solution? The RAM marketplace.

The RAM Marketplace

EOSIO is using a market-based allocation approach for RAM by utilizing Bancor’s algorithm. In simple terms, they are creating a RAM Marketplace. Personally, we feel that this is a very smart approach because it aligns RAM, their rarest asset, in accordance with the supply and demand graph.

So, how is this marketplace going to work?

Each time someone buys or sells RAM, a 0.5% fee is applied on both the buyer’s side and the seller’s side (1% overall). This actually gives an economic incentive for users to sell their RAM and also it discourages speculative marketing and inflation as the fees that are collection are promptly burned (removed from the ecosystem).

This internal RAM marketplace will make sure that there is a steady availability of RAM and will offset any future predicted shortages. You will be able to buy RAM based on the price that the system sets it at, which is based on the current available supply of RAM.

This marketplace also creates another interesting way that one can reduce speculation. A block producer can add more RAM at any point to the marketplace and shoot supply off the roof. This increase in supply will obviously decrease the price of RAM as well.

Future Expansion

So, how will the marketplace behave in the future. For that, let’s first acquaint ourselves with Moore’s Law. According to Investopedia:

“Moore’s law refers to an observation made by Intel co-founder Gordon Moore in 1965. He noticed that the number of transistors per square inch on integrated circuits had doubled every year since their invention.

Moore’s law predicts that this trend will continue into the foreseeable future. Although the pace has slowed, the number of transistors per square inch has since doubled approximately every 18 months. This is used as the current definition of Moore’s law.”

Moore’s law gives you a pretty healthy indicator of the future value of an asset. According to Larimer, if EOS grows in accordance with Moore’s Law, block producers should be able to upgrade to 4TB or even 16TB of RAM. This increase in supply will decrease the price of RAM in the marketplace.

Upcoming Parallelism

The next thing on the developer’s list is to scale up RAM usage. “High performance” is the need of the hour in the blockchain space and in order to do so, they require all the data that is available inside the RAM. An interesting approach to this is side chains usage with independent memory regions.

In essence, EOSIO block producers can operate on multiple chains and use the same token for buying RAM. The producers will be selected via elections that will happen on the main chain, and they will get to access the sidechains once elected. Each side chain will have >1TB of its own RAM and will have the ability to communicate with each other.

Note: EOS will require their own block producers to run the side chains. The idea is to perform cross-chain communication for the side chains to interact with the main chain.

Now this is where things get interesting because it opens up two interesting possibilities:

  • Firstly, the price of RAM will vary from sidechain to sidechain. So a Dapp developer can choose to operate on a sidechain where they are getting the cheapest price. This, in essence, will create healthy competition between the sidechains.
  • Secondly, using inter-blockchain communication, Dapps can gain the ability to buy unused RAM from the other chains. Because of this, Block.One believes that “many applications will prefer the many-chain approach to scaling as it will lower overall costs and scale faster.”

How Much RAM Do You Need?

EOS New York has created an extremely useful tool for all EOS developers to know how much their resources will cost. The tool is called EOS Resource Planner and you can check it out here.

The Planner gives you two handy tools.

  • One that calculates how much RAM, Network Bandwidth, and CPU Bandwidth you can afford in accordance with how much EOS you are willing to stake for each.
  • The second tool will let you know how much EOS you need to stake to get certain specifications of each resource.

Let’s look at an example of each.

Suppose, you want to buy 500 EOS worth of RAM, 400 EOS of Network Bandwidth, and 300 EOS of CPU Bandwidth. According to the tool you will get:

So, according to your resources you will get 28369297.3280 bytes of RAM, 552140623.3150 bytes/day of Network Bandwidth, and 79293966.5221 us/day worth of CPU Bandwidth.

You spent overall 1200 EOS for these resources, which at current evaluation comes down to roughly, $12,960.

Now, suppose you have the resources in mind, but you don’t quite know how much EOS you will need, you can calculate that here as well.

Suppose you are making a hypothetical Dapp which needs:

  • 1 GB RAM
  • 30000000 bytes/day Network Bandwidth
  • 45000000 us/day CPU Bandwidth.

For these resources you will need:

18924.36 + 21.73+ 170.25= 19116.34 EOS total

At current valuation, that stands at: ~$200721.57 USD

How Much Will Cryptokitties Cost on EOS?

Whenever we think talk about a new smart contract platform, we need to invariably ask the “Cryptokitties question.” When Ethereum launched Cryptokitties, it jammed up the network so badly that a couple of ICOs were forced to postpone their crowd-sale. In fact, Cryptokitties brought to light how desperately Ethereum needed immediate scalability solutions.

So, how much will something like Cryptokitties cost on the EOSIO network? Before we continue, you need to take note of two things:

  • Holding EOS tokens gives you the right to a certain amount of free transactions.
  • In real life scenarios, EOS has till now managed ~600 transactions per second.

This video by “The Cryptoverse” does a pretty nice breakdown of the calculations.

Till date, Cryptokitties has had ~393,000 sales in a ~7 month period. For ease of calculations, let’s round off 393,000 to 390,000.

So, Cryptokitties were able to do 393,000/7 = 55,714 transactions per month which is (55,714*12 = ) 668568 transactions per year.

Now, EOS, as of right now, manages 600 transactions per second, which comes around to 18,921,600,000 transactions per year. Keep in mind, there are current 900 million EOS in circulation.

So, each EOS token, as of right now, will give you (18,921,600,000/900,000,000 = )21 transactions per EOS per year.

Now, obviously this rate will go down because of the 5% inflation, but when you consider that future innovations and addition of extra resources by the block producers will increase the overall network performance, we feel that it is going to circumvent the inflation effect.

As we calculated earlier, Cryptokitties did 668,568 transactions per year. So, in order to do so many transactions, the Cryptokitties developers will need (668568/21 =) 31,837 EOS tokens.

At current valuation, that roughly comes around $318,370.

That’s how much a Dapp like Cryptokitties will cost on EOS.

Does Every EOS Holder Need RAM?

So, this begs the question, who should buy RAM?

As is pretty obvious, all the developers on EOS need to buy RAM to run their Dapps. However, what if you are not a Dapp developer? Do you still need to buy these resources?

Of course not. It is completely upto you what you want to do with their tokens. Many users on Reddit have noted that even if you are not a developer, you can simply hold onto your EOS tokens to participate in various airdrops.

There is another interesting thing that you can do with your tokens. You can simply rent out your tokens! Developers are always looking to get more resources for their Dapp. Now, suppose a Cryptokitties like Dapp becomes hugely popular on EOS. You, as a user, can donate to the Dapp by staking some of your EOS tokens for them. You can take back your stake at a later date if you are no longer interested in taking part.

Buy and Sell RAM Functions. Looking at The Code.

So, till now you have learnt how RAM allocation and marketplace works. We are going to take a look behind the scenes and see how the EOS contract works with the buying and selling of RAM. The following methods(functions) in the EOS code deal with RAM buying and selling. (NOTE: The code has been taken from GitHub)

Before we continue, let’s clarify certain terms:

· payer: Someone who pays tokens to get RAM.

· receiver: Someone who sells RAM and receives tokens.

#1 buyram()

void eosiosystem::system_contract::buyram (

account_name payer,

account_name receiver,

asset quant


The first method that we are going to look into is buyram().

This method increases the payer’s RAM quota based upon the price of RAM and the amount of tokens that have been provided. When this function is executed, the following happens:

  • On buying RAM, the payer irreversibly transfers quant (quantity of tokens) to system contract.
  • The payer can reclaim the tokens via sellram() method (more on this later).
  • Payer pays for the storage facility of the database records needed for this action.

RAM, being a scarce resource, is defined by the global “max_ram_size” property (more on this later). RAM is also governed by the bancor algorithm such that it has a price-per-byte with a constant reserve ratio of 100:1.

#2 buyrambytes()

void eosiosystem::system_contract::buyrambytes (

account_name payer,

account_name receiver,

uint32_t bytes


This is a pretty straightforward method.

It will compute the exact amount of RAM that the payer will get and bill them accordingly based on the current marketplace price.

#3 sellram()

void eosiosystem::system_contract::sellram (

account_name account,

int64_t bytes


This method reduces the receiver’s RAM quota and then transfers the required number of tokens to the receiver.

#4 setram()

void eosiosystem::system_contract::setram (

uint64_t max_ram_size


This method simply increases or decreases the amount of RAM available for sale.

There is one more interesting bit of RAM related code that you need to know. This code was brought to our attention thanks to this article.

One of the most fundamental feature of EOS is airdrop. Basically, when someone creates a project on top of the EOS blockchain, they can give away the native tokens on their project to EOS holders.

Now this begs another question. This operation will obviously cost a lot of RAM, so what happens to the project creator’s RAM after giving away all these tokens?

Apparently, once people claim the airdropped native tokens, the project creator can claim back their RAM thanks to this piece of code:

if( from.balance.amount == value.amount ) {

from_acnts.erase( from ); // <<< IMPORTANT LINE

} else {

from_acnts.modify( from, owner, [&]( auto& a ) { // <<< IMPORTANT LINE

a.balance -= value;



Because of this piece of code, post-airdrop, once the token owners move the tokens, they will be set automatically as RAM payers. The moment that happens, the project creator will recover the initial investment they made of the RAM. That is some ingenious coding.

RAM Hoarding

Because of the emergence of the RAM marketplace, RAM hoarding has become quite the issue.

It turns out that >40 GB of the RAM out of an available 64 GB has already been reserved by whales. It makes sense as to why people would do that. RAM, as we have already said, is a rare resource, and a marketplace would definitely lead to whales hoarding RAM.

Having said that, the fact that 70% of RAM has already been locked up without the presence of any DAPP with more than 300 users is extremely worrying. Plus, remember that unlike network bandwidth and CPU bandwidth, one can’t rent out RAM.

Because of this, the price of RAM has surged dramatically from $0.14 to $2.44 in a little over a week. That’s a staggering 1643% increase!

We need to wait and watch to see how this potential problem can be resolved.


The RAM marketplace is an interesting concept which goes on to potentially a solve a lot of issues that Dawn 3.0 raised. We need to wait and watch how things play out in the future to know whether the marketplace has any legs to run on or not. Having said that, aligning crypto economic incentives and creating ready liquidity for an extremely rare resource is quite an impressive achievement.

If you like the article, please clap and share 🙂 Also consider voting for us — we are “bpacbpacbpac”

Default thumbnail
Previous Story

Public PreSale Update

Default thumbnail
Next Story

How EOSIO Vote Decay Works

Latest from Blockchain Technology

Default thumbnail

Introducing the Crypto Module

Kartik’s Crypto Profile This is exciting! We have a new feature! Introducing to