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#
| Requirement | Version | Needed for |
|---|---|---|
| Rust | 1.96.1 or newer | Every Carbon crate (rust-version = "1.). |
| Node.js | 20.18.0 or newer | Only the Carbon CLI, which generates decoders and scaffolds projects. Your indexer doesn't need Node.js. |
| Solana crates | Agave 4.2 cohort | Carbon 2.0 is built on solana-client 4., solana-transaction-status 4., solana-pubkey 4., solana-account 4. and related crates. |
Check your toolchain:
rustc --versionrustc 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:
| Crate | Version |
|---|---|
solana-pubkey | 4.2.1 |
solana-account | 4.3.2 |
solana-signature | 3.4.1 |
solana-instruction | 3.4.1 |
solana-commitment-config | 3.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.
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[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 to | Add |
|---|---|
| Build any pipeline | carbon-core and tokio |
| Stream from Yellowstone gRPC | carbon-yellowstone-grpc-datasource |
| Stream from Helius LaserStream | carbon-helius-laserstream-datasource |
| Subscribe over Solana RPC websockets | carbon-rpc-block-subscribe-datasource or carbon-rpc-program-subscribe-datasource |
| Subscribe over Helius enhanced websockets | carbon-helius-atlas-ws-datasource |
| Backfill transaction history | carbon-rpc-transaction-crawler-datasource, carbon-rpc-block-crawler-datasource or carbon-helius-gtfa-datasource |
| Load a program's current accounts | carbon-rpc-gpa-datasource or carbon-helius-gpa-v2-datasource |
| Load accounts from a validator snapshot | carbon-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 program | Its decoder crate, such as carbon-token-program-decoder or carbon-pump-swap-decoder. See the decoder catalog. |
| Decode a program without a published decoder | Generate one with the CLI. See Generate a decoder. |
| Log metrics | carbon-log-metrics |
| Expose metrics to Prometheus | carbon-prometheus-metrics |
| Test decoders against fixtures | carbon-test-utils (as a dev-dependency) |
The datasource index compares datasources in detail.
carbon-core feature flags#
| Feature | Default | What it enables |
|---|---|---|
macros | Yes | Re-exports the try_ and instruction_ macros and the InstructionType derive from carbon_core. Decoder crates turn it on themselves. |
postgres | No | The carbon_ module: sqlx-backed processors, row types and Pubkey/integer column wrappers. See Postgres. |
graphql | No | The carbon_ module: Juniper scalars for Solana types and an Axum router helper. See GraphQL. |
yellowstone | No | carbon_, 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. |
cargo add carbon-core@2.0.0 --features postgres,graphqlThe feature flag reference covers every crate.
Decoder feature flags#
Every published decoder crate has the same features, all off by default:
| Feature | What it enables |
|---|---|
serde | Serialize and Deserialize on the decoder's accounts, instructions, events and types. |
postgres | Postgres row types and migrations for the decoder's accounts and instructions. Turns on serde and carbon-core/. |
graphql | GraphQL schema types for the decoder. Turns on serde and carbon-core/. |
cargo add carbon-meteora-dlmm-decoder@2.0.0 --features serdeDecoders 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/, 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:
npx @sevenlabs-hq/carbon-cli@2.0.0 --versionpnpm dlx @sevenlabs-hq/carbon-cli@2.0.0 --versionbunx @sevenlabs-hq/carbon-cli@2.0.0 --versionyarn dlx @sevenlabs-hq/carbon-cli@2.0.0 --version2.0.0To install it globally instead:
npm install -g @sevenlabs-hq/carbon-cli@2.0.0
carbon-cli --versionThe 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.
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(())
}cargo runcarbon-core is installed and the pipeline runsThen check that only one version of carbon-core is in your build:
cargo tree -i carbon-core --depth 1carbon-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.