# Base Calldata Decoder

> Base Calldata Decoder is a paid API for AI agents from x402-data-api.bodhinindustries.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-13).

Decodes raw EVM calldata hex or a Base mainnet transaction hash into a human-readable function signature, name, selector, and typed arguments using local ABI decoding plus 4byte.directory signature lookup.

## Facts

- Endpoint: GET https://x402-data-api.bodhinindustries.workers.dev/decode
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/base-calldata-decoder-692e5b95
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-NzlTwPcgCEOxeaP-zDcV

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability base-calldata-decoder-692e5b95
```

Example prompt: Can you decode this Base transaction calldata for me — 0xa9059cbb000000000000000000000000ab5801a7d398351b8be11c439e05c5b3259aec9000000000000000000000000000000000000000000000000016345785d8a0000 — and tell me what function it's calling and what the arguments are?

## When to prefer this

Use this endpoint when you need to decode raw EVM calldata or a Base mainnet transaction's input data into human-readable form, especially when you want local ABI decoding (no third-party data for arg values) combined with 4byte.directory signature resolution. Prefer this over Etherscan-style decoders when you need programmatic structured output (typed name/value pairs) rather than a UI, or when you want to verify what a transaction actually called before signing or analyzing it.

## Known failure modes

- Calldata too short or malformed hex — selector cannot be extracted, matched=false returned
- Unknown selector not in 4byte.directory — functionName and signature are null, matched=false
- Selector collision — multiple candidate signatures returned, collision=true, ambiguous decoding
- Invalid transaction hash or tx not found on Base mainnet — error or empty response
- ABI decoding mismatch — signature resolves but arguments fail to decode against the candidate signature

## How this service works

Self-computed Base onchain toolkit for AI agents: ERC-20 safety scan, manipulation-resistant TWAP price oracle, gas/fee oracle, calldata decoder, token/address/contract intel, wallet approval-risk audit, and batch token triage — all computed live from raw Base chain, no third-party data.

## Output

Returns the resolved function name, full Solidity signature, 4-byte selector, decoded argument list (name, Solidity type, value), a boolean indicating whether the signature was matched, a collision flag if multiple 4byte signatures share the selector, all candidate signatures from 4byte.directory, and an ISO-8601 timestamp of when the computation was performed.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "to": {
   "type": "string",
   "description": "Optional target contract address; its bytecode presence is surfaced as context."
  },
  "data": {
   "type": "string",
   "description": "Raw calldata hex (0x + 4-byte selector + ABI-encoded args). Required unless txHash is given."
  },
  "txHash": {
   "type": "string",
   "description": "Base mainnet transaction hash; its input calldata is fetched and decoded. Required unless data is given."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "args": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "description": "arg name"
     },
     "type": {
      "type": "string",
      "description": "solidity type"
     },
     "value": {
      "type": "string",
      "description": "decoded value as string"
     }
    }
   },
   "description": "decoded [{name,type,value}] (or null)"
  },
  "matched": {
   "type": "boolean",
   "description": "true if a signature was resolved"
  },
  "selector": {
   "type": "string",
   "description": "4-byte function selector"
  },
  "collision": {
   "type": "boolean",
   "description": "true if multiple 4byte signatures share this selector"
  },
  "signature": {
   "type": "string",
   "description": "full function signature (or null)"
  },
  "computedAt": {
   "type": "string",
   "description": "ISO-8601 timestamp"
  },
  "functionName": {
   "type": "string",
   "description": "resolved function name (or null)"
  },
  "selectorRegistry": {
   "type": "string",
   "description": "4byte.directory"
  },
  "thirdPartyDataUsed": {
   "type": "boolean",
   "description": "true — selector labels from 4byte; arg decoding is local"
  },
  "candidateSignatures": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "description": "all 4byte candidates, canonical first"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/base-calldata-decoder-692e5b95/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-data-api.bodhinindustries.workers.dev](https://www.zero.xyz/host/x402-data-api.bodhinindustries.workers.dev/llms.txt)
