The formula for RAM price in EOS
It is my impression that almost nobody knows what is the exact formula determining the price of RAM in EOS.
After a very careful study of the formulas implemented in exchange_state.cpp,
Kyunghwan Kim, Hyunwoong Ji (both from EOS Seoul) and I (from EOS Argentina) concluded that after a RAM transaction, the quantity “E times R” remains constant, where E is the EOS balance of the connector (equal to the balance of eosio.ram plus 1,000,000 EOS) and R is the amount of available RAM. It is easy to verify this by observing data from the mainnet. With only this information we can deduce an easy formula for the price of RAM.
Note: fee will be explained at the end.
Say we are buying Q bytes of RAM. We will have to pay some amount P of EOS. The price we are paying for RAM is simply P/Q. Before buying, we have the quantities E and R. After buying we will have E+P and R-Q.
We know (E+P)(R-Q) = ER.
So E/(R-Q) is the formula if there was no fee.
Why are the formulas in the code so complicated if at the end of the day the actual formula is so easy? I have no idea.
Notice that if the amount Q is small compared to available ram R, the price is approximately E/R. However if for example Q = R/2, the price is 2E/R. And so on.
How does the fee get in? According to the code in the contract delegate bandwidth.cpp the function “buyram” first charges a 0.5% fee and then buys ram with the rest of the money. So the final formula is just 1.005 E / (R-Q).
( Actually the factor 1.005 is 1000/995 = 1.005025126, because this is the number such that after substracting 0.5% the result is 1 ).
The analysis for selling RAM is similar.
Leave The formula for RAM price in EOS to:
Read more #eos posts
Best Posts From Sergio Yuhjtman
We have not curated any of yuhjtman's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Sergio Yuhjtman
- On how speculators can avoid RAM fees on EOS
- The formula for RAM price in EOS
- Why Bancor-like exchanges are expected to have fees, part 2
- Why Bancor-like exchanges are expected to have fees
- Exchange decentralizado simple para EOS, protocolo Bancor y un poco más allá
- Cryptocurrency market cap chart sounds familiar from... The Simpsons?
- What kind of dapps should be expected to be succesful during the first stage of EOS as a live blockchain?
- Julio y Agosto - Amigo (Videoclip Oficial)
- Geyser El Tatio
- EOS community in Buenos Aires, second meetup --- Plus an open question...