---
title: "Transactions"
description: "getTxHistory and getTxDetail and the one Transaction shape. Paging options. OP_RETURN payloads. Where each output went. What raw is for and when it travels."
canonical_url: "https://explorers.agntn.dev/guide/transactions"
---
# Transactions

> getTxHistory and getTxDetail and the one Transaction shape. Paging options. OP_RETURN payloads. Where each output went. What raw is for and when it travels.

## Two reads, one shape

```ts
const history = await provider.getTxHistory(address, "ethereum", { limit: 10 });
const one = await provider.getTxDetail?.(hash, "ethereum");
```

`getTxHistory` is required on every provider and pages through an address. `getTxDetail` is optional and reads one hash; TONAPI, Blockberry and Aptos don't have it. Both return `Transaction`:

```ts
interface Transaction {
  hash: string;
  blockNumber: number;
  timestamp?: string; // ISO
  from: string; // "" when the explorer names no sender
  to: string | null; // null when the explorer names no recipient
  createdContract?: string; // the deployed contract, from Etherscan and Blockscout
  value: string; // smallest native unit
  valueFormatted: string;
  gasUsed?: string;
  gasPrice?: string;
  fee?: string; // smallest native unit
  status: "success" | "failed" | "pending";
  methodId?: string; // first four bytes of the input
  functionName?: string; // when the explorer decoded it
  isContractInteraction: boolean;
  tokenTransfers: TokenTransfer[]; // the fungible transfers inside this transaction
  opReturn?: OpReturnPayload[]; // Bitcoin family
  inscriptions?: Inscription[]; // detail from mempool and blockstream
  raw?: Record<string, unknown>; // the explorer's own answer
}
```

`to` is `null` whenever the explorer names no recipient, and that is not only a contract creation. Solscan, Helius and Blockberry never name one, because a Solana or Sui transaction has no single receiver; TONAPI names one for a TON or Jetton transfer, Horizon for an operation that moved an asset, Blockchair on Ethereum only, since its Bitcoin, Bitcoin Cash, Litecoin, Dogecoin, eCash and Zcash dashboards carry inputs and outputs instead. eCash Explorer never names the other side at all: a send has a `null` recipient, a receive an empty sender. A deployment is the transaction with `createdContract`: Etherscan and Blockscout report the address the transaction deployed, from `contractAddress` and `created_contract`, and no other provider does. A missing recipient on Arweave is an empty string, because there it means a data upload, not a deployment. `from` has no `null`: when there's no sender to name, it's an empty string. Blockchair's UTXO dashboards never give one, and Blockberry leaves it empty for activity with no account on the other side. A pending transaction has `blockNumber` 0, never a guess at the next height.

## Options

```ts
interface TxHistoryOptions {
  startBlock?: number; // inclusive
  endBlock?: number; // inclusive
  sort?: "asc" | "desc";
  limit?: number; // provider caps apply, 100 on most
  page?: number; // the first page is 1
  tags?: readonly TagFilter[]; // Arweave only, see below
}
```

`clampMaxResults(limit, max)` is what every provider runs the limit through: a missing or zero limit means the provider's maximum, anything else gets rounded and kept between 1 and that maximum. Every provider honours `page`, so build your pager on any of them. Most explorers only hand out a cursor, though. Mempool, Blockstream, Blockscout, Solscan, Helius, TONAPI and Blockberry walk it past the earlier rows themselves, one request per explorer page. That's why they stop at `page * limit <= 1000` and throw past it. Better than page one again, right? TRONSCAN and Blockchair skip rows on their side. TRONSCAN goes up to 10,000 rows, 50 a page, and Blockchair up to a million. The Arweave gateway has the same 1000-row window and wants block bounds for older history, dcrdata takes up to 250 a page and no block bounds at all, Horizon up to 200 and pages up to 10, one request per page walked, and no ledger bounds either.

Need the oldest transactions first, or one block range? Mempool and Blockstream support `sort`, `startBlock` and `endBlock`. They walk a feed that only runs newest first to apply them. A range leaves out mempool transactions, which have no block yet.

Blockscout already shipped the switch for oldest transactions first, so its history honors `sort` across pages. Block bounds throw there. Good riddance to silently ignored options.

Blockchair keeps history newest first, so `sort: "asc"` and block bounds throw before a request costs any API points. No more newest page cosplaying as the oldest.

Helius serves `sort: "asc"` oldest first, using `sort-order=asc` and paging with `after-signature` instead of `before-signature`. Block bounds and order hold across every page, so `page` and `limit` stay inside the requested range. That's worth celebrating: a busy wallet's first transactions get to lead the line.

Solscan history runs newest first. `sort: "asc"` and block bounds now throw before any request, instead of quietly returning the newest rows. That's a welcome error: the end of the list is no longer passed off as the beginning. Use Helius for oldest first or slot ranges.

TONAPI measures event history in logical time, not blocks. `sort: "asc"` sends `sort_order=asc` and pages with `after_lt`. `before_lt` would keep handing back page one. That's a satisfying escape from a very repetitive history. Block bounds throw `ExplorerError` before any request, since an event carries no block to compare.

Blockberry honors `sort` on every history page. `sort: "asc"` sends `orderBy=ASC`, anything else `orderBy=DESC`. Block bounds throw `ExplorerError` before any request, even at `0`. Activity rows have no checkpoint to measure against. Asking for a range used to buy you the whole history, which is generous but wrong.

TRONSCAN sorts history by timestamp. `sort: "asc"` sends `sort=timestamp`, anything else `sort=-timestamp`. Newest comes first by default. Its API bounds the list by time, and no history option here speaks time. `startBlock` and `endBlock` now throw `ExplorerError` before any request, even at `0`. That's better than silently returning the whole history.

The walk covers at most the newest 1000 transactions. A request that needs older rows throws `UnsupportedOperationError`. The newest page pretending to be the oldest isn't useful to anyone.

`tags` is the odd one out. Only Arweave reads it, because there an upload carries whatever labels its author gave it. Each entry is `{ name, values }`. A tag matches any of its values, and every tag has to match:

```ts
await arweave.getTxHistory(address, "arweave", {
  tags: [{ name: "Content-Type", values: ["text/plain"] }],
});
```

That's the author's text posts and nothing else. Why not filter after the read? The window is 1000 rows, and the posts you want can sit behind all of them. A provider without `capabilities.txHistoryTags` ignores the field when you call it directly, so check the flag first. `explorers_tx_history` does that for you and refuses, instead of handing back the whole unfiltered history.

## OP_RETURN

In the Bitcoin family, every provider that hands out the output script decodes it into `opReturn`. That's Mempool, Blockstream, Blockchair, WhatsOnChain, Blockbook and Haskoin. Bitcoin SV's `OP_FALSE OP_RETURN` counts too. Each payload has the pushed bytes as lowercase `hex`. `text` shows up only when those bytes are printable UTF-8. Runes, Omni and other binary carriers keep the hex and skip the text. Nobody wants mojibake handed to them as a message. The CLI prints the text when there's one and the hex otherwise.

Got scripts from somewhere else, say a node dump or a data lake? `parseOpReturn()` reads one output script with no provider in the way:

```ts
import { parseOpReturn } from "@agntn/explorers";

parseOpReturn("6a13636861726c6579206c6f766573206865696469");
// { pushes: [{ hex: "636861726c6579206c6f766573206865696469", text: "charley loves heidi" }], complete: true }
```

Why `complete`? The read stops at the first opcode that isn't a push, or at a push that runs past the end. Whatever came before still comes back. Without the flag those pushes look exactly like a clean script, and that's a lie of omission. So `false` means there's more script than the pushes show.

The rest is short. A script that isn't OP_RETURN gives `undefined`, and a string that isn't hex throws a `TypeError`. An empty push like `OP_0` keeps hex `""` and skips `text`. Nothing there to read.

## Inscriptions

Got a puzzle that hides its clue in an Ordinals inscription? `getTxDetail` from Mempool or Blockstream reads it straight out of the reveal's witness. No indexer involved. Each entry in `inscriptions` names the `input` that carried it, its `contentType` and its `size` in bytes. A compressed body adds `contentEncoding`, usually `br`.

The body comes as `hex`, plus `text` when it's printable. That holds up to 4096 bytes. Past that you get the size and nothing else. Why? A 300 kB image in hex would eat an agent's context for breakfast. The bytes are still in `raw`, in that input's `witness`. History rows skip inscriptions, so ask for the one transaction.

## Where did a transaction's outputs go?

```ts
const outputs = await mempool.getOutspends(
  "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
  "bitcoin",
);
outputs[0]; // { vout: 0, address: null, value: "1000000000", valueFormatted: "10", spent: true, txid: "ea44e972...", vin: 0, blockNumber: 92240 }
```

Each row follows one output, in output order. It gives the output index, address, value and formatted value. If spent, it names the spending transaction, input index and block.

`spent` is `true`, `false`, or `null` when the explorer leaves an output out. Null beats a guess: a missing answer isn't proof that coins are unspent. The address is null for scripts without one, such as P2PK or OP_RETURN. The block is null for an unspent output or a spend waiting in the mempool.

Want to follow Satoshi's payment to Hal in block 170? The two rows tell a good story. The 40 BTC change was spent in block 181. Hal's 10 BTC waited until block 92240.

Mempool serves Bitcoin and Litecoin. Blockstream serves Bitcoin. On Pepecoin, Mempool throws `UnsupportedOperationError` before making a request.

## How to get raw transaction hex

```ts
const hex = await mempool.getTxHex(
  "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
  "bitcoin",
);
hex.slice(0, 20); // "0100000001c997a5e56e"
hex.length / 2; // 275
```

This is the serialized transaction as lowercase hex. It includes signatures and witness data. That's the useful part for a signature reader.

Mempool serves it on Bitcoin, Litecoin and Pepecoin. Blockstream serves it on Bitcoin. Both use Esplora's hex route. A reply that isn't whole bytes of hex throws `ExplorerError`. An unknown txid throws `NotFoundError`. Other providers don't support the method.

Want the bytes in an agent response? Set `hex: true` on `explorers_tx_detail`. Add `raw: true` for the spent output in `raw.vin[i].prevout`. Pass both to `keys_transaction_signatures_extract`. History rows don't carry hex. Ask for one transaction.

The example is Satoshi's payment to Hal Finney. Mempool and Blockstream returned the same 275 bytes. Hash the bytes twice with SHA-256, then reverse the result. You'll get the txid back. Even transaction bytes should show their work.

## Token transfers inside

`tokenTransfers` lists the fungible transfers the explorer attributed to this transaction, each with `contract`, `symbol`, `decimals`, `value`, `valueFormatted`, `from`, `to` and the `txHash`. Etherscan and Blockscout fill it on EVM chains, TONAPI with Jetton transfers minus the failed ones, Koios with Cardano native assets. An address that only ever received tokens from other people has an empty native history and a full [transfer history](https://explorers.agntn.dev/guide/tokens), which is why that read exists on its own.

## raw

The explorer's own answer, untouched, on the transaction that produced it. Not part of the contract and different on every provider, but there for the day you need a field nobody normalized, like every input and output of a Bitcoin transaction. A script gets it in full. The MCP tools drop it unless the call says `raw: true`, and the docs worker drops it before an answer leaves, so the [Explorer](https://explorers.agntn.dev/explorer) never shows it. It's the biggest thing in the object by far, and most callers don't want it.

## Ambiguity

64 hex characters is a hash on Ethereum, on the Bitcoin family, TRON, Cardano, Decred, Stellar and the XRP Ledger. A base58 string of 64 to 88 characters is a hash on Solana, 43 or 44 on Sui.

Arweave addresses and transaction ids share a shape, so `getTxDetail` there needs you to know what you hold. The CLI's `-m detail` is that statement.


## Sitemap

See the full [sitemap](https://explorers.agntn.dev/sitemap.md) for all pages.
