61
How IPFS Works (approximately) Sawood Alam ( @ibnesayeed) Old Dominion University Original slides by Steven Allen ( @ Stebalien)

How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

How IPFS Works(approximately)

Sawood Alam (@ibnesayeed)Old Dominion University

Original slides by Steven Allen (@Stebalien)

Page 2: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find
Page 3: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find
Page 4: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find
Page 5: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find
Page 6: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

IPFS:

Lifecycle

AddingFiles

GettingFiles

Page 7: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

IPFS:

Adding Files

Page 8: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

IPFS:

Adding Files

-> CID: Content Identifier

-> IPFS Path: /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv

-> Gateway URL: https://ipfs.io/ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv

CID

Page 9: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

IPFS:

Getting Files

CID

Page 10: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

IPFS:

Lifecycle

Import Name Find Fetch

AddingFiles

GettingFiles

Page 11: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Import Name Find Fetch

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Page 12: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Chunked File:

● Deduplication

● Piecewise Transfer

● Seeking

(each chunk is hashed)

RoutingDHTKademlia

Page 13: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Chunked File:

● Deduplication

● Piecewise Transfer

● Seeking

RoutingDHTKademlia

Page 14: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Chunked File:

● Deduplication

● Piecewise Transfer

● Seeking

RoutingDHTKademlia

Page 15: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Chunked File:

● Deduplication

● Piecewise Transfer

● Seeking

Deduplicated:

RoutingDHTKademlia

Page 16: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Fetched:

● Deduplication

● Piecewise Transfer

● Seeking

Chunked File:

RoutingDHTKademlia

Page 17: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Chunked File:

● Deduplication

● Piecewise Transfer

● Seeking

RoutingDHTKademlia

Page 18: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Contiguous File:

Chunked File:

● Deduplication

● Piecewise Transfer

● Seeking

RoutingDHTKademlia

Page 19: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

File Chunks:

RoutingDHTKademlia

Page 20: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

File Chunks:

UnixFS File:

(merkle-link)(a hash)

(merkle-tree)

0-200 200-350

0-100 100-200 100-200 200-250

RoutingDHTKademlia

Page 21: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

File Chunks:

UnixFS File:

(merkle-tree-dag) - directed acyclic graph

(merkle-link)

0-200 200-350

0-100 100-200 100-200 200-250

RoutingDHTKademlia

Page 22: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

UnixFS File(s):

UnixFS Directory: README.md main.go go.mod

File Chunks:

(merkle-link)

RoutingDHTKademlia

Page 23: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Meta-format for understanding, encoding, and decoding merkle-linked data.

RoutingDHTKademlia

Page 24: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

http://b.com/Bar.json -> { "foo": http://a.com/Foo.json}http://a.com/Foo.json -> { "content": "I am foo"}

Linked Data

RoutingDHTKademlia

Page 25: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

http://b.com/Bar.json -> { "foo": http://a.com/Foo.json}http://a.com/Foo.json -> { "content": "I am foo"}

Linked DataAuthority

RoutingDHTKademlia

Page 26: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

QmBar -> { "foo": QmFoo}QmFoo -> { "content": "I am foo"}

Merkle-Linked Data● Immutable

● Authority Less

RoutingDHTKademlia

Page 27: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Content Identifier

● Used for content addressing

● Are self describing

● Used to name every piece of data in IPFS/IPLD

● Are basically a hash with some metadata

QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv

bafybeibxm2nsadl3fnxv2sxcxmxaco2jl53wpeorjdzidjwf5aqdg7wa6u

RoutingDHTKademlia

Page 28: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Digression:Content Addressing / Location Addressing

RoutingDHTKademlia

Page 29: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

LocationAddressing

"My cat, Ozzy, is here."

Digression: Content Addressing

RoutingDHTKademlia

Page 30: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Content Addressing

"This is my cat, Ozzy."

RoutingDHTKademlia

Page 31: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

LocationAddressing

Digression: Content Addressing

RoutingDHTKademlia

Page 32: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

LocationAddressing

Digression: Content Addressing

RoutingDHTKademlia

Page 33: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

LocationAddressing

Digression: Content Addressing

RoutingDHTKademlia

Page 34: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

LocationAddressing

"That's the wrong cat!"

Digression: Content Addressing

RoutingDHTKademlia

Page 35: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

LocationAddressing

"That's the wrong cat!"

(But you can't know that!)

Digression: Content Addressing

RoutingDHTKademlia

Page 36: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

RoutingDHTKademlia

Verifiable, Immutable, Trustless

Permanent

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Page 37: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Digression:Multiformats: Self Describing Data

RoutingDHTKademlia

Page 38: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Digression: Multiformats

● Multicodec: a non-magic number to uniquely identify a format, protocol, etc.

● Multihash: a self describing hash digest.

● Multibase: a self describing base-encoded string.

RoutingDHTKademlia

Page 39: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Digression: Multiformats

Multicodec: a non-magic number.

name, tag, code, description

identity, multihash, 0x00, raw binary

ip4, multiaddr, 0x04,

dccp, multiaddr, 0x21,

dnsaddr, multiaddr, 0x38,

protobuf, serialization, 0x50, Protocol Buffers

cbor, serialization, 0x51, CBOR

raw, ipld, 0x55, raw binary

...

github.com/multiformats/multicodec

RoutingDHTKademlia

Page 40: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Digression: Multiformats

Multihash: a self-describing hash digest:

● Hash Function (multicodec)

● Hash Digest Length

● Hash Digest

RoutingDHTKademlia

github.com/multiformats/multihash

Page 41: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Digression: A bit of metadata

Multibase: a self-describing base encoding.

● A multibase prefix.

○ b - base32

○ z - base58

○ f - base16

● Followed by the base encoded data.

bafybeibxm2...

RoutingDHTKademlia

Page 42: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Self Describing

● CIDv0: QmS4u...

○ Base58 encoded sha256 multihash

● CIDv1: bafybei...

○ Multibase encoded (ipld format multicodec, multihash) tuple.

● Why CIDv1?

○ Can be encoded in arbitrary bases (base32, base58, etc.).

○ Can link between merkle-dag formats using the ipld format multicodec.

RoutingDHTKademlia

Page 43: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

IPFS uses paths, not URIs/URLs:

Unlike URLs, paths are recursive:

/dns/github.com/tcp/22/ssh/git

Versus:

git+ssh://github.com:22

Like URLs, paths are namespaced:

/ipfs/QmFoo/welcome.txt/ipns/QmBar/index.html

Not Composable!

Page 44: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

IPNS maps Public Keys to paths

/ipns/QmMyKey -> /ipfs/QmFoo (signed)

/ipns/QmMyKey -> /ipfs/QmSomethingNew

IPNS is mutable

/ipns/QmMyKey -> /ipns/QmYourKey

IPNS can point to arbitrary paths

Page 45: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Content Address (CID) Location Address (Peer)

RoutingDHTKademlia

Page 46: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Solution: Keep a "routing table"

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

What Who

QmFoo Ozzy

QmBar Izzy

RoutingDHTKademlia

Page 47: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

But the table is too BIG!

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

What Who

QmFoo Ozzy

QmBar Izzy

... millions of lines later ...

QmXXXXXXXXXXXXXXXX Seth (not a cat!)

Page 48: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Solution: Distribute the routing table and give a little bit to each peer.

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

What Who

QmBar Izzy

...

Ozzy Knows Izzy Knows

What Who

QmFoo Ozzy

...

Page 49: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

How do we know who has what piece of the routing table?

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

Page 50: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

How do we know who has what piece of the routing table?Solution: Deterministically distribute the routing table.

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

Page 51: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Distance Metric: Is peer X closer to content C than peer Y?Query Algorithm: Given the distance metric, how do we find the peers closest to C.

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

Page 52: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Distance Metric: XOR(HASH(C), HASH(Peer))Query Algorithm:1. Ask the closest peers you know for closer peers.2. Remember the closest peers.

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

Page 53: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Distance Metric: "Is this closer?"Query Algorithm: "How do I get closer?"

ChunkingUnixFSIPLD

CIDPathIPNS

RoutingDHTKademlia

Bitswap

Import FetchFindName

Page 54: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

RoutingDHTKademlia

Page 55: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

Izzy Wants

● QmTreats● QmToy

Ozzy Wants

● QmCuddles● QmFood● QmAttention

Izzy Ozzy

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

RoutingDHTKademlia

Page 56: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

RoutingDHTKademlia

Izzy Wants

● QmTreats● QmToy

Ozzy Wants

● QmCuddles● QmFood● QmAttention

Izzy Ozzy

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Page 57: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

RoutingDHTKademlia

Izzy Wants

● QmTreats● QmToy

Ozzy Wants

● QmCuddles● QmFood● QmAttention

Izzy Ozzy

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Page 58: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

RoutingDHTKademlia

Izzy Wants

● QmTreats● QmToy

Ozzy Wants

● QmCuddles● QmFood● QmAttention

Izzy Ozzy

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

QmFood

QmAttention

QmToy

Page 59: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

RoutingDHTKademlia

Izzy Wants

● QmTreats

Ozzy Wants

● QmCuddlesIzzy Ozzy

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

Page 60: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

ChunkingUnixFSIPLD

CIDPathIPNS

Bitswap

Import FetchFindName

RoutingDHTKademlia

Page 61: How IPFS Workssalam/presentations/How-IPFS-Works.pdf · Chunking UnixFS IPLD CID Path IPNS Routing DHT Kademlia Bitswap. Chunking UnixFS IPLD CID Path IPNS Bitswap Import Name Find

How IPFS Works(approximately)

Sawood Alam (@ibnesayeed)Old Dominion University

Original slides by Steven Allen (@Stebalien)