Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bitcoin Scripting, Smart Contracts (Ethereum), ...

Bitcoin Scripting, Smart Contracts (Ethereum), Tokens & ICO

Ulugbek Miniyarov

October 17, 2017
Tweet

More Decks by Ulugbek Miniyarov

Other Decks in Technology

Transcript

  1. Bitcoin Script used to lock transaction outputs; and transaction inputs

    provide data to unlock outputs • Forth-like programming language • Stack based (Left to Right) • First Input Last Output (FILO) • Composed of OP_CODES • Turing incomplete (Purposefully)
  2. Goals of Script Scripting provides the flexibility to change the

    parameters of what's needed to spend bitcoins. • Locking script - scriptPubKey • Unlocking script - scriptSig • Bitcoin clients run scriptSig & scriptPubKey to validate each transaction • Scripting system could be used to require two private keys, or a combination of several, or even no keys at all.
  3. Bitcoin Script References • Script wiki: https://en.bitcoin.it/wiki/Script • Script ide:

    https://github.com/siminchen/bitcoinIDE • Script Explorer: http://paulkernfeld.com/bse/
  4. Smart Contracts (Ethereum) a computer protocol intended to facilitate, verify,

    or enforce the negotiation or performance of a contract. Smart contracts were first proposed by Nick Szabo in 1996 • Contract (code) written and pushed to Blockchain • Initiates when user sends coin to it • Each node executes smart contract and update the ledger/blockchain • Basically Smart Contracts perform If-this-then-that (IFTTT) operations • Ethereum is one of the widest used platform for Smart Contracts • Smart Contracts also known as Decentralized Application (DApp) • Theoretically any real-world app can be DApp
  5. Smart Contracts as in Vending Machines 1. Put money to

    trigger keypad 2. User types coke code (ex. B4) 3. Coke’s falling is executed by Vending machine
  6. Solidity a contract-oriented programming language for writing smart contracts on

    various blockchain platforms. Developed by Gavin Wood, Christian Reitwiessner, Alex Beregszaszi, Yoichi Hirai and several former Ethereum core contributors to enable writing smart contracts on blockchain platforms such as Ethereum. • Turing complete • Based around ECMAScript syntax but statically typed • Runs on Ethereum Virtual Machine (EVM) • Compiles to bytecode before execution • Gas units used to fuel execution (paid by senders of transaction to miners in ether) • Gases prevent deliberate attacks and abuse on the Ethereum network • Still open to DoS attack by infinite loop but attacker should fund the DoS
  7. Programming? Bug? Hacking? The Decentralized Autonomous Organization (DAO) Incident (a

    Complex Smart Contract) - Smart Contract refund (recursive refund) bug (hacks $50M worth of Ether) - Hard Forking to revert hack since it is still in DAO child account - Split of Network to Ethereum (ETH) and Ethereum Classic (ETC) The Parity Multi-Signature Bug - Misuse of parent Smart Contract for Multi-Sig - $31M of Ether stolen (no revert possible) - White hackers hacked $180M before the attacker and returned to owners Still not a bug in Solidity itself, just not that Smart Contracts as name suggests
  8. Major use-cases of Smart Contracts • Decentralized Insurance (AXA Fizzy

    - Smart Insurance, Automatic Compensation) • Decentralized DNS (Ex: Namecoin) • Decentralized Voting machine • Decentralized Betting • Initial Coin Offering (ICO) • Any other third-party-based contracts
  9. Oracles • Contracts that need external data use Oracles •

    Actually Oracles listen to Contract events and then execute external request • Centralized Oracles would be a problem for a DApp so Oracles must be distributed • Most correct Oracles are chosen by DApp • Misused Oracles are penalized
  10. Tokens & Initial Coin Offering (ICO) Tokens: Digital Asset ICO:

    Crowdfunding using Cryptocurrencies Current ICOs: Coinmarketcap.com/tokens/ OR Tokenmarket.net/blockchain/all-assets Create your own Digital Asset: Ethereum.org/token Ethereum’s ICO market share > 50% ICOs can result in phishing, Ponzi schemes, and other scams (10% of ICOs)
  11. Fastest ICOs Source: http://techfoliance.com/fintech-corner/best-of-fintech/mapping-the-top-10-fastest-icos-of-all-time/ Modum.io - $4.2M in 10 minutes

    Firstblood - $10M in few minutes Blockchain Capital - $10M in 6 hours Bancor - $152M in 3 hours Gnosis - $12M in 10 minutes Brave - $35M in 30 seconds Humaniq - $1.5M in 60 minutes Qtum - $10M in 90 minutes Golem - $8.6M in 29 minutes Aragon - $25M in 15 minutes Tezos - $232M in 32 hours hours