Farcaster hubs are finding it harder to stay in sync. The deltagraph’s eventual consistency is making sync more complex as the network grows. Two hubs can end up in different states due to missed gossip, local rate limits or missing onchain state. The time taken to complete sync is increasing sub-linearly with the size of the network at an untenable rate.

We need a new architecture that guarantees:

  1. Decentralized global state — anyone download the entire network in a few hours.
  2. Fast sync between apps — changes should show up on all apps within a minute.
  3. No-fee posting — users must be able to send messages without paying fees of any kind.
  4. Rate limits — users shouldn’t be able to store or broadcast an infinite number of messages.
  5. No turing-completeness — required to discourage people from spamming the network.

Snapchains for ordering

We propose changing our consensus model from a deltagraph to a snapchain. This introduces ordering and strong consistency which solves many of our sync problems while retaining all the properties of deltagraphs that we really like.

A snap is a bundle of onchain events and deltas created by Farcaster users. Snaps are produced by hubs every 15 seconds. They’re linked together like a blockchain which makes the system fully ordered. Here’s a simple example of a snapchain:

  1. Alice signs up. She creates an account using the Farcaster contracts on OP Mainnet which is picked up by the hubs and bundled into the first snap.

  2. Alice says “Hello World”. She creates a delta and broadcasts it to hubs, which bundle it into the second snap produced 15 seconds later.

Screenshot 2024-09-11 at 9.54.44 AM.png

Syncing

Snapchain sync is easier because a hub can just compare snap numbers and download the missing snaps. Gossiping changes is also more reliable because you can use snap numbers to figure out if you missed a snap, and then request it.

Rate limits can also be made global — a hub must have all the prior snaps before publishing a new snap, so it knows exactly how many messages a user has created. Compared to today’s deltagraph, sync will be much faster, more deterministic and less likely to fail.