Understanding Farcaster: Part 2; Delta Graphs, Sync and Secure Messaging
In Part 1 of the Farcaster series, we delved into the intriguing mechanisms behind identity generation and authentication on this innovative social media protocol. Now, in Part 2, we are set to unveil the heart of Farcaster's operations - the Delta Graphs, Hub Sync Process, and Secure Messaging. These elements form the backbone of the platform, enabling seamless communication and collaboration among users while prioritizing privacy and data integrity.
Delta Graphs and Hubs
At the core of Farcaster's functionality lies the concept of "Delta Graphs." These graphs are dynamic structures that capture and represent the interactions between users in a flexible and efficient manner. These graphs find their home within hubs, which play a vital role as repositories for all user-generated content and information. As the size of a hub increases, so does the cost to run it efficiently, prompting the platform to introduce storage limits for users. Farcaster employs delta pruning to manage the vast amount of data generated over time. Older messages are archived to keep the platform efficient and clutter-free. However, Farcaster ensures that no user's storage is ever depleted by setting these limits judiciously. For those seeking additional storage beyond the allocated limits, Farcaster offers the option to pay for extra storage, accommodating users with diverse needs and preferences.
Farcaster's underlying architecture relies on hubs, which are collections of deltas. To ensure the smooth functioning of the platform, incentives are offered to companies building their apps and simpler API services. This encourages more hubs to operate, leading to a robust network.
Delta Types
- Casts: Public Broadcasting of Text
Casts are the backbone of Farcaster, allowing users to share text publicly visible to all. Whether it's expressing thoughts, sharing updates, or making announcements, users can communicate with a broad audience through these public broadcasts.
- Reactions: Likes and Recasts
Farcaster enables users to react to posts through likes and recasts (like shares or retweets). Liking a post indicates appreciation or agreement, while recasting allows users to amplify a message by sharing it with their followers.
- Amps: Endorsements of One User
Amps provide a way for users to endorse another user on Farcaster. It serves as a virtual pat on the back, acknowledging someone's contributions or accomplishments.
- Verifications: Proofs of Ownership and Link Wallets
In a world where identity verification is crucial, Farcaster allows users to provide proof of ownership and link their wallets securely. This feature enhances authenticity and trust among users.
- User Data: Metadata (Bio, Profile, etc.)
Farcaster enables users to customize their profiles by adding metadata like a bio, profile picture, and other relevant information, allowing them to express their individuality and interests.
- Signers: Signing Key-Pair Created Initially
For added security, Farcaster uses signing key pairs that are generated during the initial setup. These signers play a vital role in ensuring the authenticity and integrity of messages on the platform.
Hub Sync
In the vast expanse of the digital landscape, we need a way for messages to propagate quickly and in a reliable way through the network, and Farcaster operates through interconnected hubs. These hubs play a crucial role in facilitating seamless communication between users, ensuring information reaches its intended recipients promptly.
Each hub knows the address of each other hub on the network. Gossip channels are set up between these hubs through which the communication is carried out. Whenever a new Hub is added, it must know the address of at least one hub to download the entire state of the network. Gossip protocol doesn’t guarantee the ordering of messages and some messages might be discarded by other hubs while downloading the data, so these hubs perform an out-of-band sync process to periodically request full state of the hub and update themselves likewise.
To resolve conflicts arising from different social graphs, hubs employ a "merge" function, which determines the true social graph. Rules within each hub dictate how conflicts are resolved, considering timestamps and hashes to make informed decisions.
Secure Messaging: Enabling Private Communication through Advanced Encryption
Farcaster takes a proactive approach to safeguard sensitive information through a robust encryption process. This encryption methodology involves a combination of public-private key pairs, Key Defining Functions (KDFs), and advanced cryptographic techniques.
At the core of Farcaster's security model is the utilization of public-private key pairs. Both the sender and the receiver possess their unique set of keys – a public key and a private key. These keys serve a dual purpose: the public key is openly shared and used for encryption, while the private key remains confidential and is only accessible to the key owner. This asymmetric encryption ensures that only the intended recipient, who possesses the corresponding private key, can decrypt the messages encrypted with their public key.
To establish a shared secret between the sender and receiver, Farcaster employs a Key Defining Function (KDF). This function takes both the sender's private key and the recipient's public key as input and generates a secure shared secret key. The shared secret acts as the foundation for subsequent cryptographic processes, ensuring that any unauthorized party cannot access the key even if they intercept the communication.
From this shared secret, Farcaster generates two additional keys: KDF-key2 and a messaging key (MKey). The KDF2 key is derived using a secondary Key Defining Function, enhancing the complexity and strength of the encryption scheme. This multi-layered approach further fortifies the security of the communication channel.
However, the real strength of Farcaster's secure messaging lies in the messaging key (MKey). This key is crafted from the shared secret and is specifically designed to encrypt and decrypt the messages exchanged between the sender and receiver. As a result, every message is uniquely encrypted with the MKey, ensuring that even if an attacker were to gain access to one message, they would not be able to decrypt other messages without the MKey.
When a user sends a message through Farcaster, the platform employs the MKey to encrypt the content of the message before transmission. The recipient, in possession of their private key and the corresponding shared secret, can then decrypt the message using the MKey. This process ensures end-to-end encryption, where the message remains confidential throughout its journey and can only be read by the intended recipient.
Conclusion
Farcaster is a pioneering social media platform that goes beyond the conventional like-comment-share paradigm. By providing users with an array of delta types, secure messaging, and efficient data management, Farcaster empowers individuals to connect, collaborate, and share their thoughts and ideas in a secure and privacy-conscious environment. As social media continues to shape the way we communicate, Farcaster sets a new standard for inclusive, secure, and user-centric networking experiences.
Subscribe to my newsletter
Read articles from Aditi Polkam directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Aditi Polkam
Aditi Polkam
I write on how to build better backend for your apps