L1 Ethereum

Ethereum

 

If Bitcoin is a blockchain of transaction data (Transaction Blockchain)

Then Ethereum is a blockchain of application data (Application Blockchain)

 

By embedding a programs code in a publicly accessible blockchain means the program can be completely trusted to execute as written.

 

  1. Background
  2. Technology
  3. Unique Mechanics
  4. Transactions
  5. Data Storage
  6. The Blocks

 

 

Background

 

Founded by V. Buterin in 2013

 

Ethereum is designed to be the general-purpose chain.

 

  • A blockchain with a full Turing-complete programming language (meaning loop able)

 

  • That can be used to create functions to encode arbitrary state transition functions.

 

 

The purpose is that a user could easily create their own system on the blockchain with only a few lines of code.

 

 

Technology

 

Can be thought of as a repurpose of a Bitcoin ledger remodeled around a virtual computer1

i.e. Machine Instructions instead of just Transaction Data

 

Described as a State-machine with 2 core components

 

  1. There exists a single global state
  2. There is a Virtual-machine that applies changes to that state

 

 

 

 

 

State:

Formally made up of Account Object Classes;

 

Account Objects contain:

 

  • A Random Nonce (Random Number)
  • The Accounts Ether balance
  • Any Contract Code
  • The Storage

 

 

State Transitions:

A State is the sum of the database relationships in the state-database

Each State is Represented as a Block

 

A State transition is a change of the global state of the database relationships

 

 

Hash Functions:

Hashing Algorithm: Keccak-256

 

 

Unique Mechanics

 

Turing Complete:

A Turing-Complete Program is a program that can re-execute its code indefinitely.

(i.e. you can write functions that “Loop”)

 

 

Accounts:

There are Two Kinds of Accounts

 

  1. External Accounts _> Normal User Account (Similar to Bitcoin’s)

 

  1. Formed by taking the last 20 bytes of the hash of the owner’s public key.

 

  1. Contract Accounts _> Account that is Controlled by Smart Contract Code

 

  1. Formed by taking the last 20 bytes of the hash of the union of its creator address and nonce at time of deployment

 

 

Conditionals:

 

  • Value Awareness _> Can make decisions based on input/output variable(s)
  • Blockchain Awareness _> Can make decisions based on other contracts
  • State _> Can make decisions based on the global state of the environment

Transactions

 

A Transaction is referred to as a Signed Data Package that contains a Message Object

 

Contents:

Signed Data Packets Contain:

 

  • Recipient
  • Sender’s Signature
  • # Ether to be transferred
  • Data Field (Optional): this field can have data in it that is readable by smart contracts
  • STARTGAS: This is the max # of steps that a transaction is allowed to take to execute
  • GASPRICE: This is the fee the sender will pay for each step

 

 

Message Objects Contain:

 

  • Sender (this value is inherited from the signed data packet it is contained in)
  • Recipient
  • # Ether to be transferred
  • Data Field (Optional)
  • STARTGAS

 

Message Objects are produced independently by Smart Contracts

Once executed they lead to the recipients account.

 

 

Sending:

This is what’s known as a State Transition Function [STF]

You can transition the state to modify data, account balances or even smart contracts.

 

A good way to think about it, is that you are sending a modification request:

 

  • I’d like to modify this data
  • I’ll pay this amount to have it done

 

 

i.e. we can modify the state by telling the blockchain to take some money from my account and assign it (send it) to my friends account

 

 

Receiving

Involves a listening function to make an application look for the contract on the Blockchain

You Verify the Transaction and wait for enough confirmations on the blockchain

 

 

 

The Fee(s)

These always vary so you never know exactly how much things cost until they are successfully executed and included on the blockchain. You can estimate by taking:

 

Transactions _> (Total Steps * Cost of Gas per Step) + 5 Gas per byte of transaction data

Computation _>

Bandwidth _>

Storage _>

 

 

Data Storage

 

Storage is extremely expensive

Ideally you won’t be storing anything

 

State-Database Backend:

Merkle Patricia Tree

The state-database maps bytes to bytes

 

 

The Blocks

 

Ethereum Blocks are formed every 17secs

 

Contains:

 

Block Header (16 Elements) _> Contains everything but the Transaction List

Block Footer (1 Element) _> Contains the Transaction Series

 

 

Structure:

Is a mapping of

  1. Addresses and
  2. Account States

 

Contracts _> Contains a set of Functions and Application Data that reside at an address.

 

 

 

 

Introduction to Ethereum: Assignments Pt. 4

L1 & L2: Ethereum, Smart Contracts

For Review

Basic Computer Programming Functions (conditionals, variables)

Basic Computer Science (common data structures), then review some of the mechanics covered in the Introduction to Bitcoin Lessons and think about features that seem limiting, and if those limits are by design.

 

Quick Note on Smart Contracts:

Ethereum’s first stable release is version 2, “Homestead”. Version 3, “Byzantium”, is a refinement.

 

Written Assignments

  • Compare the capabilities of the Bitcoin script interpreter and the Ethereum virtual machine.

 

  • Compare the non-scripting architectural choices of Bitcoin and Ethereum.

 

Assigned Readings

  1. Buterin: “A next generation smart contract & decentralized application platform” (2013)
    https://www.sharhon.com/files/ethereum-whitepaper-buterin-2013.pdf

 

  1. Dameron: “Beigepaper: An Ethereum Technical Specification” (Current)
    https://github.com/chronaeon/beigepaper/blob/master/beigepaper.pdf

 

  1. org: “Ethereum Homestead Documentation” (Current)
    http://www.ethdocs.org/en/latest/index.html

 

 

Additional Supporting Material - References