Save 37% off PRO during our Black Friday Sale! »

402 Payment Required: micropayment and IoT

402 Payment Required: micropayment and IoT

PyconAU 2016
Video: http://youtu.be/OvJpWt5gapQ

1915b1d939ae04b90db7923f10fc7ff7?s=128

Mitch O'Neill

August 12, 2016
Tweet

Transcript

  1. 402: Payment Required Micropayments and IoT

  2. An Open Protocol For Payment Over IP Would Be Pretty

    Great
  3. HTTP Is great •Fast •Easy to implement •Wide ranging transfer

    size/type •Open Protocol
  4. A Payment Protocol needs a few more things • Fast

    • Easy to implement • Wide ranging value transfer • Open Protocol • Low transaction cost • Trustless • Anonymous
  5. Smart Sprinkler

  6. Smart Sprinkler Forecast.io Weather Predictions

  7. Smart Sprinkler Data Aggregator Solar Irradiance Forecast.io Weather Predictions

  8. Smart Sprinkler Data Aggregator Forecast.io Weather Predictions BOM Solar Irradiance

    Aggregated Data Weather Data
  9. Smart Sprinkler Data Aggregator Forecast.io Weather Predictions BOM Solar Irradiance

    Aggregated Data Weather Data census.abs.gov.au Ping
  10. Smart Sprinkler Data Aggregator Forecast.io $0.0001/call BOM $0.0001/call $0. 1/call

    $10/call census.abs.gov.au $0.00001/call
  11. This chatty, anonymous network treats resources as “too cheap to

    meter.” It’s a giant grid that transfers data but doesn’t transfer value. DDoS attacks, email spam, and flooded VPNs result. Names and identities are controlled by overlords – ICANN, DNS Servers, Facebook, Twitter, and Certificate “Authorities.” Where’s the protocol layer for exchanging value, not just data? Where’s the distributed, anonymous, permission-less system for chatty machines to allocate their scarce resources? Where is the “virtual money” to create this “virtual economy?” -- https://startupboy.com/2014/04/01/the-fifth-protocol/
  12. Smart Sprinkler Forecast.io Data

  13. Smart Sprinkler Forecast.io Credentials Data

  14. Smart Sprinkler Forecast.io Credentials Data • Payment processing • Stored

    credentials • Stored payment credentials • Accounting/Settlement • Signup • API Keys • Give payment credentials • Get billed
  15. Smart Sprinkler Forecast.io Payment Data

  16. Client Server

  17. Client Server

  18. Client Server

  19. Client Server

  20. Payment for Data process Request ‘/’ 402 Payment required •

    <payment_address>
  21. Payment for Data process Request ‘/’ 402 Payment required •

    <payment_address> Pay ‘/< payment_address >’ <receipt>
  22. Payment for Data process Request ‘/’ 402 Payment required •

    <payment_address> Pay ‘/< payment_address >’ <receipt> Request ‘/’ <receipt> Response
  23. CLI: curl https://21.co | sh Pip: pip3 install two1 Github:

    https://github.com/21dotco/two1-python Docs: https://21.co/learn/#reference-21-library two1 python library
  24. two1 python modules • bitcoin -> utils for bitcoin data

    structures (serialization/deserialization) • blockchain -> read/write to a blockchain • crypto -> public keys and signatures using elliptic curves • wallet -> creates and manages wallets (pub/private keys) • channels -> micropayment channels (described above) • bitserv -> flask/django API for OnChain, Channel and BitTransfer • bitrequest -> patches Requests library to support 402 payment protocol • mkt -> publish endpoints that accept micropayments to https://mkt.21.co
  25. Lets ping test something

  26. Micropayments for storage! http://storage.mitch.fyi/ https://github.com/mitchoneill/micropayment-storage Read: 0.02 Satoshi/byte Write: 0.05

    Satoshi/byte 1 Satoshi = ~$0.0000067760
  27. Mount Virtual Folder

  28. User Background Read Directory

  29. User Background Read File Attributes

  30. Read File

  31. Read File

  32. Read File

  33. User Background Read File

  34. Payment for Data process Request ‘/’ 402 Payment required •

    <payment_address> Pay ‘/< payment_address >’ <receipt> Request ‘/’ <receipt> Response
  35. User Background Write File

  36. User Background Write File

  37. Write File

  38. Fun challenges to make micropayments viable • Need to keep

    lowering transaction fees, the median bitcoin transaction fee is 8 cents • How to revert a transaction if the server crashes between payment and response? • How to revert a transaction if it’s a low value response
  39. Useful Links • Bitcoin Protocol -> https://bitcoin.org/en/developer-reference • Ethereum Protocol

    -> https://github.com/ethereum/wiki/wiki/Ethereum-Wire- Protocol • Two1 Library -> https://21.co/learn/#reference-21-library • Lightning WhitePaper -> https://lightning.network/lightning-network-paper.pdf • Microstorage -> https://github.com/mitchoneill/micropayment-storage