Function selector / event topic lookup

$0.002 per call · USDC via x402 · POST /api/selector-lookup

Resolve a 4-byte function selector or a 32-byte event topic hash to its known human-readable Solidity signatures, via the openchain.xyz signature database with 4byte.directory as fallback. Send POST /api/selector-lookup with the required field selector and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with selector, kind, found, signatures and source.

Unknown selectors return {found:false} with an empty list, not an error.

Category: Crypto & onchain data · Tags: crypto selector 4byte signature event topic evm smart-contract

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
selectorstringyes0x-prefixed 4-byte function selector (10 chars) or 32-byte event topic hash (66 chars).

Example request

curl -i -X POST https://agent402.tools/api/selector-lookup \
  -H "Content-Type: application/json" \
  -d '{"selector":"0xa9059cbb"}'

Without payment this returns HTTP 402 Payment Required with the exact price for selector-lookup; any x402 v2 or MPP client pays it and retries.

Example response

{
  "selector": "0xa9059cbb",
  "kind": "function",
  "found": true,
  "signatures": [
    "transfer(address,uint256)"
  ],
  "source": "openchain.xyz"
}
FieldTypeAlways presentIn the example
selectorstringyes0xa9059cbb
kindstringyesfunction
foundbooleanyestrue
signaturesarray of stringyes1 item in the example
sourcestringyesopenchain.xyz

From an MCP client

catalog.call {
  "slug": "selector-lookup",
  "params": {
    "selector": "0xa9059cbb"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for selector-lookup; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

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?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/selector-lookup", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "selector": "0xa9059cbb"
  }),
});

Part of these workflows

Function selector / event topic lookup is one step in these 2 skill packs, each sold as a single call:

Related tools

Calldata decoder (ABI or selector DB)

$0.003 · POST /api/calldata-decode

Decode EVM smart-contract transaction calldata into the function name and typed parameters. Supply an ABI (from /api/con…

Verified contract ABI (Sourcify)

$0.003 · POST /api/contract-abi

Fetch the verified ABI for a contract address from Sourcify, plus a ready-to-use list of human-readable function signatu…

Verified contract source (Sourcify)

$0.005 · POST /api/contract-source

Fetch the verified Solidity source files and compiler metadata for a contract address from Sourcify's open verification …

Contract event logs

$0.003 · POST /api/event-logs

Fetch contract event logs (eth_getLogs) on Ethereum, Base, Polygon, Arbitrum, or Optimism - bounded so it always answers…

Solidity heuristic pattern scan

FREE w/ compute · or $0.01 · POST /api/solidity-scan

Deterministic static pattern scan of Solidity smart-contract source text - a fixed ruleset flagging tx.origin authentica…

Transaction simulation (eth_call + gas)

$0.005 · POST /api/tx-simulate

Dry-run a prospective smart-contract call or transaction without broadcasting it: executes eth_call and eth_estimateGas …