# evm_pack_uint_be

Packs a UINT256 value into an exact-width big-endian BYTES value for ABI-adjacent byte construction.

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

- Kind: scalar function
- Category: [EVM utilities](/docs/category/evm-utilities.md)
- Tags: Bytes, EVM, Encoding, Deterministic, Types

Packs a UINT256 value into an exact-width big-endian BYTES value for ABI-adjacent byte construction.

## Overload 1: evm_pack_uint_be(UINT256, INTEGER)

```sql
evm_pack_uint_be(UINT256, INTEGER)
```

Returns exactly byte_width big-endian bytes and rejects values that do not fit in the requested width.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- 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

- `value` (UINT256; required; positional) — UINT256 value to encode.
- `byte_width` (INTEGER; required; positional) — Exact byte width from 1 through 32. Values that do not fit raise an Invalid Input Error.

### Returns

Fixed-width big-endian bytes

Returns exactly byte_width BYTES with no 0x prefix or ABI padding beyond that width.

- `bytes` (BYTES)

Fixed-width big-endian bytes. Returns exactly byte_width BYTES with no 0x prefix or ABI padding beyond that width.

## Additional examples

```sql
-- Encode the Uniswap V3 fee tier 3000 as uint24
SELECT hex(evm_pack_uint_be(3000::UINT256, 3)) AS fee_bytes;
-- => [{"fee_bytes":"000BB8"}]
```
