sourced form ultcoin365.com

THE ETHEREUM VIRTUAL MACHINE

Many a time you [blockchain enthusiast…] must have stumble on the word EVM which is the shorts for Ethereum Virtual Machine, and also the need for every block-chain developer to be familiar, matter of fact conversant with the way it works, in same vein that need has left many block-chain explorers in a conundrum of what exactly is the function. Today we’ll be looking at the concept behind it and hopefully gain a handful understanding of how it works.

Foremostly, it is important to know that the EVM is a distributed state machine and not a “ledger” [ a distributed ledger is a system for recording transactions of assets where the entire details of the record are noted and stored in more than one network system at the same time] which permits the creation and interaction between smart contracts, unlike a regular IDE. It manages the generation and exchange of tokens, and a typical example of this is in a DAO[Decentralized Autonomous Organization], where the EVM is responsible for managing these actions.

image describing traditional and decentralized systems
sourced from — Bitnovo

HOW THE EVM WORKS

The Virtual machine

I assume you all know about decentralized systems, but let me briefly explain what a decentralized system is anyway.

Yeah so a decentralized system is an interconnected information system where no single entity is the sole authority. You can see it as a network of enormous [1+] systems, now knowing the advantages of a decentralized system among which is ensuring transparency and stability in the ecosystem of technology data and beyond, and also the need for virtual machines as a core to archiving this cannot be emphasize, one of which these virtual machines pointed to be “unstoppable”.

Unlike a real[hardware] machine, it exists in a non tangible format which means it can be run as a software on a hardware[computer] of course. And these machines can be run from any part of the world by different people[authorized], which makes it hard and almost impossible to be invaded, attacked or shutdown, giving it the edge of max security.

Furtherly virtual machines are an abstraction layer between code and the virtual machines[call them IDE] that execute the code. Hence we can deduce that the Virtual Machines are decentralized networks that smart contracts are executed on. Talking about smart contracts…

You might probably be asking what in the French toast is a smart contract. Well a smart contract are self executing code that permits cryptographical transactions of course with the initial trigger of the user, in it are numerous lines of executable code rendering different operational directions, like funds swap or transfer, sending and storing messages, and even creation of new contracts provided that the conditions stated prior are met.

It is said to be safe and secure because the code cannot be altered or changed, hence when you trigger[deploy] a smart contract it cannot be reversed and the outcome remains the same forever hmmm...

Remember I said the EVM is a state machine, now on every execution of this smart contract there is an altering[change] in the state of the EVM. This means that it updates[corrects] to the current amount of the account, the data passed into the smart contract as well, and generally the transactions on all the accounts involved plus their level as they get completed.

an illustration of a smart-contract execution
sourced from Vas3k’s blog

Furtherly the EVM doesn’t execute actions by just compiling a Solidity code, hence it has to break it down to chunks it can understand which are lower machine language[instructions] called opcodes.

The Opcodes

Now people’s understanding language for smart contract creation is Solidity while the EVM’s language for understanding and compiling instructions is the opcode. Also EVM are termed to be an ultimate solver of very complex computational problems. How? Opcode!

Meanwhile What are opcodes?

Opcodes are low level human readable instructions of programs, the EVM opcode facilitates the compilation of the specified task to the smart contract on the EVM. The opcodes have over 145 operations that the EVM can execute like logging, address, exchange, duplicate, push…

Do not hesitate to check what kind, and how the EVM solves computational problems here. Which will also be discussed in upcoming articles.

Furtherly for every opcode operation it requires something called the gas, yes gas. Think about a cooker needing a gas to burn so as to the EVM carrying out transactions, so we are safe to say the gas is the fuel for EVM, talking about gas…

Gas

Now if you have in one way or the other participated in making ethereum transactions before now, you must have noticed something called gas. On most occasions people get turned off from making crypto[Ethereum] transactions, because the amount of gas[‘gas price’] can be ridiculous.

sourced from findmatics

What’s the idea behind gas?

Think about gas price as the gate pass one needs to be able to communicate[access] and execute[compute] any smart contract that is done by any Ethereum node.

Now in contrast to what many have concluded about gas for “tipping” blockchain miners only, gas is very important in not just giving a highest bidder the edge of express execution[TBD another day], gas checks and prevent malicious attacks that could be carried out, for instance when an attacker tries to send[deploy] a very large and complex contract that could cause chaos like a DDoS and would take a lengthy computational time, the gas[gate pass] to be paid will certainly be relatively higher which would eventually render the attacker with no choice but to retire [this is one of the reasons why a smart contract is advised to be short and simple].

These gas are attached to every opcode, meaning the opcodes have a default gas cost which results in why a complex one will have a higher price. Also gas will never be debited from your account without executing your transaction, hence there certainly will be a refund on incompletion.

Gas charged from metamask screenshot
a simple gas charge illustration

Generally the EVM has many areas of application, among which are the ERC-20 tokens, ERC-721 tokens and the Decentralized exchange systems…

And lastly if you have made out time to click on and read these far, I’ll love to say a big thanks, don’t forget to do proper as usual and share with anyone you feel might need and drop your comments/corrections where necessary bless!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaron Sunday

Aaron Sunday

FrontEnd Engineer, Smart Contractor, Day/Swing Trader…