Triton One Docs
WebsiteCustomer Portal
  • Introduction
  • RPC Pool
    • Introduction
    • GeoDNS
    • Abuse prevention
    • Rate Limits
    • Proxying
    • Support FAQs
    • Privacy & Security
  • Chains
    • Solana
      • Geyser
      • BigTable Archive
      • Improved Priority Fees API
        • For RPC Providers
      • Sending TXs
      • Deprecated calls Solana 2.0
      • Buying Transaction Bandwidth
      • Providing Transaction Bandwidth
      • Web3JS Socket/Connection Issues
    • Pythnet
    • SUI
    • Others
  • Digital Assets API
    • Introduction
    • Fungible Assets
    • API Methods
      • Get Asset
      • Get Asset Proof
      • Get Assets By Authority
      • Get Assets By Owner
      • Get Assets By Group
      • Get Assets By Creator
      • Search Assets
      • Get Token Accounts
      • Get Signatures For Asset
      • Get NFT Editions
      • Get Asset Proofs
  • Project Yellowstone
    • Introduction
    • Dragon's Mouth gRPC Subscriptions
    • Old Faithful Historical Archive
      • Old Faithful Public Report
    • Steamboat Custom Indexes
    • Whirligig WebSockets
    • Fumarole
    • Vixen
      • Generate a Yellowstone Vixen Parser with Codama
  • Account Management
    • Payments
    • Account management API
      • Introduction
      • Auth & Headers
      • Accounts
      • Address Watch Lists
      • Subscriptions
      • Subscription Types
      • Endpoints
      • Tokens
      • Rate Tiers
  • Trading APIs
    • Introduction
    • Jupiter swap
    • Pyth Hermes
    • Bundle simulation by Jito
  • Validators
    • Introduction
    • Vote account setup
    • Node identity protection
  • Pyth Publishers
    • NGINX proxy
    • Testnet, Devnet and Pythnet
Powered by GitBook
On this page
  • ✅ Prerequisites
  • 📦 Installation
  • 🛠 Setup
  • 🎉 You’re Done!
  • 🧠 Notes

Was this helpful?

  1. Project Yellowstone
  2. Vixen

Generate a Yellowstone Vixen Parser with Codama

How-to generate Vixen parser with Codama

PreviousVixenNextPayments

Last updated 1 month ago

Was this helpful?

This guide walks you through generating a Parser using , a tool for rendering Rust SDKs and parser implementations from IDLs.

Vixen is a framework for building real-time program data pipelines in Rust. This guide helps you scaffold a parser that can be used in the Vixen runtime to decode and process Solana program data.

✅ Prerequisites

1. Generate a Codama Rust SDK for your program using codama:rust-renderers.

2. You must have an idl.json file—either an Anchor-generated IDL or a custom one.

3. Install (or use npm/yarn if preferred).

📦 Installation

Install the required Codama packages:

pnpm install @codama/renderers-vixen-parser

For the parser generation script, you’ll also need:

pnpm install \
  @codama/nodes \
  @codama/nodes-from-anchor \
  @codama/renderers-core \
  @codama/visitors-core

🛠 Setup

1. Create a New Rust Parser Project

cargo new program-parser --lib

Move your idl.json file into the newly created project folder:

mv idl.json program-parser/

2. Initialize a JavaScript Project (for Codegen)

From within the parser directory:

pnpm init

Install all required JS dependencies (see Installation above).

3. Create a Parser Generation Script

Inside program-parser/, create a new file called script.cjs:

// script.cjs
const path = require("node:path");
const { rootNode } = require("@codama/nodes");
const { rootNodeFromAnchor } = require("@codama/nodes-from-anchor");
const { readJson } = require("@codama/renderers-core");
const { visit } = require("@codama/visitors-core");
const { renderVisitor } = require("@codama/renderers-vixen-parser");

const project = "program-parser"; // folder name
const idl = readJson(path.join(__dirname, "idl.json"));

// Use the appropriate node constructor based on your IDL type:
const node = rootNodeFromAnchor(idl); // for Anchor
// const node = rootNode(idl.program); // for non-Anchor

visit(
  node,
  renderVisitor(path.join(__dirname, "src", "generated"), {
    sdkName: "my_program_sdk", // snake_case SDK name
    crateFolder: __dirname,
    formatCode: true,
  })
);

💡 Tip: Replace "my_program_sdk" with the actual SDK crate name you generated with Codama.

4. Run the Code Generation Script

node script.cjs

You should see files generated in src/generated/.

5. Configure Your Rust Project

Update src/lib.rs:

mod generated;

Update Cargo.toml:

[dependencies]
yellowstone-vixen-core = "0.1.0"
solana-program = "2.1.6"
borsh = "0.10"
my_program_sdk = { path = "./my_program_sdk" } # or from crates.io

6. Build and Verify

cargo build

If successful, you now have a working parser for Solana account data using Yellowstone Vixen.

🎉 You’re Done!

You’ve successfully generated a custom Vixen parser. It can now be integrated into a Vixen pipeline for parsing and handling account state from your Solana program.

🧠 Notes

  • Codama enables reproducible parser generation from your program’s IDL. Any time your program updates, just re-run the script.

  • Generated code is idiomatic Rust and integrates directly with yellowstone-vixen-core.

  • Parsers are composable and can be used in a source → parser → sink pipeline for high-throughput indexing.

Vixen
Codama
pnpm