# BRAINIAC Contract Code Lookup

> BRAINIAC Contract Code Lookup is a paid API for AI agents from www.brainiac.software, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-17).

Retrieves the deployed bytecode (and potentially source/ABI) of a smart contract at a given address, optionally at a specific block number

## Facts

- Endpoint: POST https://www.brainiac.software/api/v1/chain-data/contract/code?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-17
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/brainiac-contract-code-lookup-5ecf3717
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_63mvI87mLWLxEfefGCjtu

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 brainiac-contract-code-lookup-5ecf3717 -d '<json body>'
```

Example prompt: Can you fetch the deployed contract code for the address 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 on-chain — just grab whatever bytecode is currently deployed there?

## When to prefer this

Use this endpoint when you need raw on-chain contract bytecode or code existence checks for a specific EVM address, especially with historical block pinning. Prefer this over block explorer scraping when you need programmatic, pay-per-call access with no account setup, and when operating in an agent context using x402 micropayments on Base.

## Known failure modes

- Invalid address format (not a valid 0x hex address) causes request rejection
- Block number out of range or future block returns an error
- Address with no deployed contract returns empty bytecode
- Network or RPC errors may cause intermittent failures
- Payment failure via x402 prevents the call from completing

## How this service works

Pay-per-call APIs for AI agents: OFAC sanctions screening, compliance checks, token security, and Base chain data via x402. No account. Fixed USDC price. MCP-ready.

## Output

A JSON response containing the contract bytecode (and potentially ABI or source metadata) deployed at the specified address, optionally scoped to a historical block number. If no code is deployed at the address, the result will likely indicate an empty code field.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "address": {
   "type": "string",
   "pattern": "^0x[0-9a-fA-F]{40}$"
  },
  "blockNumber": {
   "type": "integer",
   "maximum": 9007199254740991,
   "minimum": 0
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "code": "0x",
  "source": {
   "url": "https://mainnet.base.org",
   "status": "OK"
  },
  "address": "0x1234567890123456789012345678901234567890",
  "chainId": 8453,
  "retrievedAt": "2026-11-07T12:08:59.240Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/brainiac-contract-code-lookup-5ecf3717/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.brainiac.software](https://www.zero.xyz/host/www.brainiac.software/llms.txt)
