CS/블록체인응용

Lec 7-1: Ethereum

호프 2023. 10. 20. 19:39

Introduction to Ethereum

Ethereum is a decentralized, open-source blockchain

  • designed to support a smart contract using Turing Complete Language for a script language
  • ETH
  • originally used the PoW as its consensus algorithm like Bitcoin -> it recently changed to PoS

 

History

  • Ethereum was conceived in 2013 by Vitalik Buterin
  • On 30 July 2015, network went live, "Frontier", created its genesis block
  • the Dao was exploited in 2016 when tokens were stolen by unknown hacker. -> Fork resulted in the network splitting into Ethereum(with the theft reversed) and Ethereum Classic(original chain)
  • EEA(Enterprise Ethereum Alliance) created in 2017
  • In 2021, Berlin updgrade and London upgrade (including EIP - mechanism for reducing transaction fee volatility)
  • In 2022, Ethereum Merge -> completely transited to the PoS

 

dApps Security failure

  • DAO = Digital decentralized autonomous organization, and a form of investor-directed venture capital fund
  • In 2016, DAO was subjected to an attack that exploited a combination of vulnerabilities; affected Ether had a value about $50 at the time of the attack
  • The funds were put into an account subject to a 28-day holding period so were not actually gone;
  • DAO was dellisted from major exchanges in late 2016

 

Smart Contract

Smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract

  • allow the performance of credible transactions without third parties -> self-enforcing language
  • contract can be any program
  • Bitcoin smart contracts are only for coin transactions and cannot executes a complicated program
  • A blockchain-based smart contract is visible to any user in a blockchain system
    • leads to situation where bugs, including security holes are visible to all yet may not be quickly fixed

 

Decentralized App (dApp)

dApps are applications that are run on a P2P network of computers. rather than a single computer

  • already existed since the advent of P2P network in a way that is not controlled by any single entity
    • traditional dApps that run on a P2P network: ex. BitTorrent
  • 'blockchain enabled' website

The traditional web applications: FrontEnd -> API -> Database

dApps: FrontEnd -> Smart Contract -> Blockchain


Ethereum

The vision of Ethereum is to create an unstoppable, censorship-resistant(no goverment censoring), self-sustaining, decentralised world computer.

  • Ethereum does for distributed data storage plus computations (unlike Bitcoin)
    • Ethereum := computer while Bitcoin := SSSD (just data storage)

 

Ethereum and Bitcoin

Common Properties

  • Ethereum is a blockchain
  • Public and permissionless
    • But can create private networks like Bitcoin
  • Ethereum had PoW mining (but it changes to PoS since in 2022)
  • inbuilt cryptocurrency -> ETH (as Bitcoin has BTC)

Difference

  • Ethereum's block time is shorter: around 12seconds (while Bitcoin's around 10 minutes)
  • Ethereum has smaller blocks
  • Ethereum Virtual Machine (EVM) can run smart conrats
  • Ethereum is working with PoS

 

Ethereum (before the merge)

Mining rewards

  • In Bitcoin, miner receives: 6.25 new BTC + transaction fees
  • In Ethereum, 2 new ETH block reward.
    • It decreased over time from 5 to 2 ETH but decided by the Ethereum Core developer team not hard-coded like Bitcoin

Uncle reward

  • Some blocks are mined a little late and don't form part of the main blockchain. -> "uncles", can be referenced by later blocks
  • If uncles are referenced by a later block, they create about 1.75 ETH for the miner of the uncle
  • The miner who references an uncle also gets about 0.0625 ETH per uncle (maximum 2 uncles)

Gas and Gas Price

  • When you want to activate a smart contract, you should ask the miners to perform the calculations but this costs them time and energy so you should pay them for that service -> Gas
  • Payment is a small amount of ETH to send to the miner to make it work
  • Payment (in ETH) = Gas amount(in Gas) * Gas price(in ETH/Gas)

Gas amount

  • The more complex the smart contract, the more Gas the contract requires
  • The amount of Gas to run a contract is fixed for any specific contract, as determined by the complexity of the contract.

 

Ethereum

Gas Price

  • Gas price is specified by the person who wants the contract to run (a bit like Bitcoin transaction fees)
  • Before London Hard Fork, it's a competitive auction
  • After London Hard Fork, gas prices are calculated based on network congestion by an algorithm -> became more predictable. Also, gas fees are burned out by the system and no longer rewarded to the miners.