Before you think about deploying your EOS decentralized application (DApp) to a blockchain network, as a developer and system planner you should study in detail the cost to run your infrastructure on a public shared network with a limited amount of resources to be consumed. The storage cost and execution cost on a public blockchain network are higher than in any cloud provider like Amazon Web Services, Google Cloud or Microsoft Azure.
This article assumes that you have basic knowledge about EOS Governance scheme, its resource allocation model, EOS Staking mechanisms and Block Producers.
On any EOS public network, there is no pay per use pricing model unlike other blockchains such as Ethereum(GAS fees) or Bitcoin (Transaction fee). The access to the limited blockchain resources is controlled by a mechanism named staking that allows the users with higher ownership on the network, so a higher number of SYS tokens frozen on the system contract, to have higher priority accessing the limited resources.
On an EOS blockchain network the limited resources are:
To use the public resources, the DApp developer should acquire access to CPU and Network Bandwidth by staking the network native token (SYS) or by buying RAM with the SYS token in a dynamic market that follows demand/supply forces. The CPU and Network Bandwidth consumption tables are accumulated in 3 days periods, so the dAPP developer should stake SYS tokens for that period in proportion to the amount of data statically stored, and the number of transactions for that period and the amount of data transmitted.
To reduce these considerable costs, the EOS main network, with the REX market, allows a DApp developer to lease EOS (SYS) resources for a 30 day period to accommodate DApp demand peaks affordably.
Right now, there are multiple public EOS based networks that you can use to run your DApp, notwithstanding we will limit our analysis to the following public networks:
The table below estimated the network bandwidth cost to run 100 transactions per day with a size of 200 bytes per transaction. Your CPU and Network Bandwidth consumption is measured on a 3 day period, so every time you run a transaction your consumption is accumulated over the period and after the 3 days is reconstituted. It is essential to stake CPU and bandwidth for the 3 days period.
As revealed in the table above, if your application does not require a huge amount of data to be transmitted over the network, the SYS stake required is not going to be considered to your overall cost.
The Net bandwidth cost per KB was estimated based on the following formula:
Net Price = (Net Staked / Net Available) / 3
Note: To understand how the calculate the SYS/KB/Day dynamic pricing please read the “How we Calculate EOS Resource Usage” article.
The CPU congestion on the EOS main network has been a hot topic over the last months since the amount of CPU available to run your DApp transactions fluctuated a lot with a huge CPU demand increase imposed by EIDOS Airdrop. It is fundamental to make sure that at any time you have the required resources to make your blockchain network submissions to go through and don’t have any denial of service for your users.
On the following table, we estimated the amount of SYS balance staked to run a dAPP that requires 100 Transactions per day on each network. We estimated the minimum amount of SYS on the 9th of March 2020 prices.
Additionally, for the EOS Main Network, we estimated the loan cost (REX) to lend the same amount of EOS/SYS for 30 days.
|TELOS||100||400||0,083||0,003 €||3,32||0,13||0,40||10 TLOS||NA|
The CPU cost per millisecond was estimated based on the following formula and we used some block producers to estimate the price.
CPU Price = (CPU Staked / CPU Available) / 3
Note: To understand how the calculate the SYS/ms/day dynamic pricing please read the “How we Calculate EOS Resource Usage” article.
For dAPPs with very irregular CPU bandwidth shapes, we recommend you to deal with CPU demand spikes by lending SYS on REX market. This approach will dramatically reduce the SYS self-owned staked balances required to accommodate your application load with no service disruptions.
The RAM costs are the DApp resource that mostly contributes to your DApp budget. Every time you run a transaction that stores new data information on your smart contract database, the amount of RAM consumed will increase and your budget will be eaten.
|Network||SYS/KB (SYS)||2MB RAM(€)||4MB RAM(€)||8MB RAM(€)||16MB RAM(€)|
We recommend you to optimize the store of information about your smart contract to occupy the minimum space possible.
Aside from that, find out mechanisms and services like IPFS or decentralized storage solutions to offload the storage to a cheaper service. As soon as your DApp scales up, you can assume that the amount of RAM required to run your service will scale up.
At TAIKAI, based on our operation metrics, we estimated RAM demand and the RAM acquisition cost for the EOS main based on the current prices.
|Number of Users||RAM (KB)||Cost(€)|
|1 000|| 533 KB||87 €|
|5 000||2 666 KB||439 €|
|10 000|| 5 332 KB||878 €|
|50 000||26 660 KB||4 394 €|
The DApp users will want to use your DApp as quickly as possible. In fact, 95% will not know they’re about to interact with any blockchain at all.
For that to happen, DApp developers might need to pay for the network accounts required to onboard new users. In the following table, we estimated the costs required to set up an EOS account with 4KB of RAM.
|Network||RAM(KB)||SYS/KB (SYS)||SYS Price(€)||Cost/KB(€)||Cost/Account(€)||Cost/1K(€)||Cost/10K(€)|
Some DApps use a different scheme to avoid this cost, like supporting virtual accounts, using hierarchical account schemes, etc. We encourage you to find out an approach that suits your DApp and avoids software integration headaches.
It is essential to calculate the network tokens (EOS, TLOS, WAX) staked required to run your DApp. Your smart contract will require database space to save user data and CPU Bandwidth that accommodates your traffic demand.
Meanwhile, start also to enumerate the advantages to run on each network listed on this analysis and weight your decision. It is not easy to migrate from one network to another, so take your time to make this decision.
If you choose an EOS sidechain, the actual cost is significantly lower 10–50x, but as soon as these networks get more demand, the difference between the EOS networks and the sidechains costs will decrease. The Bancor Algorithm used to calculate RAM prices will have an impact on account acquisition cost and operation RAM required to store information.
The storage pricing, CPU and EOS account acquisition can dramatically increase your infrastructure cost once your dAPP starts to onboard and scale a higher number of users. Some dAPPs offload certain transaction costs to the final users, however, this mechanism needs to be implemented with caution because the casual consumer might not understand it.
Just do your math and plan carefully, otherwise, you could end up in a situation where your users could not use your service because you run out of EOS resources.
Staked Cost = function(CPU Bandwidth Staked, Net Bandwidth Staked)
CPU Bandwidth Staked = function(SYS Price, dAPP Demand, Network Demand)
Net Bandwidth Staked = function(SYS Price, dAPP Demand, Network Demand)
RAM Cost = function(SYS Price, dAPP Demand, RAM Market)
On TAIKAI, we are trying to estimate the cost based on metrics retrieved from our operation on a public EOS testnet. We also used some sigmoid demand curves to forecast the demand evolution over time and estimate the resources required to scale up our business.