Ethereum Blockchain

Bitcoin blockchain is the mother of all blockchains. It was intended for peer to peer transfer of value and it does that well. Around 2013, a framework for code execution was introduced by Ethereum Founders. The centerpiece and thrust of this Ethereum blockchain is a smart contract.

Consider this below diagram comparing Bitcoin and Ethereum blockchain.

On the left is the Bitcoin blockchain and a wallet application for initiating transactions. On the right is Ethereum that took a significant step towards transforming the blockchain into a computational framework that opened up a whole world of opportunities in the decentralized realm. Ethereum supports smart contracts and of virtual machine on which smart contracts execute.

Smart contracts are pieces of code deployed on the blockchain node that allow for more sophisticated transactions beyond simple value transfer, such as conditional transfers, evaluation, and multiple signature requirements. Structurally, a smart contract resembles a class definition in an object-oriented design, with data, functions, and modifiers. Smart contracts are written in a high-level programming language, like Solidity, and then translated into EVM bytecode and deployed on the Ethereum Virtual Machine, which provides a computational infrastructure to execute the code on any node in the Ethereum network. Smart contracts add a layer of logic and computation to the trust infrastructure of the blockchain, expanding its capabilities beyond value transfer.

History of Ethereum

  • It was first described in Vitalik Buterin’s white paper in 2013, with the goal of developing decentralized applications.
  • In 2014, the Ethereum Virtual Machine (EVM) was specified in a paper by Gavin Wood and the formal development of the software began.
  • In 2015, Ethereum launched with its genesis block.
  • By 2018, Ethereum had become the second-largest cryptocurrency by market capitalization.
  • In 2021, a major network upgrade named London included Ethereum improvement proposal 1559, which aimed to reduce transaction fee volatility.
  • In 2022, Ethereum shifted from a Proof-of-Work to a Proof-of-Stake consensus mechanism, also known as the Ethereum Merge, resulting in a reduction of energy consumption by approximately 99.95%.

Ethereum Block Structure

Bitcoin uses unspent transaction outputs (UTXOs) to define the blocking state and its Wallet application holds the account reference. Ethereum introduced the concept of an account as part of its protocol, where a transaction updates the account balance directly instead of maintaining state, as in Bitcoin’s UTXOs. Transactions in Ethereum can transmit value, messages, and data between accounts, resulting in state transitions. Transfers in Ethereum are implemented through transactions.

There are two types of accounts, Externally Owned Accounts and Contract Accounts.

  • Externally Owned Accounts or EOA are controlled by private keys.
  • Contract Accounts or CA are controlled by the code and can be activated only by an EOA

An externally owned account is needed to participate in the Ethereum network. It interacts with the blockchain using transactions. A Contract Account represents a smart contract. Every account has a coin balance.

A Contract Account represents a smart contract.  Every account has a coin balance.  The participant node can send transaction for Ether transfer  or it can send transaction to invoke a smart contract code or both.  Both types of transaction require fees.

An account must have sufficient balance to meet the fees needed for the transactions activated. Fees are paid in Wei. Wei is a lower denomination of Ether. One Ether 10 to the power of 18 Weis.

A transaction in Ethereum includes

  • the recipient of the message
  • digital signature of the sender authorizing the transfer
  • amount of Wei to transfer.
  • an optional data field or payload that contains a message to a contract.
  • STARTGAS which is a value representing the maximum number of computational steps the transaction is allowed.

An Ethereum transaction includes not only fields what transfer of Ethers but also messages for invoking Smart contract. An Ethereum block contains the usual previous block hash, nonce, transaction details but also details about gas or fees limits, the state of the Smart Contracts and Runner-Up headers.

Previous Block 
Hash Block hash stored in previous block. 

■ Transaction Hash Root 
Root node of transaction hash.

■ Receipt Root Hash 
Root node of receipt hash.
 
■ State Root Hash 
Root node of world state.
 
■ Timestamp 
Unix timestamp that represents the time when mining ends. 

■ Difficulty 
Difficulty is a value that shows how difficult to find a hash.
 
■ Nonce 
A nonce is a number that can only be used once. In cryptography, a nonce is a one-time code chosen randomly to transmit password securely and prevent replay attacks. 

■ Gas Limit 
Gas limit set for the block. 

■ Gas Used 
Sum of all the gas used by all transaction in the block. 

■ Extra Data 
An optional and free field to store extra data.
 
■ number 
Counting number of the block. The number incre

Making an Etherium Transfer.

For a simple Ether transfer, the amount to transfer and the target address are specified along with the fees or gas points. The amount and the fees are transferred to their respective accounts. Here, we illustrate a transaction of 100 Ether transfer between the sender’s and receiver’s accounts. Note that besides this transfer, 21,000 gas points are paid to the miner who added the transaction block to the blockchain.

An Etherium Node.

Ethereum node is a computational system that represents a business entity or individual participant in the Ethereum blockchain. A full node runs the Ethereum protocol program and verifies blocks, downloading and updating itself as new blocks and transactions are created. Full nodes also assist others in downloading and updating their copies of the blockchain, making it decentralized and immutable.

Full nodes are nodes that are full of data, they hold data and can also distribute it from the network. It also validates new blocks. They can also deploy smart contracts to the blockchain. Such nodes are taxing on the computer hardware and bandwidth.

We also have light nodes which are lighter versions of the former, these hold less data. They only receive data based on requests. Although they can verify the validity of the data, their participation is limited in block validation.
There are also archive nodes, these store all data a full node has and constructs an archive of historical states of the blockchain.

Operations on the Ethereum Blockchain

An Ethereum full node hosts the software needed for transaction initiation, validation, 

mining, block creation, smart contract execution and the Ethereum Virtual Machine, EVM.

Below figure depicts the deployment of a smart contract and the invocation for a smart contract.

Deployment and Invocation of a Smart Contract.

Smart contract is designed, developed, compiled and deployed on the EVM that can be more than one smart contract in an EVM. When the target address in a transaction is a smart contract, the execution code corresponding to the smart contract is activated and executed on the EVM.

The input needed for this execution is extracted from the payload field of the transaction. Current state of the smart contract is the values of the variables defined in it. The state of the smart contract may be updated by this execution. Results of this execution is told in the receipts.

A blockchain maintains both the state hash and the receipt hash. All the transactions generated are validated. Transaction validation involves checking the time-stamp and the nonce combination to be valid and the availability of sufficient fees for execution.

Miner nodes in the network receive, verify, gather and execute transactions. The in-work smart contract code are executed by all miners. Validated transactions are broadcast and gathered for block creation. The consensus protocol used is a memory-based rather than a CPU-based proof of work.

Summary

The article explains that an Ethereum full node is essential for mining, validation, block creation, and smart contract execution. Miner nodes receive rewards for verifying and executing transactions, and all changes to the state variable in smart contracts are stored on the blockchain and consistent across all nodes. Smart contract code is executed by all participants in the Ethereum network.