Image for post
Image for post

How different is Ethereum from Bitcoin?

In this post I make a comparison between the Ethereum Platform and the more mature (but limited) Bitcoin blockchain, pointing out the most evident differences that make Ethereum a platform with unlimited possibilities and definitely more efficient than its old cousin Bitcoin.
This post can be technical to many.

Block structure and mining

Unlike Bitcoin, Ethereum blocks contain more information than other blockchains. In fact they store a copy of both the transaction list and the most recent state, together with the block number and the difficulty. This will come useful later. Ethereum validates blocks in the following way (from the Ethereum Whitepaper)

  1. Check that the timestamp of the block is greater than that of the referenced previous block and less than 15 minutes into the future
  2. Check that the block number, difficulty, transaction root, uncle root and gas limit (various low-level Ethereum-specific concepts) are valid
  3. Check that the proof of work on the block is valid
  4. Let S[0] be the state at the end of the previous block
  5. Let TX be the block's transaction list, with n transactions. For all i in 0...n-1, set S[i+1] = APPLY(S[i],TX[i]). If any application returns an error, or if the total gas consumed in the block up until this point exceeds the GASLIMIT, return an error
  6. Let S_FINAL be S[n], but adding the block reward paid to the miner
  7. Check if the Merkle tree root of the state S_FINAL is equal to the final state root provided in the block header. If it is, the block is valid; otherwise, it is not valid

Why Merkle trees?

Hashing blocks is the most common operation in any blockchain. As a matter of fact hashing quickly and intelligently can speed up the entire system.
Hashing a set of files or chunks in general is usually done with hash lists. However, using hash trees can be more efficient due to the fact that each branch of the tree can be downloaded and checked independently from the rest. This in turns allows one node to check the integrity of a block even though the whole tree is not yet available.

Image for post
Image for post
In a Merkle tree internal nodes contain the hash of their children. The raw data blocks are in the last layer, as leaves.

Before you go

If you enjoyed this post, you will love the newsletter at datascienceathome.com It’s my FREE digest of the best content in Artificial Intelligence, data science, predictive analytics and computer science.

Written by

Managing Director @ amethix.com Chief Software Engineer & Host @datascienceathome.com

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