Skip to main content

Overview

Dyndexer is a service that allows you to run code to automatically translate on-chain events into application-specific formats. Dyndexer ensures that your code will run for every on-chain event of interest in a highly available and scalable manner. All of the streaming infrastructure is taken care of for you, so all you need to provide is the code for translation.

How it works

You can upload your code to Dyndexer in the form of a WASM binary, and configure which on-chain events it should be subscribed to. Dyndexer will then run your code for every on-chain event that matches your configuration, and store any outputs into a queryable database.

Getting Started

To get started with Dyndexer, you will need to:

  • Create a WASM binary with your custom logic
  • Upload your WASM binary
  • Create a new indexer

Creating a WASM binary

Use the syndica-dyndexer-runtime crate to help produce the correct WASM binary (currently only supports Rust).

Create a new cdylib crate with the syndica-dyndexer-runtime dependency:

Cargo.toml
[lib]
crate-type = ["cdylib"]

[dependencies]
syndica-dyndexer-runtime = "0.2"
lib.rs
use syndica_dyndexer_runtime::{processor, record_output, Output, Event};

#[processor]
fn process_event(event: Event) {

}

Examples

Some full example code for WASM functions can be found here

Building

Then build your WASM binary:

cargo build --release --target wasm32-wasi

Your binary artifact will then be located at a path like target/wasm32-wasi/release/<name>.wasm

CLI

To interact with the Dyndexer service from the CLI, you'll need to install the syndica CLI tool.

Create an indexer

syndica dyndexer indexers create -n <indexer-name> --binary-path <binary-artifact-path> --subscribe-transactions

This will create a new indexer that runs on every new transaction.

View Output

You can view some of the recorded output from your indexer via the CLI:

syndica dyndexer indexers get-output <indexer-id>

Using the API

You can interact with the Dyndexer service via a JSON RPC API over HTTP, similar to Solana RPC.