# BYTES4

4-byte fixed bytes value, typically a function selector, error selector, or prefix. VARCHAR casts parse 0x-prefixed hex exactly; use BYTES when variable-length calldata or return data is required.

Canonical HTML: <https://determica.com/docs/types/bytes4>

- Family: Fixed bytes
- Physical type: BLOB

4-byte fixed bytes value, typically a function selector, error selector, or prefix. VARCHAR casts parse 0x-prefixed hex exactly; use BYTES when variable-length calldata or return data is required.

## Used by functions

### Accepted as input

- [hex](/docs/functions/hex.md) — Formats a BLOB-backed EVM byte value as uppercase hexadecimal text without a 0x prefix. hex and to_hex are compatibility aliases with identical behavior.
- [length](/docs/functions/length.md) — Returns the number of bytes in a BLOB or BLOB-backed EVM value such as ADDRESS, BYTES32, UINT256, or INT256.
- [to_hex](/docs/functions/to_hex.md) — Formats a BLOB-backed EVM byte value as uppercase hexadecimal text without a 0x prefix. hex and to_hex are compatibility aliases with identical behavior.

### Returned as output

- [decode_function_data](/docs/functions/decode_function_data.md) — Validates and decodes selector-prefixed function calldata into typed SQL columns defined by the function's ABI inputs.
- [error_selector](/docs/functions/error_selector.md) — Returns a custom error's 4-byte selector by hashing already-canonical signature text exactly; use it to identify revert payloads.
- [error_selector_json](/docs/functions/error_selector_json.md) — Returns the 4-byte selector for a custom error described by JSON ABI; use it to identify revert payloads.
- [function_selector](/docs/functions/function_selector.md) — Returns the 4-byte Keccak-256 selector for an already-canonical function signature. The input bytes are hashed exactly and are not normalized.
- [function_selector_json](/docs/functions/function_selector_json.md) — Builds the canonical signature for a JSON ABI function fragment and returns its 4-byte Keccak-256 selector.
