Solana IDL reference › How to decode Anchor events from Solana transactions

How to decode Anchor events from Solana transactions

Anchor programs report what happened through events: Rust structs marked #[event]. They reach indexers in one of two places.

1. Program data log lines (emit!)

emit! writes the event with sol_log_data. In the transaction's log messages it appears as Program data: <base64>. Base64-decode it: the first 8 bytes are the event discriminator (by default the first 8 bytes of sha256("event:<EventName>"); Anchor 0.30+ IDLs publish it), and the rest is the event's fields in Borsh.

2. Self-CPI instruction data (emit_cpi!)

Log output is capped per transaction and can be truncated, so Anchor added emit_cpi!: the program invokes itself with the event as instruction data, signed by an event_authority PDA. That inner instruction's data begins with the fixed 8-byte tag 0xe445a52e51cb9a1d, then the event discriminator, then the Borsh fields. Explorers usually show inner-instruction data in base58.

3. Match the discriminator and read the fields

Look up the 8 bytes in the program's IDL, then read each field in order with Borsh rules (little-endian integers, 32-byte public keys, 1-byte bool, 4-byte length before a Vec or String, 1-byte tag before an Option).

Example: pump.fun TradeEvent, discriminator 0xbddb7fd34ee661ee.

Decode an event

Decoding runs on Rugsight's server against the bundled snapshot. Nothing is fetched from the chain. Paste public account data only; never paste a private key or seed phrase.

Paste a whole Program data: … line, or inner-instruction data in hex or base58. The decoder removes the emit_cpi tag when present.

All programs in the IDL reference · Explain a transaction

Data: solana-idls@1.2.1 (MIT, © Obsidian Protocol) and SPL Token / Token-2022 state layouts (Apache-2.0), snapshot 2026-11-17. Programs can upgrade and an IDL snapshot can lag the deployed program, so check important offsets against current account data.