Fetch and query Anchor program IDLs from Solana.
cargo install anchor-periscope# On-chain (requires program ID)
periscope inspect <PROGRAM_ID>
periscope instructions <PROGRAM_ID>
periscope instruction <NAME> <PROGRAM_ID>
periscope errors <PROGRAM_ID>
# From file or URL (program ID not needed)
periscope inspect --idl ./target/idl/program.json
periscope instructions --idl https://github.com/user/repo/blob/main/idl.json
periscope inspect --idl ./idl.json # Custom RPC
periscope --url https://my-rpc.com inspect <PROGRAM_ID>
# Load from file (no program ID needed)
periscope --idl ./idl.json inspect
# Load from URL - GitHub blob URLs auto-convert to raw
periscope --idl https://github.com/user/repo/blob/main/idl.json inspectConfig file location:
- Linux:
~/.config/periscope/config.toml - macOS:
~/Library/Application Support/periscope/config.toml
periscope config show
periscope config set --url https://api.devnet.solana.comRPC priority: --url flag > config file > mainnet-beta default
use periscope::{fetch_idl_from_chain, load_idl_from_file};
use solana_sdk::pubkey::Pubkey;
// From chain
let program_id: Pubkey = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4".parse()?;
let idl = fetch_idl_from_chain(&program_id, "https://api.mainnet-beta.solana.com")?;
// From file
let idl = load_idl_from_file("./target/idl/my_program.json")?;
println!("{}", idl.metadata.name);Functions:
fetch_idl_from_chain(program_id, rpc_url)- Fetch from on-chain IDL accountfetch_idl_with_client(client, program_id)- Fetch with existing RPC clientload_idl_from_file(path)- Load from local JSON filefetch_idl_from_url(url)- Fetch from URL (async)get_idl_address(program_id)- Derive IDL account address
- Anchor IDL spec 0.1.0+ (Anchor 0.29+)
- Legacy Anchor IDL (pre-0.29)
Format is auto-detected.
MIT