# Cast Transaction Agent

> Paid AI agent for EVM chain transaction analysis — decode transactions, parse receipts, trace execution, query logs, and inspect blocks across Ethereum, Arbitrum, Base, Polygon, Optimism, BSC, and more. Powered by Foundry cast. Accepts USDC payment via x402 protocol.

## Skills

| Skill | Price | Description |
|-------|-------|-------------|
| Decode Transaction | $0.001 | Fetch and decode a transaction by hash on any supported EVM chain — shows from, to, value, gas, and input data. |
| Parse Receipt | $0.001 | Get transaction receipt with status, gas usage analysis, and emitted event logs on any EVM chain. |
| Trace Transaction | $0.001 | Trace the full execution of a transaction showing internal calls and state changes on any EVM chain. |
| Decode Calldata | $0.001 | Decode hex-encoded calldata using the 4byte signature database (no RPC needed). |
| Query Logs | $0.001 | Query event logs from a contract address with optional topic and block range filters on any EVM chain. |
| Block Info | $0.001 | Get block details by number, hash, or tag on any supported EVM chain. |

- **Decode Transaction** (`tx_decode`, $0.001): Fetch and decode a transaction by hash on any supported EVM chain — shows from, to, value, gas, and input data.
  - Examples: "Decode transaction 0xabc123...", "Decode tx 0xdef456... on arbitrum"
- **Parse Receipt** (`receipt_parse`, $0.001): Get transaction receipt with status, gas usage analysis, and emitted event logs on any EVM chain.
  - Examples: "Show me the receipt for tx 0xabc123...", "Receipt for 0xdef456... on base"
- **Trace Transaction** (`trace`, $0.001): Trace the full execution of a transaction showing internal calls and state changes on any EVM chain.
  - Examples: "Trace the execution of tx 0xabc123...", "Trace 0xdef456... on polygon"
- **Decode Calldata** (`calldata_decode`, $0.001): Decode hex-encoded calldata using the 4byte signature database (no RPC needed).
  - Examples: "Decode this calldata: 0xa9059cbb...", "What function does selector 0xa9059cbb call?"
- **Query Logs** (`log_query`, $0.001): Query event logs from a contract address with optional topic and block range filters on any EVM chain.
  - Examples: "Show Transfer events from USDC on ethereum", "Query logs from 0x1234... on arbitrum"
- **Block Info** (`block_info`, $0.001): Get block details by number, hash, or tag on any supported EVM chain.
  - Examples: "Show me the latest block on base", "Get info for block 18000000 on ethereum"

## Payment

- Protocol: x402 (HTTP 402 Payment Required)
- Network: eip155:8453
- Asset: USDC
- Default price: $0.001
- Pay to: 0xa016f608aDb394B861A6a6282Ac3cB842d43d25C
- Facilitator: https://api.cdp.coinbase.com/platform/v2/x402

### Flow

1. POST / with A2A JSON-RPC task request
2. Receive HTTP 402 + `PAYMENT-REQUIRED` header with payment details
3. Sign USDC authorization (EIP-712) on eip155:8453
4. Retry the same request with `X-PAYMENT` header containing signed proof
5. Receive 200 response with task result

## Endpoints

| Method | Path | Paid | Description |
|--------|------|------|-------------|
| POST | / | Yes ($0.001) | A2A JSON-RPC task execution |
| GET | /.well-known/agent-card.json | No | A2A agent card |
| GET | /discovery | No | JSON service discovery |
| GET | /llms.txt | No | This document |
| GET | /health | No | Health check |

## Integration

```python
import httpx

resp = httpx.post("https://aliasai.io/cast/", json={
    "jsonrpc": "2.0",
    "method": "message/send",
    "params": {
        "message": {
            "role": "user",
            "parts": [{"kind": "text", "text": "YOUR PROMPT HERE"}]
        }
    },
    "id": "1"
})
# Returns 402 if payment required, 200 with result if paid
```

## Standards

- [A2A Protocol](https://a2a-protocol.org) — Agent-to-Agent communication
- [x402](https://x402.org) — HTTP-native payment protocol
- [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) — Trustless AI agent registry
- [llms.txt](https://llmstxt.org) — LLM-friendly documentation standard
