RPC method

eth_getTransactionByHash on Optimism

Supported on SwiftNodes

Everything below was measured on 2026-10-13 by calling eth_getTransactionByHash on Optimism through the same endpoint customers use, and is re-measured weekly.

What eth_getTransactionByHash does

Returns a transaction by its hash: sender, recipient, value, input data, gas fields and signature, plus the block it was included in. It returns null for a hash the node does not know, and a transaction still in the mempool has a null blockNumber.

Transaction types on Optimism

Types of the 228 transactions in five consecutive blocks when we measured. Decoders that reject unknown types will fail on Optimism if any of these is missing from their list.

0x2 EIP-1559200 (88%)
0x0 legacy23 (10%)
0x7e L1-to-L2 deposit (OP Stack)5 (2%)

Fields beyond Ethereum's

Type 0x7e (L1-to-L2 deposit (OP Stack)) transactions carry extra fields. sourceHash: the unique ID of an L1-to-L2 deposit, derived from its L1 origin; mint: the amount of ETH minted on L2 by a deposit; depositReceiptVersion: the version of the deposit receipt format.

Transactions include blockTimestamp, so you get the block time without a second call for the block.

A real Optimism transaction

A type 0x2 transaction from one of the latest blocks, as our endpoint returned it (long hex values shortened).

{
  "type": "0x2",
  "chainId": "0xa",
  "nonce": "0xaf0ca",
  "gas": "0xf4240",
  "maxFeePerGas": "0x4c711e",
  "maxPriorityFeePerGas": "0x4c4b40",
  "to": "0xf9b0c8ee13ae2fc0665764ecbdb417685dea8081",
  "value": "0x0",
  "accessList": [],
  "input": "0xc1019e4f8625352cbb676ace2330",
  "r": "0xab1ea22547003aff4b2d3f81c127e91acebf47387d48c7de80b3b824e17f24ad",
  "s": "0x6b0ab569fa9ebbfab89e943b6cc692227749c294a955d03e42aa8deb853af4bd",
  "yParity": "0x1",
  "v": "0x1",
  "hash": "0x3a47d12d2d8f95e11f1db5564b0879cf3171d8e435e515a5f7f14e56e461f6f5",
  "blockHash": "0x5a65714957fa3f272be4824e74305f58ac0e0d8587568ad4548ac454c984aa27",
  "blockNumber": "0x96d24bd",
  "transactionIndex": "0x1",
  "blockTimestamp": "0x6ace2333",
  "from": "0x33b12dd75f66933acd6438594d80cf91cacdc10b",
  "gasPrice": "0x4c5e31"
}

Example request

curl -s https://rpc.swiftnodes.io/rpc/optimism?key=YOUR_API_KEY \
  -X POST -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByHash","params":["0x3a47d12d2d8f95e11f1db5564b0879cf3171d8e435e515a5f7f14e56e461f6f5"]}'
import { createPublicClient, http } from "viem";

const client = createPublicClient({
  transport: http("https://rpc.swiftnodes.io/rpc/optimism?key=YOUR_API_KEY"),
});

const tx = await client.getTransaction({ hash: "0x3a47d12d2d8f95e11f1db5564b0879cf3171d8e435e515a5f7f14e56e461f6f5" });
if (tx.blockNumber === null) console.log("still pending");
console.log(tx.type, tx.from, tx.to, tx.value);

Other methods on Optimism

eth_getTransactionByHash on other chains

Frequently asked questions

Does Optimism support eth_getTransactionByHash?

Yes. eth_getTransactionByHash answered on the SwiftNodes Optimism endpoint when our weekly probe called it through the customer path (2026-10-13).

Which transaction types does Optimism use?

In five recent blocks: 5 × 0x7e (L1-to-L2 deposit (OP Stack)), 200 × 0x2 (EIP-1559), 23 × 0x0 (legacy).

Why does eth_getTransactionByHash return null on Optimism?

The node does not know the hash: it was never broadcast, it was dropped from the mempool, or it was sent to another chain. Check the hash and the chain ID before retrying.

Optimism endpoints, live block height and WebSocket status are on the Optimism RPC page.

One key covers every chain we serve, and SwiftNodes has a free tier.