Canonical: https://solanashreds.xyz/learn/solana-program-events

# Program events on Solana, and where to read them

Solana program events are emitted as logs or as a self CPI, and neither is in a raw transaction. How event styles differ and where to find them.

Solana program events are structured records a program publishes while it runs, usually through Anchor. With `emit!` the event becomes a `Program data:` line in the log; with `emit_cpi!` it becomes an instruction the program sends to itself. Both are produced during execution, so neither is in a raw transaction: you read events from execution data.

## Two event styles

| | `emit!` | `emit_cpi!` |
| --- | --- | --- |
| Where the event lands | a `Program data:` log line, base64 | an inner instruction from the program to itself |
| First bytes | the event's 8-byte discriminator | the 8-byte tag `e4 45 a5 2e 51 cb 9a 1d`, then the event discriminator |
| Survives log truncation | no | yes |
| Costs | a log write | a cross-program call |
| In raw shreds | no | no |

In two mainnet blocks we sampled on 18 November 2026, 202 transactions carried 280 `Program data:` lines and 220 transactions carried 286 self-calls with the event tag, so both styles are common.

## Log events

`emit!` serialises the event, puts its discriminator in front and writes the bytes through the runtime's data-logging call, which shows up as `Program data:` followed by base64 in the transaction's log. It is cheap, but it lives in the log, and logs are capped per transaction and sometimes cut further by data providers. When the log is cut, the event is gone. [Program logs or instruction data](https://solanashreds.xyz/learn/logs-vs-instruction-data) covers that limit.

## CPI events

`emit_cpi!` makes the program invoke itself through an event authority account, with instruction data made of a fixed eight-byte tag, the event discriminator and the event's fields. The event becomes an [inner instruction](https://solanashreds.xyz/learn/inner-instructions-and-cpi): recorded with the transaction's other CPIs, not in the log, so log truncation cannot remove it. Anchor's documentation recommends it for exactly that reason.

One detail catches indexers: the tag is the same for every Anchor program. Always check which program the self-call belongs to before choosing an IDL to decode it with.

## Decoding event bytes

After the tag (for CPI events) or the base64 decoding (for log events), event bytes look like instruction data: an eight-byte discriminator, made from `event:` and the event's name, then the fields in Borsh in the order the IDL lists them. The [Anchor discriminator page](https://solanashreds.xyz/learn/anchor-discriminators) shows a real event discriminator computed and checked.

Expect events to grow. Of 19 Pump.fun events we decoded from those blocks with the IDL pinned at commit 639b87f, 17 had eight more bytes after the last field the IDL describes. Decode the fields you know, keep the remainder, and do not reject the event; [event schemas that last](https://solanashreds.xyz/blog/event-schemas-that-last) goes into designing for that.

## What the event knew that the instruction did not

A real Pump.fun `sell` from slot 470,901,815, read twice: from the top-level instruction the user signed, and from the `TradeEvent` the program emitted while executing it.

| Field | Instruction (in the transaction) | TradeEvent (execution data) |
| --- | --- | --- |
| Tokens sold | 1,522,566,947,907 | 1,522,566,947,907 |
| Least acceptable proceeds | 0 lamports | |
| Proceeds received | | 201,052,554 lamports |
| Protocol fee | | 1,910,000 lamports |
| Creator fee | | 603,158 lamports |

The seller set no floor at all. Only the event says what the sale fetched and what it paid in fees.

## Recovering events after confirmation

Events come with execution metadata, so you collect them once the transaction has run: from `getTransaction` or `getBlock` (log lines and inner instructions), from Geyser streams, or from parsed APIs. A pipeline that starts from shreds records the transaction early, then attaches its events when [reconciling with RPC](https://solanashreds.xyz/docs/pipeline/reconcile) settles its status. Failed transactions emit no events for the work that did not happen, so an event's presence is itself a signal.

## Events and a shred decoder

From shreds you have the request, not the event. For many questions the request is enough, such as which token, which user and which direction. For amounts that depend on execution, such as proceeds, fills and fees, plan to wait for events. The [Pump.fun recipe](https://solanashreds.xyz/docs/programs/pump-fun) decodes the request side of exactly this sale.

## Questions about program events

### Are Anchor events in the raw transaction?

No. Both `emit!` and `emit_cpi!` events are produced during execution, as a log line or an inner instruction.

### Which event style survives log truncation?

`emit_cpi!`, because the event is an inner instruction rather than a log line.

### How do I know which IDL to decode an event with?

Use the program that emitted it: the program of the log line, or the program the self-call targets. The CPI event tag is shared by all Anchor programs.

## Where events fall short

Events say only what a program chose to publish, in its own schema, and that schema changes over time. Log events can be truncated, and neither style exists for programs that do not emit events. Events also arrive with execution data, never with the raw transaction. Use them for outcomes, and keep instruction data for what was requested.

## Next steps with events

[Reading an IDL](https://solanashreds.xyz/learn/reading-an-idl) shows where the `events` section lives, and the [bonding curve, as data](https://solanashreds.xyz/learn/pump-fun-bonding-curve) explains the reserves a TradeEvent reports. To capture the requests that lead to these events, [decode a first transaction from raw shreds](https://solanashreds.xyz/docs/quickstart).
