EIPs Explained

EIP-8072 · Draft · Interface · 2025-10-31

EIP-8072: Transaction Inclusion Subscription

Adds a transactionInclusion subscription to eth_subscribe, so a client can submit a transaction and be pushed its receipt when it lands, or until finality, instead of polling for receipts.

What problem does it solve?

The usual way to send a transaction is eth_sendRawTransaction, then call eth_getTransactionReceipt again and again until it returns something. That adds latency and wastes requests. EIP-7966 proposes eth_sendRawTransactionSync, which blocks one HTTP request until the receipt is ready, but that ties up a connection per transaction and needs careful timeouts.

EIP-8072 uses the push mechanism clients already have, eth_subscribe over WebSocket. One connection can watch many transactions without blocking, and the node notifies the client when something happens.

How it works

A new subscription type, transactionInclusion, takes an object with exactly one of:

  • transaction: a signed raw transaction. The node submits it (same rules as eth_sendRawTransaction) and starts watching. If submission fails, no subscription is created and an error is returned.
  • hash: a transaction hash to watch, for transactions sent some other way.

Providing both or neither returns error -32602 (Invalid params).

An optional includeReorgs (default false) controls how long the subscription lives:

  • false: one "included" notification with the full receipt, then the node unsubscribes automatically.
  • true: the node keeps watching. It sends "reorged" if the transaction drops out of the canonical chain, "included" again if it is re-included, and "finalized" when its block is finalized, then unsubscribes.

If the transaction is already included when you subscribe, the notification is sent immediately. If a watched hash is unknown, the subscription stays open and waits.

Sample code

Submit and wait, over a raw WebSocket:

const ws = new WebSocket(process.env.WS_URL!);

ws.onopen = () => ws.send(JSON.stringify({
  jsonrpc: "2.0",
  id: 1,
  method: "eth_subscribe",
  params: ["transactionInclusion", { transaction: signedTx, includeReorgs: true }],
}));

ws.onmessage = (ev) => {
  const msg = JSON.parse(ev.data);
  if (msg.method !== "eth_subscription") return;
  const { status, receipt } = msg.params.result;
  if (status === "included") console.log("included in", receipt.blockNumber);
  if (status === "reorged") console.log("reorged out, waiting...");
  if (status === "finalized") console.log("final, status", receipt.status);
};

A notification looks like:

{
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "params": {
    "subscription": "0x1234567890abcdef",
    "result": {
      "status": "included",
      "blockHash": "0x...",
      "blockNumber": "0x...",
      "transactionIndex": "0x...",
      "receipt": { "transactionHash": "0x...", "status": "0x1", "gasUsed": "0x...", "logs": [] }
    }
  }
}

Things to know

  • Status: Draft. Field names and behaviour may still change, and nodes that have not implemented it return a standard "unsupported subscription" error, so keep a polling fallback.
  • It needs a WebSocket (or other subscription-capable) connection; plain HTTP JSON-RPC cannot receive pushes.
  • With includeReorgs: false, "included" does not mean final; the transaction can still be reorged out.
  • Subscribing by hash tells the node operator you care about that transaction, the same privacy exposure as polling for its receipt.
  • It is an alternative to the synchronous approach in EIP-7966; a node could support both.

#json-rpc #websocket #transactions #interface #wallet

Details

Authors
Łukasz Rozmej (@LukaszRozmej)
Status
Draft
Type
Standards Track / Interface
Created
2025-10-31

Machine-readable: Markdown · JSON