sof
sof is a low-latency Solana observer runtime focused on:
- shred ingestion (direct UDP, relay, optional gossip bootstrap)
- optional shred verification
- dataset reconstruction and transaction extraction
- plugin-driven event hooks for custom logic
- local transaction commitment status tagging (
processed/confirmed/finalized) without RPC dependency
Install
Optional gossip bootstrap support at compile time:
= { = "0.3", = ["gossip-bootstrap"] }
Quick Start
Run the bundled runtime example:
With gossip bootstrap:
Runtime API
Embed directly in Tokio:
async
Or use programmatic setup:
use SocketAddr;
async
Plugin Quickstart
use async_trait;
use ;
;
async
Plugin Hooks
Current hook set:
on_raw_packeton_shredon_dataseton_transactionon_slot_statuson_reorgon_recent_blockhashon_cluster_topology(gossip-bootstrap mode)on_leader_schedule(gossip-bootstrap mode)
on_transaction events include:
commitment_statusconfirmed_slotfinalized_slot
These commitment fields are derived from local shred-stream slot progress (depth-based), not RPC polling.
on_slot_status events include local canonical transitions:
processedconfirmedfinalizedorphaned
Operational Notes
- Hooks are dispatched off the ingest hot path through a bounded queue.
- Queue pressure drops hook events instead of stalling ingest.
- In gossip mode, SOF runs as an active bounded relay client by default (UDP relay + repair serve), not as an observer-only passive consumer.
SOF_LIVE_SHREDS_ENABLED=falseenables control-plane-only mode.
Examples
observer_runtimeobserver_with_non_vote_pluginobserver_with_multiple_pluginsnon_vote_tx_loggerraydium_contracttpu_leader_logger
Run any example:
Docs
- Workspace docs index:
../../docs/README.md - Architecture docs:
../../docs/architecture/README.md - Operations docs:
../../docs/operations/README.md - Contribution guide:
../../CONTRIBUTING.md