deterministic
no-api-key
chain
blockchain
solidity
keccak

Solidity function selector: Keccak-256, 4-byte selector and event topic from a signature

Solidity function selector and event topic: compute the Keccak-256 hash of a function or event signature and derive the 4-byte selector and the 32-byte 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 (data): canonical (string|null, null in data mode), keccak256 (0x + 32 bytes), selector (0x + 4 bytes; string|null, null for kind=event and in data mode), topic0 (0x + 32 bytes; string|null, null for kind=function or error and in data mode), inputs ([] or null, null in data mode), normalisations [{from, to}]. Data mode (data= instead of signature, hashing arbitrary text or hex bytes with Keccak-256): canonical, selector, topic0 and inputs are null, normalisations is empty, and encoding (utf8|hex) and input_bytes (integer) are added.

Deterministic: identical input returns identical output, so the response is served with Cache-Control: private, max-age=31536000, immutable (the paying client may cache it indefinitely; shared caches must not, because the response is paid).

Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#chain-selector

get/v1/chain/selector

Request

  • Base URL: https://api.duoleads.com
  • URL: https://api.duoleads.com/v1/chain/selector
  • Auth: none declared

Query parameters

signaturestring

Solidity function, event or error signature, e.g. transfer(address to, uint amount). Accepted: at most 1024 characters.

datastring

Alternative to signature: raw data to Keccak-256 hash. Accepted: at most 8192 characters.

encoding'utf8' | 'hex'

Encoding of data: utf8 (default) or hex. Accepted: utf8, hex.

kind'function' | 'event' | 'error'

function (default), event or error. Accepted: function, event, error.

Response

Paid and settled. data is route-specific; a route that judges its input returns 200 with data.valid: false for a bad value.

okunknown required
route'/v1/chain/selector' required
version'1.0.0' required

Changes

No recorded changes to this operation across all 1 revision of this API.