Skip to content

Function selector / event topic lookup

$0.002 per callUSDC via x402POST /api/selector-lookup

Resolve a 4-byte function selector or a 32-byte event topic hash to its known human-readable Solidity signatures, via an open, community 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, source and 1 more.

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

Category: Crypto & onchain dataTags: 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). The example sends 0xa9059cbb.

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.

Watch a call get paid

RequestPOST /api/selector-lookup
402$0.002 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "selector": "0xa9059cbb",
  "kind": "function",
  "found": true,
  "signatures": [
    "transfer(address,uint256)"
  ],
  "source": "4byte.sourcify.dev",
  "credit": "Signatures from the Sourcify signature database (https://4byte.sourcify.dev)."
}
FieldTypeAlways presentIn the example
selectorstringyes0xa9059cbb
kindstringyesfunction
foundbooleanyestrue
signaturesarray of stringyes1 item in the example
sourcestringyes4byte.sourcify.dev
creditstringyesSignatures from the Sourcify signature database (https://4byte.sourcify.dev).

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 an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.17.1.

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?.({ maxAmountPerPayment: "$0.002" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_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"
  }),
});

No wallet yet? Fund a first one with USDC on Base, no ETH needed, or run npx -y agent402-mcp@0.17.1 wallet new to make one on this computer: it stores the key and prints the address and the config, never the key.

The quote (Python)

Standard library only: the 402 and the price its PAYMENT-REQUIRED header quotes on each chain. To pay from Python, sign it with any x402 client.

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/api/selector-lookup", method="POST", data="{\"selector\":\"0xa9059cbb\"}".encode(), headers={"Content-Type": "application/json"})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

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.002POST /api/calldata-decode

Decode EVM smart-contract transaction calldata into the function name and typed parameters.

Verified contract ABI

$0.003POST /api/contract-abi

Fetch the verified ABI for a contract address from an open verified-contract repository, plus a ready-to-use list.

Verified contract source

$0.005POST /api/contract-source

Fetch the verified Solidity source files and compiler metadata for a contract address from an open verified-contract.

Contract event logs

$0.003POST /api/event-logs

Fetch contract event logs (eth_getLogs) on Base (network "base"; other chains answer 400) - bounded so it always.

Solidity heuristic pattern scan

FREE w/ computeor $0.01POST /api/solidity-scan

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

Transaction simulation (eth_call + gas)

$0.005POST /api/tx-simulate

Simulate a transaction before sending it: a dry run of a smart-contract call that executes eth_call and eth_estimateGas.