How does CPU work in EOS network?

in #eos6 years ago (edited)

View the original post on Musing.io

CPU is a network resource in the EOS mainnet network. EOS has a system which allocates CPU to network participants who stake EOS tokens for CPU resource. This system was implemented to prevent spam transactions and denial of service attack. It also prevents overloading of the network. CPU resource is allocated at a rate that is in proportion to how much EOS a user has staked.

CPU is calculated in microseconds and it represents computing time. In simple words, it indicates how much computing time is allocated to a user. Having more computing time would allow a user to make more transactions.

When a user performs an action in the EOS network, he losses a portion of his allocated CPU time. After using up all his CPU time, he will have to wait for 24 hours till CPU is recharged. The EOS code that sets this value is in the config file's 50th line:

 > static const uint32_t account_cpu_usage_average_window_ms  = 24*60*60*1000l; 

A user can check how much CPU time he has by visiting his EOS profile in a block explorer. Below, I have given my EOS profile links to two major block explorers as examples.

https://bloks.io/account/littleboyeos

https://eostracker.io/accounts/littleboyeos

At the time of writing, my CPU time showed as "CPU used - 48,062 µs / 111,819 µs". It means I have 111,819 microseconds of CPU time and I used 48,062 microseconds. That means, I have  111819 - 48062 =  63757 microseconds of CPU time left that I can use in the next 24 hours.

These stats are calculated at the time of my last transaction or other action I performed in the EOS network. So, if I don't do anything in the next few hours, the same stat would be shown to me. 

This CPU time allocation constantly changes. It is calculated based on how busy the network is. If the network is very busy and it is running at 500+ transactions per second, users with a low amount of EOS staked will have low CPU time. If the network is not busy and only 5 transactions are happening per second, then users will have 100 times higher CPU time than when it is running at 500+ tps.

I have tried to use simple language in my answer so that it is understandable for both smart and average users. If you still have doubts about something related to EOS CPU time, share your thoughts in the comments.

Sort:  

DO RAM next!!! Thanks.

Thanks for the suggestion, I am considering writing a post about that.

I will read it if you make it.

Huge collection of informative articles. I should have started following you earlier, now have to go all the way back and start reading many your older posts!

Posted using Partiko Android

Congratulations @littleboy! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of comments

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Hi @littleboy!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 3.998 which ranks you at #3466 across all Steem accounts.
Your rank has improved 5 places in the last three days (old rank 3471).

In our last Algorithmic Curation Round, consisting of 188 contributions, your post is ranked at #13.

Evaluation of your UA score:
  • You're on the right track, try to gather more followers.
  • The readers appreciate your great work!
  • Great user engagement! You rock!

Feel free to join our @steem-ua Discord server

Thanks for this wonderful explanation about CPU allocation on the EOS netowork. Glad to hear that it resets every 24 hours. I was not able to play EOS knights because I used up all my CPU allocations LOL. I thought I needed more EOS to stake to my CPU to continue LOL that would make that a very expensive game to play LOL.

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.032
BTC 63617.36
ETH 3070.79
USDT 1.00
SBD 3.82