This entry is part 1 of 1 in the series EOS Dapp Development
  • Don’t Decentralize Everything

I have spent a lot of time recently working on EOS smart contracts and before that spent time working on dapps for other chains. This is actually going to be the first post in a series primarily aimed at developers but there are some insights that I think are very important to users of and investors in EOS projects.

With the introduction of the dApp people clamor for having everything decentralized. While this may be a noble goal it really isn’t practical in many cases. At current prices (and I use the term current loosely because it will change a lot while I am writing this, to say nothing of how much it may change by the time you are reading it) it cost .56 USD to get 1 millisecond of cpu time. When I started the article about ten minutes before writing this sentence it was .98 USD per ms. If you are not a developer you probably aren’t used to tracking anything by the millisecond so let me give you an example of a dapp and how much cpu they have staked and how much of that they use.

One of the dApps I am heavily invested in is betdice. They have very heavy usage and so are a great example of an app that uses a lot of on chain resources. They currently have 6893791 EOS staked for cpu in just one of their contracts. At current EOS price of $3.12 that means that they have about 21 Million USD staked in cpu on that contract. Imagine the kind of hardware one could purchase for 21 Million dollars. On the EOS mainnet that buys them about 3.4 hours of cpu time per day.

If you could move just half of the processing off chain you get to put 10 million dollars back in your pocket.

Now, for a gambling dApp that EOS is a small amount to have to stake when compared with the profits that it produces but imagine if instead of randomized rolls for gambling it was a dapp that was handling the logic for a game of chess. One assumption I will make is that this dapp allows you to play chess against another person with a wager between the two of you. I make this assumption because if you were just playing for fun I can’t imagine why you would need the game on the blockchain at all.

The decentralized purist would argue that for each move the player sends their move to the chain and the smart contract checks to verify the move is legal, saves the new board state and checks for a win condition. If the game is over the contract would send the funds to the winner. Basically none of the logic should exist on a centralized server somewhere.

If however you were to run all of the logic on a centralized server you could still have moves sent over the blockchain which would give you the ability to reconstruct a game at any time. So user a sends a message to the chess contract with the desired move. A centralized server running somewhere can read the messages and handle all of the logic and then the centralized server calls the contract with an updated board state and a flag to notify if the board state results in victory. If that flag is set the contract could contain logic to verify that the board state does indeed mean victory before paying the victor.

On even the most underpowered laptop checking to see if the state of a chess board results in victory is trivial in terms of cpu usage but if you had to pay for every millisecond of cpu time it would not be so trivial. It would be an interesting project to set up contracts that worked fully decentralized and partially decentralized and measure the difference in costs for the two but I’ll leave that to someone with more free time than I have at the moment.

So if you are an investor try to look into how the developer is using the blockchain. Are they efficiently putting the resources to use or are they just wasting money by decentralizing portions of a dapp that provides no real benefit to the end user? If you are developer make sure that every single line of code you write for your smart contract needs to be in that contract because it will cost you ram fees and it will cost your users CPU.

12 votes, average: 4.83 out of 512 votes, average: 4.83 out of 512 votes, average: 4.83 out of 512 votes, average: 4.83 out of 512 votes, average: 4.83 out of 5 (12 votes, average: 4.83 out of 5)
You need to be a registered member to rate this.
(1796 total tokens earned)


  1. Infosion

    Very nice insights! That’s really a lot of CPU for BetDice. And that’s just for a more or less simple betting DApp… For me this seems like EOS will have a hard time when functionalities of DApps will grow?

    1. voorash Post author

      I had a nice reply for you but it seems to have gone poof. I think without going into sister chains the only short term solution to cpu is really developers focusing on moving things off chain unless there is a very strong reason to keep it on chain.

      1. Infosion

        Then double Thx for answering again 😉
        Interesting, it makes totally sense, but I never thought about it that far this way. I mean that there really is a need for that, because the CPU & RAM cost that much at EOS. So when will there be the first crypto/AWS hybrid solution? ^^
        I mean honestly, traditional CPU doesn’t cost that much anymore these days … I guess there will be solutions in future who will bring the best solutions of these problems together (like for example EOS for “blockchain stuff” & Amazon AWS or something else for executing the stuff that is not worth on blockchain for the cheapest possible price…).

    1. voorash Post author

      Well the short answer is they get all of their EOS back and could sell it to get their money back. But the longer answer is that unless they close up shop they can really never get it back since they will always need it. In that way it is sort of like the fallacy people believe that their home is an investment. Most people can’t just sell their home like they would some stock because they still need somewhere to live.

      I suppose you could consider the net costs based on the opportunity cost of deploying 21 million dollars elsewhere for whatever the duration of the investment is.