Bancor Algorithm: Mathematical & Economic Analysis

HTX Research
HTX Research
Published in
9 min readJul 31, 2018

This report is produced by Huobi Research; please cite “Huobi Beyond The White Paper” for reference.

Abstract

After the substantial price fluctuations of EOS RAM, people are becoming more familiar with the Bancor pricing mechanism. After the article [Huobi Focal Point Vol.8] "There ain't no such thing as a free lunch"—what can we learn from the price of EOS RAM on Public Chain’s token economic system design, Huobi Research continued to research into this algorithm, analyzing mathematical and economic principles behind it. We calculated and compared the RAM price under different parameters, and obtained following research results:

  • The hidden price function in the Bancor algorithm corresponds with the concept of economic price elasticity curve.
  • Since the price is entirely based on supply and demand, Bancor algorithm calculates, by calculus function, the equivalent price of the EOS required to purchase the RAM to prevent price fluctuation during purchase.
  • RAM Price varies under different curve parameters. For example, at 18:40 on July 10th Beijing time, utilizing MATLAB R2015a, we have reached a conclusion that when paying 10 EOS or more for RAM, a parameter value of 0.0005 is more “economical” than 0.5.

Since the price is entirely based on supply and demand, Bancor algorithm calculates, by calculus function, the equivalent price of the EOS required to purchase the RAM to prevent price fluctuation during purchasing.

RAM Price varies under different curve parameters. For example, at 18:40 on July 10th Beijing time, utilizing MATLAB R2015a, we have reached a conclusion that when paying 10 EOS or more for RAM, a parameter value of 0.0005 is more “economical” than 0.5.

Full Report

1. Introduction

After the substantial price fluctuations of EOS RAM, the Bancor pricing mechanism behind it is becoming more and more familiar by people. After the article [Huobi Focal Point Vol.8] "There ain't no such thing as a free lunch”, Huobi Research continued to research into this algorithm, analyzing mathematical and economic principles behind it. Through the formula, we calculated and compared the RAM price under different parameters, and we can see that the parameters do affect the RAM price to certain degrees.

However, it should be noted that the measured data results as presented in this article do not constitute, nor shall be regarded as proof or confirmation of the future price trend of EOS RAM.

2. Main Conclusion

As a result, we have arrived at following conclusions and recommendations:

  • The hidden price function in the Bancor formula corresponds with the concept of economic price elasticity curve.
  • Since the price is entirely based on supply and demand, Bancor algorithm calculates, by calculus function, the equivalent price of the EOS required to purchase the RAM to prevent price fluctuation during purchase.
  • RAM Price varies under different curve parameters. For example, at 18:40 on July 10th Beijing time, utilizing MATLAB R2015a, we have reached a conclusion that when paying 10 EOS or more for RAM, a parameter value of 0.0005 is more “economical” than 0.5.

3. What is Bancor?

As introduced in the previous report, Bancor is a super-sovereign currency concept proposed by Keynes and Schumacher between year 1940 and 1942. It can be used as an account unit for international trade and was officially proposed by the United Kingdom after World War II. However, because of the dominated strength of the United States after World War II, the Bancor program was not adopted at the Bretton Woods conference. However, the Bancor algorithm that applies this idea continues its vitality. The Bancor algorithm, proposed by the Bancor Network, relies on predetermined formula to determine the exchange price between digital assets. Its co-founder Eyal Hertzog was recently invited by BM to discuss the application of Bancor algorithm in EOS.

Despite the recent breach of Bancor Network, we continued to look into this algorithm. Since it is a model that originally intended for international trade, it naturally considers the exchange between different entities. According to the white paper, Bancor algorithm has a detailed and rigorous pricing model. It defines two types of tokens: One is a connector token that is usually used for circulation (ie, reserves, such as BTC, ETH, EOS, etc.); the other is the Smart Token as a intermediary for "intra-platform" exchange. In order for the exchange price to meet the supply and demand relationship just mentioned above, the price is determined by the formula provided below.

In the above formula, CW stands Connector Weight, which indicates the relationship between the total value of the Smart Token and the connector balance. See formula below:

According to the formula, smaller Smart Token supply and more connector balance leads to higher connector price to redeem the Smart Token. Although not without its flaws, this relationship shows why the EOS has higher price when there is less RAM available. We will continue to explain below why we believe this formula is flawed.

4. Formula Design

With regard to the RAM price, there is no doubt that RAM supply is at its highest at the beginning of the MainNet launch, in which the lowest price is 0.017 EOS/KB. With this price in mind, 1MB of RAM costs 0.017 * 1024 = 17.408 EOS, and all 64GB RAM worths 1140850.688 EOS. What if someone purchase all available RAM?

There are many ways to prevent this from happening. The easiest approach, of course, is to set a limit on the amount of RAM to be purchased in each transaction—if the limit is set at 32GB per transaction, for example, the price of purchasing the remaining RAM after the first 32GB purchase would sky-rocket, drastically increasing the cost to obtain all 64GB RAM. The limit can be further set to 16GB, 8GB and so on to limit the above mentioned practice and make the RAM pricing more reasonable.

Calculus can be utilize to calculate the projected RAM price. This derivation process can be found in the Bancor Network White Paper.

Define R as the current connector balance, S as the current Smart Token supply, F as the coefficient (CW as mentioned above), and P as the current Smart Token price, then: S*P=Smart Token’s market value, and FSP=Connector balance.

When the user wants to purchase the Smart Token in the number of dS, he/she needs to pay P dS, which also equals to the change in Connectors (dR = P dS)

Furthermore, because of R = FSP, the function could be differentiated as, dR = d(FSP) = F d(SP) = F(S dP + P dS). Hence, by combining the two equations above, we can get:

As we can see, the result of this differential equations bears resemblance to the price elasticity curve in economics:

  • RAM price is inelastic and remains at a certain level when CW or F equals 1;
  • RAM price follows a “normal” supply-demand price curve when CW is between 0 and 1.

With this price function, you can then integrate it to arrive at the number of Smart Tokens that can be exchanged for different quantities of connectors.

If T represents the number of Smart Tokens to be purchased, the amount of connectors one should pay (“E”) equals to:

Dividing E by T, we can get the “Effective Price” (one could obtain T amount of Smart Tokens with E amount of connectors regardless of the number of purchases).

Therefore, there is no need to limit the maximum amount of RAM could be purchased in a single purchase. Correspondingly, however, the effective price changes according to the number of connectors purchased in a single transaction, so “arbitrage” would not be possible.

5. The Complicated Formula of EOS RAM

In EOS’s application of Bancor algorithm, the exchange rate between EOS and RAM is not solely determined by the price curve. Instead, a intermediary token—RAMCORE—corresponding to the “Smart Token” in the Bancor Algorithm.

The exchange formula between EOS and RAM could be found at: https://github.com/EOSIO/eos/blob/v1.0.8/contracts/eosio.system/exchange_state.cpp

Because a new token “RAMCORE” is introduced, the actual exchange from EOS to RAM (and vice versa) involves two functions.First is the conversion formula from EOS to RAMCORE, which writes:

Where E is the number of RAMCORE that can be exchanged, R is the overall supply of RAMCORE, C1 is the current EOS balance, T1 is the number of EOS to be used for purchase, and F is a constant.

By reorganizing the above function, we can get the conversion formula of RAMCORE and RAM as:

Where T2 is the amount of RAM to be purchased, and C2 is the RAM balance. The formula could be further simplified as:

According to the function above, the price of RAM will drastically increase when C2 decreases or when C1 increases.

6. RAM price under different parameters

According to the simplified formula above, F has little effect on RAM’s price. So does it have a big impact on the price when Daniel Larimer changed the constant from 0.5 to 0.0005?

The parameters in the formula needs to be calculated before we can arrive at an answer. According to https://github.com/eoshackathon/eos_dapp_development_cn/blob/master/docs/ram_price.md, on 10:39:52, July 10th, 2018 (UTC), the parameters are as follows:

  • C1=5429573.4801 EOS
  • C2=12656705118 RAM

Because C1 and C2 constantly changes according to the market, we select the above time as an example to calculate the parameters. Next, we use MATLAB (R2015a 8.5.0.197613) to calculate the formula.

We compare the two scenarios (F=0.0005 and F=0.5) and calculate the difference in amount of RAM purchased with given EOS.

We can see that, whe F changes, the results are indeed different: For a single purchase of 10,000 EOS, the amount of RAM acquired when F=0.0005 is 20KB less than when F=0.5, in which the effective price of RAM is 4.0412e-04 EOS/KB higher; for a single purchase of 100,000 EOS, the amount of RAM acquired when F=0.0005 is 2MB less than F=0.5, in which the effective price of RAM is 0.004 EOS/KB higher when F=0.0005.

According to the results, there indeed will be a difference for large amount of purchases. RAM is actually more “economical” when F=0.5. Given this result, Daniel Larimer and the EOS community should be careful when it comes to adjusting parameters of the function.

Reference

  1. Bancor Protocol Whitepaper
  2. Formulas for Bancor system
  3. [Huobi Focal Point Vol.8] "There ain't no such thing as a free lunch"—what can we learn from the price of EOS RAM on Public Chain’s token economic system design
  4. https://eospark.com/ram.html
  5. https://github.com/eoshackathon/eos_dapp_development_cn/blob/master/docs/ram_price.md

Huobi Research

About us:

Huobi Research of Blockchain Application (Huobi Research) was founded in April 2016 and started research and explorations in various aspects in blockchain area since March 2018. We cover blockchain technology research, industry analysis, application innovation and economic model explorations etc. We aim to establish a research platform and to offer theoretical foundations as well as judgements of trends in blockchain to the public, ultimately promoting the development of the entire industry.

Contact us:

E-mail:huobiresearch@huobi.com

Twitter: @Huobi_Research

Medium: Huobi Research

Facebook: Huobi Research

Website: http://research.huobi.com/

Disclaimer:

1. Huobi Research does not have any form of association with blockchain projects or other third-parties mentioned in this report that could jeopardize the objectivity, independence and fairness of this report.

2. All outside information, data referenced in this report is from compliant and legitimate sources that we deem as reliable, and Huobi Research have conducted the due diligence concerning its authenticity, accuracy and completeness, but such due diligence does not provide any guarantee.

3. This report is only for reference purposes. Conclusions and viewpoints in the report do not constitute any form of investment advice on crypto assets. Huobi Research is not responsible for any losses resulting from the use of this report, unless stipulated by law. Under no circumstances should the readers give up their own investment analysis and judgements.

4. This report only reflects the opinions from Huobi Research on the day it was finalized. Future market condition changes may lead to updates of such judgements.

5. The report is copyrighted by Huobi Research, please cite the source when quote, and get approval from us when large amount of contents is referenced. Under no circumstances is reference, abridgment and modification contrary to original intention permitted.

--

--

HTX Research
HTX Research

Blockchain industry top think tank, affiliated to Huobi Group.