Calldata decoder (ABI or selector DB)
POST /api/calldata-decodeDecode EVM smart-contract transaction calldata into the function name and typed parameters. Send POST /api/calldata-decode with the required field data and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with selector, decoded, name, signature, params and 2 more.
Supply an ABI (from /api/contract-abi) or a signature like transfer(address,uint256) for a fully offline decode; with neither, the 4-byte selector is resolved via an open, community signature database (4byte.directory fallback) and each candidate signature is tried. Unknown selectors return a documented partial decode (selector + raw 32-byte words) instead of an error.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
data | string | yes | 0x-prefixed calldata (selector + encoded args). Max 100KB. Also accepted as input, body, payload, content. |
abi | array | no | Optional contract ABI (JSON array) - enables a fully offline decode with parameter names. |
signature | string | no | Optional function signature, e.g. transfer(address,uint256) - offline decode without a full ABI. |
Example request
curl -i -X POST https://agent402.tools/api/calldata-decode \
-H "Content-Type: application/json" \
-d '{"data":"0xa9059cbb000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d000000000000000000000000000000000000000000000000000000000000f4240"}'Without payment this returns HTTP 402 Payment Required with the exact price for calldata-decode; any x402 v2 or MPP client pays it and retries.
Watch a call get paid
POST /api/calldata-decode$0.002 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"selector": "0xa9059cbb",
"decoded": true,
"name": "transfer",
"signature": "transfer(address,uint256)",
"params": [
{
"type": "address",
"name": null,
"value": "0xabf4fabd7c416fb67202e5f9002389fc75e2a9d0"
},
{
"type": "uint256",
"name": null,
"value": "1000000"
}
],
"source": "4byte.sourcify.dev",
"credit": "Signatures from the Sourcify signature database (https://4byte.sourcify.dev)."
}| Field | Type | Always present | In the example |
|---|---|---|---|
selector | string | yes | 0xa9059cbb |
decoded | boolean | yes | true |
name | string | yes | transfer |
signature | string | yes | transfer(address,uint256) |
params | array of objects | yes | 2 items in the example |
source | string | yes | 4byte.sourcify.dev |
credit | string | yes | Signatures from the Sourcify signature database (https://4byte.sourcify.dev). |
From an MCP client
catalog.call {
"slug": "calldata-decode",
"params": {
"data": "0xa9059cbb000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d000000000000000000000000000000000000000000000000000000000000f4240"
}
}The hosted connector at https://agent402.tools/mcp needs a payment for calldata-decode; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.17.1.
Errors and behavior
datais required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. Some calls are paid before they run; a failed one can be retried free with the same payment, or is refunded. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
GETorHEADto /api/calldata-decode returns the same 402 quote, so the price can be read without a body. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
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?.({ maxAmountPerPayment: "$0.002" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/calldata-decode", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"data": "0xa9059cbb000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d000000000000000000000000000000000000000000000000000000000000f4240"
}),
});No wallet yet? Fund a first one with USDC on Base, no ETH needed, or run npx -y agent402-mcp@0.17.1 wallet new to make one on this computer: it stores the key and prints the address and the config, never the key.
The quote (Python)
Standard library only: the 402 and the price its PAYMENT-REQUIRED header quotes on each chain. To pay from Python, sign it with any x402 client.
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/calldata-decode", method="POST", data="{\"data\":\"0xa9059cbb000000000000000000000000abf4fabd7c416fb67202e5f9002389fc75e2a9d000000000000000000000000000000000000000000000000000000000000f4240\"}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base unitsPart of these workflows
Calldata decoder (ABI or selector DB) is one step in this skill pack, each sold as a single call:
- Transaction forensics - Explain what an EVM transaction actually did: confirmation status, the raw transaction from the chain, decoded calldata with typed parameters, the resolved function signature, and labeled counterparties.
Related tools
Verified contract ABI
Fetch the verified ABI for a contract address from an open verified-contract repository, plus a ready-to-use list.
Function selector / event topic lookup
Resolve a 4-byte function selector or a 32-byte event topic hash to its known human-readable Solidity signatures.
Transaction simulation (eth_call + gas)
Simulate a transaction before sending it: a dry run of a smart-contract call that executes eth_call and eth_estimateGas.
Verified contract source
Fetch the verified Solidity source files and compiler metadata for a contract address from an open verified-contract.
Gas snapshot (slow / standard / fast)
Live gas price snapshot for a chain - slow / standard / fast tiers in gwei, plus the latest base fee.
Solidity heuristic pattern scan
Deterministic static pattern scan of Solidity smart-contract source text - a fixed ruleset flagging tx.origin.