Blockchain Basics Series (5 part series — PART 3)
Blockchain is the backbone of all cryptocurrencies, and being a fast growing technology, there are many applications or projects that can be harnessed to solve human problems. As a crypto enthusiast perhaps you have come across concepts such as smart contracts and Ethereum Virtual Machine (EVM). But do you know what they are and how they operate?
Unfortunately, many people tend to overlook or have little information about Blockchain’s underlying technology. It is important to understand what these applications are all about, and the role they play in crypto development. And since the crypto sphere is a vast world, we shall take one step at a time.
Let’s start with the Ethereum Blockchain, with a special focus on the Ethereum Virtual Machine (EVM). As you already know, the Ethereum Blockchain takes precedence as the first Blockchain with a team dedicated to its maintenance and development.
So, what is Ethereum Virtual Machine (EVM)?
Just like all Blockchains, Ethereum leverages on multiple nodes that run software on their computer to ensure security as well as maintain trust. Each node taking part in the Ethereum protocol operates software on their computer commonly referred to as Ethereum Virtual Machine (EVM).
First, Ethereum Virtual Machine guarantees security by preventing Denial-of-service attacks, which are somewhat an emerging challenge in the crypto industry. Secondly, EVM interprets and executes Ethereum programming language and ensure that communication can be achieved without any interference.
To break it further, EVM can simply be understood us a system designed to operate as a runtime environment for Ethereum based smart contracts. As you already know, smart contracts enable people from different corners of the world to interact and exchange value without a centralized authority. And there is no doubt that this technology will revolutionize many industries in the near future.
It is vital to also note that EVM operates in a sandboxed environment- it is totally isolated from the main Blockchain network, and works perfectly as a testing environment. Therefore anybody who would want to create a smart contract using EVM can do so without interfering with other Blockchain operations.
Perhaps you may ask: why should tests be executed in a sandboxed environment? Test runs in a sandboxed environment are essential because a flawed code can be detrimental to any smart contract. Furthermore, a sandboxed environment provides unlimited opportunities to learn, iterate, improve and eventually build robust smart contracts.
Now let’s delve deeper to understand the correlation between EVM and smart contracts.
Ethereum Blockchain vs. EVM vs. Smart Contracts
The Ethereum Blockchain can host three types of transactions:
First, you can transfer Ether from one account to another account. These transactions are more or less similar to Bitcoin transfers. For instance, you can send 3 Ether from your account to the landlord account as rent payment. Here the transaction records would contain the following: a timestamp when the transaction took effect, sender’s ether address as the source of the funds, the recipient’s address, and of course the amount you sent out.
Secondly, there is the transfer of Ether from a user to no one. This kind of a transaction is meant to create smart contracts. For example, let’s say Jackson and James are very smart and they decide to create a smart contract within the conditions of a specific bet. Here the transaction will only contain the sender’s account and a timestamp.
Thirdly, there is the transferring of Ether from an external account to a smart contract. Here every time an account intends to implement a smart contract, transactions are made to the smart contract and the instructions relating to the execution are put into the data field to guide the contract on what it should do.
Each time any of the above transactions happens, a node within the network executes the codes as specified in the smart contract via the EVM.
Smart Contract Price
For every smart contract to be implemented, some amount is paid out to the EVM for execution. The payment is made to the specific node that was used to store, compute, execute and verify the smart contract.
The price of each smart contract is calculated based on the cost assigned to each statement. The fee is paid in Gas- which can easily be exchanged for Ether. Therefore to execute a smart contract, you will need to specify the amount of Gas you would like to spend. The execution process terminates upon either completion of a transaction or when the Gas limit is attained. This goes a long way in protecting smart contracts from infinite loops.
So, what exactly does EVM do?
Ethereum Virtual Machine does the following checks whenever there is a transaction on the Ethereum Blockchain:
1. Confirms if a transaction has the correct number of values, the validity of the signature as well as whether the transaction nonce matches the nonce of that particular transaction account. If there is a mismatch, the transaction will be returned as an error.
2. Calculates the transaction fee required and initializes the gas payment.
3. Executes the transfer of the required amount of digital assets to the assigned address.
Should EVM detect that the sender did not put enough Gas or Ether, the transaction will be rolled back out. Here the transaction fee will not be refunded; it is paid to the miner.
However, should a transaction be unsuccessful due to an error on the recipient’s address, EVM refunds the amount sent as well as the associated fee to the sender (no miner is paid here).
EVMs sit at the very apex of the Ethereum Blockchain. As you can see in this article, it plays a critical role in the storage, execution and verification of smart contracts.
With EVM and smart contracts, you can sell property at the click of a button to any buyer in the world and get your funds once the deal is sealed without an intermediary, thus eliminates unnecessary costs.
All said and done, EVM might just be the application through which the Ethereum Blockchain will have the most disruptive impact in 2018 and beyond. What is your take?