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

Decentralizing the Web with JavaScript

Decentralizing the Web with JavaScript

6c3e7ef20801b4b967dc1643f63d6233?s=128

Ignacio Anaya

December 04, 2018
Tweet

Transcript

  1. Decentralizing the Web with JavaScript ! " ! @ianaya89 Decentralizing

    the Web with JavaScript - @ianaya89
  2. ! Nacho Anaya ! @ianaya89 • JavaScript Engineer @BloqInc •

    Ambassador @Auth0 • Organizer @Vuenos_Aires Decentralizing the Web with JavaScript - @ianaya89
  3. !" Decentralizing the Web with JavaScript - @ianaya89

  4. Decentralizing the Web with JavaScript - @ianaya89

  5. ! Boring Part Decentralizing the Web with JavaScript - @ianaya89

  6. Blockchain !" Cryptocurrency Decentralizing the Web with JavaScript - @ianaya89

  7. ! " Blockchain Decentralizing the Web with JavaScript - @ianaya89

  8. P2P ! ↔ # ↔ Decentralizing the Web with JavaScript

    - @ianaya89
  9. ! Hash hash(' ! ') // d2d4e9ddd66e9ce4ee288aea24a345de hash(' " ')

    // 23622db6154ea91d793647c9bd990824 Decentralizing the Web with JavaScript - @ianaya89
  10. Decentralizing the Web with JavaScript - @ianaya89

  11. ! Blocks const genesisBlock = hash(null, data, metaData) const currentBlock

    = hash(genesisBlock, data, metaData) /* ... */ const newBlock = hash(prevBlock, data, metaData) Decentralizing the Web with JavaScript - @ianaya89
  12. ! Good! Decentralizing the Web with JavaScript - @ianaya89

  13. ! Bad! Decentralizing the Web with JavaScript - @ianaya89

  14. ! Ethereum Decentralizing the Web with JavaScript - @ianaya89

  15. Ethereum !" Ether Decentralizing the Web with JavaScript - @ianaya89

  16. ! Smart Contracts “A set of promises, specified in digital

    form, including protocols within which the parties perform on these promises…” !" Nick Szabo Decentralizing the Web with JavaScript - @ianaya89
  17. ! Smart Contracts “A piece of code that runs in

    the blockchain!!"” !# Everyone else Decentralizing the Web with JavaScript - @ianaya89
  18. ! Uses Cases Assets Exchange - Chain Control - Data

    Ownership - Trust funds - Network Democracy Decentralizing the Web with JavaScript - @ianaya89
  19. ♻ Life Cycle Code ➡ Compile ➡ Deploy Interact Decentralizing

    the Web with JavaScript - @ianaya89
  20. ! Keys & Address Decentralizing the Web with JavaScript -

    @ianaya89
  21. ! TX Decentralizing the Web with JavaScript - @ianaya89

  22. ! Ether Decentralizing the Web with JavaScript - @ianaya89

  23. ! Gas Decentralizing the Web with JavaScript - @ianaya89

  24. !"⌚ DApps Decentralizing the Web with JavaScript - @ianaya89

  25. ! Flow ! .......................... ⬇ .......................... TX ➡ Confirmation New

    Block Decentralizing the Web with JavaScript - @ianaya89
  26. ! Philosophy Decentralizing the Web with JavaScript - @ianaya89

  27. ! Cool Projects Aragon - IPFS - Cryptokities - Golem

    - GitCoin - Decentraland - Open Bazaar - Bank Fish Decentralizing the Web with JavaScript - @ianaya89
  28. ! Why DApps? Decentralizing the Web with JavaScript - @ianaya89

  29. "People want to have a web they can trust. People

    want apps that help them do what they want without spying on them." !" Tim Bernes Lee Decentralizing the Web with JavaScript - @ianaya89
  30. ! Web 3.0 Decentralizing the Web with JavaScript - @ianaya89

  31. ! Funny Part Decentralizing the Web with JavaScript - @ianaya89

  32. ! Client • geth • parity • ganache-cli Decentralizing the

    Web with JavaScript - @ianaya89
  33. ! Network • Main • Test (Ropsten, Kovan, Rinkeby) •

    Private • Local Decentralizing the Web with JavaScript - @ianaya89
  34. ! ganache-cli $ npm i -g ganache-cli $ ganache-cli #

    starts a local node with HTTP provider Decentralizing the Web with JavaScript - @ianaya89
  35. ! Solidity pragma solidity ^0.4.24; contract HelloCoin { mapping (address

    => uint) public balance; function mint (address receiver, uint amount) public returns(uint) { balance[receiver] += amount; return balance[receiver]; } } Decentralizing the Web with JavaScript - @ianaya89
  36. ! Truffle $ npm i -g truffle $ truffle init

    # inits a new truffle project $ truffle compile # compile contracts and generate ABI $ truffle test # run test cases $ truffle migrate # deploy/migrate contracts to the blockchain Decentralizing the Web with JavaScript - @ianaya89
  37. ! Web3 import Web3, { providers } from 'web3' const

    provider = new providers.HttpProvider('http://localhost:8545') const web3 = new Web3(provider) Decentralizing the Web with JavaScript - @ianaya89
  38. ! Truffle Contracts import { providers } from 'web3' import

    contract from 'truffle-contract' import abi from './Contratc.json' const provider = new providers.HttpProvider('http://localhost:8545') const MyContract = contract(abi) MyContract.setProvider(provider) Decentralizing the Web with JavaScript - @ianaya89
  39. ! MetaMask Decentralizing the Web with JavaScript - @ianaya89

  40. Decentralizing the Web with JavaScript - @ianaya89

  41. ! https:!"cryptozombies.io Decentralizing the Web with JavaScript - @ianaya89

  42. ! Take Away Decentralizing the Web with JavaScript - @ianaya89

  43. ! Thanks! ! Questions? ! @ianaya89 Decentralizing the Web with

    JavaScript - @ianaya89