# Duo Data Utilities – Solidity Keccak-256 Selector & Topic Derivation

> Duo Data Utilities – Solidity Keccak-256 Selector & Topic Derivation is a paid API for AI agents from api.duoleads.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-02).

Computes the Keccak-256 hash of a Solidity function, event, or error signature to derive the 4-byte function selector and 32-byte event topic, with automatic signature normalisation; also hashes arbitrary text or hex bytes.

## Facts

- Endpoint: GET https://api.duoleads.com/v1/chain/selector?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/duo-data-utilities-solidity-keccak-256-selector-topic-derivation-a1dba4ff
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_it-SO-XsTsvwkZX3E_wxi

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 duo-data-utilities-solidity-keccak-256-selector-topic-derivation-a1dba4ff
```

Example prompt: What is the 4-byte function selector and full Keccak-256 hash for the Solidity function signature 'transfer(address to, uint amount)' — treat it as a function kind?

## When to prefer this

Choose this endpoint when you need to compute Solidity ABI selectors, event topics, or Keccak-256 hashes of signatures in a single deterministic call with automatic normalisation (uint→uint256, tuple flattening, parameter name stripping). It is particularly valuable when working with raw or human-readable Solidity signatures copied from source code that may not yet be in canonical form. Prefer this over rolling your own keccak library when you need the canonical signature and normalisation audit trail alongside the hash.

## Known failure modes

- Missing both 'signature' and 'data' query parameters returns a validation error
- Malformed or unparseable Solidity signature returns a parse error
- Invalid hex encoding when encoding=hex causes a bad-request error
- Unsupported 'kind' enum value returns a validation error
- Signature exceeding 1024 characters is rejected
- Network or upstream timeout returns a 5xx error

## How this service works

Compute the Keccak-256 hash of a Solidity function or event signature and derive the 4-byte function selector and the 32-byte event topic. Normalises the signature first — strips parameter names, expands uint to uint256 and the other aliases, flattens tuples — so a signature copied from source code produces the same selector as the canonical form. Also hashes arbitrary text or hex bytes with Keccak-256.

## Output

Returns a JSON object with the canonical Solidity signature, list of parsed input types, 4-byte selector (for functions/errors) or null, 32-byte topic0 (for events) or null, full 32-byte Keccak-256 hash, and a list of any normalisations applied (e.g. uint→uint256 expansions). Metadata includes request ID, computed timestamp, price, and a determinism flag.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "data": {
       "type": "string",
       "maxLength": 8192,
       "description": "Alternative to signature: raw data to Keccak-256 hash."
      },
      "kind": {
       "enum": [
        "function",
        "event",
        "error"
       ],
       "type": "string",
       "default": "function",
       "maxLength": 64,
       "description": "function (default), event or error."
      },
      "encoding": {
       "enum": [
        "utf8",
        "hex"
       ],
       "type": "string",
       "default": "utf8",
       "maxLength": 64,
       "description": "Encoding of data: utf8 (default) or hex."
      },
      "signature": {
       "type": "string",
       "maxLength": 1024,
       "description": "Solidity function, event or error signature, e.g. transfer(address to, uint amount)."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "ok",
      "route",
      "version",
      "data",
      "meta"
     ],
     "properties": {
      "ok": {
       "const": true
      },
      "data": {
       "type": "object",
       "required": [
        "canonical",
        "keccak256",
        "selector",
        "topic0",
        "inputs",
        "normalisations"
       ],
       "properties": {
        "inputs": {
         "type": [
          "array",
          "null"
         ],
         "items": {
          "type": "string"
         }
        },
        "topic0": {
         "type": [
          "string",
          "null"
         ]
        },
        "encoding": {
         "type": "string"
        },
        "selector": {
         "type": [
          "string",
          "null"
         ]
        },
        "canonical": {
         "type": [
          "string",
          "null"
         ]
        },
        "keccak256": {
         "type": "string"
        },
        "input_bytes": {
         "type": "i
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "inputs": [
    "address",
    "uint256"
   ],
   "topic0": null,
   "selector": "0xa9059cbb",
   "canonical": "transfer(address,uint256)",
   "keccak256": "0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b",
   "normalisations": []
  },
  "meta": {
   "price_usd": "0.05",
   "disclaimer": "Factual output of a deterministic computation over public data. Provided as is, with no warranty of accuracy, completeness or availability. Not investment, financial, legal, tax, medical or any other professional advice, and not a recommendation. Verify before relying on it. Terms: https://api.duoleads.com/terms",
   "request_id": "01K6B7Q4ZC8H3F2M9WXR5TYN0D",
   "computed_at": "2026-09-28T12:00:00.000Z",
   "deterministic": true
  },
  "route": "/v1/chain/selector",
  "version": "1.0.0"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/duo-data-utilities-solidity-keccak-256-selector-topic-derivation-a1dba4ff/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.duoleads.com](https://www.zero.xyz/host/api.duoleads.com/llms.txt)
