EOS RAM and CPU too expensive to make EOS viable?

in #eos6 years ago (edited)

In a discussion with @tradealert he was inquiring if the RAM and CPU prices make EOS non-viable as a smart contracting platform. I understand the situation for RAM slightly better than I understand CPU utilization, so I will cover RAM first. I believe people may be under misconceptions about these topics because they are comparing EOS with their own understanding of classical computing where we have cheap gigabytes of storage.

RAM on EOS

First, blockchains can do amazing things without even using RAM. The Steem blockchain, for example, has no RAM available and we are able to do many unique things on Steem. We can even store variables on the blockchain without there being RAM! How can it be? What we do on Steemit is we simply perform a custom JSON publish which records the event on the blockchain in a format which stores variables for others to publicly access. Then the blockchain can be referenced as a way of updating variables for outside sources looking at the chain of events. This does utilize Steem bandwidth, but it does not utilize any RAM.

Let us continue this example then and imagine that we did have RAM and Smart Contracting on Steem. Let's imagine that we wanted to store a huge amount of variables inside of a single smart contract but RAM was expensive just like it is on EOS where it sells for 11 cents per kb. One trick we could do to save on our smart contracting RAM is publish a periodic custom JSON to the blockchain, storing hundreds of variables for us. We could publish perhaps $10 worth of RAM storage a day, but it would cost us very little in utilization. This is because we are not using RAM to store the variable but rather just a published event to the chain.

Then if we required our smart contract to know where to look for the latest publish, we could have a single variable point to the block number of the custom JSON. Let's say we used a 64 bit integer in RAM to point to the block number that the smart contract needs to access to find the JSON. The cost of having this 64 bit integer storage would be $0.007 USD.

When you reserve your RAM, you do not lose it.

In the above example, the integer pointing to a block with data could be reserved memory since the smart contract operator owns and stakes some EOS. Meaning, for this storage, there is no significant fee, other than the opportunity cost of owning some EOS and staking it. This single variable could be used to reference a large amount of data for that entire smart-contract's operations.

The Point of RAM is to Store Important Variables -NOT- to Store Data

RAM on EOS is only for storing and processing those variables which cannot be handled by utilizing outside storage and networks. EOS actually has a storage capability which is like I described above. It is in the EOS storage capability where we would store things like blog posts or custom JSON. The smart contract just stores a log/hash pointing to the outside data, while not storing the data itself.

Examples Where you Might Use a Variable in EOS RAM

  • Timestamp or Flag of when my smart contract is permitted to operate (on/off kill switch) Cost: Less than 1 cent of storage cost
  • Data Structure Example for Smart Contracting DEX Limit Order (enables smart contract to manipulate data for this instance of what must be accomplished ) Cost: Less than 5 cents for the structure, very likely the actual order book for the exchange is stored outside of RAM, but the smart contract may need a data structure to work with to load & manipulate a given instance one at a time
  • Raw URL's, pointers, hashes, ect. Most of these could be stored utilizing less than 512 bytes, which is just over 4kb... so less than $0.50 each. No smart-contract would need many instances of these. These are sort of like expensive luxury variables where it is fine to spend the 50 cents to store a raw URL which you could have just stored in a pointer instead. Meaning, no application would store tons of these and waste space, they would store a pointer to tons of these if they needed to reference a large data source.

Ethereum also has a RAM Expense for Smart Contracts

Ethereum RAM was never transitioned into a tokenized asset which speculators could trade. Memory costs for Ethereum boil down into gas prices. So every day, people are paying exorbinant amounts to execute Ethereum smart contracts, and this is the cost of Ethereum RAM. It costs a lot. How much? I cannot say because it takes a super-geek to tell you. There are probably nuanced ways of looking at it, such as whether Ethereum actually has enough RAM if there was a run on the RAM banks of the network.

Even so, with Ethereum, each type of program statement is interpreted by their network and a gas cost is applied to each command. This is why certain ICO's tell us to send a different amount of gas with the contract issuance to use their smart contract. Instead of the ICO company paying the cost, the users are paying the RAM cost with each transaction. I recall at times, people spending upward of $5 per single contract call for ICO's on Ethereum.


CPU on EOS

In this section, I will be able to explain less. I hope perhaps someone can come into our comment section and explain CPU Utilization on EOS a little better. If I get something wrong here, also feel free to correct me.

When you stake EOS, you get some CPU utilization. CPU utilization is fluid, meaning it is not just like RAM where we stake some and we are guaranteed a certain number of kb. What we are guaranteed is a certain amount over time, relative to the rest of the network.

The traditional model which was explained, was that if your app requires X amount of CPU and RAM, then you can simply buy enough and stake that, guaranteeing your app's functionality without requiring your users to use gas payments. This is ideal because 99% of people worldwide will never figure out how to utilize blockchain transactions to send gas to smart contracts. The gas model Ethereum uses, prevents most of the world from participating on their complex system.

EOS's model is that the company stakes enough EOS to operate their contract. This implies it is a company, not Joe Blow who owns 10 EOS trying to deploy an enterprise level contract on EOS. From my understanding, if your contract gets high usage, earning you millions, it's very likely you bought upward of 10,000 in EOS to stake on the Network. While this is prohibitive to scammers who want to launch their ICO on a $100 investment in a website and an Ethereum contract deployment, this amount of money is nothing to people who actually want to deploy something valuable that will earn hundreds of thousands or millions in revenue.

Boiling it down to actual costs for CPU utilization, and how much can be accomplished for how much staked EOS, takes a smarter geek than I to answer.

--- If you are that smarter geek, here are some questions! ---

  • How does EOS CPU and Bandwidth for a smart contract work, if it is an ICO with hype usage on release date? Many Ethereum smart contracts threw the network into overload and high gas prices, because the ICO was released on a certain date. I believe EOS allocates by the smart contract resources itself, so if the ICO hit high utilization would the ICO contract be shut down?

  • How much EOS would an ICO need to stake to operate their ICO smart contract, assuming high level of interest and usage? Let's assume they get 100,000 people using the smart contract within 4 hours of launch, in their first day.

  • Could you assign a cost for CPU? Or give us a metric, like 1,000 EOS produces X CPU available over X amount of time?

Conclusion

Dan is intending to build a Steemit competitor on EOS. Last I checked, the codebase was not released, but Dan had stated that he had begun the project. If it is possible to run a Steemit competitor on the EOS blockchain, without hitting into RAM, Bandwidth, and CPU shortages... then effectively EOS is a viable system to launch enterprise level applications on. I am not smart enough to understand all the details for everything about EOS, but what I do understand does not make me think RAM is expensive since we are talking about a luxury data resource that should be utilized very little. I am actually far more concerned with Bandwidth and CPU, and how those are affected by rushes on specific smart contracts.


Published on

mentormarket.io
by crypto-investor


https://mentormarket.io/legal/termsandconditions

Sort:  

Wow great insights you provide....better helped me understand differences in handling with steem and eos. As to your question re airdrops, I believe currently the dapp would need to hold the resources, but if the network isn't clogged (and it isn't) you can use more resources than you are strictly entitled to, or just take more time, at starting next week, lease resources via chintai. Ram is the actual bottleneck, but there are now airgrabs, where users provide the ram.

Excellent post. Earned my vote and a tip via TIMM. I’d like to see someone pick up where you left off on CPU utilization.

I got a response from EOS New York when I sent them an email about this post. Plan on sharing it soon.

One point I noticed is that the website I found the RAM price on is using their notation wrong. It is very common for people to misuse a kb when they actually mean KB. They did in fact get it wrong on the website above.

This means prices are actually 8 times cheaper than I listed above for RAM. RAM prices are 11 cents per KiB, and it's the big B which means byte not bit.

EOS New York plans on launching a calculator soon which lets people resource plan ICO's, airdrops, ect. For now, they do have a working calculator which is pretty decent for RAM, CPU, and Bandwidth planning.

https://www.eosrp.io/#calc ... I will be making a post about this in the coming days, most likely.

Wow...that's quite the error. Looking forward to the post.

lots of interesting use case even without RAM the conclusion helped to learn a lot

eos is the best. why would you mine eos only when you can mine other profitable currencies like e.g Ethereum or any other currency and convert it to EOS. common sense says this.

it was difficult for me to understand the whole scenariu but in the conclusion i think i get whole scenariu like his lines

. If it is possible to run a Steemit competitor on the EOS blockchain, without hitting into RAM, Bandwidth, and CPU shortages... then effectively EOS is a viable system to launch enterprise level applications on

Coin Marketplace

STEEM 0.26
TRX 0.20
JST 0.038
BTC 92922.43
ETH 3362.42
USDT 1.00
SBD 3.72