evm_byte

Implements the EVM BYTE opcode over a UINT256 word. BYTE index 0 selects the most significant byte and index 31 selects the least significant byte. Negative indices and indices above 31 return zero. NULL input propagates to NULL.

Example

Local

1
SELECT evm_byte(0::BIGINT, '0x1200000000000000000000000000000000000000000000000000000000000034'::UINT256)::VARCHAR AS result;
2
-- => [{"result":"18"}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

evm_byte(BIGINT, UINT256) #

Extracts one byte using EVM most-significant-byte-first indexing.

Inputs

Name Type Use
n BIGINT

BIGINT index; 0 is the most significant byte and 31 the least.

required positional
x UINT256

UINT256 EVM word.

required positional

Returns

Name Type
byte_value UINT256

Selected byte. UINT256 value 0 through 255; out-of-range indices return zero; NULL input returns NULL.

Category and tags

Category
EVM utilities
Tag
Types
Tag
EVM