The open-source, canonical implementation of Farcaster's Snapchain network.
Snapchain is a data storage layer for the Farcaster social protocol. It is a blockchain-like decentralized p2p network that stores data created by Farcaster users. Learn more about Snapchain's design from the whitepaper.
The main goals of this implementation are:
-
High Throughput: Written in Rust and will process at least 10,000 transactions per second.
-
Data Availability: Can be run for < $1,000/month and provide real-time access to user data.
-
Canonical Implementation: Is the most accurate reference for how Snapchain and Farcaster should work.
Snapchain is in the migration phase. Please check the release docs for more details on timelines.
A snapchain node lets you read and write messages to the network. You will need a machine with the following system requirements to get started:
- 16 GB of RAM
- 4 CPU cores or vCPUs
- 1TB of free storage
- A public IP address
- Ports 3381 - 3383 exposed on both TCP and UDP.
You can start a new node or upgrade an existing node with the following commands:
mkdir snapchain
cd snapchain
docker compose down # If you have a previous version running
wget https://raw.githubusercontent.com/farcasterxyz/snapchain/refs/heads/main/docker-compose.mainnet.yml -O docker-compose.yml
docker compose up # append -d to run in the background
A brand new node will download historical snapshots to catchup to the latest state before it begins sync. This can take up to 2 hours. Check the node's status by running curl http://localhost:3381/v1/info
. You should see maxHeight
increasing and blockDelay
decreasing until it approaches zero.
We welcome contributions from developers of all skill levels. Please look for issues labeled with "help wanted" to find good tickets to work on. If you are working on something that is not explicitly a ticket, we may or may not accept it. We encourage checking with someone on the team before spending a lot of time on something.
We will ban and report accounts that appear to engage in reputating farming by using LLMs or automated tools to generate PRs.
Before you begin, ensure you have the following installed:
- Rust (latest stable version)
- Cargo (comes with Rust)
- Protocol Buffers compiler (
brew install protobuf
) - cmake (
brew install cmake
)
Clone the snapchain and dependent repos and build snapchain:
git clone [email protected]:CassOnMars/eth-signature-verifier.git
git clone [email protected]:informalsystems/malachite.git
cd malachite
git checkout 13bca14cd209d985c3adf101a02924acde8723a5
cd ..
git clone [email protected]:farcasterxyz/snapchain.git
cd snapchain
cargo build
After setting up your Rust toolchain above, you can run tests with:
cargo test
For development, you can run multiple nodes by running:
make dev
These will be configured to communicate with each other.
To query a node, you can run grpcurl
from within the container:
docker compose exec node1 grpcurl -import-path proto -proto proto/rpc.proto list
If you need fresh keypairs for your node, you can generate them with:
cargo run --bin generate_keys
You can remove any cached items by running:
make clean
- Update
package.version
inCargo.toml
- Commit the change.
- Tag the commit using
snapchain_version=$(awk -F '"' '/^version =/ {print $2}' Cargo.toml) git tag -s -m "$snapchain_version" "v$snapchain_version"
- Push the commit and tag to trigger an automated build.
- Once automated build is complete, confirm the Docker image was published