Merkle Trees and the Ethereum network

Alex Gallagher Salvador
4 min readMay 24, 2021

Before we start defining what a Merkle tree is it is important to define the concept of Cryptographic Hash.

A Hash is a function that derives from an arbitrary input of data and has a consistent output length. It is very rare that two inputs share the same output. Once you have a hash from a set of data you can prove to someone else that this is a true and unique piece of digital information (hence the importance of hashes to prove ownership and singularity of Fungible and Non-Fungible Tokens).

When you combine multiple hashes of a different range of inputs you can generate a data structure called Merkle Tree. Merkle trees allow users to generate hashes out of two or more previous hashes combined.

A Merkle tree is a very efficient way to prove that a small set of data is within a much larger dataset (e.g., a blockchain). Let’s say two different parties participate in the same distributed shared network and one wants to prove to the other a certain level of trust or authenticity (e.g., demonstrating that a specific data input has not been modified) instead of downloading the full blockchain we would just verify the root hash. As soon as one of the previous files becomes corrupted, the root hash will not be the same.

Blockchains use this data structure where we take a hash of a piece of data and combine it with the hash of a new piece of data in order to obtain a new root. With this new root, we can now prove the causality from the combined previous hashes into the new hash. This is a great way to prove the order of the history of the specific data structure. This is what we would call the block part:

List of Transactions → Hash function by using the original root

In the specific case of Ethereum, instead of listing a set of transactions at a time, we are taking a whole computer’s state (the Ethereum Virtual Machine or EVM). In each block, we can find a set of computer programs or operations.

The following is a list of the elements included in each block of the EVM:

  • Time Stamp
  • List of Transactions
  • Hash
  • Parent Hash
  • Uncles
  • Miner Address
  • Difficulty
  • Nonce
  • Gas Used
  • Reward

Each interaction you have with the Ethereum blockchain is cryptographically signed. The Ethereum Virtual Machine (or EVM) was designed to directly interact with programs that live on the blockchain, also called Smart Contracts. Every time you interact with the blockchain you have to spend a small amount of ether to incentivize the miners and help prevent spamming the network. As of this current date, Ethereum is using Proof of Work as a consensus mechanism to secure the network and will be gradually be transitioning to Proof of Stake (read my next article for more details on this subject).

The EVM allows you to sent Ether (Ethereum native token) or any other ERC-20 token (EVM standard for fungible tokens) from one user to another, or you can also call a method on a contract living inside the EVM. The contracts can also have certain predefined functions (e.g., requiring a certain amount of signers approval to release funds).

Main areas of development in the EVM include the following:

  • Accounting
  • Prediction Markets
  • Crowd Funding
  • Stable Currencies
  • Peer to peer lending
  • Synthetic assets
  • Decentralized Exchanges and exchange aggregators (to find the best possible exchange rates in the market)
  • Intellectual property ownership (Non-Fungible tokens).

In my next article, I will be attempting to simplify the transition from Proof of Work (PoW) to Proof of Stake (PoS) established in the Ethereum protocol roadmap and which will be taking place in the upcoming months.

--

--