15 Feb, 23

The Internal Workings of Ethereum’s Infrastructure

The Internal Workings of Ethereum's Infrastructure
Finn Judell

Ethereum was initially conceptualised in 2013 by programmer Vitalik Buterin and brought to market in 2015 in collaboration with a cohort of (now renowned) blockchain developers. Today, the protocol is maintained by one of the largest open-source communities in the world – second only to Linux. Throughout its lifetime, it has seen various upgrades which aim to fulfil the protocol’s vision as the decentralised, permissionless ‘World Computer’

As Ethereum evolves to deliver its original promise as the ‘world computer’, users often struggle to keep up with its evolving infrastructure. Ethereum’s most recent upgrade from Proof-of-Work (PoW) to Proof-of-Stake (PoS) resolved a major critique from the public; cutting electricity consumption by 99% while maintaining full decentralisation and protocol security. This upgrade also drastically changed various features within the protocol. This article will walk through the current state of Ethereum and go into detail regarding the core infrastructure that underpins the protocol.

Ethereum Virtual Machine (EVM) 

Blockchains used as a method for securing digital currencies, like Bitcoin, store data within a distributed ledger that maintains a record of all transactions within the network. However, protocols like Ethereum enable more complex functions on top of blockchains. Instead of simply acting as a distributed ledger for transactions, Ethereum is a distributed state machine for smart contracts. This was the original idea that brought Ethereum to market as the world computer in 2015. Put simply, the EVM is a core piece of software specialised for executing smart contracts and computes the state of the network after each block is added to the chain. 

The EVM reads smart contracts in the form of Bytecode, the non-human-readable code that can only be compiled and executed by a virtual machine. Solidity is the programming language that was created to provide a human-readable framework for developers to write smart contracts that can be executed on the Ethereum blockchain. Solidity can be easily converted into bytecode, thereby making it readable for the EVM. In between Solidity and Bytecode exists ‘opcode’; opcode acts as a set of instructions that the EVM must take to perform a smart contract written in Solidity. The more opcodes in a smart contract, the more costs that a smart contract will consume to execute – this is known as gas fees. Gas consumed by executing opcodes can be calculated by adding up each different opcode in a smart contract and multiplying it by the cost of each opcode.

Although the EVM is native to Ethereum, it has become a standard across the industry as a framework for smart contract execution. Ethereum smart contracts are compatible with Polygon, Avalanche and BNB-Chain, Fantom and many more given they all EVM compatible. Therefore, developers can easily migrate smart contracts from one EVM-compatible chain to another.

Hashing in Ethereum

Hashing refers to the deterministic transformation and generation of input data of any length into a string of a fixed size. Hashing in blockchain ensures that any blockchain data that is attempted to be altered can be easily read by all nodes within the blockchain and identified as malicious or incorrect. In the case of Ethereum, hashing is treated differently, allowing states of the EVM to be altered within specified parameters of the smart contract. The protocol uses the hashing function Secure Hashing Algorithm 256 bits (SHA-256), which was derived from the National Security Agency’s paper entitled “On the Secure Hash Algorithm family”. This hashing algorithm ensures that original data cannot be retrieved via decryption and cannot be replicated with a different input, a core function that enables Ethereum’s absolute deterministic nature. SHA-256 is compulsory for Ethereum’s immutability and security, ensuring that any blockchain data that is attempted to be altered maliciously can be easily read by all nodes within the blockchain and identified as invalid.

Merkle Trees

A Merkle Tree (otherwise known as Binary Hash Tree), is a data structure originally invented by Ralph Merkle in 1979 and is an integral component of hashing within the blockchain protocols. While not specifically implemented in Ethereum, it is important to learn about it before addressing how Merkle structures are implemented to ensure immutability within the network. The function supports efficient querying of blockchain data and enables verification without referring to every transaction of every block. A Merkle tree is composed of various transactions within the blockchain networks, merged together to form one single hash called the ‘root node’. This process is made up of various components: a ‘leaf’, transactions that are being hashed, a ‘branch’, the method used to query transaction data from the root, and the root, the end output that is pushed onto the block appended to the longest chain. 

Patricia Merkle Tries

Due to Ethereum’s nature as a state machine, the protocol needs to include permissions for the state to be modified. The kind of output used in Ethereum to allow for variable states is a complex Merkle hashing technique known as a ‘Practical Algorithm To Retrieve Information Coded In Alphanumeric’ (PATRICIA) Trie. Patricia Tries needs to produce three different Merkle Roots which separate constant values from varying values – ensuring Ethereum operates securely while allowing states to be changed over time. More technical information on Patricia Tries, which is outside the scope of this article, can be found in the official Ethereum Docs.

Ethereum PoS Block Production

On PoS Ethereum, a single validator is randomly selected to be a ‘block processor’. The 

validator that has been selected is issued a block reward and received any associated priority fees in the block. This mechanism is more energy efficient and scalable than PoW since it does not require nodes to perform intensive computational work in order to produce blocks.

Slots

Blocks in the Ethereum protocol are enclosed into ‘slots’’. A time period of 12 seconds is given for the network to choose a random validator to propose a block to the slot. Each slot may or may not have a block in it (depending on network activity). 

Epochs

Slots are then bundled up into ‘epochs’. Epochs are composed of up to 32 slots that validators have to propose and attest over a period lasting. Each epoch is made up of block time * number of slots = time to epoch → 12 sec  x  32 slots =6.4 mins.

Validation and Finality

The total number of validators is split up into committees and one or more individual committees are responsible to attest each slot. One validator from the committee is chosen to create a new block and send it out to the epoch, while the other 127 validators will be checking to validate that the block is correct. Upon each new epoch, the validators are mixed and merged into new committees ensuring that roles within the network are chosen at random for each new epoch. An epoch is only considered finalised after the progression of two or more epochs after it. This process ensures fraud prevention within the network by allowing validators to attest to the state of Ethereum. 

Transactions & Gas

Gas refers to the unit that measures the amount of computational effort required to execute an Ethereum transaction by validators. Users have to pay a fee for this computation, this fee is known as the ‘Gas fee’. Gas is paid in Ethereum’s native currency, ETH. Gas prices are denoted in gwei, which is a denomination of ETH – each gwei is equal to 0.000000001 ETH. The word ‘gwei’ means ‘giga-wei’, and is equal to 1,000,000,000 wei. Wei itself is the smallest possible unit of ETH, similar to how a sat is the smallest unit of BTC.

Transaction Information

A submitted transaction includes information about the recipient, signature, nonce, value, data, gas limit, and maximum fees. The recipient can be an externally-owned account, whereby the transaction will transfer value, or a contract account, in which case the transaction will execute the contract code. Further, the signature is generated with the sender’s private key and confirms that the sender authorised the transaction. Moreover, the nonce is a sequentially incrementing counter that indicates the transaction number from the account. The value is the amount of ETH to be transferred from the sender to the recipient, expressed in wei. Additionally, the data field is optional and can be used to include arbitrary data. The gas limit is the maximum amount of gas units that can be consumed by the transaction. Gas units represent computational steps taken to execute the transaction. The maximum fees per gas are the maximum amount of gas the sender is willing to pay for the transaction, including base and priority fees.

Memory Pool

Ethereum’s memory pool, also known as the mempool, is a cache for pending transactions that are yet to be picked up by validators participating in verifying the chain. When a user creates a new transaction, it is broadcast to the network and then added to the mempool, where it waits to be included in a new block by validators. The mempool is a temporary holding area for unconfirmed transactions, allowing users to see which transactions are waiting to be added to the blockchain.

Once a transaction has been included in a new block and added to the blockchain, it is removed from the mempool. Transactions in the mempool are typically prioritised based on their fees, with transactions that offer higher fees being more likely to be included in the next block. This ensures that users who are willing to pay higher fees have a better chance of getting their transaction confirmed quickly.

Base Fee

Every block has a base fee. For an Etherum user to submit a transaction, they must be eligible for inclusion in the next block; to be eligible for inclusion in the block, the price per gas must be at minimum equal to the base fee. The base fee is calculated based on the number of transactions per block; however, this process is calculated independently of the current block and is instead determined by the blocks before it – allowing transaction fees to be more predictable for Ethereum users. When the block is mined, the base fee is “burned”, removing it from circulation. This fee is burned is to subsidise inflation from block rewards and protect the underlying value of ETH.

Priority Fee

The priority gas fee – also known as a miner tip – is used as an additional incentive for validators to include transactions in a specific block or before/after a specific transaction. Without priority fees, logical validators would have no disincentive to propose empty blocks rather than useful blocks – the validator would receive the same reward either way. This is important because miners need to be able to cover the costs of storing data on-chain. The larger the priority fee that a user includes in their transaction, the higher likelihood that their transaction will have over other pending transactions in the mempool being submitted within that block.

Max Fee

A user can specify the maximum limit they are willing to pay for their transaction to be executed. For a transaction to be successfully executed, the max fee must exceed the sum of the base fee and tip (max fee base fee + tip). The transaction sent is reverted if the difference between the max fee and the sum of the base fee and tip.

What Makes Up an Ethereum node?

On September 15, 2022, Ethereum merged from using the PoW consensus algorithm to PoS. Following this event, known as the Merge, the execution and consensus layers of the Ethereum blockchain operated independently. Today, these two components operate in tandem. Referencing the name ‘The Merge’, this transition refers to the merging of these two components, making it compulsory to run both Execution and Consensus clients to run together in order to gain access to the Ethereum network. This particular modular design of blockchain architecture was coined by Vitalik Buterin in his paper ‘encapsulated complexity’.

Execution Client

The execution layer (also known as the execution client) listens to new transactions broadcasted to the network, executes them in the EVM and holds the latest state and database of all current data on the Ethereum network. It is the Execution Clients’ job to process any user transactions on the network.

Consensus Client

The consensus layer (also known as the Beacon node) implements the PoS consensus algorithm, which enables the network to agree on the current state of the blockchain, validated using data provided by the execution layer. It is the Consensus Clients’ job to ensure that the blockchain agrees on one unified state, enabled by PoS consensus.

Types of Ethereum Nodes

Full Nodes

Full nodes have to store the complete Blockchain locally and participate in validation. While these nodes have access to all state data on the EVM, they do not store all historical EVM data locally. Full nodes calculate the historic state of the EVM on-demand once queried by the node operator. 

Light Nodes

Light nodes (sometimes referred to as light clients) are similar to full nodes. However, instead of storing the entirety of the blockchain, these nodes only store parts of the blockchain that are relevant to the transaction being performed. Light nodes are cheaper to maintain and are an easier method of accessing the blockchain without having to maintain a fully-synced copy. This infrastructure cannot act independently and rely on full nodes to function appropriately, often using them as intermediaries to verify the state of the blockchain. Currently, there are no production-ready light clients on the consensus layer; however, there are several in development.

Archive Node

Similar to full nodes, Archival nodes store all the blocks ever recorded on the blockchain. In addition to this, archival nodes store everything kept in the full node while building an archive of the historical states of the blockchain. These types of nodes technically do not have any security benefits over Full Nodes; However, Archive Nodes provide an extra level of efficiency to users who need swift access to historical transactions. 

Remote Procedure Calls (RPCs)

An RPC, or Remote Procedure Call, is a form of inter-process communication (IPC) that allows two computers to communicate with each other. In the context of blockchain, an RPC refers to the process where developers can communicate with a node to read blockchain data. In the initial inception of blockchain technology, it was expected that all users of the blockchain run their own local node; in reality, the cost and user experience of running a node creates various barriers to entry for blockchain users. This posed an opportunity for developers to create centralised platforms that offer blockchain infrastructure as a service. RPC nodes like Infura, Alchemy and Quicknode provide infrastructure for various blockchains which allow users to read blockchain data without having to run their own node. 

If someone is using a default MetaMask wallet, then they are likely connected to a centralised RPC. This piece of infrastructure has become a core part of the ecosystem. RPCs are vital in lowering the barriers to entry for everyday blockchain users. However, the use of RPCs requires users to trust the RPC provider. Technically, an RPC provider is capable of censoring certain smart contracts and manipulating blockchain data for the RPC user. Therefore, RPC nodes act as a single point of failure. For example, on April 23rd 2022, Infura (one of the largest RPC providers) experienced a service disruption that resulted in downtime for a large majority of the Ethereum and Filecoin ecosystem, rendering solutions like Polygon, Optimism and Arbitrum useless for a period of time.

Staking in Ethereum Validators

Staking is the act of depositing 32 ETH into an active validator or multiple validators running both Execution and Consensus clients. If there is a lesser amount of validators on the network, the return per validator increases; if the total staked amount of validators increases, the total block rewards increase to fund those validators although as a result, individual validators will receive fewer rewards.

In addition to the base block reward, validators are also incentivised by priority fees which are determined by the supply of validators and the demand for ethereum transactions.

Maximum Extractable Value

Maximum Extractable Value (MEV), otherwise known as Miner Extractable Value, is a term that refers to the potential profits that validators (previously miners under PoW) can earn by choosing which transactions to include in blocks they mine. Validators can earn more by selecting and ordering transactions with higher fees or by holding back transactions with lower fees. This can lead to users competing to offer higher fees to get their transactions included, which can result in higher fees for the network overall. There have been concerns raised about the possibility of miners/validators manipulating MEV and the potential effects on the Ethereum network.

Slashing

An Ethereum validator’s stake can be slashed if they behave dishonestly or go offline. Depending on the dishonest or lazy behaviour of the validator, its penalty can range anywhere between 1% to 100% of its total staked ETH. If a validator’s holdings go below 60% due to the slashing of the original stake (32 ETH) then the validator is automatically kicked from the protocol – transferring the remaining ETH back to the node operator’s assigned wallet. Slasher infrastructure is generally provided ‘out of the box’ within Ethereum validator infrastructure.

That being said, Prysm Labs recently developed a standalone ‘Slasher Validator’’; its function is to report slashable ‘proof’ to a consensus client where it will earn a small whistleblower reward for including this proof into a block. This specific piece of infrastructure is optional and is not necessary to run alongside an Ethereum validator but may want to be considered if the validator is operating a high stake piece of infrastructure such as a staking pool or data centre.

Withdrawals

Ethereum stakers are not currently able to withdraw their staked ETH. The withdrawal function is expected to be implemented after the ‘Shanghai Fork’ which was initially expected to be rolled out within 6-12 months after The Merge; currently, the date of the Shanghai upgrade is unknown; although speculation around the upgrade indicates that it may go live sometime in the second half of 2023.

Different types of Ethereum staking

Solo Staking

Solo staking is the most impactful way to participate in the Ethereum network and is a key component to ensuring absolute decentralisation. Solo stakers will need 32 ETH to stake in their validator, as well as a strong internet connection, the ability to constantly monitor and maintain their node as well as their own validator key infrastructure. While this method does require some technical knowledge, it also provides stakers with full participation rewards without needing to trust anyone else with the responsibility of custody or validator operation. All of the responsibility is on the operator – which could be seen as a positive trait or a negative trait depending on the technical expertise of the operator. 

Staking as a Service

For users who would prefer not to run their own validator node, staking-as-a-service solutions offer an alternative option. Staking-as-a-service providers are third party node operators that handle the operation of a user’s validator client. People who choose to use staking-as-a-service providers will still need to satisfy the 32 ETH requirement and secure Ethereum validator key infrastructure but do not need the added complexity of running a node and maintaining the node. Examples of Staking as a Service provider include Blockdaemon, Figment and BloxStaking. Staking-as-a-service businesses generally operate under a fee-sharing model, reducing the profitability of the validator by about 5-10%.

Pooled Staking

Staking pools are a collaborative approach to Ethereum staking. This method is a more inclusive approach, allowing users to stake ETH even if they cannot meet the minimum requirement of 32 ETH. Pooling is not natively supported on Ethereum, so third-party solutions were built to address this market inefficiency. Pooled staking is relatively easy to participate in, requiring little to no technical experience. Additionally, pooled staking allows participants to claim liquidity tokens like stETH, consequently enabling participants to generate instant rewards rather than waiting for withdrawals to be enabled. On the other hand, pooled staking involves counterparty risk. A pooled staker will need to trust that the pooled staking provider is operating their validator correctly. Examples of pooled staking providers include Lido and Rocket Pool and Staked.

Centralised Exchange Staking

Many centralised exchanges provide staking services. This solution is often attractive to those who are not yet comfortable holding ETH in their own wallet but still want to earn some yield on their ETH holdings. Like pooled staking, exchange staking does not require users to provide the full 32 ETH for a node. The trade-off here requires a high level of trust in the centralised exchange offering the staking product to carry out responsibilities as a node operator. Further, centralised exchange staking products pose a significant risk to the decentralisation of the Ethereum network, controlling a large sum of validators which creates a centralised target and point of failure – making the network vulnerable to attacks.

It is important to note that centralised exchange staking has faced, and continues to face, regulatory challenges from the Securities and Exchange Commission (SEC) in America. On the 9th of February, the SEC published a statement confirming that it has shut down Kraken’s staking program in the United States. The SEC’s issue with Kraken’s program was that it oversimplified staking and made it less intimidating for retail customers, thus making itself too much of an intermediary. The cryptocurrency exchange agreed to pay a US$ 30 million fine to the SEC for not registering the offering and sale of its crypto asset staking-as-a-service program.

Conclusion

Ethereum’s transition to a PoS consensus algorithm has significantly altered the network’s underlying infrastructure. The current state of the protocol consists of various evolving components that use encapsulated complexity to provide a simplified framework within a fundamentally complex system. This approach enables the protocol to operate in a straightforward manner while allowing for the implementation of complex technologies that provide features such as privacy and scalability. Although the long-awaited Merge will not be the last core update, it has laid the foundation for a wide range of future developments.

DISCLAIMER

Zerocap Pty Ltd carries out regulated and unregulated activities.

Spot crypto-asset services and products offered by Zerocap are not regulated by ASIC. Zerocap Pty Ltd is registered with AUSTRAC as a DCE (digital currency exchange) service provider (DCE100635539-001).

Regulated services and products include structured products (derivatives) and funds (managed investment schemes) are available to Wholesale Clients only as per Sections 761GA and 708(10) of the Corporations Act 2001 (Cth) (Sophisticated/Wholesale Client). To serve these products, Zerocap Pty Ltd is a Corporate Authorised Representative (CAR: 001289130) of AFSL 340799

All material in this website is intended for illustrative purposes and general information only. It does not constitute financial advice nor does it take into account your investment objectives, financial situation or particular needs. You should consider the information in light of your objectives, financial situation and needs before making any decision about whether to acquire or dispose of any digital asset. Investments in digital assets can be risky and you may lose your investment. Past performance is no indication of future performance.

FAQs

What is the Ethereum Virtual Machine (EVM)?

The Ethereum Virtual Machine (EVM) is a core piece of software specialized for executing smart contracts and computing the state of the network after each block is added to the chain. It reads smart contracts in the form of Bytecode, which can be compiled and executed by a virtual machine.

What is the role of hashing in Ethereum?

Hashing in Ethereum refers to the deterministic transformation and generation of input data of any length into a string of a fixed size. It ensures that any blockchain data that is attempted to be altered can be easily read by all nodes within the blockchain and identified as malicious or incorrect.

What are Merkle Trees and Patricia Merkle Tries in Ethereum?

Merkle Trees are a data structure that supports efficient querying of blockchain data and enables verification without referring to every transaction of every block. Patricia Merkle Tries, on the other hand, are a complex Merkle hashing technique used in Ethereum to allow for variable states.

How does staking work in Ethereum?

Staking in Ethereum involves depositing 32 ETH into an active validator or multiple validators running both Execution and Consensus clients. The return per validator varies depending on the total number of validators on the network.

What are the different types of Ethereum nodes?

There are several types of Ethereum nodes including Full Nodes, Light Nodes, and Archive Nodes. Full Nodes store the complete Blockchain locally and participate in validation. Light Nodes only store parts of the blockchain that are relevant to the transaction being performed. Archive Nodes store all the blocks ever recorded on the blockchain and build an archive of the historical states of the blockchain.

Like this article? Share
Latest Insights

15 Feb, 23

Web 2 versus Web 3: Key Differences

The internet has undergone significant transformations since its inception, evolving from static Web 1.0 pages to the dynamic and interactive Web 2.0. Now, we stand

15 Feb, 23

Blockchain Business Applications: Improving Any Sector

Blockchain technology, initially synonymous with cryptocurrencies like Bitcoin, has evolved into a multifaceted tool with significant applications across various traditional business sectors. This evolution is

Weekly Crypto Market Wrap, 17th June 2024

Download the PDF Zerocap provides digital asset liquidity and digital asset custodial services to forward-thinking investors and institutions globally. For frictionless access to digital assets

Receive Our Insights

Subscribe to receive our publications in newsletter format — the best way to stay informed about crypto asset market trends and topics.

Want to see how bitcoin and other digital assets fit into your portfolio?

Contact Us
Ready to sign up?
Create an Account