[Episode 1] Mastering Ethereum : A Short Summarized Story

Lets dive deeper into world of Ethereum with the very famous book "Mastering Ethereum" by the co-founders of Ethereum itself

[Episode 1] Mastering Ethereum : A Short Summarized Story

If you are procastinating to read this 320 Pages book due to time or any other reason, I will help you to grasp its concepts with my 14 parts blog series which will be summarized version to let you understand and revise quickly.

Join me in the race and lets get down to the rabbithole of Ethererum. Yuhuu...!!!

Lets start with Chapter 1 : What is Ethereum

What is Ethererum


  • Ethereum is an open source, globally decentralized computing infrastructure that executes programs called smart contracts.
  • It enables developers to build powerful dapps with built-in economic functions. While providing high availability, auditability, transparency, and neutrality, eliminates censorship.

Similarity with Bitcoin


=> peer-to-peer network
=> a Byzantine fault–tolerant
=> proof-of-work blockchain
=> digital signatures and hashes
=> a digital currency

Differences from Bitcoin


Bitcoin is a digital currency payment network i.e cryptocurrency application with limited scripting language. While Ethereum is Turing complete programmable blockchain that runs a virtual machine capable of executing complex code. Its currency Ether is intended as a utility currency to pay for use of the Ethereum platform as world computer.

Components of a Blockchain :


=> A peer-to-peer (P2P) network
=> Messages, in the form of transactions
=> A set of consensus rules for a valid state transition
=> A state machine that processes transactions
=> A chain of cryptographically secured blocks that acts as a ledger
=> A consensus algorithm that decentralizes control over the blockchain
=> Incentivization scheme such as block rewards

Term “blockchain” is just a shorthand reference to the combination of above technologies. Today, there are a huge variety of blockchains with very different properties but base technicality and specification remains same.

The Birth of Ethereum


  • With limited set of transaction types, data types, and sizes of data storage, it was hard to build a more freedom and flexibility project on top of Bitcoin because it needed additional off-chain layers, and that was against benefits of public blockchain. So new blockchain was only option.

  • Toward the end of 2013, Vitalik Buterin, a young programmer and Bitcoin enthusiast, proposed turing-complete contracts to replace the specialized contract language of Mastercoin(an overlay protocol that extended Bitcoin to offer rudimentary smart contracts). Mastercoin team was impressed but it didnt fit their dev roadmap.

  • In Dec 2013, he shared whitepaper of Ethererum: a Turing-complete, general-purpose blockchain. Andreas, Gavin Wood and few dozen people received it and helped evolving the proposal. Andreas helped in enforcing consensus rules on smart contract execution a much later. Dr. Gavin Wood was first to offer help to Vitalik. He had C++ programming skills and became Ethereum’s co-founder, codesigner, and CTO.

  • The main idea of Ethereum founders was to provide secure and decentralized programming environment to developers to program their broad variety of application without having to implement the underlying mechanisms of blockchain.

  • The founders worked for years, building and refining the vision. And on July 30, 2015, the first Ethereum block was mined.

Ethereum’s Four Stages of Development


Ethereum’s development was planned over four distinct stages with subreleases(“hard forks”) that were not backward compatible.

  • Main Development Stages : Frontier, Homestead, Metropolis,and Serenity.

  • Intermediate Hard Forks : Ice Age, DAO, Tangerine Whistle, Spurious Dragon, Byzantium, and Constantinople.

NameBlock NumberDescription
Stage : Frontier
Started on July 2015
Block #0The initial stage of Ethereum
Hard Fork : Ice AgeBlock #200,000to motivate transition to PoS
Stage : Homestead
Started from Mar 2016
Block #1,150,000Second Stage of Ethererum
Hard Fork : DAOBlock #1,192,200Ethereum and Ethereum Classic splits to reimburse DAO hack victims
Hard Fork : Tangerine WhistleBlock #2,463,000DoS attack lead to Gas Calculation changes for some I/O heavy operations
Hard Fork : Spurious DragonBlock #2,675,000To address more DoS attack vectors and protect from replay attack mechanism
Stage : Metropolis
Started from Oct 2017
Block #4,370,000Byzantium and Constantinople were two hard forks planned for Metropolis

Metropolis will be followed by the final stage of Ethereum’s deployment, code‐named Serenity.

Ethereum: A General-Purpose Blockchain


Ethereum is also a distributed state machine like bitcoin. But instead of tracking only the state of currency ownership, Ethereum tracks the state transitions of a general-purpose data store as a key–value tuple just like RAM.

Just like most computers, Ethereum can load code into its state machine and run that code, storing the resulting state changes in its blockchain. Difference is Ethereum state changes are governed by the rules of consensus and the state is distributed globally.

Ethereum’s Components


ComponentDescription
P2P networkEthereum runs on the Ethereum main network, which is addressable on TCP port 30303, and runs a protocol called ÐΞVp2p.
Consensus rulesDefined in the Yellow Paper
TransactionsNetwork messages that include sender, recipient, value, and data payload.
State machineState transitions are processed by stack based EVM that executes bytecode. Programs are written in Solidity and compiled to bytecode for EVM exection
Data structuresEthereum’s state is stored locally on each node as a database (usually Google’s LevelDB), which contains the transactions and system state in a serialized hashed data structure called a Merkle Patricia Tree.
Consensus algorithmEthereum uses Bitcoin’s consensus model, sequential single-signature blocks. Plans to move to a PoS weighted voting system, codenamed Casper.
Economic securityEthereum currently uses a PoW algorithm called Ethash, but will move to PoS
ClientsMost prominent Ethererum Clients are Go-Ethereum (Geth) and Parity.

Arrival of "Gas"


Turing-complete systems can run in “infinite loops,” i.e program that does not terminate. Ethereum can’t predict if a smart contract will terminate, or how long it will run, without actually running it. Whether by accident or on purpose, a smart contract can be created such that it runs forever when a node attempts to validate it. This results into an infinite range of nasty, resource-hogging, memory-bloating, CPU-overheating cases that simply waste resources. This is effectively a DoS attack.

So Ethereum introduces a metering mechanism called gas. Each instruction has a predetermined cost in units of gas. Amount of gas has to be passed when a transaction triggers that sets the upper limit of what can be consumed running the smart contract. The EVM will terminate execution if the amount of gas consumed by computation exceeds the gas available in the transaction.

So, Gas is the mechanism Ethereum uses to allow Turing-complete computation while limiting the resources that any program can consume. Gas can only be purchased as part of a transaction, and can only be bought with ether.

From General-Purpose Blockchains to Decentralized Applications (DApps)


  • Ethereum’s vision expanded to become a platform for programming DApps.
  • DApps is meant to take the WWW to its next evolutionary stage, from centrally owned and managed applications, to applications built on decentralized peer-to peer protocols.

A DApp is composed of at least:

 - Smart contracts on a blockchain
 - A web frontend user interface.

In addition, many DApps include other decentralized components, such as:

 - A decentralized (P2P) storage protocol and platform
 - A decentralized (P2P) messaging protocol and platform

Ethereum’s Development Culture


Unlike Bitcoin, Ethereum develpment culture is focused on the future rather than the past i.e “move fast and break things.” A change is implemented, even if that breaks compatibility, or forcing clients to update leading to rapid innovation and evolution. That means You can’t simply “upgrade” your smart contracts. You must be prepared to deploy new ones, migrate users, apps, and funds, and start over.

Further Readings :


• The Ethereum Yellow Paper: ethereum.github.io/yellowpaper/paper.pdf
• The Beige Paper, a rewrite of the Yellow Paper for a broader audience in less formal language: github.com/chronaeon/beigepaper
• ÐΞVp2p network protocol: bit.ly/2quAlTE
• Ethereum Virtual Machine list of resources: bit.ly/2PmtjiS
• LevelDB database (store the local copy of the blockchain): leveldb.org
• Merkle Patricia trees: github.com/ethereum/wiki/wiki/Patricia-Tree
• Ethash PoW algorithm: github.com/ethereum/wiki/wiki/Ethash
• Casper PoS v1 Implementation Guide: bit.ly/2DyPr3l
• Go-Ethereum (Geth) client: geth.ethereum.org
• Parity Ethereum client: parity.io

Thats the end of Chapter 1. Stay Tuned for upcoming more 13 chapters which will cover cryptography, wallets, oracles, tokens, EVM and lot more.

Hope You enjoyed it.