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

Learn About Blockchains

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

Learn About Blockchains

Sioux Falls Developer Meetup - 1/30/2018

What is blockchain technology?
How does it work and what applications exist?
As a developer, how do I get started implementing my own blockchain?

Blockchain, the underlying technology in cryptocurrency is all the hype right now with some cryptocurrency values skyrocketing over 1500% last year! Let's discuss how blockchain works and how it is useful in markets beyond cryptocurrency. Learn how to get started implementing your own blockchain!

"Email is to the internet as cryptocurrency is to the blockchain."

https://www.meetup.com/sfdevs/events/246909966/

Avatar for Daniel Black

Daniel Black

February 02, 2018

Other Decks in Programming

Transcript

  1. Motivation for Blockchain Create a decentralized way to solve problems

    (especially those of a transactional nature) Create a transparent and immutable history of what has happened
  2. Cryptography (public and private keys) Alice signs a message using

    her private key. Anyone that has Alice’s public key can verify that the message was signed by Alice. A Bitcoin transaction is “signed” with sender’s private key. The community can verify that the sender is in fact the sender by using the sender’s public key.
  3. Cryptography (hashes) A fixed-length value based on an arbitrary-length input

    value Deterministic - for a given input value, the same hash value is always produced Calculated by sending the input value through a hash function (SHA-1 SHA-2 MD5) Example: “Sioux Falls, SD” ===> SHA-256 ===> “80c019b252781dfe1383e25a50548112b010af1edec57720c0dc29addbafe7a8” “Sioux falls, SD” ===> SHA-256 ===> “4a83459dccdcc1ff1b5e166396ed23a62ee295a66e78bd93acf1706795e38544” source: googleblog.com Sha-2 Sha-2
  4. Cryptography (hashes) Each block header in a blockchain contains a

    hashed value of the contents of the previous block Transactions are referenced via hash pointers
  5. Bitcoin White paper published in 2008 by “Satoshi Nakamoto” A

    digital asset managed by a P2P network with no intrinsic value or backing authority Balances are managed by a single blockchain, controlled by the rules established by the ecosystem Prevents double spending and fraud Decentralizes processing bitcoin transactions and verifying transactions Distributed consensus
  6. How does Bitcoin work? Alice wants to pay Bob Alice

    broadcasts a transaction to P2P network with Alice’s signature (private key) - Typically by the front-end clients (wallets, online markets, etc) Nodes receive the transaction and “compete” to propose a new block including Alice’s transaction - Known as mining The block is proposed and the P2P network verifies - the transaction structure and values are valid - the transaction is signed by Alice (priv / pub key) - the sent amount has a valid source of funds using hash pointers
  7. Double Spend Prevention Distributed Consensus Nodes use longest chain Rule

    of thumb - 6 confirmations source: coursera.org
  8. Bitcoin Mining Game theory Miners are nodes that propose new

    blocks after solving a math problem for that block Miners receive bitcoins + transaction fees as a reward if their proposed block is accepted Reward started at 50 BTC and halves every 210,000 blocks (~4 years), currently at 12.5 BTC.
  9. Bitcoin Mining Miners must create a SHA-2 hash that starts

    with X number of zeroes. Inputs must be the block header + transactions in the block + “nonce” The variable is the “nonce” - miners guess different values until they arrive at a hash that starts with X number of zeros X is determined by the difficulty, recalculated every 2 weeks based on average time to solve the problem, keep it at around 10 minutes
  10. Bitcoin Disadvantages Limited scripting abilities (blockchain script is limited +

    whitelist on node software) 7 transactions / second - based on max block size and 10 min average / block Compare to Visa’s 5k-10k / second
  11. Altcoins Litecoin - fork of a fork of Bitcoin -

    uses Scrypt instead of SHA-256. Ripple - pre-mined, owners kept 20% - uses a few primary nodes to validate transactions - focuses on business to business Ethereum - written in a Turing complete language - enables rich smart contracts
  12. Start From Scratch Create the protocol and rules Create the

    node software Create mining software Create marketplace software OR… fork existing “platform” like Bitcoin and modify OR...
  13. Ethereum Describe as a “decentralized platform for applications” Block time

    is 14-15 seconds Turing complete developer environment Write Smart Contracts in Solidity language
  14. Ethereum Grew over 13,000% in 2017 Over 50% ICOs are

    part of the Ethereum blockchain 250+ live DApps
  15. Ethereum - DAPPs Distributed Applications (DAPPs) Fueled by “gas” that

    translates into “Ether” Runs on Ethereum Virtual Machine (EVM)
  16. Smart Contract Collections of functions and its states that correspond

    to an address in the blockchain source: codeburst.io
  17. CryptoKitty Breed and trade kittens for Ether Uses Smart Contracts

    and non-fungible coins (kittens) Digital beanie-babies
  18. ERC Coin Protocols ERC 20 - protocol that allows devs

    to define a fungible “coin” - An ether is the same as any other ether ERC 721 - protocol for non-fungible “coins” - All CryptoKitties are not created equal
  19. Applications FileCoin - distributed storage VINCoin - vehicle history Slock.it

    - locate and rent assets, e.g. apartment or car Healthcare… Property Transfer… Games...
  20. Go Tinker Run a Bitcoin / Ethereum node Build and

    deploy an Ethereum DApp to a test network Download a mining program Build a simple blockchain implementation, step by step