1. Get started

Installation

Requirements, the Carbon crates to add for each job, core and decoder feature flags, and how to install and run the Carbon CLI.

On this page

This page lists what Carbon 2.0 needs, which crates to add for the indexer you're building, and how to run the Carbon CLI. For a guided first project, follow the quickstart instead.

Requirements#

RequirementVersionNeeded for
Rust1.96.1 or newerEvery Carbon crate (rust-version = "1.96.1").
Node.js20.18.0 or newerOnly the Carbon CLI, which generates decoders and scaffolds projects. Your indexer doesn't need Node.js.
Solana cratesAgave 4.2 cohortCarbon 2.0 is built on solana-client 4.2.2, solana-transaction-status 4.2.2, solana-pubkey 4.2, solana-account 4.3 and related crates.

Check your toolchain:

Terminal
rustc --version
Output
rustc 1.99.0 (b940084d7 2026-09-28)

If it's older than 1.96.1, run rustup update stable.

Keep one Carbon version and one Solana cohort#

All carbon-* crates in a project must be version 2.0.0. Don't mix Carbon 2 crates with Carbon 1 decoders or datasources: Cargo builds both versions of carbon-core, and their types don't match. The same goes for Solana crates you depend on directly: pick versions from the Agave 4.2 cohort so that one version of solana-pubkey, solana-account and the other type crates ends up in your build.

When you add a Solana crate yourself, use the version Carbon uses:

CrateVersion
solana-pubkey4.2.1
solana-account4.3.2
solana-signature3.4.1
solana-instruction3.4.1
solana-commitment-config3.1.1
solana-client, solana-account-decoder, solana-transaction-status=4.2.2

Add Carbon to a project#

Every indexer needs carbon-core, at least one datasource, the decoders for the programs you read, and an async runtime. A metrics exporter is optional but recommended.

Terminal
cargo add carbon-core@2.0.0
cargo add carbon-rpc-transaction-crawler-datasource@2.0.0
cargo add carbon-meteora-dlmm-decoder@2.0.0
cargo add carbon-log-metrics@2.0.0
cargo add tokio --features full
cargo add env_logger log
Cargo.toml
[dependencies]
carbon-core = "2.0.0"
carbon-log-metrics = "2.0.0"
carbon-meteora-dlmm-decoder = "2.0.0"
carbon-rpc-transaction-crawler-datasource = "2.0.0"
env_logger = "0.11.11"
log = "0.4.35"
tokio = { version = "1.54.1", features = ["full"] }

Replace the datasource and decoder with the ones you need. env_logger and log aren't required, but Carbon reports datasource and processor errors through the log crate, so install a logger to see them.

Which crates you need#

You want toAdd
Build any pipelinecarbon-core and tokio
Stream from Yellowstone gRPCcarbon-yellowstone-grpc-datasource
Stream from Helius LaserStreamcarbon-helius-laserstream-datasource
Subscribe over Solana RPC websocketscarbon-rpc-block-subscribe-datasource or carbon-rpc-program-subscribe-datasource
Subscribe over Helius enhanced websocketscarbon-helius-atlas-ws-datasource
Backfill transaction historycarbon-rpc-transaction-crawler-datasource, carbon-rpc-block-crawler-datasource or carbon-helius-gtfa-datasource
Load a program's current accountscarbon-rpc-gpa-datasource or carbon-helius-gpa-v2-datasource
Load accounts from a validator snapshotcarbon-validator-snapshot-datasource
Feed updates from your own source (Kafka, files, a Geyser plugin)carbon-stream-message-datasource, or implement Datasource yourself with async-trait
Decode a programIts decoder crate, such as carbon-token-program-decoder or carbon-pump-swap-decoder. See the decoder catalog.
Decode a program without a published decoderGenerate one with the CLI. See Generate a decoder.
Log metricscarbon-log-metrics
Expose metrics to Prometheuscarbon-prometheus-metrics
Test decoders against fixturescarbon-test-utils (as a dev-dependency)

The datasource index compares datasources in detail.

carbon-core feature flags#

FeatureDefaultWhat it enables
macrosYesRe-exports the try_decode_instructions! and instruction_decoder_collection! macros and the InstructionType derive from carbon_core. Decoder crates turn it on themselves.
postgresNoThe carbon_core::postgres module: sqlx-backed processors, row types and Pubkey/integer column wrappers. See Postgres.
graphqlNoThe carbon_core::graphql module: Juniper scalars for Solana types and an Axum router helper. See GraphQL.
yellowstoneNocarbon_core::transformers::yellowstone, which converts Yellowstone protobuf transactions to Solana types. The Yellowstone and LaserStream datasources turn it on for you; enable it yourself only to convert Yellowstone messages in your own code.
Terminal
cargo add carbon-core@2.0.0 --features postgres,graphql

The feature flag reference covers every crate.

Decoder feature flags#

Every published decoder crate has the same features, all off by default:

FeatureWhat it enables
serdeSerialize and Deserialize on the decoder's accounts, instructions, events and types.
postgresPostgres row types and migrations for the decoder's accounts and instructions. Turns on serde and carbon-core/postgres.
graphqlGraphQL schema types for the decoder. Turns on serde and carbon-core/graphql.
Terminal
cargo add carbon-meteora-dlmm-decoder@2.0.0 --features serde

Decoders you generate with the CLI get the same features, controlled by --with-postgres and --with-graphql (both on by default) and --with-serde. They also get a base58 feature when you pass --with-base58 true; it turns on serde and serializes Pubkey fields as base58 strings.

Install and run the CLI#

The Carbon CLI, @sevenlabs-hq/carbon-cli, generates decoder crates from Anchor or Codama IDLs (parse) and scaffolds complete indexer projects (scaffold). It needs Node.js 20.18.0 or newer. Run it without installing:

Terminal
npx @sevenlabs-hq/carbon-cli@2.0.0 --version
Terminal
pnpm dlx @sevenlabs-hq/carbon-cli@2.0.0 --version
Terminal
bunx @sevenlabs-hq/carbon-cli@2.0.0 --version
Terminal
yarn dlx @sevenlabs-hq/carbon-cli@2.0.0 --version
Output
2.0.0

To install it globally instead:

Terminal
npm install -g @sevenlabs-hq/carbon-cli@2.0.0
carbon-cli --version

The package installs two equivalent commands, carbon-cli and carbon. Run carbon-cli parse or carbon-cli scaffold without options to be prompted for each one. CLI 2.0.0 generates code that depends on Carbon 2.0.0 crates. See the CLI reference for every command and flag.

Verify the install#

Put this program in src/main.rs. A pipeline with no datasources starts and returns straight away, so it checks that Carbon compiles and runs without touching the network.

src/main.rs
use carbon_core::{error::CarbonResult, pipeline::Pipeline};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    // A pipeline with no datasources returns as soon as it starts.
    Pipeline::builder().build()?.run().await?;
    println!("carbon-core is installed and the pipeline runs");
    Ok(())
}
Terminal
cargo run
Output
carbon-core is installed and the pipeline runs

Then check that only one version of carbon-core is in your build:

Terminal
cargo tree -i carbon-core --depth 1
Output
carbon-core v2.0.0
├── carbon-log-metrics v2.0.0
├── carbon-meteora-dlmm-decoder v2.0.0
├── carbon-rpc-transaction-crawler-datasource v2.0.0
└── carbon-quickstart v0.1.0 (/home/you/carbon-quickstart)

If Cargo reports that there are multiple carbon-core packages, one of your carbon-* dependencies isn't 2.0.0. Set every one to 2.0.0 and run cargo update.

Next steps#

Your endpoints

Code samples use these instead of the placeholders, so you can copy and run them as they are. They’re stored only in this browser and never sent anywhere.