ipfs / notes

IPFS Collaborative Notebook for Research
MIT License
402 stars 31 forks source link

PubSub notes from the IPFS Workshop - recursion and corecursion, PubSub API and Self Certified Streams #154

Open daviddias opened 8 years ago

daviddias commented 8 years ago

tl;dr; This issue serves to capture the ideas and observations we made and discussed during the IPFS Workshop, with regards to PubSub. The goal was to nail down the interface that apps might expect first (focus on the user) and then create the pubsub stack to support that.

note 1: The names of things might change. note 2: This is based on the notes I took from all the discussions, my apologies in advanced if I got anything wrong, I'll update if that happens. Everyone that was present is welcome to edit, thank you

PubSub API - Self Certified Streams

A Self Certified Stream (SCS) is an authenticated and certified data structure uses Self Certified Links (SCL) to create an chain of of blocks.

Another type of a Self Certified Link is IPNS (also known as Self Certified Names), described by the IPRS spec.

In contrast with IPLD and its Selector, SCS use coSelectors to query the IPFS network to find what are the next blocks in the chain.

image

While selectors offer a way to do recursion(traversal) of any IPLD graph, coSelectors are form to show interest blocks that will follow (i.e append-only logs, blockchains)

This way, we get a coBitswap, that instead of sending a wantlist for specific blocks, sends a list for interest of blocks that point to the ones in the list. (coBitswap is a way to describe it, in the end, might all just be part of bitswap)

Participants Discovery (Peer Discovery)

To find the peers participating in the feed, namely: publishers and subscribers; we can use:

image

There isn’t quite a one perfect size solution, most probably the best is using something hybrid or letting the application developer select what makes more sense for their app requirements. libp2p already supports multiple discovery mechanisms for Peer Discovery to live at the same time.

Subscription Models

There are 4 categories of subscription models in the pubsub literature, these are:

We can achieve Type based subscriptions, the most requested ones, with CoSelectors, where a CoSelector can represent a whole chain of events that follow the same tag:

image

Reliability

One of the cruxes to achieve scalable pubsub, is the rule in how Acknowledgements are performed. With Self Certified Streams, the receiver can infer if it has received all the packets in one chain by validating its ancestry, requesting again only the ones it missed. In some sense, it is the strategy of NACK, but where the packets hashes are the NACK and these are authenticated, giving the received the possibility to ask for any peer in the network for the missing packets.

Tree forming

Getting a sound algorithm for tree forming, would give IPFS Self Certified Streams a way to scale up without increasing insanely the network traffic generated. Our plan is to make the API solid first and then involve the networking and treeforming bits of the implementation, so that prototypes that need PubSub today can start testing it.

Other notes

Authenticated vs Certified

An authenticated data structure is something like an hash chain (merkledag). For pubsub, we need our data structure to be Certified (Cryptographically signed), otherwise it would be very easy to spam the network with unwanted events, since every node could publish to that stream.

——

Previous pubsub discussions

jbenet commented 8 years ago

Very nice post!

Good summary of many discussions.

Some nits here.


Authenticated I would put it like this, but i'm sure there are more succinct and correct definitions: A value is said to be authenticated when one can reliably prove it is the intended value (authentic). It is usually used in relation to values or messages created by a sender; the values are authenticated if we can reliably prove whether a value was originally constructed by the sender, or it is a different or modified value, not created by the sender.

jbenet commented 8 years ago

Also-- this is not everything mikolalysenko and nicola talked about. I would really like to see their own original writeups, before they read this.

daviddias commented 8 years ago

Thank your reviewing on the spot!

Your "Authenticated vs Certified" section is incorrect. "Authenticated" has a formal definition, which includes hashing AND digital signatures. So "authenticated data structure" covers the signed ones too.

I kind of got this definition from one of our chats (Authenticated -> Merkle links ; Certified -> Mazieres links). Could you double confirm this one? I'm good calling it either way, but better to have this as a 'glossary', so we do not leave exploits in our future meme transfers :). If "Authenticated -> Mazieres links", then what would be Certified for you?

And yes, I would really like to have @mikolalysenko and @nicola drop their notes and thoughts to move forward :) @whyrusleeping I'm sure you will have a say here too.

jbenet commented 8 years ago

No, authenticated means BOTH signed and Merkle-linked. And really more: anything you can prove is authentic (truly the originally intended thing).

Certified just means signed, I think. I'm not 100% sure.

It's not up to me, it's the terms used in cryptography. On Sat, Aug 6, 2016 at 12:17 David Dias notifications@github.com wrote:

Thank your reviewing on the spot!

Your "Authenticated vs Certified" section is incorrect. "Authenticated" has a formal definition, which includes hashing AND digital signatures. So "authenticated data structure" covers the signed ones too.

I kind of got this definition from one of our chats (Authenticated -> Merkle links ; Certified -> Mazieres links). Could you double confirm this one? I'm good calling it either way, but better to have this as a 'glossary', so we do not leave exploits in our future meme transfers :). If "Authenticated -> Mazieres links", then what would be Certified for you?

And yes, I would really like to have @mikolalysenko https://github.com/mikolalysenko and @nicola https://github.com/nicola drop their notes and thoughts to move forward :) @whyrusleeping https://github.com/whyrusleeping I'm sure you will have a say here too.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ipfs/notes/issues/154#issuecomment-238031410, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIcof20-hqQB1O7W2Dw00VIH2DlGmjqks5qdLOvgaJpZM4Jd6IN .