81trust / 100

Base Simulate

by base-simulate in Onchain & crypto

x402 APIPassing, checked 1 h ago

Simulate a Base mainnet transaction before sending it - will it succeed, estimated gas, and the decoded revert reason if it would fail.

POST https://x402.agentindex.world/base/simulate

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
84 ms typical, 84 ms slowest 5%
Last check
1 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://x402.agentindex.world/base/simulate" \
  -H "content-type: application/json" \
  -d '{"data":"0x313ce567","from_address":"0xb3F32bdfe8D07825BC0D7387295aB1D7559BA69d","to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fx402.agentindex.world%2Fbase%2Fsimulate
const res = await pay("https://x402.agentindex.world/base/simulate", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"data":"0x313ce567","from_address":"0xb3F32bdfe8D07825BC0D7387295aB1D7559BA69d","to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}),
});
console.log(await res.json());

Example input

{
  "data": "0x313ce567",
  "from_address": "0xb3F32bdfe8D07825BC0D7387295aB1D7559BA69d",
  "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}

Example output

{
  "gas_estimate": 30958,
  "return_data": "0x0000000000000000000000000000000000000000000000000000000000000006",
  "revert_reason": null,
  "will_succeed": true
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
1 h agoPassed40284 ms$0.005
6 h agoPassed402192 ms$0.005