Transaction simulation (eth_call + gas)

$0.005 per call · USDC via x402 · POST /api/tx-simulate

Dry-run a prospective smart-contract call or transaction without broadcasting it: executes eth_call and eth_estimateGas against the latest block over the same keyless multi-endpoint public RPC pool as /api/evm-rpc (ethereum, base, polygon, arbitrum, optimism). Send POST /api/tx-simulate with the required field to and pay $0.005 per call over x402 or MPP (there is no free tier). It returns a JSON object with network, success, returnData, gasEstimate and revertReason.

Returns the return data and a gas estimate on success, or {success:false} with the revert reason when the call would fail. Strictly read-only - nothing is signed or broadcast.

Category: Crypto & onchain data · Tags: crypto simulation eth_call gas transaction evm dry-run smart-contract

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
tostringyes0x-prefixed 40-char target contract/account address. Also accepted as target, dest, destination, end.
datastringno0x-prefixed calldata (default 0x - plain value transfer).
fromstringnoOptional sender address (default zero address).
valuestringnoOptional value in wei - decimal string or 0x hex (default 0).
networkstringnoethereum / base / polygon / arbitrum / optimism (default base).

Example request

curl -i -X POST https://agent402.tools/api/tx-simulate \
  -H "Content-Type: application/json" \
  -d '{"network":"base","to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","data":"0x70a08231000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d0"}'

Without payment this returns HTTP 402 Payment Required with the exact price for tx-simulate; any x402 v2 or MPP client pays it and retries.

Example response

{
  "network": "base",
  "success": true,
  "returnData": "0x00000000000000000000000000000000000000000000000000000000000f4240",
  "gasEstimate": 31234,
  "revertReason": null
}
FieldTypeAlways presentIn the example
networkstringyesbase
successbooleanyestrue
returnDatastringyes0x00000000000000000000000000000000000000000000000000000000000f4240
gasEstimatenumberyes31234
revertReasonnullnonull

From an MCP client

catalog.call {
  "slug": "tx-simulate",
  "params": {
    "network": "base",
    "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "data": "0x70a08231000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d0"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for tx-simulate; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/tx-simulate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "network": "base",
    "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "data": "0x70a08231000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d0"
  }),
});

Part of these workflows

Transaction simulation (eth_call + gas) is one step in this skill pack, each sold as a single call:

Related tools

Calldata decoder (ABI or selector DB)

$0.003 · POST /api/calldata-decode

Decode EVM smart-contract transaction calldata into the function name and typed parameters. Supply an ABI (from /api/con…

Gas snapshot (slow / standard / fast)

$0.005 · POST /api/gas-snapshot

Live gas price snapshot for a chain - slow / standard / fast tiers in gwei, plus the latest base fee. Sampled from eth_f…

Transaction receipt (decoded transfers)

$0.003 · POST /api/tx-receipt

Full receipt for a transaction hash in one call: status, block, from/to, value, gas used vs limit, effective gas price, …

Block info

$0.001 · GET /api/block-info

Header-level detail for one block on Ethereum, Base, Polygon, Arbitrum, or Optimism: hash, timestamp (unix + ISO), trans…

Block receipts (one block, summarised)

$0.005 · POST /api/block-receipts

Every transaction receipt in one block, fetched as a single upstream read and summarised: tx count, succeeded vs failed,…

Chain info snapshot

$0.001 · GET /api/chain-info

One-call chain state snapshot: chain id, latest block number, and current gas price (wei + gwei) for Ethereum, Base, Pol…