Skip to content

Solana Instruction Decoding

A Solana transaction is made up of one or more instructions. Each instruction calls a program, passes it data, and lists the accounts the program reads or writes. Without decoding, the instruction data is unreadable, making it impossible to verify what you are approving.

Fordefi decodes Solana instructions using the program's IDL (Interface Description Language file). An IDL is the Solana equivalent of an EVM contract's ABI: it describes a program's instructions, their arguments, and the accounts each instruction expects. With an IDL, Fordefi shows the instruction name, its arguments by name, and a name for every account. Fordefi also shows the account list for programs that have no IDL.

Instruction decoding is available for Solana mainnet in the Fordefi web console, the browser extension, and the mobile app.

To learn more about the sources of Fordefi's IDL cache and the supported formats see Solana IDL Sources.

View a transaction's instructions

The transaction details show an Instructions section with the number of top-level instructions in the transaction, for example Instructions (5).

  • Web console: In the sidebar, click Transactions, and then click a transaction in the list. In the transaction panel, in the Overview tab, scroll down to Instructions (N), below Recipients.

    Instructions section in the Overview tab of the transaction panel in the web console
  • Browser extension and mobile app: In the transaction screen, next to Transaction details, tap Instructions (N). The Instructions page opens.

    Instructions link in the transaction details screen of the mobile app

The counter counts top-level instructions only. It doesn't include inner instructions.

Use the Instruction # dropdown to switch between instructions. On the Instructions page, instruction #1 is selected when you first open the page. On the mobile app, tapping the dropdown opens a bottom sheet.

Each entry in the dropdown is shown as #N Program name: Instruction name, for example #1 Manifest CLOB Program: Swap. You can search the dropdown by instruction name.

Web console:

Instruction dropdown in the web console, listing instructions with indented inner instructions

Mobile app:

View instructions bottom sheet in the mobile app

Instruction details

For the selected instruction, Fordefi shows these details:

  • Instruction name: The name of the instruction, as written in the program's IDL, for example Swap. Shown as Unknown when the program has no IDL.
  • Program name: The name of the program, for example Manifest CLOB Program.
  • Program ID: The address of the program.
  • Address name: The name of the program's address in your Address Book, when it exists.
  • DApp name: The DApp the program belongs to, when known.

Accounts

The Accounts (N) list shows every account that the instruction uses, in the order the program expects them. For each account, Fordefi shows:

  • Account name: The name of the account slot in the program's IDL, for example Payer or Market. When the program has no IDL, the account is shown as Account #1, Account #2, and so on.
  • Roles: One or more role labels. See Account roles.
  • Label: The Address Book contact, vault, or DApp that the address belongs to. When Fordefi doesn't recognize the address, the shortened address is shown.

Account roles

  • SIGNER: The account signs the transaction.
  • WRITABLE: The instruction can change the account.
  • FEE PAYER: The account pays the transaction fee. It is always the first account in the transaction, and is always a signer and writable.
  • PROGRAM: The account is a program that the instruction invokes. This role is evaluated per instruction, because the same account can be a program in one instruction and an ordinary account in another.

Roles are read directly from the transaction, so they appear for every instruction, whether or not the program has an IDL. If the transaction uses address lookup tables, Fordefi resolves them, so the list always shows the full addresses.

Inner instructions

A program can call other programs while it runs. For example, a swap program doesn't move tokens itself, it calls the SPL Token program to do it. These calls are known as cross-program invocations (CPIs). They are not part of the transaction you sign, but they affect your assets, and you can't see them in the signed data.

When Fordefi can observe them, inner instructions appear in the Instruction # dropdown, indented beneath the instruction that triggered them and numbered accordingly, for example #2.1 and #2.2. They are expanded by default. Each inner instruction has the same details, accounts, and data as a top-level instruction, and is decoded when the called program's IDL is available.

  • Before signing: Inner instructions come from Fordefi's simulation of the transaction. If the simulation fails, inner instructions aren't shown.
  • After the transaction is mined: Inner instructions come from the mined transaction.

Data

The Data section shows the instruction's data, with a toggle between Decoded and Raw.

  • Decoded: The instruction's arguments, by name, for example inAtoms: 10,000. Arguments that contain other values, such as structures and lists, are shown nested with indentation. When an argument is an address, Fordefi shows the Address Book, vault, or DApp name it belongs to. The decoded view is the default.
  • Raw: The instruction's data as a hexadecimal string, which you can copy with Copy.

When the program has no IDL, or decoding fails, there is nothing to decode. The Decoded option is disabled and the Raw view is shown by default.

Batches of transactions

When a DApp requests several Solana transactions at once, the browser extension shows them as a single transaction, titled N Solana transactions, with all the instructions in one list. Instructions are numbered sequentially across the whole batch. For example, two transactions with five instructions each show instructions #1 through #10, not #1 through #5 twice.

Policies

Instruction decoding gives you visibility into what a transaction does. Policy rules don't yet match on decoded Solana instruction data.