Output
sf.substreams.solana.v1.Transactions
Inputs

Package ref
solana-common@v0.5.1Run package
CLI
Run transactions_by_programid from the command line.
substreams run solana-common@v0.5.1 transactions_by_programid -e solana-mainnet --start-block -1substreams auth or directly on thegraph.market (see docs).README
The Solana Common Modules Substreams contains a set of modules that allow you to easily retrieve basic information from the Solana blockchain, such as transactions or instructions.
The substreams.yaml file defines all the different modules available, and also provides you with documentation about the usage of every module.
In your substreams.yaml,
imports:
sol: https://spkg.io/streamingfast/solana-common-v0.5.1.spkg
If you know the instruction program ID of all transactions that you want, use the program_ids index like this:
blockFilter:
module: sol:program_ids
query:
string: "program:4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTy || program:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD"
If you also need to get transactions based on the instruction's accounts, use the (bigger) index like this:
blockFilter:
module: sol:program_ids_and_accounts
query:
string: "program:4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTy || account:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD"
In your substreams.yaml,
imports:
sol: https://spkg.io/streamingfast/solana-common-v0.5.1.spkg
transactions_by_programid or transactions_by_programid_and_account (along with source: sf.substreams.v1.Clock if you need slot number/ID/timestamp) as your module input, ex: - name: my_cool_module
kind: map
inputs:
- source: sf.substreams.v1.Clock
- map: sol:transactions_by_programid
sol:transactions_by_programid or transactions_by_programid_and_account module to match the data that you want to be fed to your module:params:
sol:transactions_by_programid: "program:4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTy"
sol:transactions_by_programid_and_account: "program:4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTy || (account:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD && program:FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH)"
substreams build. With buffa in your Cargo.toml dependencies, it generates the Rust bindings for these types, so you do not need to write a buf.gen.yaml yourself.program_ids (index)program:TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA, program:4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTyUse it to only get blocks that contain instructions matching the programID/accounts that you need, ex:
- name: my_module
...
blockFilter:
module: program_ids
query:
string: (program:4vMsoUT2BWatFweudnQM1xedRLfJgJ7hswhcpz4xgBTy || program:TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)
program_ids_and_accounts (index)account:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD, program:TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DAUse it to only get blocks that contain instructions matching the programID/accounts that you need, ex:
- name: my_module
...
blockFilter:
module: program_ids_and_accounts
query:
string: (account:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD && program:TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)
transactions_by_programid (map)program_ids index to only process blocks that contain matching instructions.transactions_by_programid_and_account (map)program_ids_and_accounts index to only process blocks that contain matching instructions.blocks_without_votes: read sf.solana.type.v1.Block directly with source: instead of map: sol:blocks_without_votes_without_votes suffix, for example transactions_by_programid_without_votes is now transactions_by_programidsubstreams 0.8 and substreams-solana 0.16Modules
Output
sf.substreams.solana.v1.Transactions
Inputs
Output
sf.substreams.index.v1.Keys
Inputs
`program_ids_and_accounts` creates a _cache_ to efficiently retrieve instructions based on the program ID and the accounts they use. For example, the following sets keys for the Token program and one account: * program:TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA * account:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD
Output
sf.substreams.index.v1.Keys
Inputs
`transactions_by_programid_and_account` emits the transactions that contain an instruction matching the query, and skips blocks with none through the `program_ids_and_accounts` index. Set the query in params, for example: * program:TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA && account:Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD
Output
sf.substreams.solana.v1.Transactions
Inputs