# Installation (Carbon 2.0)

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

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](https://carbon.sevenlabs.org/quickstart.md) instead.

## Requirements

| Requirement   | Version          | Needed for                                                                                                                                     |
| ------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Rust          | 1.96.1 or newer  | Every Carbon crate (`rust-version = "1.96.1"`).                                                                                                |
| Node.js       | 20.18.0 or newer | Only the [Carbon CLI](#install-and-run-the-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.2.2`, `solana-transaction-status 4.2.2`, `solana-pubkey 4.2`, `solana-account 4.3` and related crates. |

Check your toolchain:

```sh
rustc --version
```

Output:

```text
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:

| 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.

```sh
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`:

```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 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`](https://carbon.sevenlabs.org/concepts/datasources.md) 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](https://carbon.sevenlabs.org/decoders.md). |
| Decode a program without a published decoder                      | Generate one with the [CLI](#install-and-run-the-cli). See [Generate a decoder](https://carbon.sevenlabs.org/guides/generate-a-decoder.md).                   |
| 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](https://carbon.sevenlabs.org/datasources.md) compares datasources in detail.

> **Note.** `carbon-jito-shredstream-grpc-datasource` and `carbon-jetstreamer-datasource` are not published for Carbon 2.0. Their 1.x versions depend on Carbon 1 and the Solana 3 crates, so they can't be used in a Carbon 2 project.

## `carbon-core` feature flags

| Feature       | Default | What it enables                                                                                                                                                                                                                                       |
| ------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `macros`      | Yes     | Re-exports the `try_decode_instructions!` and `instruction_decoder_collection!` macros and the `InstructionType` derive from `carbon_core`. Decoder crates turn it on themselves.                                                                     |
| `postgres`    | No      | The `carbon_core::postgres` module: `sqlx`-backed processors, row types and `Pubkey`/integer column wrappers. See [Postgres](https://carbon.sevenlabs.org/guides/postgres.md).                                                                        |
| `graphql`     | No      | The `carbon_core::graphql` module: Juniper scalars for Solana types and an Axum router helper. See [GraphQL](https://carbon.sevenlabs.org/guides/graphql.md).                                                                                         |
| `yellowstone` | No      | `carbon_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. |

```sh
cargo add carbon-core@2.0.0 --features postgres,graphql
```

The [feature flag reference](https://carbon.sevenlabs.org/reference/feature-flags.md) 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/postgres`. |
| `graphql`  | GraphQL schema types for the decoder. Turns on `serde` and `carbon-core/graphql`.                                           |

```sh
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:

**npx**

```sh
npx @sevenlabs-hq/carbon-cli@2.0.0 --version
```

**pnpm**

```sh
pnpm dlx @sevenlabs-hq/carbon-cli@2.0.0 --version
```

**bun**

```sh
bunx @sevenlabs-hq/carbon-cli@2.0.0 --version
```

**yarn**

```sh
yarn dlx @sevenlabs-hq/carbon-cli@2.0.0 --version
```

Output:

```text
2.0.0
```

To install it globally instead:

```sh
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](https://carbon.sevenlabs.org/reference/cli.md) 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`:

```rust
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(())
}
```

```sh
cargo run
```

Output:

```text
carbon-core is installed and the pipeline runs
```

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

```sh
cargo tree -i carbon-core --depth 1
```

Output:

```text
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

- [Quickstart](https://carbon.sevenlabs.org/quickstart.md): Build and run your first indexer against mainnet.
- [Architecture](https://carbon.sevenlabs.org/concepts/architecture.md): How a pipeline moves updates from datasources to processors.
- [Generate a decoder](https://carbon.sevenlabs.org/guides/generate-a-decoder.md): Use the CLI to decode your own program.

---

Carbon 2.0.0 documentation · Web: https://carbon.sevenlabs.org/installation · Last updated 2026-11-09 · Index of all pages: https://carbon.sevenlabs.org/llms.txt
