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.

Node.js Interactive

1,057 views

Published on

Have you ever been stuck downloading a module you already have? Have you ever been stuck without internet, unable to npm install when all the modules you need are stored in your coworkers' computers in the same LAN? Well no more! With the IPFS companion for npm, you get (a) distributed discovery: install modules seamlessly from any other computer you can reach; (b) cryptographic versioning: never install the same version twice; (c) free deduplication: don't download or store the same things multiple times.

npm-over-ipfs uses IPFS (the InterPlanetary Filesystem), a new file distribution protocol. IPFS is like Git meets Bittorrent; it is perfect for Node.js modules, it enables devs to have local caches, work offline or work in LANs, and use modules present in nearby machines.

Published in: Internet

Node.js Interactive

  1. 1. Stellar Module Management David Dias, Protocol Labs
  2. 2. Stellar Module Management Package Repo Tarball Container
  3. 3. • Module Management • npm • The Web • IPFS, the InterPlanetary Filesystem
  4. 4. • Module Management • npm • The Web • IPFS, the InterPlanetary Filesystem • 🌠
  5. 5. Modules Management
  6. 6. • What interfaces are available • Language biased • Reusable code, library or 
 project all together Scope
  7. 7. • Share it • Make a webpage for the project • Register it in a public listing Discover a module
  8. 8. • Use a tool • Download from a webpage • Sneaker net • Email Transport
  9. 9. • How to deal with constant new • Notify users • Avoid breaking compatibility • Cope with demand • Security patches Update
  10. 10. • How to store these modules • Storage space and bandwidth concerns Structure
  11. 11. • Check what I’m running Integrity
  12. 12. • Who owns it • Who is allowed to change it • Where can it run • Where can it be accessible Ownership
  13. 13. • Scope • Discovery • Transport • Update • Activity • Structure • Integrity • Ownership
  14. 14. • Storage is cheap • Bandwidth is virtually “free”
  15. 15. Location Addressing
  16. 16. http://10.20.30.40/foo/bar/baz.png location path http://example.com/foo/bar/baz.png
  17. 17. http://10.20.30.40/foo/bar/baz.png you
  18. 18. http://10.20.30.40/foo/bar/baz.png 10.20.30.40 you
  19. 19. http://10.20.30.40/foo/bar/baz.png 10.20.30.40 you
  20. 20. Permanence Security IoT Control Offline Bandwidth Disconnected
  21. 21. a protocol to upgrade the web
  22. 22. Permanent Distributed Safer Smarter Offline Faster
  23. 23. SFS web DHT+
  24. 24. web DHT SFS routing network exchange merkledag naming applications The Stack
  25. 25. routing network exchange merkledag naming applicationsThe Stack Defining the Data Moving the Data Using the Data IPLD - IP Linked Data libp2p IPNS - IP Naming System
  26. 26. { name: ‘martian’ … } { user: ??? }
  27. 27. { name: ‘martian’ … } { user: ??? } hash( ) -> KQsXSobGtbNhF
  28. 28. { name: ‘martian’ age: 9001 … } { user: KQsXSobGtbNhF … } hash( ) -> KQsXSobGtbNhF MERKLE LINK
  29. 29. cvs/svn
  30. 30. cvs/svn
  31. 31. cvs/svn
  32. 32. MerkleDAG in IPFS data forms a dag it’s called the merkle dag because the links are hashes
  33. 33. blob, tree, commit unix files and dirs any data structures are represented as dags blocks, txns, wallets kv-stores
  34. 34. http://10.20.30.40/foo/bar/baz.png location path http://example.com/foo/bar/baz.png
  35. 35. http://10.20.30.40/foo/bar/baz.png location path http://example.com/foo/bar/baz.png /ipns/example.com/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png content path
  36. 36. 10.20.30.40 you HTTP http://10.20.30.40/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png
  37. 37. http://10.20.30.40/foo/bar/baz.png 10.20.30.40 you /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png IPFS
  38. 38. /ipns/example.com/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png content path MUTABILITY IPNS - InterPlanetary Naming System
  39. 39. /ipns/QmYJPtosPTfoC/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png content path /ipns/example.com/foo/bar/baz.png IPNS - InterPlanetary Naming System MUTABILITY
  40. 40. /ipns/QmYJPtosPTfoC/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png QmW98pJrc6FZ6
  41. 41. /ipns/QmYJPtosPTfoC/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png QmYJPtosPTfoC public key secret key QmW98pJrc6FZ6
  42. 42. public key QmW98pJrc6FZ6 secret key /ipns/QmYJPtosPTfoC/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png QmYJPtosPTfoC QmW98pJrc6FZ6
  43. 43. public key QmW98pJrc6FZ6 secret key /ipns/QmYJPtosPTfoC/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png QmYJPtosPTfoC signed by QmYJPtosPTfoC QmW98pJrc6FZ6
  44. 44. public key QmW98pJrc6FZ6 secret key /ipns/QmYJPtosPTfoC/foo/bar/baz.png /ipfs/QmW98pJrc6FZ6/foo/bar/baz.png QmYJPtosPTfoC signed by QmYJPtosPTfoC QmW98pJrc6FZ6
  45. 45. DHT - Distributed Hash Table
  46. 46. DHT are the Holy Grail of P2P Networks
  47. 47. 1 5 6 10 50 55
  48. 48. 1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500
  49. 49. 1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500
  50. 50. 1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500 hash( ) = 91
  51. 51. 1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500 hash( ) = 91
  52. 52. 1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500 Who has fim , which hash( ) = 91?
  53. 53. What you get ✓ Discovery (through IPNS) ✓ Integrity (through cryptographic hashing) ✓ Activity (the more downloads, the merrier) ✓ Structure (download things at most once) ✓ Transport (stream from every peer that has the module) ✓ Update (just sync the parts that are changed) ✓ Ownership (private clusters, IPNS records signed,
  54. 54. registry-mirror npm i <insert-module-name> –-registry=<IPFS bridge>
  55. 55. registry-mirror demo
  56. 56. LXJS 2013 - http://yearbook.lxjs.org
  57. 57. Thank you! David Dias - http://daviddias.me IPFS http://ipfs.io Protocol Labs http://ipn.io

×