Skip to main content

Filecoin Forest Snapshots Backfilling

This service automates the process of backfilling historical snapshots of the Filecoin Forest node, building and validating snapshots, and archiving them to R2 storage.

It provides a reliable, reproducible archive of Filecoin chain data for long-term access and research.


High-Level Architecture

┌─────────┐
│ Forest │ <-- Full node for chain data access
└────┬────┘
┌────┴────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌─────────┐
│ Compute │ ─▶ │ Build │ ─▶ │ Validate │ ─▶ │ Upload │──▶ │ R2 │
│ State │ │ Snapshots │ │ Snapshots │ │ Snapshots │ │ Archive │
└──────┬──────┘ └──────┬────┘ └─────┬─────┘ └─────┬─────┘ └─────────┘
┌──────┴──────────────────┴───────────────┴────────────────┴─────┐
│ RabbitMQ (Message Bus) │
└────────────────────────────────────────────────────────────────┘

Sequence Diagram


Services

Forest

  • Runs a Forest Filecoin node.
  • Provides chain data for historical state computation.
  • Exposes RPC (2345) and P2P ports internally.

RabbitMQ

  • Central message broker.
  • Manages queues for tasks and state exchange.
  • UI at http://localhost:15672.

Compute-State

  • Connects to Forest.
  • Reads last computed state from RabbitMQ.
  • Computes historical chain states.
  • Publishes compute-state events.

Build-Snapshots

  • Consumes state-computed tasks.
  • Reads last built snapshot from RabbitMQ.
  • Builds deterministic chain snapshots.
  • Publishes snapshot-built events.

Validate-Snapshots

  • Ensures snapshots are consistent and complete.
  • Consumes snapshot-built tasks.
  • Validates snapshots.
  • Publishes snapshot-validated events.

Upload-Snapshots

  • Consumes validated snapshots.
  • Uploads them to Cloudflare R2.
  • Publishes upload-complete events.

Workflow

  1. Forest syncs with the Filecoin network.
  2. Compute-State computes historical states and pushes jobs into RabbitMQ.
  3. Build-Snapshots creates deterministic snapshots.
  4. Validate-Snapshots checks correctness.
  5. Upload-Snapshots archives data to R2.

Deployment

Run via Ansible:

ansible-playbook playbooks/deploy-forest-snapshot-backfilling-service.yml

Monitoring

  • RabbitMQ management: ssh -fN -L 15672:localhost:15672 devops@<host> && curl http://localhost:15672
  • Metrics and logs via Grafana Alloy → Grafana Cloud.
  • Alerts trigger on failed jobs or upload issues.

Storage

  • Lite Snapshots: /data/snapshots/lite → uploaded to R2.
  • Diff Snapshots: /data/snapshots/diff → uploaded to R2.
  • Metrics: /data/metrics.
  • Forest node data: /home/<user>/forest/data.