Introduction to DApp development

68a8092ba46ca5848bcdfc453d81c4bb?s=47 Koshik Raj
December 15, 2018

Introduction to DApp development

68a8092ba46ca5848bcdfc453d81c4bb?s=128

Koshik Raj

December 15, 2018
Tweet

Transcript

  1. Basics of smart contracts and DApp development - Koshik Raj

  2. Agenda • Bitcoin and smart contract basics • Turing complete

    scripting language to create smart contracts • Basics of Ethereum • Setting up Ethereum development environment • Create an "Hello World" smart contract • Create, test and deploy a Proof of Ownership application.
  3. Why was Bitcoin created?

  4. Centralization concerns in the past • Cyber attacks on major

    institutions. ◦ Sony pictures, JP Morgan Chase data breach. ◦ Target customer confidential data breach. • Expensive transaction fee. • Subprime mortgage crisis in 2008.
  5. How Bitcoin solved it?

  6. None
  7. Distributed Ledger Technology (DLT) Each node holds a copy of

    the blockchain Blockchain + p2p+ Consensus algorithm = DLT
  8. Cryptography in blockchain • Hashing • Digital signatures

  9. Blockchain 1234 1234 1235 1235 1237

  10. Consensus mechanism • Algorithm to reach a global truth •

    Consensus mechanism solves the byzantine generals’ problem. • Bitcoin’s proof-of-work is the first and well known consensus algorithm.
  11. Consensus algorithm: proof-of-work • Uses hash puzzle to do work

    • Incentivizes miner for their work from transaction fee + new coins • Hash cash proposed in 1997 by Adam Back • Reduce email spam and DOS attacks
  12. Bitcoin addresses • Bitcoin uses asymmetric cryptography to generate public-private

    key pair • Public key is used to generate the public address • Private key is used to sign the transactions ◦ bitcoin-cli getnewaddress 1JK1yCXbP2WkwgzbAUqpWTeo9rQkA9seNg ◦ bitcoin-cli dumpprivkey 1JK1yCXbP2WkwgzbAUqpWTeo9rQkA9seNg L2NAKvQsbkeQZyhfPRWw1juQ19ohxGCFbdr8izQSHEmKWYFtVjXK
  13. Bitcoin transactions • Bitcoin does bookkeeping with a transaction based

    ledger • Every transaction must be validated by the node • Every transaction consists of inputs and outputs • Transaction fee must be paid for every transaction created • Unconfirmed transactions are maintained in mempool: https://www.blockchain.com/btc/unconfirmed-transactions
  14. Transaction verification • Bitcoin uses Turing incomplete stack-based language called

    "Script" • Uses locking and unlocking scripts ◦ Locking: 4 OP_ADD 6 OP_EQUAL ◦ Unlocking: 2
  15. Decentralized applications • Applications designed to run in a decentralized

    network. • There is no single server to provide the service, thus avoiding the single point failure.
  16. Decentralized application architecture RPC

  17. Smart contracts • Protocol that allows contracts to be verified

    and enforced in a self-executing manner. • Self enforcement removes the need for intermediaries
  18. Ethereum basics • Ethereum is a widely-used platform for creating

    decentralized applications (https://www.stateofthedapps.com/stats) • Ethereum houses its own distributed virtual machine, and scripting language called Solidity
  19. Ethereum VM and Solidity • EVM provides a runtime environment

    to execute smart contracts • EVM runs on a node that is isolated from the Ethereum network • Each transaction/ contract executed needs GAS (transaction fee). • Only the smart contract output can be inserted to the blockchain • EVM executes the compiled Solidity bytecode • Solidity is a contract-oriented programming language influenced by C++, Python and JavaScript
  20. Let's build a DApp

  21. Contact me: Koshik Raj linkedIn: koshikraj GitHub: koshikraj twitter: rajkoshik

    koshik.raj@gmail.com www.koshik.me “keep calm and create DApps”