# OnchainExpat Contract Decoder API

> OnchainExpat Contract Decoder API is a paid API for AI agents from x402.onchainexpat.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-13).

Decodes and analyzes smart contract data, ABIs, or transaction calldata using pay-per-request x402 protocol

## Facts

- Endpoint: POST https://x402.onchainexpat.com/api/x402-crypto/contract-decoder
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/onchainexpat-contract-decoder-api-69a11361
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_D3Yf7QNeJbq0pV05JbQqM

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 onchainexpat-contract-decoder-api-69a11361 -d '<json body>'
```

Example prompt: Can you decode this smart contract calldata for me? I have a raw hex transaction input — 0xa9059cbb000000000000000000000000abcdef... — and I want to know which function it's calling and what the parameters are.

## When to prefer this

Use this endpoint when you need to decode raw EVM smart contract calldata, understand what a transaction is doing, or interpret contract interactions without setting up your own ABI parsing infrastructure. Ideal for pay-per-use blockchain data decoding without API key management.

## Known failure modes

- Invalid or malformed calldata hex returns a parse error
- Unknown contract ABI with no verified source may return incomplete decoding
- Unsupported blockchain network returns an error
- Missing required input fields returns a 400 validation error
- Payment not received via x402 protocol returns 402 Payment Required

## How this service works

Pay-per-request AI, crypto, proxy, and utility APIs using x402 protocol

## Output

Returns a JSON object with decoded smart contract data including function name, parameter names and values, ABI fragments, and human-readable interpretation of the calldata or contract interaction.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "address"
 ],
 "properties": {
  "chain": {
   "type": "string",
   "description": "Blockchain (default: base)"
  },
  "address": {
   "type": "string",
   "description": "Contract address (0x + 40 hex chars)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "data": {
   "type": "object",
   "properties": {
    "chain": {
     "type": "string"
    },
    "address": {
     "type": "string"
    },
    "analysis": {
     "type": "object",
     "description": "AI-generated analysis including summary, purpose, key_functions, security_notes, risk_level"
    },
    "verified": {
     "type": "boolean"
    },
    "explorer_url": {
     "type": "string",
     "description": "Link to view contract on block explorer"
    },
    "contract_name": {
     "type": "string"
    },
    "risk_analysis": {
     "type": "object",
     "description": "Pattern-based risk analysis with flags and risk_score"
    }
   }
  },
  "success": {
   "type": "boolean"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/onchainexpat-contract-decoder-api-69a11361/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.onchainexpat.com](https://www.zero.xyz/host/x402.onchainexpat.com/llms.txt)
