> For the complete documentation index, see [llms.txt](https://docs.solscan.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.solscan.io/solscan-api/api-transaction-enhanced-filtering-by-program-instruction.md).

# API Transaction Enhanced - Filtering by Program Instruction

## Filtering by Program Instruction — Developer Reference

**Solscan Pro API** · `GET /v2.0/account/transactions/enhanced`

Full endpoint: [`https://pro-api.solscan.io/v2.0/account/transactions/enhanced`](https://pro-api.solscan.io/v2.0/account/transactions/enhanced)

***

### Overview

`/account/transactions/enhanced` is the upgraded version of `/account/transactions`. It returns raw Solana transaction objects (same structure as `getTransaction` RPC) with full server-side filtering by time, slot, signature range, signer, token, program, and instruction discriminator.

The `instruction` parameter is the focus of this document — it filters transactions by the **leading bytes of instruction data**, which uniquely identifies which instruction was called inside a program.

***

***

### The `instruction[]` Parameter

#### What it does

Filters transactions where at least one instruction matches both a specific **program** and a specific **discriminator**. Works server-side — only matching transactions are returned.

Multiple values use **OR** logic: a transaction matching any of the provided values is included.

#### Format

Every value passed to `instruction[]` follows a single unified format:

`instruction[] = PROGRAM_ADDRESS + DISCRIMINATOR`

The `PROGRAM_ADDRESS` is the base58 program address (44 characters). The `DISCRIMINATOR` identifies which specific instruction within that program — its format depends on how the program was built (see Three Cases below).

`instruction[]=PROGRAM_ADDRESSDISCRIMINATOR`

* Type: `array`
* Required: No
* Max values: 5
* No `program[]` prerequisite — the program address is embedded in the value itself

#### Example from Solscan API

```markdown
<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
  ?address=DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M
  &instruction[]=DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23Mf223c68952e1f2b6
```

Breaking this down:

```markdown
Program address : DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M   (Jupiter DCA)
Discriminator   : f223c68952e1f2b6                                  (8-byte Anchor)
Instruction name: deposit  → sha256("global:deposit")[0..8]
Combined value  : DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23Mf223c68952e1f2b6
```

bash

```markdown
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M
    &instruction[]=DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23Mf223c68952e1f2b6
    &limit=10
    &encoding=jsonParsed' \\
  --header 'token: YOUR_API_KEY'
```

#### Web UI vs API mapping

The Solscan web UI shows a shorter form in the URL (discriminator only):

[`https://solscan.io/account/jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu ?instruction=5f81edf00831df84`](#jupiter-limit-order-juponjaxxgz4rjzxzpmp4oxduvqsqtzzyknqvzynrnu)

The API requires the full combined form (program address + discriminator):

`instruction[]=jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu5f81edf00831df84`

***

### How to Find the Right Hex Value

#### Hex Dictionary

Check Solscan IDL Dictionary to find the hex and program address you want to filter

[Tools](https://solscan.io/tools#idl-dictionary)

#### Case 1 — Anchor Programs (8-byte discriminator)

Anchor programs compute their instruction discriminator using SHA-256:

```
discriminator = sha256("global:" + instruction_name_from_IDL)[0..8]
```

Result: always 8 bytes = 16 hex characters.

> **Critical:** The instruction name must match the IDL exactly — including casing. Jupiter V6 uses camelCase (`sharedAccountsRoute`). Jupiter Limit Order uses snake\_case (`cancel_order`). One wrong character produces a completely different hash with no error.

#### How to compute

**JavaScript / TypeScript:**

```tsx
import { createHash } from 'crypto';

function anchorDiscriminator(instructionName: string): string {
  return createHash('sha256')
    .update(`global:${instructionName}`)
    .digest()
    .slice(0, 8)
    .toString('hex');
}

// Jupiter Limit Order — snake_case
anchorDiscriminator('cancel_order')           // "5f81edf00831df84"
anchorDiscriminator('initialize_order')       // "856e4aaf709ff59f"
anchorDiscriminator('fill_order')             // "e87a7319c78f88a2"

// Jupiter V6 — camelCase
anchorDiscriminator('route')                  // "e517cb977ae3ad2a"
anchorDiscriminator('sharedAccountsRoute')    // "5703feb8e7573909"

// PumpFun — single word
anchorDiscriminator('buy')                    // "66063d1201daebea"
anchorDiscriminator('sell')                   // "33e685a4017f83ad"
anchorDiscriminator('create')                 // "181ec828051c0777"
```

**Python:**

```python
import hashlib

def anchor_discriminator(instruction_name: str) -> str:
    h = hashlib.sha256(f"global:{instruction_name}".encode()).digest()
    return h[:8].hex()
```

#### How to find instruction names from IDL

**Option A — Anchor CLI:**

```bash
anchor idl fetch PROGRAM_ID --provider.cluster mainnet-beta
# Look for instructions[].name in the output
```

**Option B — Solscan Explorer:**

Open `solscan.io/account/PROGRAM_ID` → "Anchor Program" tab → instruction names listed come directly from the on-chain IDL.

**Option C — Program's GitHub:**

Look for `target/idl/<program_name>.json` → `instructions[].name`.

***

#### Case 2 — Native Programs (1-byte enum discriminator)

Native Rust programs do not use Anchor. They route instructions using a simpler scheme — typically a single `u8` byte at position `data[0]`. You cannot compute these with `sha256`.

The hex value must be looked up from the program's source code or from a known on-chain transaction.

#### How to find the hex value from a transaction

**Step 1 — Find a known transaction on Solscan:**

Open a transaction that called the instruction you want. In the instruction detail, find the `data` field (base58-encoded).

**Step 2 — Decode to bytes:**

```tsx
import bs58 from 'bs58';

// 'data' field from instruction in Solscan transaction detail
const dataBase58 = "3Bxs3zzLZLuLQEYX"; // example
const bytes = bs58.decode(dataBase58);

// For Anchor programs: first 8 bytes
const anchorPrefix = Buffer.from(bytes.slice(0, 8)).toString('hex');

// For native programs: first 1 byte
const nativePrefix = Buffer.from(bytes.slice(0, 1)).toString('hex');

console.log('8-byte prefix:', anchorPrefix);
console.log('1-byte prefix:', nativePrefix);
```

**Step 3 — Verify** across multiple transactions of the same type to confirm the prefix is consistent.

#### Summary: Three Cases at a Glance

| Case  | Program type                     | `instruction[]` format                     | Discriminator length | Example                             |
| ----- | -------------------------------- | ------------------------------------------ | -------------------- | ----------------------------------- |
| **1** | Anchor (has IDL)                 | `programAddress` + 8-byte SHA256 hex       | 16 hex chars         | `JUP6Lk...e517cb977ae3ad2a`         |
| **2** | Shank (native Rust + IDL)        | `programAddress` + 1-byte enum index hex   | 2 hex chars          | `metaqb...31`                       |
| **3** | Native, no IDL (Solscan-decoded) | `programAddress` + instruction name string | Variable             | `Tokenk...initializeImmutableOwner` |

***

### Discriminator Reference Tables

#### Anchor Programs

#### Jupiter V6 Aggregator — `JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4`

IDL casing: **camelCase**

| Instruction                          | `instruction[]` value | Description                            |
| ------------------------------------ | --------------------- | -------------------------------------- |
| `route`                              | `e517cb977ae3ad2a`    | Standard multi-hop swap                |
| `sharedAccountsRoute`                | `5703feb8e7573909`    | Swap with shared intermediate accounts |
| `exactOutRoute`                      | `7e2c8ea1d9a65bc6`    | Swap targeting exact output amount     |
| `sharedAccountsExactOutRoute`        | `41d8fa8dac726b69`    | Exact-out with shared accounts         |
| `routeWithTokenLedger`               | `34650f14745e8de8`    | Swap with token ledger tracking        |
| `sharedAccountsRouteWithTokenLedger` | `b4476e37d9cc1af6`    | Combined                               |

```bash
# All Jupiter V6 swaps for a wallet (route or sharedAccountsRoute)
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=WALLET
    &program[]=JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
    &instruction[]=e517cb977ae3ad2a
    &instruction[]=5703feb8e7573909
    &status=1
    &limit=40' \\
  --header 'token: YOUR_API_KEY'
```

***

#### Jupiter Limit Order — `jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu`

IDL casing: **snake\_case**

| Instruction            | `instruction[]` value | Description                  |
| ---------------------- | --------------------- | ---------------------------- |
| `initialize_order`     | `856e4aaf709ff59f`    | Place a new limit order      |
| `cancel_order`         | `5f81edf00831df84`    | Cancel an active limit order |
| `cancel_expired_order` | `d87840eb9b13e563`    | Cancel an expired order      |
| `fill_order`           | `e87a7319c78f88a2`    | Fill (execute) a limit order |
| `update_order`         | `3608d0cf2286efa8`    | Update order parameters      |

```bash
# All limit order placements — matching the Solscan web URL:
# solscan.io/account/jupoNjAxXgZ4...?instruction=5f81edf00831df84
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu
    &instruction[]=5f81edf00831df84' \\
  --header 'token: YOUR_API_KEY'
```

***

#### PumpFun — `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`

IDL casing: **single word / camelCase**

| Instruction | `instruction[]` value | Description                      |
| ----------- | --------------------- | -------------------------------- |
| `buy`       | `66063d1201daebea`    | Buy tokens from bonding curve    |
| `sell`      | `33e685a4017f83ad`    | Sell tokens to bonding curve     |
| `create`    | `181ec828051c0777`    | Create new token + bonding curve |
| `withdraw`  | `b712469c946da122`    | Withdraw after graduation        |
| `setParams` | `a51f8635bdb482ff`    | Set program parameters           |

```bash
# All PumpFun buys for a specific wallet
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=WALLET
    &program[]=6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
    &instruction[]=66063d1201daebea
    &status=1' \\
  --header 'token: YOUR_API_KEY'
```

***

#### PumpSwap AMM — `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA`

| Instruction  | `instruction[]` value | Description                 |
| ------------ | --------------------- | --------------------------- |
| `buy`        | `66063d1201daebea`    | Buy tokens from AMM pool    |
| `sell`       | `33e685a4017f83ad`    | Sell tokens to AMM pool     |
| `createPool` | `f4ec750412003e58`    | Create a new liquidity pool |
| `deposit`    | `f223c68952e1f2b6`    | Add liquidity               |
| `withdraw`   | `b712469c946da122`    | Remove liquidity            |

***

#### Meteora DLMM — `LBUZKhRxPF3XUpBCjp4YzTKgLLjeyegsnkragzgX3e1`

| Instruction              | `instruction[]` value | Description                |
| ------------------------ | --------------------- | -------------------------- |
| `swap`                   | `f8c69e91e17587c8`    | Swap tokens                |
| `addLiquidity`           | `af5dbe403d45f72f`    | Add liquidity to bin range |
| `addLiquidityByWeight`   | `2864ba22a03abda5`    | Add liquidity by weight    |
| `addLiquidityByStrategy` | `3fce7c3284c7f5c7`    | Add liquidity by strategy  |
| `removeLiquidity`        | `42462be955ca6569`    | Remove liquidity           |
| `initializeLbPair`       | `d4ef121058d49273`    | Create new DLMM pool       |
| `claimFee`               | `60de60a26da84b50`    | Claim accumulated fees     |
| `claimReward`            | `4e2e56036289e445`    | Claim pending rewards      |

***

#### OpenBook V2 — `opnb2LAfJYbRMAHHvqjCwQxanZn7ReEHp1k81EohpZb`

| Instruction               | `instruction[]` value | Description               |
| ------------------------- | --------------------- | ------------------------- |
| `placeOrder`              | `c00587a4401d171f`    | Place a new limit order   |
| `placeOrderPegged`        | `e725358372f26354`    | Place a pegged order      |
| `cancelOrder`             | `1b5e0e66de5a0c81`    | Cancel a specific order   |
| `cancelAllOrders`         | `1a89748f328b8970`    | Cancel all open orders    |
| `cancelAllAndPlaceOrders` | `f49de4be55bd8eef`    | Atomic cancel-all + place |
| `settleFunds`             | `90cad55fcdcf1ffd`    | Settle filled order funds |

***

#### Marinade Finance — `MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD`

| Instruction     | `instruction[]` value | Description          |
| --------------- | --------------------- | -------------------- |
| `depositSol`    | `ea2547ee8871ffc4`    | Deposit native SOL   |
| `liquidUnstake` | `5c5668e7895eb4c6`    | Instant unstake      |
| `orderUnstake`  | `c1c8fa8c0007dfdf`    | Delayed unstake      |
| `claim`         | `3ec6d6c1d59f6cd2`    | Claim matured ticket |

***

#### Kamino Lending — `KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD`

| Instruction                 | `instruction[]` value | Description               |
| --------------------------- | --------------------- | ------------------------- |
| `depositReserveLiquidity`   | `c4673dc58e51b79f`    | Deposit to reserve        |
| `borrowObligationLiquidity` | `44808469a09add91`    | Borrow against collateral |
| `repayObligationLiquidity`  | `02fa22eeb7c3175b`    | Repay borrow              |
| `withdrawReserveLiquidity`  | `41ce6575a9d0f7c4`    | Withdraw from reserve     |
| `liquidateObligation`       | `427ece3917fdad5e`    | Liquidate position        |

***

#### Native Programs (1-byte enum)

#### SPL Token — `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`

Values from [official SPL Token source](https://github.com/solana-labs/solana-program-library) — stable since genesis.

| Instruction         | `instruction[]` value | Description                     |
| ------------------- | --------------------- | ------------------------------- |
| `InitializeMint`    | `00`                  | Initialize a new mint           |
| `InitializeAccount` | `01`                  | Initialize a token account      |
| `Transfer`          | `03`                  | Transfer tokens                 |
| `Approve`           | `04`                  | Approve delegate                |
| `MintTo`            | `07`                  | Mint new tokens                 |
| `Burn`              | `08`                  | Burn tokens                     |
| `CloseAccount`      | `09`                  | Close token account             |
| `TransferChecked`   | `0c`                  | Transfer with mint verification |
| `MintToChecked`     | `0e`                  | Mint with verification          |
| `BurnChecked`       | `0f`                  | Burn with verification          |

```bash
# All token transfers (Transfer or TransferChecked) for a wallet
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=WALLET
    &program[]=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
    &instruction[]=03
    &instruction[]=0c
    &status=1' \\
  --header 'token: YOUR_API_KEY'
```

***

#### Raydium AMM V4 — `675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8`

No public IDL. Values from on-chain data analysis.

| Instruction       | `instruction[]` value | Description                   |
| ----------------- | --------------------- | ----------------------------- |
| `swapBaseIn`      | `09`                  | Swap with fixed input amount  |
| `swapBaseOut`     | `0b`                  | Swap with fixed output amount |
| `addLiquidity`    | `03`                  | Add liquidity                 |
| `removeLiquidity` | `04`                  | Remove liquidity              |

```bash
# All Raydium V4 swaps for a wallet
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=WALLET
    &program[]=675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8
    &instruction[]=09
    &instruction[]=0b
    &status=1' \\
  --header 'token: YOUR_API_KEY'
```

***

### Full Request Examples — Combined Filters

#### USDC swaps on Jupiter V6 within a time window

```bash
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=WALLET
    &program[]=JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
    &instruction[]=e517cb977ae3ad2a
    &instruction[]=5703feb8e7573909
    &token[]=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
    &from_time=1720000000
    &to_time=1720086400
    &status=1
    &limit=40
    &encoding=jsonParsed' \\
  --header 'token: YOUR_API_KEY'
```

#### New token launches on PumpFun (program as address)

```bash
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
    &instruction[]=181ec828051c0777
    &status=1
    &limit=40
    &encoding=jsonParsed' \\
  --header 'token: YOUR_API_KEY'
```

#### Market maker order activity on OpenBook V2 with slot range

```bash
curl --request GET \\
  --url '<https://pro-api.solscan.io/v2.0/account/transactions/enhanced>
    ?address=MARKET_MAKER_WALLET
    &program[]=opnb2LAfJYbRMAHHvqjCwQxanZn7ReEHp1k81EohpZb
    &instruction[]=c00587a4401d171f
    &instruction[]=e725358372f26354
    &from_slot=280000000
    &to_slot=285000000
    &limit=40' \\
  --header 'token: YOUR_API_KEY'
```

#### Paginating through results with cursor

```tsx
async function getAllInstructions(address: string, instructionHex: string) {
  const results = [];
  let cursor: string | undefined;

  do {
    const params = new URLSearchParams({
      address,
      'instruction[]': instructionHex,
      status: '1',
      limit: '40',
      ...(cursor ? { cursor } : {})
    });

    const res = await fetch(
      `https://pro-api.solscan.io/v2.0/account/transactions/enhanced?${params}`,
      { headers: { token: API_KEY } }
    );
    const { data } = await res.json();

    if (!data || data.length === 0) break;

    results.push(...data);
    // cursor from last item's slot + signature for next page
    const last = data[data.length - 1];
    cursor = `${last.slot}_${last.transaction.signatures[0]}`;

  } while (true);

  return results;
}
```

***

***

### Choosing the Right Encoding

The `encoding` parameter controls the format of transaction data in the response.

| Value                  | `instruction.data` format                          | Use when                       |
| ---------------------- | -------------------------------------------------- | ------------------------------ |
| `jsonParsed` (default) | Human-readable parsed object (where IDL available) | Exploring data, debugging      |
| `json`                 | Base58 string                                      | Standard RPC-compatible format |
| `base64`               | Base64 string                                      | Compact binary transfer        |
| `base58`               | Base58 string                                      | Legacy compatibility           |

For instruction filtering and data analysis, `jsonParsed` gives the most context. For raw byte inspection (to find discriminators manually), `json` or `base64` and then decoding client-side.
