Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Java and the blockchain - introducing web3j
Next
Download to read offline and view in fullscreen.

Share

The Blockchain and JavaScript

Download to read offline

This is a presentation is an introduction to the blockchain. It defines, what is the blockchain and shows how JavaScript developers can create blockchain applications.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

The Blockchain and JavaScript

  1. 1. The Blockchain and JavaScript Portia Burton @pkafei Node.js Interactive
  2. 2. Who am I? My name is Portia Burton I am a full-stack developer at the Atlantic magazine Became interested in blockchains earlier this year Not a cryptographic expert
  3. 3. Background about Blockchain and Bitcoin
  4. 4. What is a Blockchain? A blockchain is a cross between a decentralized data store and bittorrent. It is similar to a database but there isn’t a database administrator.
  5. 5. What is Bitcoin? Type of Cryptocurrency Creation based on paper by Satoshi Nakamoto titled “Bitcoin: Peer-to-Peer Electronic Cash System” Peer-to-peer which means transactions happen without a third party. Alice can send money directly to Bob
  6. 6. Bitcoin vs. Blockchain Bitcoin is part of a blockchain Blockchain is a digital ledger of transactions Each transaction is cryptographically signed Blockchains are trustless The bitcoin blockchain is open to everyone
  7. 7. We will focus on the Blockchain
  8. 8. Can an average developer build blockchain applications?
  9. 9. Yes, We Can!
  10. 10. But first, some more background
  11. 11. Many Different Types of Cryptocurrencies
  12. 12. Ethereum
  13. 13. Introduction to Ethereum Ethereum is a programmable blockchain, every new blockchain spawned from Ethereum has the same properties as Ethereum Ethereum Virtual Machine is the low level machine language Is Turing complete, unlike bitcoin which does not have looping capabilities It also is aware of multiple states, unlike bitcoin which is only aware of two states (spent and unspent)
  14. 14. Different Consensus Mechanisms Proof of Work: Uses the Etash algorithm. The Etash algorithm is based on Bitcoin’s the Dagger-Hashimoto algorithm. ⛏⛓ Proof of Stake: Proof of Stake is another way of validating. It calculates the weight of the node, being proportional to its computational resources. It’s less resource intensive than Proof of Work.
  15. 15. Smart Contracts
  16. 16. What is a Smart Contract? Stored on the blockchain and executed by code Many smart contracts are written in Solidity (syntax is similar to JavaScript) Powered by gas which can be computationally mined or purchased in an exchange People and machines can interact with it
  17. 17. Transaction: Signed data package that stores a message to be sent from an externally owned account GAS: the name for the execution fee that senders of transactions need to pay for operations on Ethereum blockchain VALUE (field): The amount of wei to transfer from sender to the recipient STARTGAS (value): Representing the maximum number of computational steps the transaction execution is allowed to take GASPRICE (value): Representing the fee the sender is willing to pay for gas
  18. 18. Applications of Ethereum Blockchain of Smart Contracts Self-executing legal contracts Create “American Idol” where people can vote using generated tokens Company boards can be ran virtually Dropbox business model create and sell encrypted storage space Predicting financial futures based on an oracle
  19. 19. Ethereum Chains
  20. 20. Different Blockchains Public blockchain: It is the official Ethereum chain that everyone can read and interact with Testnet blockchain: The official test chain of Ethereum. Good way to test contracts without wasting real ether Private blockchain: This is a blockchain that you can create yourself. This blockchain can be freely accessed by others, or you can add addresses by invite only
  21. 21. How to build a custom blockchain? 1. Create a Genesis file 2. Init your blockchain locally on the command line* 3. Start your chain again, this time with parameters (not in the documentation) *Be sure to run “init” each time
  22. 22. Genesis File Nonce: a random or pseudo-random number that can only be used once gasLimit: is the highest amount you are willing to pay for a computation Alloc: how much money that you allocate to your blockchain { "nonce": "0x0000000000000042", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000 000000000000", "extraData": "0x0", "gasLimit": "0x8000000", "difficulty": "0x400", "mixhash": "0x0000000000000000000000000000000000000000000000000000 000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": { } } CustomGenesis.json
  23. 23. Private Blockchain Parameters Use these parameters in the cli when creating a custom blockchain Nodiscover: Other people will not discover your blockchain RPC: JS interface for your node Networkid: Create a custom networkid inter geth --identity "Testing" --rpc --rpcport "8080" -- rpccorsdomain "*" --datadir "C:chainsTestChain1" -- port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1999 console
  24. 24. In Conclusion
  25. 25. Combine Mist and Ethereum Download Mist https://github.com/ethereum/mist Download Democracy Contract: https://www.ethereum.org/dao
  26. 26. Blockchain Technology Growing Pains Forces different parties (or contractors) to be savy about code Still very new platform and technology
  27. 27. Solidity Contract Bugs Transaction-Ordering Bug (TOD): Smart contract assumes a particular state of a contract that doesn’t exist Timestamp Dependence Bug: Asynchronous network is disconnected from a synchronized global clock. Some contracts assume that network is on global contract Unchecked Send: Most common exploit. Attacker elicits unexpected behavior from the contract by calling if from a carefully constructed call-stack
  28. 28. Smart Contract Bloopers https://ethereum.karalabe.com/talks/2016-hackethon.html#1
  29. 29. Enough About Me: How can you get started today? Solidity Tutorial: https://solidity.readthedocs.io/en/develop/ Bootstrap Meteor App: https://github.com/SilentCicero/meteor-dapp-boilerplate Example Dapps: http://ethereum.stackexchange.com/questions/2940/where-can-i-find-some-solidity-smart-contract-source-code- examples Command Line Interface of Interacting with the Ethereum Network: https://www.ethereum.org/cli Meteor: https://www.meteor.com/
  30. 30. Different Ethereum Frameworks These frameworks provide developers the tools need to create, test, and deploy smart contracts using Ethereum Truffle: https://github.com/ConsenSys/truffle The Dao: https://github.com/slockit/DAO Embark: https://github.com/iurimatias/embark-framework
  31. 31. Thank You!
  32. 32. References 1. http://ethdocs.org/en/latest/mining.html#what-is-mining 2. http://ethdocs.org/en/latest/frequently-asked-questions/frequently-asked- questions.html#what-s-the-difference-between-account-and-wallet-contract 3. http://www.coindesk.com/making-sense-smart-contracts/ 4. https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options 5. http://www.ethdocs.org/en/latest/contracts-and-transactions/account-types-gas- and-transactions.html 6. https://blog.ethereum.org/2016/07/12/build-server-less-applications-mist/
  • HaslinaHjSaharCTALTA

    Mar. 15, 2018
  • abpai1

    Dec. 15, 2017
  • JuneLei4

    Dec. 1, 2017
  • PrideMusvaire

    Nov. 27, 2017
  • AbidQureshi

    Nov. 3, 2017
  • SeanMNLawrence

    Oct. 22, 2017
  • FreddiePokrzywaJr

    Oct. 21, 2017
  • subbujois

    Oct. 19, 2017
  • LorisBach

    Oct. 10, 2017
  • ptlola

    Sep. 19, 2017
  • cnthuravi

    Sep. 11, 2017
  • roadlabs

    Sep. 6, 2017
  • hakanostrom

    Jul. 31, 2017
  • JacobMcKinley

    Jul. 19, 2017
  • GregoryShaversJr

    Jul. 14, 2017
  • JamesGormley8

    Jun. 22, 2017
  • hwiahn

    Jun. 12, 2017
  • MichaelJohnson808

    Jun. 4, 2017
  • pneumaticdispatch

    May. 24, 2017
  • DennisKloster2

    Apr. 24, 2017

This is a presentation is an introduction to the blockchain. It defines, what is the blockchain and shows how JavaScript developers can create blockchain applications.

Views

Total views

16,109

On Slideshare

0

From embeds

0

Number of embeds

4,368

Actions

Downloads

157

Shares

0

Comments

0

Likes

25

×