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).
Output
raydium.v1.InstructionsInputs
Package ref
raydium@v0.2.0Run package
CLI
Run map_raydium_instructions from the command line.
substreams run raydium@v0.2.0 map_raydium_instructions -e solana --start-block -1substreams auth or directly on thegraph.market (see docs).README
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).
| Program | ID | Label |
|---|---|---|
| AMM V4 | 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 | amm_v4 |
| CLMM | CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK | clmm |
| CPMM | CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C | cpmm |
initialBlock is 60,000,000 (early Raydium AMM V4 era). Full history is a large backfill.
Instruction is annotated with (schema.table) / (schema.field) in proto/raydium.proto.map_raydium_instructions (output proto:raydium.v1.Instructions).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.
substreams auth
rustup target add wasm32-unknown-unknown
# brew install streamingfast/tap/substreams-sink-sql
substreams build
substreams run ./substreams.yaml map_raydium_instructions \
-s 320000000 -t +100 -o jsonl
# 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
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.
SELECT * FROM raydium_instructions WHERE _deleted_ = 0 LIMIT 100;
SELECT program_name, count()
FROM raydium_instructions
WHERE _deleted_ = 0
GROUP BY program_name;
Modules
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).
Output
raydium.v1.InstructionsInputs
Output
sf.solana.type.v1.BlockInputs
Output
sf.substreams.index.v1.Keys
`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.
Output
sf.solana.type.v1.BlockInputs