> For the complete documentation index, see [llms.txt](https://docs.triton.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.triton.one/solana/quickstart/streaming/generate-parsers-with-codama.md).

# Generate parsers with Codama

Generate a Shipstern parser for any Solana program from its IDL, with Codama and the include\_shipstern\_parser! macro.

[Shipstern](https://github.com/solana-rpc/shipstern) builds a parser for your program at compile time from a [Codama](https://github.com/codama-idl/codama) IDL, through the `include_shipstern_parser!` proc macro. Nothing is written to disk and there is no build script. The generated parser decodes the program's accounts and instructions inside a Shipstern pipeline.

Shipstern (formerly Yellowstone Vixen) is an open-source framework for real-time Solana program data pipelines in Rust. [How to use Shipstern + gRPC](/solana/quickstart/streaming/how-to-use-shipstern-grpc.md) shows how its sources connect to Triton.

## Prerequisites

* Your program's IDL, as `idl.json`. An Anchor IDL works; so does an IDL already in Codama form.
* Node.js with `npx`, for the one-time conversion step.
* A Rust project for your pipeline.

## 1. Convert the IDL to Codama JSON

The macro also reads an Anchor IDL directly, but this guide uses Codama JSON. Convert the IDL once:

```bash
npx -p codama -p @codama/nodes-from-anchor codama convert idl.json codama.json
```

Name both packages. `codama convert` reads Anchor IDLs through `@codama/nodes-from-anchor`, and outside a Node.js project it doesn't install that package for you. If your IDL is already in Codama form, skip this step.

## 2. Add the dependencies

```toml
[dependencies]
borsh = { version = "1", features = ["derive"] }
shipstern = "0.12"
shipstern-core = "0.12"
shipstern-parser = "0.12"
shipstern-proc-macro = "0.12"
shipstern-yellowstone-grpc-source = "0.12"
rustls = "0.23"
toml = "0.9"
```

The generated code needs `shipstern-core` and Borsh's `derive` feature. To also parse program events, including self-CPI events, enable the `program-events` feature on `shipstern-proc-macro`; it changes the instruction parser's output to carry the events too.

## 3. Generate and run the parser

`include_shipstern_parser!` takes the path to `codama.json`, relative to your crate root. It expands to a module named after the program in snake\_case, with `PROGRAM_ID`, `AccountParser`, `InstructionParser`, and the account and argument types. Use the parsers like any built-in Shipstern parser. This pipeline, for a program named `my_program` in the IDL, streams its accounts and instructions from Dragon's Mouth gRPC and logs them:

```rust
use shipstern::Pipeline;
use shipstern_proc_macro::include_shipstern_parser;
use shipstern_yellowstone_grpc_source::YellowstoneGrpcSource;

include_shipstern_parser!("codama.json");

#[derive(Debug)]
pub struct Logger;

impl<V: std::fmt::Debug + Sync, R: Sync> shipstern::Handler<V, R> for Logger {
    async fn handle(&self, value: &V, _raw: &R) -> shipstern::HandlerResult<()> {
        println!("{value:?}");
        Ok(())
    }
}

fn main() {
    rustls::crypto::aws_lc_rs::default_provider()
        .install_default()
        .expect("Failed to install rustls crypto provider");

    let config = std::fs::read_to_string("Shipstern.toml").expect("Error reading config file");
    let config = toml::from_str(&config).expect("Error parsing config");

    shipstern::Runtime::builder()
        .account(Pipeline::new(my_program::AccountParser, [Logger]))
        .instruction(Pipeline::new(my_program::InstructionParser, [Logger]))
        .build::<YellowstoneGrpcSource>(config)
        .run();
}
```

`Shipstern.toml` holds the source settings: put your Triton gRPC endpoint in `endpoint` and your token in `x-token` under `[source]`. Start from the repository's [`Shipstern.example.toml`](https://github.com/solana-rpc/shipstern/blob/main/Shipstern.example.toml).

The Shipstern repository's [Codama parser generation reference](https://github.com/solana-rpc/shipstern/blob/main/docs/codama-parser-generation.md) covers which IDL nodes the macro reads, discriminators, and event envelopes.

{% hint style="info" %}
The standalone Codama renderer `@codama/renderers-vixen-parser` (last released in October 2025) writes parser crates for the pre-rename framework and has not been released for Shipstern. Use the macro.
{% endhint %}

## What's next

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>How to use Shipstern + gRPC</strong></td><td>Run your parser against a live Dragon's Mouth gRPC stream.</td><td><a href="/solana/quickstart/streaming/how-to-use-shipstern-grpc.md">How to use Shipstern + gRPC</a></td></tr><tr><td><i class="fa-tower-broadcast">:tower-broadcast:</i> <strong>Dragon's Mouth gRPC</strong></td><td>Sub-slot real-time updates for accounts, transactions, slots, and blocks via gRPC.</td><td><a href="/solana/real-time-streaming/dragon-s-mouth-grpc.md">Dragon's Mouth gRPC</a></td></tr></tbody></table>

***

<i class="fa-life-ring">:life-ring:</i> Contact support by clicking the chat icon in your [customer dashboard](https://customers.triton.one)\ <i class="fa-briefcase">:briefcase:</i> Sales questions? [Contact us](https://triton.one/contact)\ <i class="fa-sparkles">:sparkles:</i> AI agent? Read [llms.txt](https://docs.triton.one/llms.txt)\ <i class="fa-rss">:rss:</i> Follow updates: [Blog](https://blog.triton.one) · [X](https://x.com/triton_one) · [YouTube](https://www.youtube.com/@triton_one_ltd) · [Telegram](https://t.me/tritonone) · [GitHub](https://github.com/rpcpool)
