# RPCX Method Language Reference

> Every step, function, operator, param type, and rule of the RPCX method language, each with its syntax and an example on the live tables.

Canonical: https://nolimitnodes.com/docs/api-reference/rpcx/language

This page lists everything the RPCX method language accepts, so you can write a method without a coding agent. Each step and function has its syntax, what it does, and an example. Every full method on this page reads the [live tables](/docs/api-reference/rpcx/tables) and takes a list of wallets, so one call covers many addresses.

For a shorter introduction and the rules for live tables, see [Writing methods](/docs/api-reference/rpcx/writing-methods). To find tables and columns, see [Live tables](/docs/api-reference/rpcx/tables) and [All tables](/docs/api-reference/rpcx/all-tables). For one example per table, see [Examples by table](/docs/api-reference/rpcx/popular-tables).

## The shape of a method

A method is a header followed by a body in braces.

```text RPCX method
# Transactions of many wallets in a time window, newest first.
method walletTxs(
  wallets: pubkey[] "Wallet addresses",
  from: time "Start (UTC)",
  to: time "End (UTC)",
  limit: uint64 = 100 "Max rows",
) {
from live_transactions
filter (address | in wallets) && ts >= from && ts () {`. The name is 1 to 64 letters, digits, or underscores. You call the method as `rpcx_`. Use `()` for a method with no params.
- **Body:** a pipeline, one step per line. It starts with `from` and ends before the closing `}`. Each step works on the rows from the step before.
- **Comments:** a `#` starts a comment that runs to the end of the line, in the header or the body.
- The last `}` in the text closes the method. Nothing may follow it except blank lines.

## Params

Params go between the parentheses, separated by commas. They may span several lines, and a trailing comma is allowed.

```text
name: type
name: type = default
name: type = default "Description"
name?: type
```

- A param name starts with a letter or `_`, then letters, digits, or `_`. Each name is used once.
- A param is required unless it has a default.
- A default is a number, a double-quoted string, `true`, or `false`. It must fit the type: a `uint64` default is a whole number of 0 or more, and a `time` default is a string such as `"2026-11-15"`.
- The description is a double-quoted string and always comes last. It is saved with the method.
- `name?: type` marks a param as optional with no default. A call that leaves it out, or passes `null`, gets `null` for it. See [Optional filters](#optional-filters).

### Param types

| Type | Accepts | Example value |
|---|---|---|
| `pubkey` | A base58 Solana address (32 bytes) | `"ARu4n5mFdZogZAravu7CcizaojWnS6oqka37gdLT5SZn"` |
| `signature` | A base58 transaction signature (64 bytes) | `"2bZ38WCx2c6kyf7GFpnviH8TtbBJbGwvscaUiojjLYk6THFg2aNA6fh2cPDgyGdK8uwUQc6iFgk4VMUKtPTbRRVm"` |
| `string` | Any text | `"pump"` |
| `uint64` | An integer from 0 to 2^64 - 1 | `100` |
| `int64` | A signed 64-bit integer | `-5` |
| `float64` | A number | `0.5` |
| `bool` | `true` or `false` | `true` |
| `time` | A UTC time, as RFC 3339 or `YYYY-MM-DD`. `datetime` and `timestamp` are other names for this type. | `"2026-11-15 00:00:00"`, `"2026-11-15T00:00:00Z"`, `"2026-11-15"` |
| `pubkey[]` | A list of addresses | `["ARu4n5mFdZogZAravu7CcizaojWnS6oqka37gdLT5SZn", "EKmzDJWkajsqLMkY5WLWts9iUgqHCQny6hhd77fcQGN"]` |
| `signature[]` | A list of transaction signatures | `["2bZ38WCx2c6kyf7GFpnviH8TtbBJbGwvscaUiojjLYk6THFg2aNA6fh2cPDgyGdK8uwUQc6iFgk4VMUKtPTbRRVm"]` |
| `string[]` | A list of texts | `["a", "b"]` |
| `uint64[]` | A list of integers from 0 to 2^64 - 1 | `[1, 2, 3]` |

`pubkey` and `signature` values are checked when the method runs, also inside lists. A value, or a default, that is not valid base58 of the right length is refused. An empty string is not a valid `pubkey`.

### List params

A list param holds many values in one param. A call passes it as a JSON array, with up to 1,000 values. Use it with `in`:

```text
filter (address | in wallets)
```

This is how a method reads many addresses at once. RPCX reads every address in the list in the same run, so pass all of them in one call instead of calling the method once per wallet. `filter address in wallets`, without the pipe, means the same.

### Using params in the body

There are three ways to refer to params and columns:

| Write | Means |
|---|---|
| `wallet` | The param `wallet`, when a param has that name. Otherwise the column. |
| `$wallet` | Always the param `wallet`. The check fails if no param has that name. |
| `this.owner` | Always the column `owner`, even when a param is also named `owner`. |

In `filter address == wallet`, `address` is a column and `wallet` is the param. `live_token_balance_changes` has a column named `owner`, so a method on it that also has an `owner` param writes `this.owner` for the column:

```text RPCX method
method tokenMovesOfOwner(wallets: pubkey[], owner: pubkey, from: time, to: time) {
from live_token_balance_changes
filter (address | in wallets) && ts >= from && ts ` | `uint64` |
| The right side of `in`, against an address column, as in `(address \| in wallets)` | `pubkey[]` |
| Compared with a column, as in `address == wallet` or `ts >= start` | The column's type: a `String` address column gives `pubkey`, `sig` gives `signature`, `DateTime` gives `time`, `UInt*` gives `uint64`, `Int*` gives `int64`, `Float*` gives `float64` |
| Named `from`, `to`, `start`, `end`, `since`, `until`, `after`, `before`, or ending in `_time`, `_at`, `_ts`, `_date` | `time` |
| Named `limit`, `count`, `n`, `offset`, or starting with `min_` or `max_` | `uint64` |
| Named like an address, such as `wallet`, `owner`, `mint`, `pool`, `user`, `authority`, `program` | `pubkey` |
| Named `sig`, `signature`, or ending in `_sig` or `_signature` | `signature` |
| Anything else | `string` |

Params from code are always required. Add a default in the **Params** tab to make one optional.

### Optional filters

To let callers skip a filter, mark the param with `?` and test it for `null`:

```text RPCX method
method tokenMoves(
  wallets: pubkey[] "Wallets",
  token?: pubkey "Token mint. Leave it out for all tokens.",
  from: time "Start (UTC)",
  to: time "End (UTC)",
) {
from live_token_balance_changes
filter (address | in wallets) && ts >= from && ts = from && ts 
from  = 
```

The alias gives the table a short name, which you need with `join`. Table names come from `list_tables`, from [Live tables](/docs/api-reference/rpcx/tables), or from the **Code** tab, which lists them when you type `from `.

Every read of a live table needs a key or a bounded range in the `filter` right after `from`: a key such as `address`, `sig`, `program` on `live_instructions`, or `owner` on `live_token_accounts`, or on a chain table a `ts` or `slot` range. Add a `ts` range to every read by address. See [Keys and ranges](/docs/api-reference/rpcx/tables#keys-and-ranges).

```text RPCX method
method firstTxs(wallets: pubkey[], from: time, to: time) {
from t = live_signatures
filter (t.address | in wallets) && t.ts >= from && t.ts 
```

Join conditions with `&&` (and) and `||` (or). Several `filter` lines in a row act like one filter joined with `&&`.

```text RPCX method
method costlyTxs(wallets: pubkey[], from: time, to: time, min_fee: uint64 = 100000) {
from live_transactions
filter (address | in wallets) && ts >= from && ts = min_fee && success
select {address, ts, sig, fee, compute_units}
}
```

Put the key or range in the first filter, right after `from`.

### `derive`

Add computed columns and keep all the others.

```text
derive { = , ...}
```

A new column can be used by the steps after it, including later columns in the same `derive`.

```text RPCX method
method feePerCompute(wallets: pubkey[], from: time, to: time) {
from live_transactions
filter (address | in wallets) && ts >= from && ts  0
derive {
  fee_sol = fee / 1000000000,
  lamports_per_cu = fee / compute_units
}
select {ts, sig, fee_sol, lamports_per_cu}
take 20
}
```

### `select`

Keep only the listed columns, in that order. A column can be renamed or computed.

```text
select {,  = , ...}
```

```text RPCX method
method txsShort(wallets: pubkey[], from: time, to: time) {
from live_transactions
filter (address | in wallets) && ts >= from && ts , -, ...}
```

```text RPCX method
method newestTxs(wallets: pubkey[], from: time, to: time) {
from live_signatures
filter (address | in wallets) && ts >= from && ts 
take ..
take 
```

`take 10` keeps the first 10 rows. `take 11..20` keeps rows 11 to 20: the count starts at 1 and both ends are included. `take limit` uses a param, which must be `uint64` or `int64`.

```text RPCX method
method secondPageOfTxs(wallets: pubkey[], from: time, to: time) {
from live_signatures
filter (address | in wallets) && ts >= from && ts  = , ...}
group {, ...} ()
```

Without `group`, `aggregate` returns one row for all rows:

```text RPCX method
method txStats(wallets: pubkey[], from: time, to: time) {
from live_transactions
filter (address | in wallets) && ts >= from && ts = from && ts = 10
sort {-txs}
take limit
}
```

- A `filter` after the group filters the grouped rows, for example `filter txs >= 10`.
- `group` can also hold `sort` and `window`. See [`window`](#window).
- `group {} (take 1)` keeps one row per value. See [One row per value](#one-row-per-value).
- `group {} (sort {...} | take 3)` keeps the top 3 rows per value. See [Top rows per group](#top-rows-per-group).
- The aggregate functions are listed in [Aggregate functions](#aggregate-functions).

### `join`

Add the columns of a second table to each row, where a condition matches.

```text
join  =  (==)
join  =  ()
join side:  =  ()
```

- `(==sig)` joins rows where the column `sig` is equal on both sides.
- A condition can compare any columns, for example `(c.sig == t.sig)`. In a condition, `this` is the table before the join and `that` is the joined table: `(this.sig == that.sig)`.
- `side` sets which rows are kept. `inner`, the default, keeps rows that match on both sides. `left` keeps every row from the first table. `right` keeps every row from the joined table. `full` keeps every row from both.
- Give both tables an alias and use it for the columns, such as `c.ts`. Columns with the same name in both tables are ambiguous without one.

Each live table in a join needs its own key or range. Read the second table in a `let`, or in a pipeline in parentheses, with its own filter, then join it. This adds the fee and fee payer of the transaction to each token balance change:

```text RPCX method
method tokenMovesWithFee(wallets: pubkey[], from: time, to: time) {
let txs = (
  from live_transactions
  filter (address | in wallets) && ts >= from && ts = from && c.ts )
window rows:.. ()
window range:.. ()
window rolling: ()
window expanding:true ()
```

The pipeline inside is a `derive` that uses [window functions](#window-functions) or [aggregate functions](#aggregate-functions). Sort first. Inside `group`, the window restarts for each group.

A moving average of the fee over the current row and the two before it:

```text RPCX method
method movingAverageFee(wallet: pubkey, from: time, to: time) {
from live_transactions
filter address == wallet && ts >= from && ts ..` | From `a` rows before to `b` rows after the current row. `0` is the current row, negative numbers are before it. | `window rows:-2..0 (derive {avg3 = average fee})` |
| `range:..` | Rows whose sort value is between the current value plus `a` and plus `b`. Sort by one number column, such as `slot`. | `window range:-1..0 (derive {near = count this})` |
| `rolling:` | The current row and the `n - 1` rows before it | `window rolling:3 (derive {avg3 = average fee})` |
| `expanding:true` | Every row from the first to the current one: a running total | `window expanding:true (derive {running = sum change})` |

A running SOL balance change per wallet, with `expanding:true` inside `group`:

```text RPCX method
method runningSol(wallets: pubkey[], from: time, to: time) {
from live_sol_balance_changes
filter (address | in wallets) && ts >= from && ts , ...} (take 1)
```

```text RPCX method
method mintsMoved(wallets: pubkey[], from: time, to: time) {
from live_token_balance_changes
filter (address | in wallets) && ts >= from && ts = from && ts  = ()
let  =  -> 
```

Use a relation with `from `. A relation that reads a live table needs its key or range inside the `let`, right after its `from`.

```text RPCX method
method failedTxCount(wallets: pubkey[], from: time, to: time) {
let failed = (
  from live_signatures
  filter (address | in wallets) && ts >= from && ts `:

```text RPCX method
method feesInSol(wallets: pubkey[], from: time, to: time) {
let sol = x -> x / 1000000000
from live_transactions
filter (address | in wallets) && ts >= from && ts ` | Number of distinct values | `count_distinct sig` |
| `sum` | `sum ` | Sum of the values | `sum fee` |
| `average` | `average ` | Mean of the values | `average fee` |
| `min` | `min ` | Smallest value | `min ts` |
| `max` | `max ` | Largest value | `max fee` |
| `first` | `first ` | A value from one row of the group. Which row is not guaranteed: a `sort` before `group` does not set it. | `first sig` |
| `last` | `last ` | A value from one row of the group. As with `first`, which row is not guaranteed. | `last sig` |

To get the time of the first or last transaction, use `min ts` or `max ts`.

### Window functions

Use these inside `window (derive {...})`, after a `sort`.

| Function | Syntax | What it does | Example |
|---|---|---|---|
| `row_number` | `row_number this` | Row number in the window, starting at 1 | `row_number this` |
| `rank` | `rank ` | Rank in sort order. Ties share a rank, and the next rank skips: 1, 1, 3. | `rank ts` |
| `rank_dense` | `rank_dense ` | Rank in sort order without gaps after ties: 1, 1, 2. | `rank_dense ts` |

### Math functions

| Function | Syntax | What it does | Example |
|---|---|---|---|
| `math.round` | `math.round  ` | Round to the given number of decimal digits | `math.round 2 (fee / 1000000000)` |
| `math.abs` | `math.abs ` | Absolute value | `math.abs change` |
| `math.floor` | `math.floor ` | Round down to an integer | `math.floor (change / 1000000)` |
| `math.ceil` | `math.ceil ` | Round up to an integer | `math.ceil (change / 1000000)` |
| `math.pow` | `math.pow  ` | `x` to the power of `exponent` | `math.pow 2 fee` |
| `math.sqrt` | `math.sqrt ` | Square root | `math.sqrt fee` |
| `math.exp` | `math.exp ` | e to the power of `x` | `math.exp 1` |
| `math.ln` | `math.ln ` | Natural logarithm | `math.ln fee` |
| `math.log10` | `math.log10 ` | Base 10 logarithm | `math.log10 fee` |
| `math.log` | `math.log  ` | Logarithm in the given base | `math.log 2 fee` |

### Text functions

The text to work on is always the last argument.

| Function | Syntax | What it does | Example |
|---|---|---|---|
| `text.lower` | `text.lower ` | Lower case | `text.lower signer` |
| `text.upper` | `text.upper ` | Upper case | `text.upper signer` |
| `text.trim` | `text.trim ` | Remove spaces at both ends | `text.trim " pump "` |
| `text.ltrim` | `text.ltrim ` | Remove spaces at the start | `text.ltrim " pump"` |
| `text.rtrim` | `text.rtrim ` | Remove spaces at the end | `text.rtrim "pump "` |
| `text.length` | `text.length ` | Number of characters | `text.length signer` |
| `text.extract` | `text.extract   ` | Part of the text, from `start` (counting from 1), `length` characters long | `text.extract 1 4 signer` |
| `text.replace` | `text.replace   ` | Replace every occurrence of `pattern`. The pattern is plain text. | `text.replace "pump" "" mint` |
| `text.starts_with` | `text.starts_with  ` | True if `s` starts with `prefix` | `text.starts_with "So1" mint` |
| `text.contains` | `text.contains  ` | True if `s` contains `part` | `text.contains "pump" mint` |
| `text.ends_with` | `text.ends_with  ` | True if `s` ends with `suffix` | `text.ends_with "pump" mint` |

### Date functions

| Function | Syntax | What it does | Example |
|---|---|---|---|
| `date.trunc` | `date.trunc  ` | Round a time down to the start of its `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, or `"year"`. The unit is a string. | `date.trunc "hour" ts` |
| `date.diff` | `date.diff   ` | Whole units from `start` to `end`. The unit is a bare word: `second`, `minute`, `hour`, `day`, `week`, `month`, or `year`. | `date.diff second from ts` |
| `date.to_text` | `date.to_text  ` | Format a time as text with strftime codes, such as `%Y`, `%m`, `%d`, `%H`, `%M`, `%S` | `date.to_text "%Y-%m-%d %H:%M" ts` |

### Other functions

These two are used with a pipe, `|`. Inside `{...}`, such as in `derive` or `select`, put the whole expression in parentheses.

| Function | Syntax | What it does | Example |
|---|---|---|---|
| `in` | ` \| in ..` or ` \| in [, ...]` | True if `x` is in the range, both ends included, or in the list | `(fee \| in 5000..100000)` |
| `as` | ` \| as ` | Convert to a type: `DOUBLE`, `BIGINT`, `UBIGINT`, `HUGEINT`, `VARCHAR`, or `BOOLEAN`. `Float64`, `Int64`, `UInt64`, `Int128`, and `String` also work. | `(fee \| as Float64)` |

In a `filter`, `in` takes a list param, a literal list, or a range:

```text RPCX method
method txsOfTwoWallets(from: time, to: time) {
from live_signatures
filter (address | in [
  "ARu4n5mFdZogZAravu7CcizaojWnS6oqka37gdLT5SZn",
  "EKmzDJWkajsqLMkY5WLWts9iUgqHCQny6hhd77fcQGN",
]) && ts >= from && ts ` | Greater than | `fee > 0` |
| `>=` | Greater than or equal | `fee >= 10000` |
| ` 5000` |
| `\|\|` | Or | `fee == 0 \|\| compute_units == 0` |
| `!` | Not | `!(fee > 5000)` |
| `+` | Add | `pre_amount + change` |
| `-` | Subtract, or negate | `post_amount - pre_amount` |
| `*` | Multiply | `fee * 2` |
| `/` | Divide. The result is always a decimal number, even for two integers. | `fee / 1000000000` |
| `//` | Integer division: the whole part of the result | `slot // 1000` |
| `%` | Remainder | `slot % 4` |
| `??` | The right side when the left side is `null` | `null ?? 0` |
| `~=` | Regular expression match | `signer ~= "^So1"` |

Use parentheses when in doubt about the order: `(a + b) * c`.

### Literals

| Kind | Form | Example |
|---|---|---|
| Integer | Digits. `_` may separate groups. | `1_000_000` |
| Decimal number | Digits with a `.`, or with an exponent | `1.5e3` |
| String | Double quotes | `"So11111111111111111111111111111111111111112"` |
| Boolean | `true` or `false` | `true` |
| Null | `null` | `null` |
| Date | `@` and `YYYY-MM-DD` | `@2026-11-15` |
| Date and time | `@` and `YYYY-MM-DDTHH:MM:SS`, in UTC | `@2026-11-15T12:30:00` |
| Range | `..`, both ends included. Used by `in`, `take`, and `window`. | `(slot \| in 380000000..380000100)` |
| List | `[, ...]`. Used by `in`. | `(slot % 4 \| in [0, 1])` |

A date literal can replace a `time` param, for example `filter ts >= @2026-11-15 && ts ` for a default.

```text
case [ => , ..., true => ]
```

```text RPCX method
method feeSizes(wallets: pubkey[], from: time, to: time) {
from live_transactions
filter (address | in wallets) && ts >= from && ts = 1000000 => "large",
    fee >= 10000 => "medium",
    true => "small",
  ],
}
select {ts, sig, fee, size}
take 20
}
```

To count the rows for each `case` value, `group` by the new column:

```text RPCX method
method feeSizeCounts(wallets: pubkey[], from: time, to: time) {
from live_transactions
filter (address | in wallets) && ts >= from && ts = 1000000 => "large",
    fee >= 10000 => "medium",
    true => "small",
  ],
}
group {size} (aggregate {txs = count this})
}
```

## Names and columns

- Strings use double quotes.
- A column with the same name as a param needs `this.`: `this.owner`. See [Using params in the body](#using-params-in-the-body).
- After a `join`, write `.`. Give an output column a clear name when both tables have it, for example `tx_ts = t.ts`.
- A new column named like a function, such as `sum`, `min`, `count`, or `neg`, cannot be used by a later step: the check fails with `Ambiguous name`. Pick another name, such as `total` or `txs`.
- Amounts are raw integers. SOL amounts are in lamports. Token amounts are in base units: divide by `10^decimals` yourself.

## The time range

The chain tables hold the latest Solana data, up to the newest blocks. On a read by address, add a `ts` range:

```text
filter (address | in wallets) && ts >= from && ts = start && slot = from && ts  1, true => 0],
  own_fee = case [signer == address => fee, true => 0],
}
group {address} (
  aggregate {
    txs = count this,
    failures = sum failed,
    first_tx = min ts,
    last_tx = max ts,
    fees_paid = sum own_fee
  }
)
sort {-txs}
}
```

For the single transactions, see the `walletTxs` method at the top of this page.

### Who pays for your wallets' transactions

```text RPCX method
# Fee payers other than the wallet itself, per wallet.
method feePayers(
  wallets: pubkey[] "Wallet addresses",
  from: time "Start (UTC)",
  to: time "End (UTC)",
  limit: uint64 = 50 "Max rows",
) {
from live_transactions
filter (address | in wallets) && ts >= from && ts = from && ts = from && ts  0
group {address, mint} (
  aggregate {
    receipts = count this,
    received = sum change,
    last_receipt = max ts
  }
)
sort {address, -receipts}
}
```

### Balances and holdings now

```text RPCX method
# SOL balance and number of token holdings per wallet, right now.
method walletSnapshot(wallets: pubkey[] "Wallet addresses") {
let holdings = (
  from live_token_accounts
  filter (owner | in wallets)
  filter amount > 0
  group {owner} (aggregate {tokens = count this})
)
from a = live_accounts
filter (a.address | in wallets)
join side:left h = holdings (a.address == h.owner)
select {a.address, sol = a.lamports / 1000000000, tokens = h.tokens ?? 0}
sort {-sol}
}
```

A wallet with no token holdings gets `tokens` = `0`. An address with no account on chain returns no row.

### Number each wallet's transactions

```text RPCX method
# Each wallet's transactions in a window, numbered in time order.
method txsNumberedPerWallet(
  wallets: pubkey[] "Wallet addresses",
  from: time "Start (UTC)",
  to: time "End (UTC)",
  limit: uint64 = 200 "Max rows",
) {
from live_signatures
filter (address | in wallets) && ts >= from && ts = from && ts < to
group {address} (
  sort {-fee}
  take 3
)
select {address, ts, sig, fee}
sort {address, -fee}
take limit
}
```

`take 3` inside `group` keeps the first 3 rows of each wallet, in the order of the `sort` before it. Change `3` to keep more or fewer rows per wallet.
