Introduction to the IPFS

Dff59e8fd0bf8973701ee5c3c2a672a5?s=47 gentam
June 29, 2017

Introduction to the IPFS

IPFSについて調べたのでまとめました

Dff59e8fd0bf8973701ee5c3c2a672a5?s=128

gentam

June 29, 2017
Tweet

Transcript

  1. 5.

    *1'4ͱ͸  • The InterPlanetary File System • ҰจͰݴ͏ͱ: "Content

    Addressed, Versioned, P2P File System" • Protocol Labs < https://protocol.ai> Juan Benet Λத৺ͱͯ͠ɼ2013 12݄ࠒʹ։ൃ։࢝ • GoͰॻ͔Ε࣮ͨ૷͕͜͜< https://github.com/ipfs/go-ipfs>ʹ͋Δ 5
  2. 8.

    *1'4ͷ໨త • HTTPΛऔΓସ͑ɼΑΓྑ͍WebΛ࡞Δ͜ͱΛ໨తͱ͢Δ • ΑΓྑ͍Web • Faster: P2PܕͰܦ༝ΛݮΒͨ͢Ί? • Safer:

    ϒϩοΫνΣʔϯͱ૊Έ߹ΘͤΔ͜ͱͰରվ᜵ • Open: ͋ΒΏΔίϯςϯπ͕ɼڞ௨ͷ໊લۭؒʹΦʔϓϯʹΞυϨ γϯά͞ΕΔ 8
  3. 9.

    *1'4ͱ#MPDLDIBJO • Blockchain ͸େྔͷσʔλΛอ࣋͢Δʹ͸޲͔ͳ͍ ‣ IPFSΛར༻ͯ͠ɼαΠζͷେ͖ͳσʔλʹରԠ ‣ ͦͷΠϛϡʔλϒϧ͔ͭύʔϚωϯτͳϦϯΫΛɼϒϩοΫνΣʔ ϯʹࡌͤΔ ‣

    Blockchain্ͷΞϓϦέʔγϣϯ͸IPFSΛར༻͢Δ͜ͱͰύϒ ϦοΫʹΞΫηεՄೳͳσʔλϕʔεΛ࡞Δ͜ͱ͕Ͱ͖Δ ‣ IPFSͱBlockchain͸ͱͯ΋૬ੑ͕ྑ͍ 9
  4. 10.

    – Juan Benet “The contribution of IPFS is simplifying, evolving,

    and connecting proven techniques into a single cohesive system, greater than the sum of its parts.” 10
  5. 28.

    28 IPFSͷ໨ඪͱશମ૾ˠIPFSͷίϯηϓτ • ҰจͰݴ͏ͱ: "Content Addressed, Versioned, P2P File System"

    • Protocol Labs <https://protocol.ai> Juan Benet Λத৺ͱͯ͠ɼ2013 12݄ࠒʹ։ൃ։࢝ • GoͰॻ͔Ε࣮ͨ૷͕͜͜<https://github.com/ipfs/go-ipfs>ʹ͋Δ *1'4ͱ͸ 
  6. 29.

    29 IPFSͷ໨ඪͱશମ૾ˠIPFSͷίϯηϓτ • ҰจͰݴ͏ͱ: "Content Addressed, Versioned, P2P File System"

    • Protocol Labs < https://protocol.ai> Juan Benet Λத৺ͱͯ͠ɼ2013 12݄ࠒʹ։ൃ։࢝ • GoͰॻ͔Ε࣮ͨ૷͕͜͜<https://github.com/ipfs/go-ipfs>ʹ͋Δ *1'4ͱ͸  DHT, SFS Git (+Blockchain) SFS
  7. 30.

    *1'4Λߏ੒͢Δٕज़ͱͦͷಛ௃ • Routing - DHT • Block Exchanges - BitTorrent

    • Version Control Systems - Git • Self-Certified Filesystems - SFS 30
  8. 31.

    *1'4Λߏ੒͢Δٕज़ͱͦͷಛ௃ • Routing - DHT • Block Exchanges - BitTorrent

    • Version Control Systems - Git • Self-Certified Filesystems - SFS 31
  9. 33.

    %)5ͷྫ  Kademlia • IDͷXORΛڑ཭ؔ਺ʹ͓͍ͯ໦ߏ଄Λ࡞Δ • log(n) ͷޮ཰తͳlookup (e.g. 10,000,000

    ϊʔυͰ ໿20ϗοϓ) • ίϯτϩʔϧϝοηʔδΛݮΒ͠ɼΫΤϦʔͷΦʔόʔϔουݮগ • ௕ੜ͖ͳϊʔυΛ༏ઌ͢ΔઃܭʹΑΓDoS߈ܸʹڧ͍ ͪͳΈʹࣗ෼͸Kademlia DHTͷγϛϡϨʔγϣϯΛErlangͰ࡞Ζ͏ͱͯ͠·͢ 33
  10. 35.

    %)5ͷྫ  Coral DSHT • Distributed Sloppy Hash Table •

    KademliaͰ͸ίϯςϯπͷIDʹ"͍ۙ"ϊʔυ͕ཉ͘͠ͳ͍৘ใ·Ͱ࣋ͭඞཁ͕ ͋ͬͨɽ • → ୅ΘΓʹ"ϙΠϯλ" (࣮ࡍʹσʔλΛ͍࣋ͬͯΔϊʔυͷΞυϨε)Λอ࣋͢ Δ͜ͱͰޮ཰Խ • ஍Ҭͱن໛ʹΑͬͯ֊૚Խ͞Εͨ"Ϋϥελ"Λ࡞Δ͜ͱͰɼ͍ۙϊʔυ͔Β୳ࡧ Λ࢝Ίɼ௿͍ϨΠςϯγʔΛ࣮ݱ 35
  11. 36.

    *1'4Λߏ੒͢Δٕज़ͱͦͷಛ௃ • Routing - DHT • Block Exchanges - BitTorrent

    • Version Control Systems - Git • Self-Certified Filesystems - SFS 36
  12. 39.

    *1'4Λߏ੒͢Δٕज़ͱͦͷಛ௃ • Routing - DHT • Block Exchanges - BitTorrent

    • Version Control Systems - Git • Self-Certified Filesystems - SFS 39
  13. 40.

    (JU • όʔδϣϯ؅ཧγεςϜ͸ɼϑΝΠϧͷมߋΛϞσϧԽ͠ผͷόʔδϣ ϯΛޮ཰తʹ഑෍͢ΔػೳΛఏڙ • Git͸ɼ෼ࢄ؀ڥʹదͨ͠ɼMerkle DAG* ΦϒδΣΫτϞσϧʹϑΟ ϧπϦʔ΁ͷมߋΛΩϟϓνϟ͢Δ *

    Merkle Directed Acyclic Graph (ϋογϡ໦ ༗޲ඇ॥؀άϥϑ?) – ϚʔΫϧπϦʔ ͱࣅ͍ͯΔ͕ɼΑΓ൚༻తͳߏ଄ɽॏෳΛόϥϯε͢Δඞཁ͕ͳ͘ɼ༿Ͱͳ͍ ϊʔυ΋σʔλΛ࣋ͭ 40
  14. 41.

    (JU 1. ΠϛϡʔλϒϧͳΦϒδΣΫτ͕ɼϑΝΠϧ (blob), σΟϨΫτϦ (tree), มߋ (commit)Λද͢ 2. ΦϒδΣΫτ͸ɼίϯςϯπͷϋογϡ஋ʹΑͬͯΞυϨε͕͚ͭΒΕΔ

    3. ଞͷΦϒδΣΫτ΁ͷϦϯΫ͸ຒΊࠐ·ΕɼMerkle DAGΛܗ੒͢Δ 4. ΄ͱΜͲͷϝλσʔλ(ϒϥϯνɼλάɼetc)͸୯ʹΦϒδΣΫτ΁ͷࢀরϙΠϯλͰ͔͠ͳ ͍ͨΊɼ࡞੒΍ߋ৽ͷॲཧ͸͍ܰ 5. όʔδϣϯͷมߋ͸ɼࢀরͷߋ৽͔ΦϒδΣΫτͷ௥Ճ 6. όʔδϣϯͷมߋΛଞͷϢʔβ΁഑෍͢Δʹ͸ɼ୯ʹΦϒδΣΫτΛసૹ͠ɼͦ͜ͷࢀরΛ ߋ৽͢Δ͚ͩ 41
  15. 43.

    *1'4Λߏ੒͢Δٕज़ͱͦͷಛ௃ • Routing - DHT • Block Exchanges - BitTorrent

    • Version Control Systems - Git • Self-Certified Filesystems - SFS 43
  16. 48.

    *1'4ϓϩτίϧͷߏ੒ 1. Iden99es - ϊʔυͷIDੜ੒΍ೝূΛ؅ཧ 2. Network - ଞͷϐΞͱͷ઀ଓΛ؅ཧ 3.

    Rou9ng - ಛఆͷϐΞ΍ΦϒδΣΫτΛ୳ͨ͢Ίͷ৘ใΛ؅ཧ 4. Exchange - ϒϩοΫަ׵ϓϩτίϧ(BitSwap)Λར༻ͯ͠ɼޮ཰తͳϒϩοΫ഑෍ 5. Objects - ೚ҙͷσʔλΛΞυϨε෇͖ΠϛϡʔλϒϧͳΦϒδΣΫτͷMerkle DAG ΁ 6. Files - GitʹӨڹ͞Εͨόʔδϣϯ؅ཧϑΝΠϧγεςϜ 7. Naming - self-certifying ͰมߋՄೳͳ໊લ 48
  17. 50.

    *EFOUJUJFT • ϊʔυ͸NodeID ʹΑͬͯࣝผ͞ΕΔ • ͜Ε͸ɼS/Kademlia ʹ͓͚Δ҉߸ύζϧͱڞʹ࡞ΒΕͨެ։伴ͷϋογϡ஋ • Ϣʔβ͸ࣗ༝ʹ৽ͨͳ NodeIDΛൃߦͰ͖ɼຖճҟͳΔIDΛར༻͢Δ͜ͱ΋Ͱ͖Δ

    (͕ɼͦ ͏͢ΔͱωοτϫʔΫతʹෆརʹͳΔͨΊಉ͡IDΛ࢖͏͜ͱ͕ಈػ෇͚ΒΕΔ type NodeId Multihash type Multihash []byte // self-describing cryptographic hash digest type PublicKey []byte type PrivateKey []byte // self-describing keys type Node struct { NodeId NodeID PubKey PublicKey PriKey PrivateKey } 50
  18. 51.

    *%ͷੜ੒ • S/Kademlia ϕʔεͷ IPFS ʹ͓͚ΔIDੜ੒: difficulty = <integer parameter>

    n = Node{} do { n.PubKey, n.PrivKey = PKI.genKeyPair() n.NodeId = hash(n.PubKey) p = count_preceding_zero_bits(hash(n.NodeId)) } while (p < difficulty) • ࠷ॳͷ઀ଓ࣌ʹϐΞ͸ެ։伴Λަ׵͠ɼhash(other.PublicKey) ͕ other.NodeID ͱҰக͢Δ͔֬ೝ͢Δɽ͠ͳ͔ͬͨΒ઀ଓΛ੾Δɽ 51
  19. 55.

    /FUXPSL4UBDL  • Transport: IPFSͷτϥϯεϙʔτϨΠϠʹ͸ͲΜͳϓϩτίϧͰ΋ ࢖͏͜ͱ͕Ͱ͖Δɽಛʹ WebRTC DataChannl (ϒϥ΢βͱͷ઀ଓ࣌) ΍ɼuTP

    (LEDBAT) ͕ద͍ͯ͠Δ • Reliability: ΋͠ԼҐͷωοτϫʔΫ͕৴པੑΛఏڙ͠ͳ͍৔߹͸ɼ IPFS͕uTP΍ɼSCTPΛར༻ͯ͠৴པੑΛ֬อͰ͖Δ 55
  20. 56.

    /FUXPSL4UBDL  • Connectivity: ICE (Interactive Connectivity Establishment) NATӽ͑ ͷٕज़Λར༻͢Δ

    • Integrity: ϋογϡͷνΣοΫαϜΛར༻ͯ͠ϝοηʔδͷ׬શੑΛ νΣοΫͰ͖Δ(೚ҙ) • Authenticity: HMACͱૹ৴ऀͷެ։伴Λར༻ͯ͠ɼϝοηʔδͷ৴ པੑΛνΣοΫͰ͖Δ(೚ҙ) 56
  21. 57.
  22. 59.

    3PVUJOH • IPFSϊʔυ͸ɼҎԼͷ৚݅Λຬͨ͢ϧʔςΟϯάγεςϜ͕ඞཁ: • ଞͷϐΞͷωοτϫʔΫΞυϨεΛ୳͢͜ͱ͕Ͱ͖Δ • ಛఆͷΦϒδΣΫτΛ͍࣋ͬͯΔϐΞΛ୳͢͜ͱ͕Ͱ͖Δ • IPFSͰ͸ɼS/Kademlia ͱ

    Coral Λϕʔεͱͨ͠DSHTΛར༻ͯ͠ɼ͜ΕΛ࣮ ݱ • 1KBҎԼͷখ͞ͳσʔλ͸DHT্ʹ௚઀ɼͦΕΑΓେ͖͍σʔλ͸ࢀর(࣮ ମΛ࣋ͭNodeID)Λอଘ͢Δ 59
  23. 60.

    3PVUJOH*OUFSGBDF type IPFSRouting interface { FindPeer(node NodeId) // gets a

    particular peer's network address SetValue(key []bytes, value []bytes) // stores a small metadata value in DHT GetValue(key []bytes) // retrieves small metadata value from DHT ProvideValue(key Multihash) // announces this node can serve a large value FindValuePeers(key Multihash, min int) // gets a number of peers serving a large value } • ͜ͷΠϯλʔϑΣΠεʹै͍ͬͯ͑͢͞Ε͹ɼશ͘ผͷϧʔςΟϯάγ εςϜͱೖΕସ͑ͯ΋໰୊͸ͳ͍ 60
  24. 62.

    #MPDL&YDIBOHF#JU4XBQ1SPUPDPM • BitSwap: BitTorrentʹΠϯεύΠΞ͞ΕͨϒϩοΫަ׵ϓϩτίϧ • have_list ʹ͋ΔϒϩοΫΛަ׵ʹΦϑΝʔ͠ͳ͕Β • want_list ͷϒϩοΫΛ୳͍ͯ͘͠

    • BitTorrentͱ͸ҧ͍ɼ͜ͷަ׵͸1ͭͷτϨϯτϑΝΠϧʹ੍ݶ͞Ε ͳ͍ ‣ ͲͷϑΝΠϧΛߏ੒͢ΔϒϩοΫ͔ͱ͍͏͜ͱ͸ؔ܎ͳ͘ɼࣗ༝ ʹ(ϒϩοΫͷ)෺ʑަ׵Λ͢ΔϚʔέοτϓϨΠε 62
  25. 63.

    #JU4XBQ$SFEJU • BitSwap͸ɼ୯७ͳΫϨδοτγεςϜʹΑΓҎԼͷޮՌΛ࣋ͭ: • Seeder (ϊʔυʹ͕શͯͷσʔλΛμ΢ϯϩʔυ͠ऴΘͬͨঢ়ଶ)ʹɼΞο ϓϩʔυΛଓ͚ΔΠϯηϯςΟϒΛ༩͑Δ • Leecher (ࣗ෼͸Ξοϓϩʔυ͠ͳ͍ͨͩ৐Γϊʔυ)Λ๷͙

    • ͜Ε͸ɼϐΞୡ͕ޓ͍ʹΫϨδοτͷόϥϯεΛه࿥͠ɼ"ෛ࠴"͕૿͑Δ΄ ͲʹϒϩοΫΛૹ৴͢Δ֬཰͕Լ͕ͬͯ͘Δ͜ͱͰ࣮ݱ • ͞Βʹɼ্ͷ࢓૊ΈʹΑͬͯૹΒͳ͍͜ͱʹͨ͠ϐΞ͸ɼignore_cooldown (10 sec)ͷ͚࣌ؒͩແࢹ͢Δ͜ͱͰɼ֬཰తήʔϜΛ͢Δ͜ͱΛ๷͙ 63
  26. 64.

    #JU4XBQ4USBUFHZ   • BitTorrentʹ͓͍ͯσϑΥϧτͷઓུ͸ "tit-for-tat"͕ͩɼଞʹ΋༷ʑ ͳઓུ͕ଘࡏ͢Δ: • BitTyrant: ଎౓Λॏࢹͯ͠SelfishʹPeerΛબ୒͍ͯ͘͠ઓུ

    • BitThief: ࣗ෼͸શ͘ΞοϓϩʔυͤͣʹͨͩͷΓ͢Δઓུ • PropShare: ΦʔΫγϣϯͷϞσϧʹج͖ͮൺ཰తʹγΣΞ ‣ ަ׵ͷύϑΥʔϚϯεΛ࠷େԽͤͭͭ͞ɼͨͩͷΓϊʔυ΍ະ஌ͷ ઓུʹରͯ͠଱ੑΛ࣋ͨͳ͚Ε͹͍͚ͳ͍ɽ 64
  27. 65.

    #JU4XBQ4USBUFHZ  • BitSwapʹ͓͚Δݱঢ়ͷબ୒͸debt ratio: r Ͱεέʔϧͤͨ͞γάϞ Πυؔ਺ (ෛ࠴ऀʹରͯ͠ૹ৴͢Δ֬཰) •

    r͕৴པͷई౓ͱͳΓɼγϏϧ߈ܸ΁ͷ଱ੑ΋࣋ͭ: աڈʹଟ͘ͷ σʔλΛަ׵ͨ͠৴པͰ͖Δϊʔυʹ͸׮େͰɼ৽ೖΓʹ͸ݫ͍͠ 65 P(send | r) = 1 1 + e6 3r r = bytes send bytes recv + 1
  28. 66.

    #JU4XBQ-FEHFS • ϊʔυ͸ledgerʹɼଞͷϊʔυͱͷ௨৴Λه࿥͢Δ • ίωΫγϣϯΛ࡞Δࡍʹ͸ɼ͜ͷledgerΛަ׵͢Δ type Ledger struct { owner

    NodeId partner NodeId bytes_sent int bytes_recv int timestamp Timestamp } • ަ׵ͨ͠ledger͕Ұக͠ͳ͚Ε͹ɼॳظԽ͞ΕΔɽ͋Δ͍͸ෆਖ਼ͩͱ൑ அͯ͠ަ׵Λڋ൱͢Δ͜ͱ΋Ͱ͖Δ 66
  29. 67.

    #JU4XBQͷ઀ଓྫ 1. Open: ϐΞ͸ ledgers Λ߹ҙ͕औΕΔ·ͰૹΓ߹͏ 2. Sending: want_lists ͱ

    ϒϩοΫΛަ׵͠߹͏ 3. Close: ϐΞ͕઀ଓΛ੾Δ 4. Ignored(ྫ֎): ϐΞ͸λΠϜΞ΢τ΍ɼෆਖ਼ͳઓུʹΑͬͯແࢹ͢Δ 67
  30. 70.

    .FSLMF%"(ͷಛ௃ 1. Content Addressing: શͯͷίϯςϯπͱϦϯΫ͸ϢχʔΫͳ multihashνΣοΫαϜʹΑͬͯಛఆ͞ΕΔ 2. Tamper resistance: ΋͠σʔλ͕վ͟Μ͞ΕͨΓɼյΕͨΓͨ͠৔

    ߹͸νΣοΫαϜʹΑͬͯݕ஌Ͱ͖Δ 3. Deduplica9on: ಺༰͕ಉ͡σʔλ͸ɼશ͘ಉ͡ϋογϡʹͳΔͨΊ ॏෳͯ͠อଘ͞ΕΔ͜ͱ͸ͳ͍ 70
  31. 71.

    *1'40CKFDU IPFS ϦϯΫͱΦϒδΣΫτͷϑΥʔϚοτ: type IPFSLink struct { Name string //

    name or alias of this link Hash Multihash // cryptographic hash of target Size int // total size of target } type IPFSObject struct { links []IPFSLink // array of links data []byte // opaque content data } 71
  32. 72.

    JQGTίϚϯυͱΦϒδΣΫτ • ipfs ίϚϯυͰ৭ʑͳૢ࡞͕Ͱ͖Δ (brew install ipfs) • ྫ: ϦϑΝϨϯεΛશͯϦετ͢Δ

    > ipfs ls /XLZ1625Jjn7SubMDgEyeaynFuR84ginqvzb XLYkgq61DYaQ8NhkcqyU7rLcnSa7dSHQ16x 189458 less XLHBNmRQ5sJJrdMPuu48pzeyTtRo39tNDR5 19441 script XLF4hwVHsVuZ78FZK6fozf8Jj9WEURMbCX4 5286 template <object multihash> <object size> <link name> • શͯͷΦϒδΣΫτ͕ϋογϡ஋Λ࣋ͭ͜ͱ͕Θ͔Δ 72
  33. 75.

    ͦͷଞ • (౰વ͚ͩͲ) શͯͷΦϒδΣΫτ͸Ͳ͔͜ͷϊʔυͷ෺ཧతͳετϨʔ δʹଘࡏ͢Δ ‣ ΞΫηεͨ͠΋ͷ͸ϩʔΧϧʹΩϟογϡ͞ΕΔ (ظؒ͸ઃఆՄ • ಛఆͷΦϒδΣΫτΛϩʔΧϧʹཹΊ͓͖͍ͯͨ৔߹ɼ͸"ϐϯ"͢Δ͜ͱ

    ͕Ͱ͖Δ • ΦϒδΣΫτΛੈքʹެ։͢Δʹ͸ɼΩʔΛDHTʹ௥Ճ͢Δ͚ͩ ‣ όʔδϣϯΛߋ৽ͨ͠৔߹͸ผͷΦϒδΣΫτͱͳΔͨΊɼͦΕΛτ ϥοΩϯά͢Δʹ͸·ͨผͷΦϒδΣΫτ͕ඞཁ 75
  34. 76.

    ΦϒδΣΫτͷ҉߸Խ • IPFSͰ͸ΦϒδΣΫτϨϕϧͰ҉߸Խ͕ߦΘΕΔ • ϢʔβͷΩʔνΣʔϯͰࣗಈతʹೝূ΍ॺ໊Λߦ͏ type EncryptedObject struct { Object

    []bytes // raw object data encrypted Tag []bytes // optional tag for encryption groups } type SignedObject struct { Object []bytes // raw object data signed Signature []bytes // hmac signature PublicKey []multihash // multihash identifying key } 76
  35. 78.

    'JMFT • IPFS ͸ҎԼͷΦϒδΣΫτͷछྨΛఆٛ͢Δ: 1. block: a variable-size block of

    data. 2. list: a collection of blocks or other lists. 3. tree: a collection of blocks, lists, or other trees. 4. commit: a snapshot in the version history of a tree. 78
  36. 79.

    ܦҢͷิ଍ • Gitͷߏ଄Λͦͷ··ར༻͔͕ͨͬͨ͠ɼҎԼͷཧ༝ʹΑͬͯվมͨ͠΋ͷ Λར༻͍ͯ͠Δ: 1. ߴ଎ͳαΠζϧοΫΞοϓ (→objectsʹαΠζͷऩूػೳΛ௥Ճ) 2. ڊେϑΝΠϧͷෳ੡ (→

    listΦϒδΣΫτΛ௥Ճ) 3. commitsͷtree΁ͷຒΊࠐΈ • ͦΕͰ΋IPFSͱGitͷߏ଄͸े෼ʹ͍ۙͨΊม׵͢Δ͜ͱ͕Ͱ͖Δ • ϑΝΠϧΦϒδΣΫτ͸JSONͰදه͞ΕΔ͕ɼ࣮ࡍʹ͸protobufͰόΠφ ϦΤϯίʔυ͞Ε͍ͯΔ 79
  37. 81.

    'JMF0CKFDUMJTU • list ͸ෳ਺ͷblob͔Βߏ੒͞ΕΔڊେͳϑΝΠϧͳͲΛҙຯ͢Δ { "data": ["blob", "list", "blob"], //

    lists have an array of object types as data "links": [ { "hash": "XLYkgq61DYaQ8NhkcqyU7rLcnSa7dSHQ16x", "size": 189458 }, { "hash": "XLHBNmRQ5sJJrdMPuu48pzeyTtRo39tNDR5", "size": 19441 }, { "hash": "XLWVQDqxo9Km9zLyquoC9gAP8CL1gWnHZ7z", "size": 5286 } // lists have no names in links ] } 81
  38. 82.

    'JMF0CKFDUUSFF • tree ͸σΟϨΫτϦ: ໊લ͔Βϋογϡ΁ͷϚοϓͰɼGitͱࣅ͍ͯΔ { "data": ["blob", "list", "blob"],

    // trees have an array of object types as data "links": [ { "hash": "XLYkgq61DYaQ8NhkcqyU7rLcnSa7dSHQ16x", "name": "less", "size": 189458 }, { "hash": "XLHBNmRQ5sJJrdMPuu48pzeyTtRo39tNDR5", "name": "script", "size": 19441 }, { "hash": "XLWVQDqxo9Km9zLyquoC9gAP8CL1gWnHZ7z", "name": "template", "size": 5286 } // trees do have names ] } 82
  39. 83.

    'JMF0CKFDUDPNNJU  • commit͸೚ҙͷΦϒδΣΫτͷ͋Δ࣌ؒʹ͓͚Δεφοϓγϣοτ > ipfs file-cat <ccc111-hash> --json {

    "data": { "type": "tree", "date": "2014-09-20 12:44:06Z", "message": "This is a commit message." }, "links": [ { "hash": "<ccc000-hash>", "name": "parent", "size": 25309 }, { "hash": "<ttt111-hash>", "name": "object", "size": 5198 }, { "hash": "<aaa111-hash>", "name": "author", "size": 109 } ] } 83
  40. 84.

    'JMF0CKFDUDPNNJU  > ipfs file-cat <ttt111-hash> --json { "data": ["tree",

    "tree", "blob"], "links": [ { "hash": "<ttt222-hash>", "name": "ttt222-name", "size": 1234 }, { "hash": "<ttt333-hash>", "name": "ttt333-name", "size": 3456 }, { "hash": "<bbb222-hash>", "name": "bbb222-name", "size": 22 } ] } 84
  41. 88.

    4FMG$FSUJpFE/BNFT • IPFSͷ໊લ͸ҎԼͷεΩʔϚΛ࢖͏ 1. ·ͣɼNodeId = hash(node.PubKey) Ͱ͋Δ 2. શͯͷϢʔβʹɼNodeIdΛϓϨϑΟοΫεͱͨ͠"ϛϡʔλϒϧ"ͳ໊લۭؒΛ༩͑Δ:

    /ipns/<NodeId> 3. Ϣʔβ͸͜ͷύεʹࣗ෼ͷϓϥΠϕʔτΩʔͰαΠϯͨ͠ΦϒδΣΫτΛެ։Ͱ͖Δ ྫ͑͹: /ipns/XLF2ipQ4jD3UdeX5xp1KBgeHRhemUtaA8Vm/docs/hello 4. ଞͷϢʔβ͕ΦϒδΣΫτΛಘͨͱ͖ʹ͸ɼॺ໊͕ެ։伴ͱNodeIdʹҰக͢Δ͔͔֬ ΊΔ͜ͱͰɼϛϡʔλϒϧͳύεΛ࣮ݱ 88
  42. 89.

    4FMG$FSUJpFE/BNFT • IPFSͷ໊લ͸ҎԼͷεΩʔϚΛ࢖͏ 1. ·ͣɼNodeId = hash(node.PubKey) Ͱ͋Δ 2. શͯͷϢʔβʹɼNodeIdΛϓϨϑΟοΫεͱͨ͠"ϛϡʔλϒϧ"ͳ໊લۭؒΛ༩͑Δ:

    /ipns/<NodeId> 3. Ϣʔβ͸͜ͷύεʹࣗ෼ͷϓϥΠϕʔτΩʔͰαΠϯͨ͠ΦϒδΣΫτΛެ։Ͱ͖Δ ྫ͑͹: /ipns/XLF2ipQ4jD3UdeX5xp1KBgeHRhemUtaA8Vm/docs/hello 4. ଞͷϢʔβ͕ΦϒδΣΫτΛಘͨͱ͖ʹ͸ɼॺ໊͕ެ։伴ͱNodeIdʹҰக͢Δ͔͔֬ ΊΔ͜ͱͰɼϛϡʔλϒϧͳύεΛ࣮ݱ 88 f͡Όͳͯ͘n
  43. 91.

    89 IPFSϓϩτίϧͷߏ੒ → 5. Object • ఻౷తͳUNIXϑΝΠϧγεςϜ΍Webͱಉ͡ύεͷϞσϧΛ࢖͏ # format /ipfs/<hash-of-object>/<name-path-to-object>

    # example /ipfs/XLYkgq61DYaQ8NhkcqyU7rLcnSa7dSHQ16x/foo.txt 1BUIT  Ұํipfsͷύε͸"Φϒ δΣΫτ"ͷϋογϡ
  44. 94.

    1FFS-JOLT • Ϣʔβ͸ଞͷϢʔβͷΦϒδΣΫτ΁ͷϦϯΫΛࣗ෼ͷΦϒδΣΫτʹ௚઀ೖΕΔ ͜ͱ͕Ͱ͖Δ • ͜Ε͸ɼweb of trustΛ࡞Δ͜ͱʹ΋໾ཱͭ # Alice

    links to bob Bob ipfs link /<alice-pk-hash>/friends/bob /<bob-pk-hash> # Eve links to Alice ipfs link /<eve-pk-hash/friends/alice /<alice-pk-hash> # Eve also has access to Bob /<eve-pk-hash/friends/alice/friends/bob # access Verisign certified domains /<verisign-pk-hash>/foo.com 92
  45. 95.

    %/4595*1/43FDPSET • /ipns/<domain> ͕༗ޮͳυϝΠϯ໊Ͱ͋ͬͨ৔߹ɼIPFS͸ɼDNS TXT ϨίʔυΛϧοΫΞοϓ͢Δ: • IPFS͸ɼ஋ΛଞͷΦϒδΣΫτͷϋογϡ஋͔IPNSͷύεͱղऍ͢ Δ: #

    this DNS TXT record ipfs.benet.ai. TXT "ipfs=XLF2ipQ4jD3U ..." # behaves as symlink ln -s /ipns/XLF2ipQ4jD3U /ipns/fs.benet.ai 93
  46. 97.

    /BNF4IPSUFOJOH4FSWJDF • ໊લͷϋογϡ஋Λ୹ॖͯ͠ಡΈ΍͍͢ܗʹ͢ΔαʔϏεΛ࡞Δ͜ ͱ͕Ͱ͖Δ • ͜Ε͸ɼࠓͷDNSͱWeb URLͷؔ܎ʹ͍ۙ: # User can

    get a link from /ipns/shorten.er/foobar # To her own namespace /ipns/XLF2ipQ4jD3UdeX5xp1KBgeHRhemUtaA8Vm 95
  47. 99.

    *1'4ͷൃలՄೳੑ 1. As a mounted global filesystem, under /ipfs and

    /ipns. 2. As a mounted personal sync folder that automatically versions, publishes, and backs up any writes. 3. As an encrypted file or data sharing system. 4. As a versioned package manager for all software. 5. As the root filesystem of a Virtual Machine. 6. As the boot filesystem of a VM (under a hypervisor). 97 7. As a database: applications can write directly to the Merkle DAG data model and get all the versioning, caching, and distribution IPFS provides. 8. As a linked (and encrypted) communications platform. 9. As an integrity checked CDN for large files (without SSL). 10.As an encrypted CDN. 11.On webpages, as a web CDN. 12.As a new Permanent Web where links do not die.
  48. 101.

    ؔ࿈ͦ͠͏ͳϓϩδΣΫτ • Storj <https://storj.io/> • Gitchain <http://gitchain.org/> • ZeroTier One

    <https://www.zerotier.com/> • MaidSafe <https://maidsafe.net> • SIA < http://sia.tech/> • Upspin <https://upspin.io> 99
  49. 102.

    3FGFSFODFT • IPFS HP <https://ipfs.io/> • White Paper <https://github.com/ipfs/papers/raw/master/ipfs- cap2pfs/ipfs-p2p-file-system.pdf>

    • the morning paper<https://blog.acolyer.org/2015/10/05/ipfs-content- addressed-versioned-p2p-file-system/> 100