Ethereum virtual machines (EVMs) are blockchain-powered software platforms. EVMs allow software architects to build and deploy decentralized applications (dApps).
Blockchain developers really value them, because they do not have extended downtimes and are able to keep created application objects safe from being modified or altered.
If you are looking to start using EVMs, then you need not be an expert programmer.
EVMs are designed in a manner that also eliminates the requirement for really powerful hardware, which makes them suitable for beginners.
The Ethereum blockchain platform includes external and contract accounts. With a transfer initiated from any one of these, users may send ETH or data in binary format.
When platform developers use gas, it protects the EVM from various attacks that might end up slowing down the blockchain network.
Also, depending on its type, Ethereum (ETH) network data resides in storage, memory, or stack.
Ethereum Works by Executing Opcodes
Users are able to disable EVM accounts or completely remove them via the selfdestruct Solidity command. But how does Ethereum actually work?
The smart contract platform is able to perform various tasks by executing specific types of instructions, known as opcodes. Each opcode is 1 byte (or 8 bits) in size and gets encoded to bytecode.
Opcodes are also split up into its bytes when users perform a certain task.
Since there are a total of 140 opcodes, Ethereum virtual machines are said to be Turing-complete, meaning that it can (theoretically) solve any type of computation problem.
The source-code that’s executed on it does not have access to other system processes on users’ PCs, which effectively isolates the EVM.
As mentioned, there are two main types of accounts on Ethereum: external and contract. EVMs are able to treat both equally.
And every account has a certain ETH balance. Meanwhile, any transfer that carries ETH can change it.
It’s also worth noting that a transfer initiated from one account to another may hold a certain amount of ETH or binary data (also called payload).
Additional actions may depend on the actual account. So if it includes source-code, then that gets executed. The payload effectively turns into input data.
And if it’s not set, then the code users send gets executed and ends up returning code for a completely new contract.
During the construction phase, the source-code of the contract does not contain anything (in other words, it’s empty).
Since there’s no centralized authority, contracts are run on all Ethereum network nodes. This approach may lead to a (considerable) slowing down of the blockchain network (which may be the intention).
In order to really slow things down, they can create many different and complex contracts.
To ensure protection from such attacks, every opcode comes with a base-level gas cost, and gas is like a token that’s used to pay EVM for performing the transaction.
Its main goal is to place a certain limit on how much work an operation needs. As the EVM completes the transfer, it starts using its gas up (gradually).
EVM Stores Data/Info in Storage, Memory, or Stack
The EVM specification lists three independent storage areas, which include storage, memory, and the stack.
Storage areas may be found inside each account and are able to store the contract state variables.
Storage gets assigned as part of the process of issuing a smart contract. Users may change this with a sendTransaction function call.
Notably, no contract is able to read the storage of another contract (for security and privacy reasons) or write directly into it.
Meanwhile, memory is linear and can hold temporary variables.
Since they only actually exist in the calling function itself, memory is erased between calls. Users may address memory at byte level, but the limit of one reading is set at 256 bits, and writes may be of anywhere between 8 and 256 bits.
Users are required to pay in gas in order to expand memory. And it can scale quadratically, and the more it expands, the more it will cost. But it is still cheaper to use when compared to storage.
The EVM specification defines it as a stack machine. A stack is where the computations take place.
This data area can carry as many as 1024 small local variables. And each stack item has a total size of 256 bits.
The stack is also the most economical out of the different data storing areas.
A programmer may have limited access to the stack. They can copy one of 16 top elements to the top, or choose to make the top element switch places with one of the 16 under it.
In order to get deeper access, users may start moving stack elements to the storage area or directly to memory.
Logs Technically Not a Memory Type
It’s worth noting that logs aren’t really a memory type. But they are also used to hold data, so they could cover them as well when introducing Ethereum/Solidity.
Logs can carry data via an indexed structure with a mapping reaching block level. Smart contracts won’t have access to the data contained in the log once it has been created.
But they may be reached from outside the blockchain itself. Some of this data is also found in bloom filters.
Other important information to know about EVMs involves the Solidity selfdestruct operation, which removes source-code from the blockchain.
But it will still remain part of the blockchain’s history and may still stay in most of the EVM nodes.
EVM Tech Is Evolving, Maturing Rapidly
EVM technology has evolved considerably during the past few years. One notable project called Syscoin, which leverages the best of Bitcoin and Ethereum via a coordinated platform, has developed its own Network Enhanced Virtual Machine (NEVM).
As explained by its developers, Syscoin’s design keeps intact the “gold standard” security of the Bitcoin consensus mechanism and merged-mining while offering the performance characteristics expected in Ethereum’s 2.0 future thanks to L2 ZK-Rollup technology.
The main advantages of NEVM are: L2 scalability for smart contracts, as well as independent fee markets, which are powered by ZK-Rollups.
NEVM is also compatible with Ethereum, so basically any ETH-based smart contract may be deployed on NEVM.
Then there’s robust security, because the platform utilizes proven L1, by leveraging Bitcoin merge-mined PoW and Bitcoin-compliant consensus.
In addition to these features, protocol adaptation enables trustless portability of value between Bitcoin and Ethereum (SYS <-> NEVM), all on a single, coordinated platform
Ethereum accounts may be external and contract. Users may send ETH tokens or binary data from one account to another by conducting a transaction.
SInce gas is used for transfers, it becomes practically impossible to start slowing down the performance of EVMs (intentionally).
In order to store data in Ethereum, developers may choose to use storage, memory, or stack.
And to remove EVM accounts, they can use the selfdestruct Solidity operation. There’a also an option to deactivate them by changing the value of an internal state.