# event_signature

Returns EVM topic0 by hashing already-canonical event signature text exactly; use it to filter non-anonymous logs.

Canonical HTML: <https://determica.com/docs/functions/event_signature>

- Kind: scalar function
- Category: [Contracts and ABI](/docs/category/contracts-and-abi.md)
- Tags: ABI

Returns EVM topic0 by hashing already-canonical event signature text exactly; use it to filter non-anonymous logs.

## Overload 1: event_signature(VARCHAR)

```sql
event_signature(VARCHAR)
```

Hashes already-canonical text such as Transfer(address,address,uint256) exactly, without normalization.

- Kind: scalar
- Execution context: Offline
- Behavior: Exact Signature Event Signature
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `signature` (VARCHAR; required; positional) — Signature text such as Transfer(address,address,uint256), without the event keyword or indexed modifiers. The text is hashed exactly without normalization.

### Returns

Event topic0

Keccak-256 of the supplied canonical signature as BYTES32.

- `hash` (BYTES32)

Event topic0. Keccak-256 of the supplied canonical signature as BYTES32.

### Examples

_Local SQL · Local_

```sql
SELECT event_signature('Transfer(address,address,uint256)') AS topic0;
-- ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
```

## Guidance

### Selector, topic0, calldata, and return data

Use event_signature or event_signature_json to build topic0 before filtering logs or validating decoded events. The JSON helper derives canonical input types and ignores names and indexed modifiers.

- Anonymous logs omit topic0 even though this helper can still compute the event signature hash.
- Indexed flags affect where values appear in log topics, but not the event signature hash.
- The Transfer example is the USDC log at Ethereum block 20,000,000, transaction 0x5cbf...3dde, log index 97; its topics and data are reconstructed offline.
- Use function_selector for the first four bytes of calldata.
- Use error_selector for the first four bytes of custom error revert data.
- Use event_decode_json when you already have topics and data to decode.

```sql
SELECT event_signature('Transfer(address,address,uint256)') AS topic0;
```

## Related functions

- [get_logs](/docs/functions/get_logs.md) — Usually Before
- [event_decode](/docs/functions/event_decode.md) — Usually Before
- [event_decode_json](/docs/functions/event_decode_json.md) — Usually Before
- [parse_abi_event](/docs/functions/parse_abi_event.md) — See Also
