Since my last diary, I published the proposal for permissioned data. That’s the big kahuna folks! Give it a read. Since then, I went to Dweb camp and Local-First Conf where I got the chance to meet and hang with lots of awesome folks building stuff on the protocol. There’s clearl…
Check out that proposal & give me feedback over here
1
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
Things are still changing! I expect updates to the proposal before we reach an "official spec". Though I suspect the big picture is pretty firm at this point.
I made a forum post about returning to the at:// scheme. This is still undecided, but I continue to lean in that direction which the current proposal reflects
We have a community working group going to spec out "Atmospheric groups/communities" (think standard.site for communities). Check it out and join the convo if you're interested in this work.
I'm working on an alpha version of the protocol & PDS. I'm hoping to have that out in the next couple weeks. I've been conferencing the last week & I’ll be at the IETF in Vienna next week. But it will be coming soon! Several folks in the ecosystem already have working implementat…
3
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
34
byteStart
27
features
0
uri
https://dholms.leaflet.pub/3mnkrxp7rt22i
$type
pub.leaflet.richtext.facet#link
plaintext
Alright, so the outcome of Diary 6 was that we got a "space credential" for accessing data in a space. This diary is going to get into what you actually do with that credential. In other words, how that data is stored and synced between parties.
4
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
facets
0
index
byteEnd
23
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#bold
plaintext
The quick & dirty of it
5
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
166
byteStart
154
features
0
uri
https://dholms.leaflet.pub/3mfrsbcn2gk2a
$type
pub.leaflet.richtext.facet#link
plaintext
Zooming out, let's remember what we're trying to achieve here: a network that basically feels the same as public broadcast atproto. As I described in the second diary:
6
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
149
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
"users publish records, those records are canonically stored in the user’s PDS, applications crawl PDSes and sync data to build their own views..."
7
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
To keep things symmetric, we probably want the following in our sync protocol:
8
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.unorderedList
children
0
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
a user-owned repository
1
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
a cryptographic commitment over the repository so that a syncer can know that it has a complete copy of the user's data
2
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
a pull-based sync protocol, likely operation-based
You can see a full description of the proposed permissioned repository & sync protocol in the proposal that I recently published. It generally mirrors the public broadcast protocol in semantics, but differs in a few important ways. I'll spend this post walking through each of tho…
10
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
134
byteStart
63
features
0
$type
pub.leaflet.richtext.facet#bold
plaintext
Before we get into it, the through-line on all of this is that public broadcast data is substantially different from permissioned data. It's not even just a “public vs private” thing. Public broadcast data is "on the record" in some sense. It's archival, self-authenticating, redi…
11
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
I'd argue this turns out to be a good thing, as we get a substantially lighter-weight repo & sync protocol on the other end!
The MST (Merkle Search Tree) has almost become synonymous with atproto (that’s the data structure for the public repository, don’t worry you don’t need to know what it is). However, we're not planning to use it for permissioned data. I've received some pushback that, even if it's…
14
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
276
byteStart
272
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
To contextualize this decision: I believe that if the permissioned data protocol is successful it will have at least an order of magnitude more data (likely even more than that) than the public broadcast protocol. This isn't an "old vs new" protocol thing. It's just that most of …
15
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The MST is a heavy data structure. To prove a single record, you need all of the data from that record as well as every structural node of the MST up to the commit (usually between 3-7 nodes) and finally the commit which includes the signature. This is a lot of data. It's also di…
16
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
225
byteStart
222
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
The big thing you get out of using a merkle tree is "partial sync" with a special case of that being a proof for a single record. This is very important for the public broadcast protocol where a user has a repo containing all of their data. Many apps only want some small piece of…
17
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
101
byteStart
96
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
Permissioned data differs in this regard because all published data is situated in a particular space. The space provides the sync boundary, and in most cases syncers will want to sync the entire repository in the space. Partial sync is less important, and I expect single-record …
18
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
One thing we absolutely do want to retain from the MST is the idea of a "root hash" of the data. This is some small value that can serve as an integrity check that you possess the entire data set.
19
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
If we get rid of the need for partial sync or individual record proofs, there’s a much lightweight data structure that we can use that still commits over the entire repository: a multiset hash. If a hash is a unique fingerprint for some piece of data, a multiset hash is a fingerp…
20
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
105
byteStart
79
features
0
$type
pub.leaflet.richtext.facet#code
plaintext
For our use case, we can model a permissioned repo as a collection of strings: collection/rkey/record_cid.
21
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
3
plaintext
Comparing hashes
22
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
89
byteStart
81
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
The simplest version of a multiset hash is an XOR-of-hashes (this probably isn't actually classified as a multiset hash, but whatever it helps give the intuition). Take each item in the set, hash it, and XOR the hashes together. Updates are easy! If you create an item, you just X…
Unfortunately, these are susceptible to Wagner's Generalized Birthday Attack. I'll avoid getting into all the details & tradeoffs of that attack. I think you could argue that for our use-case, there's actually not a clear attack to pull off with that (it's kinda a self-own to do …
24
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
56
byteStart
19
features
0
uri
https://arxiv.org/pdf/1601.06502
$type
pub.leaflet.richtext.facet#link
1
index
byteEnd
213
byteStart
183
features
0
uri
https://words.filippo.io/crqc-timeline/
$type
pub.leaflet.richtext.facet#link
plaintext
So what then? Well Elliptic Curve Multiset Hashes (ECMH) are intended to respond to exactly this! Unfortunately, these get broken by quantum computers via Shor's algorithm, and I was strongly encouraged by Filippo to not use them.
25
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
53
byteStart
47
features
0
uri
https://eprint.iacr.org/2019/227.pdf
$type
pub.leaflet.richtext.facet#link
plaintext
The Wagner-and-Shor-secure multiset hash is an LtHash. This thing is actually pretty slick & turns out to be (I think) even simpler than ECMH. It's basically a ✨fancy✨ XOR of hashes.
26
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
You can think of XOR-of-hashes as taking each bit of your current hash, then either adding or subtracting the bit in the same position from the hash of the item you're adding/removing, and then taking the result modulo 2 (in modulo 2, add & subtract end up having the same result:…
LtHash is the same basic operation, but you take a bigger hash (2048 bytes instead of 32), split it into 2-byte “lanes”, add/subtract each lane, and then take the result of that modulo 2^16. It's basically XOR-of-hashes in mod 65536 instead of mod 2. It's really pretty simple and…
28
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The only downside is that the state is 2kb rather than 32 bytes. This is trivial state to keep around but still a bit heavier on the wire than we'd like to send. So both sides of the sync protocol are encouraged to maintain the full 2kb LtHash as state, however when the hash is s…
29
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
facets
0
index
byteEnd
19
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#bold
plaintext
Deniable signatures
30
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Even if you've never heard of the MST, you probably know that we're signing stuff in atproto. This is what makes it "self-authenticating". It lets you rebroadcast data & is the bedrock of trust for our network.
31
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
163
byteStart
149
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
However, I strongly believe that in the context of permissioned data, asymmetric signatures on data are an anti-pattern. I'd argue they give you the exact opposite thing you want. The point of permissioned data is that things within a space should only be visible in that space. A…
The current proposal introduces a deniable signing scheme based on HMACs. This is a common approach in things like OTR, TLS and Signal (tho the exact scheme is a bit different).
Richard Barnes wrote up a great post on this and argued that deniability is not something that we should go out of our way for. Basically that messages generally leak via screenshots or other mechanisms, and the existence of signatures is negligible to the breach if it matters at…
34
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
386
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
"Experience shows that when leaks like this happen, cryptography just isn't a major factor; see the DNC emails vis à vis DKIM or Signalgate with Signal, and of course the innumerable breaches where no cryptographic proof is available. At best, the black market gets a little more …
35
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
291
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#italic
textSize
small
plaintext
Also real quick: I really appreciate Richard for engaging with the proposal. I meant to respond earlier, but I was trying to get the proposal over the line & have been conferencing since then. I extended how much I would have otherwise said in this section in order to respond to …
36
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The null hypothesis that we should compare our design to is not the public broadcast protocol, it's other permissioned spaces on the modern web. In that context, I can't think of a single example in which unencrypted data is asymmetrically signed by users.
37
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
One way of looking at this is to say "does signing even matter at all" - for permissioned data (in the sense of deniability) but also for public data (in the sense of authenticity). I'm not trying to be flippant. I think you can look at the current state of the network and make t…
38
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
So why bother signing stuff? Well every time you sync from jetstream or microcosm, since you don't rely on asymmetric signatures, you instead rely on your trust relationship with that service.Those trust relationships are able to evolve because consumers always have recourse to a…
39
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
The existence of signatures "greases the wheels" on these trust relationships.
40
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
220
byteStart
214
features
0
$type
pub.leaflet.richtext.facet#italic
1
index
byteEnd
259
byteStart
250
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
I think of signatures on permissioned data similarly. I don't want to "grease the wheels" on data escaping containment. Ideally data never escapes its access boundary. But it will. And when it does, it should be a social situation to navigate, not a technical one. Whether you tru…
41
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Will this matter in court or the next time DNC emails leak? I'm not sure. But most users aren't going to court. There are many things that happen before "going to court" or becoming a national news story, and deniability is just as important in all of these everyday scenarios. In…
42
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
By asymmetrically signing data, we lower the required trust level for a leaker down to zero. A leaker can be credible with no prior trust and with no analysis by trusted institutions. Meanwhile, even large corpuses of data (like the election emails) are becoming easier to fabrica…
43
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Privacy issues exist on the modern web in which your data is generally held by one application. We're increasing the cardinality of that relationship. Every additional app that has access to your data increases your exposure risk. I think this requires a complementary mechanism t…
44
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
2
facets
0
index
byteEnd
23
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#bold
plaintext
Syncing without a relay
45
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
As I just discussed, permissioned data cannot be rebroadcast because it does not have an asymmetric signature. What does this mean for our super-duper global rebroadcasting machine - the relay?
46
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Well, it means we can't do that. And downstream syncers always need to go directly to PDSes to sync. Don’t fret, this is fine! Relays were always an optimization over syncing directly from the PDS.
47
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
228
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
(Quick vibe note: I think a relay makes a lot of sense for global broadcast, but is itself at odds with permissioned data. Basically, I don't "miss" relays in this design. I think, as a role, they don't match the problem space.)
48
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
42
byteStart
39
features
0
$type
pub.leaflet.richtext.facet#code
plaintext
What does sync look like? Repos have a rev (basically a logical clock) that works similar to public broadcast repos. A syncer says "can I get everything that happened to this repo since my last rev". The PDS sends that as a list of operations, along with the MAC'd multiset hash. …
That's it! Abstractly, this is basically exactly Sync 1.1 semantics, but without requiring tricks like "operation inversion" because we're working with a simpler data structure than the MST.
50
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
I know everyone loves the firehose, and you might say "why can't we just keep the same WebSocket interface on the PDS?" A few reasons:
51
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.unorderedList
children
0
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
The Relay manages the complexity of the connection logic. It's a lot of work for applications to juggle thousands of WebSocket connections. Much easier to make HTTP requests.
1
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
153
byteStart
148
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
Each PDS hosts many repositories, each requiring a different credential. Managing credentials for all these repositories over a single WebSocket is a lot of complexity.
2
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
Many PDSes have very low throughput. For them, getting a write out involves sending a notification to a relay, spinning up a websocket, sending one event, then just waiting for that connection to die. HTTP request is much simpler/direct and generalizes well to both large & small …
3
$type
pub.leaflet.blocks.unorderedList#listItem
content
$type
pub.leaflet.blocks.text
plaintext
HTTP/2 offers things like multiplexing & header compression. Even for big hosts with lots of throughput, I expect it to be comparable in terms of resource-usage to a WebSocket.
52
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Don't despair over your lack of a firehose! I'm serious, this is such a lighter-weight protocol. I think application devs will really warm up to it. I also expect many applications will deploy a small sidecar to wrangle complexity rather than doing so themselves.
53
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.header
level
3
facets
0
index
byteEnd
19
byteStart
0
features
0
$type
pub.leaflet.richtext.facet#bold
plaintext
Write notifications
54
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
If everything is pull-based, we still need a way to make the system feel "real-time". In other words, syncers need to know when to pull so they can get updates shortly after writes.
55
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
For this, we introduce a very light-weight write notification. Repo hosts notify a space host when they write, and the space host fans this out to all syncers.
56
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Write notifications are expected to come mainly from the space host, but can ultimately come from anywhere. They can be re-tried & re-sent without complications.
57
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
facets
0
index
byteEnd
88
byteStart
84
features
0
$type
pub.leaflet.richtext.facet#italic
plaintext
This is not an authoritative push. Ultimately it's best effort (though it should be best effort). But if a syncer ever misses a notification, they'll notice on the next sync (because of the multiset hash) and will automatically self-heal.
That's basically the whole design of the protocol. Of course this series was mainly intended to provide intuition for the problem space and then motivate a particular solution, so we glossed over a lot of the little details and mechanisms along the way. You can find the latest on…
60
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
I'll probably write one more diary post, an addendum of sorts that goes over all the changes we made from the diaries along the way, including the URI scheme and removing the member list.
In the meantime, if you’re interested in participating in the formal standardization of the (public) protocol, I encourage you to join the IETF mailing list and participate in the upcoming working group meeting (on July 23). If you’re interested & have any questions, feel free to…
62
$type
pub.leaflet.pages.linearDocument#block
block
$type
pub.leaflet.blocks.text
plaintext
Thanks again to everyone who's been following along & giving me feedback along the way :)