All packages
raydium

raydium

billettc
v0.2.0/9 downloads/Repository

Package ref

raydium@v0.2.0

Run package

CLI

Run map_raydium_instructions from the command line.

substreams run raydium@v0.2.0 map_raydium_instructions -e solana --start-block -1
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

Raydium Solana Substreams

Indexes every instruction (top-level and CPI/inner) for the three main Raydium programs on Solana mainnet, and sinks them into ClickHouse using substreams-sink-sql from-proto (schema derived from protobuf annotations — no DatabaseChanges / schema.sql).

ProgramIDLabel
AMM V4675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8amm_v4
CLMMCAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqKclmm
CPMMCPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1Ccpmm

initialBlock is 60,000,000 (early Raydium AMM V4 era). Full history is a large backfill.

How sinking works (from-proto)

  1. Instruction is annotated with (schema.table) / (schema.field) in proto/raydium.proto.
  2. The sink module is map_raydium_instructions (output proto:raydium.v1.Instructions).
  3. substreams-sink-sql from-proto generates ClickHouse tables (raydium_instructions + system columns like _block_number_, _block_timestamp_, _version_, _deleted_) and streams inserts.

See FROM_PROTO.md.

Prerequisites

substreams auth
rustup target add wasm32-unknown-unknown
# brew install streamingfast/tap/substreams-sink-sql

Build

substreams build

Test (small range)

substreams run ./substreams.yaml map_raydium_instructions \
  -s 320000000 -t +100 -o jsonl

Local / ClickHouse Cloud sink (from-proto)

# Auth for Solana Substreams endpoint
export SUBSTREAMS_API_TOKEN=...   # or: substreams auth

# ClickHouse Cloud (native TLS port 9440). Password via env — do not commit it.
export CLICKHOUSE_PASSWORD='...'
# In ClickHouse Cloud → Settings → IP access list: allow your public IP (or 0.0.0.0/0 for testing).

# Smoke test (~1000 slots)
START_BLOCK=320000000 STOP_BLOCK=+1000 ./deploy-sink.sh

# Full history from initialBlock (60_000_000) → live tip
./deploy-sink.sh

Equivalent one-liner (password URL-encoded if it contains ~ etc.):

substreams-sink-sql from-proto \
  "clickhouse://default:${CLICKHOUSE_PASSWORD}@m4oqcwi4dx.us-central1.gcp.clickhouse.cloud:9440/raydium?secure=true" \
  ./substreams.yaml map_raydium_instructions \
  --endpoint mainnet.sol.streamingfast.io:443

Hosted sink (StreamingFast Portal)

Deploy the built .spkg as a ClickHouse SQL sink in from-proto mode (module_output_type = proto:raydium.v1.Instructions, not DatabaseChanges). Provide ClickHouse host/user/database; stage the password in the Portal UI.

Query tips

SELECT * FROM raydium_instructions WHERE _deleted_ = 0 LIMIT 100;

SELECT program_name, count()
FROM raydium_instructions
WHERE _deleted_ = 0
GROUP BY program_name;

Modules

Execution graph

4 modules
mapMain

map_raydium_instructions

Extract every instruction (including CPI/inner) targeting Raydium AMM V4, CLMM, or CPMM. Accounts are resolved to base58; data is hex. Sink this module with `substreams-sink-sql from-proto` (ClickHouse).

from #60000000
Show 3 dependencies
map

sol:v020:blocks_without_votes

`blocks_without_votes` allows you to consume a full Solana Block without Vote instructions (`Vote111111111111111111111111111111111111111`). If you consume it on HISTORICAL data (+1000 blocks from HEAD), you will be reading from the StreamingFast cache, thus saving costs on the amount of TB read.