What is CPU? What is RAM? And How Does the EOS blockchain Utilize These Resources?
The EOSIO software is a sophisticated operating system on which apps can be built. The brilliance of the software is its ability to scale horizontally and vertically, which means that sometime in the near future, EOS based blockchain(s) will be able to process millions of transactions per second. Another benefit of the software is that it charges no user fees, making it a desirable platform for developers and users alike. There is no doubt about it, EOS is a game changer! BUT, because the EOSIO software is novel in the blockchain world, there are key aspects of EOS that do not quite work in a traditional way, or do not line up with classical tech definitions. One of the aspects that make the EOSIO software unique is the way that CPU and RAM are used on the EOS blockchain.
IF YOU’RE IN A RUSH, JUST READ THIS: THE TRAIN METAPHOR
If the EOS blockchain was a train, CPU, RAM, and network could be explained in the following way:
Network would be the available seats in each train leaving and entering the blockchain. Your chair will always be reserved, and if u need it, it will be yours. BUT, if no one is on the train, you could lay across a bunch of chairs because they are free! So network is a way to make sure you have somewhere to sit when the train leaves. CPU is how often you can ride the train, and works much like network as far as allocation goes.
CPU is how often you can ride the train. You may have a train ticket, but of course the ticket is only usable on certain days and times.
Now the EOS train is pretty laid back, so any unused space is free to use re: CPU and network, until the people that paid for the space need to use the space.
CPU and network are joint resources that together are called BANDWIDTH.
RAM is your storage space on the train. If you need to bring a ton of luggage, you need to pay per bag to check your bags onto the train. If you do not need to bring a lot of luggage, you can sell your storage space to others that are riding on the train.
CPU, RAM AND NETWORK: SIMPLE DEFINITIONS
First, it is important to understand what CPU is in a general sense. Per www.makeuseof.com,
“The Core Processing Unit (CPU) is often referred to as the brains of the computer. While the CPU only makes up one of many processing units, it is one of the most important. It is the part of a computer that performs calculations, actions, and runs programs.”
On the EOS blockchain(s), CPU is used to execute transactions.
Network is the amount of data that can be sent from one point to another in a specific amount of time. An example of this in action is phone services and their allocation of data usage per month. If you go above your allotted amount of data usage for the month, you will either be shut off, or have to pay more.
In EOS, network works in much of the same way. The EOSIO software has a default of parameters set and the code or “rules” can be changed by block producers, if they so choose.
RAM on the other hand,
“…acts as a middle ground between the small, super-fast cache in your CPU and the large, super-slow storage of your hard drive or SSD. It’s used to temporarily store working parts of the operating system and data being actively used by applications. It’s not used for permanent storage.”
The above is the traditional understanding of RAM. On EOS blockchains; however, RAM is used for permanent storage. One example is how account keys and balances needs to be stored in RAM and accessed very quickly every time they are called upon. So while it may not be the traditional definition of “permanent”, on the EOS blockchain RAM provides a permanent means of storage.
Example: 1gb of RAM = 1gb of storage on the present day EOS blockchain. So if u want to store a 4gb movie on EOS as of today, you need to buy 4gb of RAM.
SIDE NOTE: In the future there will be solutions where you connect storage for data that doesn’t need as much speed. Examples are picture storage, streaming, etc. Basically, someone could build dropbox on EOS and this will free up some RAM. Users could store transactions on the EOS chain, but the actual data will be stored in a hard drive like service. So a block producer could have one server with a lot of hard drives to store large files. A log of ownership will be logged on the blockchain’s RAM.
TLDR: Basically RAM is used to store information, like a hard drive, but WAY faster.
ALSO REMEMBER: All full nodes also need the amount of RAM that is used by the chain. Meaning, if block producers increase the amount of RAM, it’ll become more expensive not only for block producers to run, but also for everyone else who runs nodeos.
HOW ARE THESE COMPONENTS USED ON THE EOS BLOCKCHAIN
THE BLOCK PRODUCERS
In the EOS ecosystem, CPU, RAM, and network are all provided to the chain by block producers. This is why the quality of the hardware block producers use to run their BP operations is of keen interest to EOS coin holders. When block producers create and/or witness blocks, they are agreeing/signing off on processing data being handed to them by the user. This also means that they are allowing dapps/users to use their hardware to store and process transactions. So instead of a centralized server set up like we see utilized in present day, EOS token holders access several independent Block Producer’s server setups, which helps protect their data from a central point of failure (among other benefits).
THE TOKEN HOLDERS
Per the EOSIO software, anyone that holds EOS coins and stakes them is entitled to a corresponding amount of CPU and network, collectively known as bandwidth, at least. I say at least because per the EOSIO software design, you can be allotted MORE bandwidth than you are staked for, if more bandwidth is free and available to use on the network. Token holders are also entitled to a corresponding amount of RAM. When it comes to RAM token holders only get what they pay for, which is where it differs from bandwidth. Also, RAM is bought, not staked for. So it can be resold, but not unstaked. This difference allows for RAM to be bought/sold in a secondary market that allows for RAM speculation.
Because the EOSIO software does not charge fees for TX or other actions (because you already paid for the resources you use/actions you perform via staking) DAPP developers and users are free to utilize resources without a per action charge. This makes building a DAPP on the EOS blockchain quite desirable, as most users will not interact with a DAPP that requires fees per every action.
A SPECIFIC EXAMPLE: WHY CAN BLOCKTWITTER SPAM THE NETWORK AND HURT THE PERFORMANCE OF OTHER DAPPS
Because the EOSIO software allocates the maximum amount of RAM available to DAPPS in the system, when an account that has staked EOS decides to spam the network (thus sucking up free ram that other dapps have been using) they can cause other DAPPS functions to slow down or stop working altogether. In the case of the BLOCK TWITTER account, they have come up with an efficient way to spam the EOS network that allows them to consume a significant amount of free bandwidth. Many Dapps that currently reside on the EOS mainchain count on using the free bandwidth that they get (remember, if the bandwidth is available they get to use more of the system bandwidth then they have staked) to make their apps functional. This additional bandwidth that they are able to use is called leeway.
During their spamming hayday, Block Twitter transactions used a very low amount of CPU, and much more network. This means that the EOS bandwidth parameters could be set too high, or it could be that the algorithm for how CPU and network are allotted needs to be changed. These ideas need to be explored to find a long term fix to Block Twitter.
THE GREYLISTING DEBATE
A work around to this problem is greylisting. The top 21 BPs can decide to grey list an account they feel is spamming the network. This means the account would only be allocated the amount of resources they have staked, and thus cannot “hog” free resources that other DAPPS are depending on at this nascent stage of the EOS ecosystem.
While this is a practical solution, some wonder if such an action is fair. Why do certain DAPPS/and or actions deemed as valuable get to access free resources while others that are deemed as spam do not. This is a debate being had by the community and the EOS mainnet BPs currently.
THE BLACK LISTING DEBATE
A longer term fix would be blacklisting. Blacklisting is the process in which the top 21 BPs would curate and add to a list of of “bad accounts” that they would block from performing any actions on the EOS mainnet. The onus would then be on the blacklisted account to prove to the EOS BPs that they are not spammers.
This solution, while convenient, would most likely be met with scorn, and seen as too great a power for BPs to hold without being prone to corruption.
The blacklisting would be censorship. This is what BPs currently do when an account has been hacked and is waiting for an arbitration order.
SO, WHAT IS THE SOLUTION?
To recap, Dapp developers and users need CPU, network, and RAM to perform actions on the EOS mainnet. These resources are provided to them via the hardware block producers provide. Block producers act as a decentralized, distributed server network that serves the EOS mainnet. The EOSIO software dictates that each EOS coin held by a coin holder corresponds with a certain amount of CPU, network, and RAM on the EOS mainnet. While RAM is the amount of EOS that a user actually has staked, bandwidth is flexible, and users can be allocated more bandwidth than they have staked based on the availability of bandwidth on the network.
Block producers and the block.one team are discussing the problem and working on a solution. Some early, but yet to be explored ideas are delegation (like Chintai), a tweak to the bandwidth allocation algorithm, or action against spam accounts via greylisting, blacklisting, or arbitration. While these problems may seem great, the EOS mainnet is only four months old and these sorts of problems are to be expected. If the past is any indicator, the EOS community will sort this short-term problem out to the benefit of all in the ecosystem. In the meantime, the best action coin holders can take is to reach out to their favorite BPs and ask questions, engage in debate, and offer solutions. Together, we can solve this problem.
A PROJECT WORTH MENTIONING
Bank of Staked! If you run out of stake you can borrow some for free. Block Producers can join this project and stake some EOS that can be used for free for short amounts of time. This great project is brought to you by EOS LaoMao.