4

Coming from other blockchains, renting or buying ram / cpu on EOS is a weird concept to grasp for now.

From my understanding, an EOS account can choose to buy ram or cpu? Can they not buy any at all?

  • What is the ram used for? I'm assuming its like hard drive space? Once I buy it, do I keep it forever? And the data stored on there is forever too? What happens if it takes up many gb of data?

  • What is cpu used for? I'm assuming its to run contracts as in gas for ethereum? What happens if I use up 100% of my cpu.

  • Where can one see how much they own of these things?

And am I missing anything else aside from buying ram / cpu?

1 Answer 1

6

EOS account can choose to buy ram or cpu? Can they not buy any at all?

You need RAM for the nodes to store data about your account,--including account name, public keys, and other meta-data--in the blockchain state. CPU and NET are needed for executing the transaction that creates your account and storing that transaction on the blockchain, respectively. Similarly, all future transactions need CPU and NET, but they only need RAM if you want to store something in the persistent storage.

What is the ram used for? I'm assuming its like hard drive space?

Yes, it's like hard drive space on EOSIO.

Once I buy it, do I keep it forever?

You can sell it once you don't need it anymore, but there's a 0.5% fee for RAM trading that is meant to go to the community and discourage RAM speculation.

And the data stored on there is forever too?

Yes, as long as you don't remove the data from the storage, the data remains in the state of the blockchain.

What happens if it takes up many gb of data?

If the supply of available RAM goes down faster than the demand, then the prices for RAM would increase. However, on the mainnet, every new block increases the RAM supply by 1kb to help making RAM affordable at the expense of requiring more performant machines to run a node.

What is cpu used for?

It's used to prevent spam. If there were no CPU limits, one could spam transactions to a degree that would make it impossible for many nodes to synch (i.e. it introduces resource scarcity to make it valuable)

I'm assuming its to run contracts as in gas for ethereum? What happens if I use up 100% of my cpu.

It's not quite gas: CPU recharges after 3 days on mainnet--this means that if you use 100% of your CPU, in 3 days you'll have all your CPU back at 0% usage. On the other hand, gas is paid to miners for their services and is not recovered by the payer.

Where can one see how much they own of these things?

$ cleos get account <account_name>

Alternatively, block explorers may provide this information as well. (question about list of block explorers)

And am I missing anything else aside from buying ram / cpu?

Yes, you are missing NET.

The resource model of EOSIO uses CPU and NET for preventing computational spam and storage spam, respectively. NET (network bandwidth) is used in relation to the resource debt that your transaction causes: every node, when downloading the chain, will have to download your transaction as well. Thus, to prevent the chain growing larger than intended, NET restrictions apply the same as CPU restrictions.

Both NET and CPU (together they are sometimes called "bandwidth") recharge at the same time, they can be leased to others, they don't require a fee, and work primarily as mechanisms of spam prevention. RAM is different, and it has an internal market, a trading fee, and it does not recharge automatically.

For more details and an explanation of the entire concept, please check out the whitepaper as it has a section on Resource Usage where this is explained:

All blockchains are resource constrained and require a system to prevent abuse. With a blockchain that uses EOS.IO software, there are three broad classes of resources that are consumed by applications:

  1. Bandwidth and Log Storage (Disk);
  2. Computation and Computational Backlog (CPU); and
  3. State Storage (RAM).

Bandwidth and computation have two components, instantaneous usage and long-term usage. A blockchain maintains a log of all Actions and this log is ultimately stored and downloaded by all full nodes. With the log of Actions, it is possible to reconstruct the state of all applications.

The computational debt is calculations that must be performed to regenerate state from the Action log. If the computational debt grows too large then, it becomes necessary to take snapshots of the blockchain's state and discard the blockchain's history. If computational debt grows too quickly then it may take 6 months to replay 1 year worth of transactions. It is critical, therefore, that the computational debt be carefully managed.

Blockchain state storage is information that is accessible from application logic. It includes information such as order books and account balances. If the state is never read by the application, then it should not be stored. For example, blog post content and comments are not read by application logic, so they should not be stored in the blockchain's state. Meanwhile the existence of a post/comment, the number of votes, and other properties do get stored as part of the blockchain's state.

Block producers publish their available capacity for bandwidth, computation, and state. The EOS.IO software allows each account to consume a percentage of the available capacity proportional to the amount of tokens held in a 3-day staking contract. For example, if a blockchain based on the EOS.IO software is launched and if an account holds 1% of the total tokens distributable pursuant to that blockchain, then that account has the potential to utilize 1% of the state storage capacity.

Adopting the EOS.IO software on a launched blockchain means bandwidth and computational capacity are allocated on a fractional reserve basis because they are transient (unused capacity cannot be saved for future use). The algorithm used by EOS.IO software is similar to the algorithm used by Steem to rate-limit bandwidth usage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.