Whitepaper In Four Minutes - Ethereum

Whitepaper In Four Minutes - Ethereum




Introduction:

Bitcoin is the first example of a digital asset that runs without a central issuer or controller. Blockchain is the underlying technology that enables this system.

The blockchain is an open, decentralized ledger where nodes in the network agree together on updates to the state of the ledger. When the nodes can prove they worked on a cryptographically hard problem i.e. proof-of-work, the network allows free entry into the consensus process.

Ethereum builds up on the bitcoin blockchain. It adds a built-in turing-complete programming language to create smart contracts and decentralized applications (DAaps).

What are smart contracts and DAaps?

Smart contracts are programs created and stored in the Ethereum blockchain. It executes only when specific criteria is meet. Think of it as cryptographic “boxes” or “autonomous agents” that contain values which gets unlocked when certain conditions are met. These contracts are immutable i.e., no one can change it after it is deployed to the blockchain.

smart-contract
Blockchain smart contract

Unlike bitcoin scripting, the programming language in Ethereum is “Turing-complete”. It supports a broader set of computational instructions that enables writing complex contracts.

DAaps are applications that run on a peer-to-peer network rather than on a single centralized computer. The primary characteristics of a blockchain DAaps are:

  • Open source apps stored in a decentralized public blockchain,
  • Participants get tokens as incentives, and
  • It uses a standard cryptography algorithm as proof of value.

How do smart contracts work?

The creator first uploads the smart contract to the blockchain. The participating nodes in the Ethereum network then replicate the smart contact, which then gets distributed throughout the network. Once it is on the blockchain, anyone can invoke the smart contract to perform operations or execute read/write operations.

smart-contract-trigger
Smart contract is automatically executed

What is Ethereum, again?

Ethereum is a blockchain can be thought of as a global "world computer" that nobody owns. Anybody can upload a program or smart contract in the blockchain. Anybody can execute that program.

Since the program is decentralized, there is no central point of failure. Ethereum intends to create an alternative protocol for building a decentralized application.

How does Ethereum work?

Ethereum Accounts:

Unlike Bitcoin, Ethereum’s state is made up of “accounts”.

An account consists of -

  • a nonce value (counter to uniquely run transactions),
  • account’s ether balance
  • contract code (if present), and
  • storage (empty by default).

It uses a state transition function to transfer value and information between accounts.

Note: “Ether” is the intrinsic currency used to pay transaction fees in the network.

Gas to run contracts:

Ethereum has the concept of “gas”, where one gas usually maps to one step of computation in a contract. When invoking a contract, the sender needs to send a specific gas amount that covers the cost of running the contract code.

Gas price is amount of ether the sender is willing to spend on every unit of gas. The unit of gas price is gwei. Wei is the smallest unit of ether, and gwei is 1,000,000,000 ether.

unit-of-ethereum
Unit of Measure

How does it all work?

An account can be either an externally owned account or a contract account. Externally owned accounts have no code and are controlled solely by their private key. These contracts can send messages by creating and signing a transaction.

A “transaction” is a process of sending a signed data package containing a message from an externally owned account.

A transaction consists of:

  • recipient of the sender,
  • a unique signature created by the sender,
  • the recipient,
  • amount of ether sent from the sender to the recipient, and
  • optional data fields, i.e., STARTGAS and GASPRICE.

Every transaction has to specify two optional fields - STARTGAS and GASPRICE.

GASPRICE represents the fee for a computational step.
STARTGAS represents the most number of computational steps a transaction can take.

Each step of computation costs something in the network. A transaction has to specify the largest amount it is willing to spend for the computation.

Contract accounts are controlled by their contract code. When it receives a “message” to run the contract code, it allows the sender to read/write it’s internal storage, send messages, or create other contracts.

A message consists of -

  • sender of the message,
  • recipient of the message,
  • amount of ether sent, and
  • optional data field, i.e., STARTGAS.

A message is like a transaction except that it gets created by a contract, not an external actor.

Note: If a contract calls other contracts, the initializer pays for the sub-executions as well. This means, STARTGAS assigned by a transaction applies to all its sub-executions as well.

transaction-message
Difference between a transaction and message

Dissecting a contract:

A contract is a code written in a low-level, stack-based bytecode language called the “Ethereum Virtual Machine” or EVM.

The code consists of series of operations that runs until it reaches the end, or an error, or it detects one of the STOP or RETURN instructions.

A contract consists of a long-term key-value storage which lives longer than a single execution of a contract. Think of this like the contract’s database.

Apart from this, the contract has access to the current blockchain state, the sender of the message, the data field of the incoming transaction message, and block header data.

Blockchain and Mining in Ethereum:

Ethereum and Bitcoin blockchains are similar in many ways with some major differences. Unlike Bitcoin, Ethereum blocks store both the transaction list as well as the most recent state. The blocks also store the block number and the difficulty.

The basic block validation algorithm:

  • Check if previous block reference is valid and exists.
  • Check if new block is created fairly recently (timestamp greater than references previous block and not later than 15 minutes from the previous block)
  • New block is valid (block number, difficulty, transaction root, etc. are valid)
  • Proof of work on the new block is valid.
  • Run state transitions from all transactions in the block and make sure there are no errors.
  • Check Merkle tree validation.

state-transition-flow
State transition flow in Ethereum

Note: The process of executing the contract code is part of the definition of state transition function, which is part of the block validation algorithm.

What is Ethereum useful for?

Like Bitcoin, Ethereum is commonly used as a digital asset or a digital currency to store and transfer ethers between accounts.

The most common type of application is to build a custom token system. A token can represent a real asset like USD or Gold, or it could be an individual token like a MattCoin or a MaryCoin. An organization like Uber could come up with UberCoin that users/drivers could earn and pay.

Another application would be building identity and reputation systems on top of Ethereum.

The most common example of one is the DNS system used on the internet to map domain names like “infourminut.es” to an IP Address. It's like an address so that a computer can send messages to another computer.

Distributed Autonomous Organizations (or DAOs) are another interesting use case for the Ethereum blockchain. DAO is an organization that has its rules stored in a contract or across many contracts.

Other applications that can be built on top of Ethereum are:

  • Dropbox - like Decentralized file storage.
  • Insurance applications.
  • Prediction markets.
  • Escrow like contracts.

Conclusion:

The whitepaper proposes an upgraded blockchain which can create decentralized applications.

The Ethereum protocol does not directly support these applications but provides all the required abstractions or building blocks to build such applications. It takes the concept of a blockchain beyond currency.

References:

Image Sources:


Read summary of a whitepaper in four minutes. Every week. On Wednesdays.
Sometimes twice a week!