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.
The Ethereum blockchain is similar to the one of Bitcoin in many ways. However, some major differences in how Ethereum works internally make it not only more useful from a practical perspective and definitely more powerful but also more efficient than Bitcoin.
The reader who is new to Ethereum and blockchain will have a general overview of the potential benefits of such technologies by reading my previous post Ethereum, how the Internet will be.
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)
- Check if the previous block referenced exists and is valid
- Check that the timestamp of the block is greater than that of the referenced previous block and less than 15 minutes into the future
- Check that the block number, difficulty, transaction root, uncle root and gas limit (various low-level Ethereum-specific concepts) are valid
- Check that the proof of work on the block is valid
Sbe the state at the end of the previous block
TXbe the block's transaction list, with
ntransactions. For all
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
S[n], but adding the block reward paid to the miner
- Check if the Merkle tree root of the state
S_FINALis 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.
In the picture above, the integrity of data block 2 can be verified immediately if the tree already contains hash 0–0 and hash 1 by hashing the data block and iteratively combining the result with hash 0–0 and then hash 1 and finally comparing the result with the top hash. Similarly, the integrity of data block 3 can be verified if the tree already has hash 1–1 and hash 0. This will be useful if files get split into very small chunks (data blocks) and their integrity gets checked in a non sequential way, as soon as blocks become available. An error in sending one block will compromise its integrity but only a small portion of the tree will changed, and only the aforementioned block will eventually be requested again and downloaded quickly.
In addition to the efficient hashing mechanism, the fact that each block contains the entire state of the transaction improves efficiency even further. In fact, there is no need to store the entire blockchain history, like in Bitcoin. To make a fair comparison, if Bitcoin used such an approach it would save space from 5 to 20 times.
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.