Blockchain Basics Week2 Ethereum Blockchain

Ethereum Blockchain

  • Learning Objectives:
    • Discuss the smart contract
    • Illustrate Ethereum blockchain protocol, elements and operation
    • Demonstrate concept of "gas" ### Smart Contracts
  • Centerpiece and thrust of Ethereum blockchain
  • A piece of code deployed in the blockchain node
  • add a layer of logic and computation to the trust infrastructure supported by the blockchain
  • Execution of a smart contract is initiated by a message embedded in a transactioN

  • A smart contract resembles a class definition in an object oriented design:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    pragma solidity ^0.4.0;  // version of the solidiity

    contracr SimpleStorage { // contract name
    uint storeData;

    function set(uint x) { // write
    storeData = x;
    }

    function get() constant returns (uint) { // read
    return storedData;
    }
    }
  • Ethereum Virtual Machine, EVM provides a run anywhere obstruction layer for the contract code.

Ethereum Structure

  • new concept - Account
    • The originator and the target of a transaction
    • Basic units of Ethereum protocol
    • Externally Owned Accounts, EOA
      • Controlled by private keys
      • Participate in the Ethereum network
    • Contract Accounts, CA
      • Controlled by the code and can be activated only by an EOA
      • Represent a smart contract
  • Wei

    • A lower denomination of Ether.
    • One Ether 10 to the power of 18 Weis
  • Transaction

    • Recipient of the message
    • Digital signature of the sender authorizing the transfer
    • Amount of Wei to transfer
    • Optional data field or payload that contains a message to a contract
    • STARTGAS: A value representing the maximum number of computational steps the transaction is allowed
    • Gas price: A value representing the fee sender is willing to pay for the computations
  • An Ethereum transaction includes not only fields what transfer of Ethers but also messages for invoking Smart contract.

  • An Ethereum block contains

    • Previous block hash
    • Nonce
    • Transaction details but also details about gas or fees limits

    • State of the Smart Contracts
    • Runner-Up headers

Ethereum Operations

For a simple Ether transfer

  • The amount to transfer
  • The target address are specified
  • Fees or gas points

An Ethereum full node hosts

  • transaction initiation, validation, mining, block creation, smart contract execution and the EVM

When the target address is a smart contract

  • The execution code corresponded is activated and executed on the EVM
  • The input needed for this execution is extracted
  • Current state of the smart contract is the values of the variables defined in it, can be updated

Transaction validation involves:

  • Checking the time-stamp

  • The nonce combination to be valid
  • Availability of sufficient fees for execution

Miner nodes in the network receive, verify, gather and execute transactions.

Incentive Model

Mining is the process used to secure the network by validating the computations, collecting them to form a block, verifying them, and broadcasting it.

  • Gas

    • Every action in Ethereum requires crypto fuel, or gas.
    • Gas points do not vary different from Ether.
    • Gas limit: Amount of gas points available for a block to spend.
    • Gas spent: Actual amount of gas spent at the completion of the block creation
  • Incentive model
    • The winning miner also gets the fees, gas points for execution of a smart contract transactions
    • Blocks created by other are called Ommer(side) Blocks.
    • Ommer miners also get a small percentage of the total gas points as a consolation and for network security

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×