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

402 Payment Required: micropayment and IoT

402 Payment Required: micropayment and IoT

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

Mitch O'Neill

August 12, 2016
Tweet

More Decks by Mitch O'Neill

Other Decks in Programming

Transcript

  1. A Payment Protocol needs a few more things • Fast

    • Easy to implement • Wide ranging value transfer • Open Protocol • Low transaction cost • Trustless • Anonymous
  2. 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/
  3. Smart Sprinkler Forecast.io Credentials Data • Payment processing • Stored

    credentials • Stored payment credentials • Accounting/Settlement • Signup • API Keys • Give payment credentials • Get billed
  4. Payment for Data process Request ‘/’ 402 Payment required •

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

    <payment_address> Pay ‘/< payment_address >’ <receipt> Request ‘/’ <receipt> Response
  6. 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
  7. 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
  8. Payment for Data process Request ‘/’ 402 Payment required •

    <payment_address> Pay ‘/< payment_address >’ <receipt> Request ‘/’ <receipt> Response
  9. 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
  10. 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