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

Intro to Building Decentralized Applications - ...

Intro to Building Decentralized Applications - Fog City Ruby

Most people think peer-to-peer (P2P) networks are just for file sharing, but it turns out you can also build other types of P2P applications with advantages like enhanced privacy and security. We’ll walk through the process of building an increasingly complex P2P cloud file storage system (think Dropbox), and touch on the challenges you’d run into and some of their possible solutions. Topics include efficiently locating data within a large network and building a system where we can trust random people on the internet with our personal files.

Avatar for Dylan Barnard

Dylan Barnard

July 11, 2018

More Decks by Dylan Barnard

Other Decks in Technology

Transcript

  1. @dkbarns - Data privacy: “Technically someone could do that ...”

    - Markie Z. Pros & Cons + Familiar development model
  2. @dkbarns - Data privacy: “Technically someone could do that ...”

    - Markie Z. - Data security Pros & Cons + Familiar development model
  3. @dkbarns - Data privacy: “Technically someone could do that ...”

    - Markie Z. - Data security - Anonymity Pros & Cons + Familiar development model
  4. @dkbarns Centralized vs. decentralized systems Terminology - node, peer, device

    (laptop, Digital Ocean Droplet) No central authority client/server model client-server nodes
  5. @dkbarns 2. Connect to HOST server 3. Send JSON STORE

    message + file Basic upload process OWNER HOST 1. Create TCP server … 4. Write local file copy FILE FILE COPY
  6. @dkbarns A better cloud storage system Ownership: How to keep

    files private On-demand: How to deal with uncertain uptime Data loss: How to ensure data integrity Incentives: How to encourage participation
  7. @dkbarns A better cloud storage system Ownership: How to keep

    files private On-demand: How to deal with uncertain uptime Data loss: How to ensure data integrity Incentives: How to encourage participation
  8. @dkbarns Encryption PRIVATE KEY Generate key Step 1: Encryption Algorithm

    “Hello world!" “7sr2ygq7sa” Encrypt Step 2:
  9. @dkbarns Generate shard file name “ello w" FILE a15cv Split

    file Step 1: Step 2: Hashing Algorithm SHARDS File Splitting (“Sharding”)
  10. @dkbarns FILE OWNER 1. Encrypt 2. Shard a15cv 75cav 03p2i

    ii24a a15cv 75cav 03p2i ii24a HOST 3. Send Upload with sharding
  11. @dkbarns Manifest files FILE OWNER 1. Encrypt 2. Shard a15cv

    75cav 03p2i ii24a MANIFEST WRITE SHARD IDS TO MANIFEST
  12. @dkbarns FILE OWNER 1. Encrypt 2. Shard a15cv 75cav 03p2i

    ii24a a15cv 75cav 03p2i ii24a HOST 3. Send Upload with sharding MANIFEST WRITE SHARD IDS TO MANIFEST
  13. @dkbarns FILE OWNER 1. Encrypt 2. Shard a15cv 75cav 03p2i

    ii24a 3. Send How to distribute shards? MANIFEST WRITE SHARD IDS TO MANIFEST ?
  14. @dkbarns Use a master list? OWNER NODE LIST HOST a15cv

    03p2i 75cav ii24a 75cav a15cv ii24a 03p2i
  15. @dkbarns Use master lists? OWNER NODE LIST HOST NODE LIST

    a15cv 03p2i 75cav ii24a 75cav a15cv ii24a 03p2i
  16. @dkbarns Where to store a given shard? OWNER SHARD HOST

    ? 75cav IDs i80l9 1plm1 Distribute data?
  17. @dkbarns What is our closeness metric? OWNER SHARD HOST ?

    75cav i80l9 1plm1 Based on the shard id Logical closeness - shard id’s “closeness” to other node’s id
  18. @dkbarns What is our closeness metric? OWNER SHARD HOST ?

    75cav i80l9 1plm1 Based on the shard id Logical closeness - shard id’s “closeness” to other node’s id THIS IS A BLACK BOX
  19. @dkbarns What is our closeness metric? OWNER SHARD HOST ?

    75cav i80l9 1plm1 Based on the shard id Logical closeness - shard id’s “closeness” to other node’s id THIS IS A BLACK BOX BLACK BOX COVERS RABBIT HOLE
  20. @dkbarns Secure, private P2P cloud file storage MANIFEST WRITE SHARD

    IDS TO MANIFEST 2. Encrypt 3. Shard 4. Distribute HOST CONTACT LIST • Smaller routing lists • Smaller storage a15cv 75cav 03p2i ii24a a15cv 75cav CONTACT LIST ii24a 03p2i 1. Upload FILE OWNER
  21. @dkbarns Secure, private P2P cloud file storage MANIFEST WRITE SHARD

    IDS TO MANIFEST 2. Encrypt 3. Shard 4. Distribute HOST CONTACT LIST • Smaller routing lists • Smaller storage • Large files a15cv 75cav 03p2i ii24a a15cv 75cav CONTACT LIST ii24a 03p2i 1. Upload FILE OWNER
  22. @dkbarns Kademlia links 1. Kademlia: A Peer-to-peer Information System Based

    on the XOR Metric (Slides) - Maymounkov, Mazi`eres - https://tams.informatik.uni-hamburg.de/lehre/2004ss/vorlesung/medientec hnik/material/kpres.pdf 2. Xoro P2P - Chen, Kurutz, Lee, - https://xorro-p2p.github.io/resources/ 3. Tristan Slominski, Distribute All The Things - https://docs.google.com/presentation/d/11qGZlPWu6vEAhA7p3qsQaQtW H7KofEC9dMeBFZ1gYeA/edit#slide=id.g1718cc2bc_03157
  23. @dkbarns Looking for my next team! On the at ...

    - dylankb.github.io - @dkbarns - github.com/dylankb