Solana Analytics Platform Powered by Grounded AI
Semantic Knowledge Graph • Natural Language Analytics • Explainable Insights • Interactive Dashboards
sap-etl is the ETL pipeline for the Solana Analytics Platform.
It is a C++20 pipeline that converts native Jetstreamer local output into RDF aligned with MOBR's Solana ontology and either:
- writes Turtle (
.ttl) files, or - sends batched SPARQL
INSERT DATAupdates to a QLever endpoint.
This repository provides the ingestion, transformation, RDF mapping, loading, checkpointing, and resume logic used to prepare Solana ledger-derived data for SAP's semantic knowledge graph infrastructure.
- SAP Backend: https://github.com/mobr-ai/sap
- SAP Frontend: https://github.com/mobr-ai/sap-frontend
The SAP backend repository contains the API, orchestration layer, semantic query integration, authentication flows, and knowledge graph services that consume the outputs produced by this ETL pipeline.
The SAP frontend repository contains the React/Vite SPA used for the user-facing analytics interface, dashboards, onboarding, wallet flows, and product experience.
Together, the repositories form the core SAP stack:
Solana data sources
│
▼
sap-etl
│
▼
Ontology-aligned semantic outputs
│
▼
sap backend + QLever / knowledge graph services
│
▼
sap-frontend
This project is designed for Jetstreamer’s outputs.
Jetstreamer currently provides:
-
historical replay by slot range or single epoch
-
built-in ClickHouse-backed plugins including:
program-trackinginstruction-trackingpubkey-stats
-
a ClickHouse-backed server
Accordingly, sap-etl consumes local ClickHouse tables created by Jetstreamer
over the ClickHouse HTTP interface. It does not parse internal ClickHouse data
files directly, and it does not require any new Jetstreamer plugin.
Because the built-in plugin outputs are aggregated tables, the RDF generated by
sap-etl is limited to concepts that can be mapped from the available data.
Currently the loader maps:
program_invocationsslot_instructionsjetstreamer_slot_statuswhen present
This means the current implementation emits RDF for:
so:Slotso:Blockso:Program- selected telemetry-style ledger events grounded in native Jetstreamer aggregates
The codebase is structured so that future source adapters can add richer mappings when new native data sources become available.
- clean C++20 codebase with separation of concerns
- source / transform / load layering
- native ClickHouse-over-HTTP Jetstreamer source adapter
- TTL output with automatic file rotation
- QLever SPARQL update loading
- slot-range chunking
- checkpoint files for resume support
- parallel transformation with thread-local triple buffering
- tests with CTest
- no shell scripts required
- integration path for the SAP backend knowledge graph layer
- ontology-aligned outputs for grounded AI analytics workflows
src/config- CLI parsing and runtime configurationsrc/source- source adapterssrc/clickhouse- ClickHouse HTTP accesssrc/transform- ontology mappingsrc/load- TTL and QLever loaderssrc/checkpoint- checkpoint persistencesrc/model- shared domain types and slot/epoch selection logictests- unit tests
Install:
- C++20 compiler (
g++12+ orclang++15+) - CMake 3.24+
libcurldevelopment package
Example on Ubuntu / Debian:
sudo apt update
sudo apt install -y build-essential cmake pkg-config libcurl4-openssl-devClone sap-etl from the Git repository:
git clone https://github.com/mobr-ai/sap-etl.git
cd sap-etlcmake -S . -B build
cmake --build build -jctest --test-dir build --output-on-failuresap-etl expects Jetstreamer-generated local data to already exist.
Clone Jetstreamer from:
git clone https://github.com/anza-xyz/jetstreamer.gitJetstreamer documents the following setup characteristics that matter here:
- Rust toolchain / Cargo
- Clang 16 rather than 17 for RocksDB-related builds
- local ClickHouse helper support in the workspace
On Ubuntu / Debian, Jetstreamer documents installation using Clang 16 and supporting packages.
Inside the Jetstreamer repository:
cargo build --releaseJetstreamer’s runner accepts either:
- a single epoch
- or a slot range written as
<start>:<end>
Examples:
Epoch 900:
cargo run --release -- 900Slots from 388908000 to 388916000:
cargo run --release -- 388908000:388916000To enable the built-in native plugins that produce the local tables consumed by
sap-etl, use:
cargo run --release -- 900 --with-plugin instruction-tracking --with-plugin program-trackingOr for slot ranges:
cargo run --release -- 388908000:388916000 --with-plugin instruction-tracking --with-plugin program-trackingcargo clickhouse-serversap-etl connects to ClickHouse over HTTP, typically:
http://127.0.0.1:8123
It reads native Jetstreamer tables and transforms the rows into RDF.
The generated RDF is intended to support the broader SAP knowledge graph and
semantic analytics workflow, where the main sap backend can query indexed data
through QLever or related semantic infrastructure.
TTL is the default output mode. To make it explicit:
./build/sap-etl \
--load-type ttl \
--scope slots \
--slots 388908000-388916000./build/sap-etl \
--scope slots \
--slots 388908000-388916000 \
--clickhouse-url http://127.0.0.1:8123 \
--clickhouse-database default \
--output-dir ./out \
--output-prefix sap-solana./build/sap-etl \
--load-type qlever \
--scope slots \
--slots 388908000-388916000 \
--qlever-update-url http://127.0.0.1:7001Slot mode is the default. Epoch mode is also supported, but because sap-etl is
an external C++ process and not embedded in Solana runtime code, the epoch-to-slot
conversion is driven by an explicit epoch schedule passed on the command line.
Example:
./build/sap-etl \
--scope epochs \
--epochs 800,801 \
--slots-per-epoch 432000 \
--first-normal-epoch 8 \
--first-normal-slot 8160 \
--warmup true \
--clickhouse-url http://127.0.0.1:8123 \
--output-dir ./outUse the correct schedule for the ledger you replayed.
--load-type ttl|qlever--scope slots|epochs--slots 1-10,20,30-40--epochs 800,801--clickhouse-url http://127.0.0.1:8123--clickhouse-database default--output-dir ./out--output-prefix sap-etl--checkpoint-dir ./checkpoints--ttl-max-size 50GiB--source-chunk-slots 10000--loader-batch-triples 20000--worker-threads 8--resume true--overwrite false
Each TTL output file is capped by --ttl-max-size.
The default limit is 50 GiB.
If the output grows past the limit, sap-etl automatically starts the next file:
sap-etl-0.ttlsap-etl-1.ttlsap-etl-2.ttl
and so on.
Checkpoints are written under --checkpoint-dir.
The current implementation stores the last fully completed slot chunk so interrupted runs can continue from the last durable boundary.
If you want a fresh run:
./build/sap-etl ... --resume false --overwrite trueThe QLever loader sends batches as SPARQL INSERT DATA updates over HTTP.
You are expected to point --qlever-update-url at a QLever endpoint that accepts
SPARQL updates.
Example:
./build/sap-etl \
--load-type qlever \
--scope slots \
--slots 388908000-388916000 \
--qlever-update-url http://127.0.0.1:7001In the broader SAP stack, QLever acts as the semantic query layer that can be
used by the sap backend to support ontology-backed analytics and grounded AI
workflows.
The design is ready for future native sources:
- add a new source adapter by implementing
JetstreamerSource - add richer ontology mapping in
OntologyMapper - keep the existing loaders unchanged
This preserves separation of concerns and avoids code duplication.
Future extensions should continue to keep sap-etl focused on deterministic
data ingestion and ontology-aligned transformation, while leaving API
orchestration, user-facing flows, authentication, and product logic to the main
sap and sap-frontend repositories.
Licensed under the GNU GPLv3.
You may use, modify, and distribute the software under the same license.