Skip to content

Verify a STATS_V1 result

STATS_V1 proves four deterministic statistics over a bounded uint64[] input. The verifier family accepts up to 4,096 values.

For values: uint64[], compute:

Field Solidity type Rule
n uint32 values.length
sum uint256 Sum of every value
min uint64 Smallest value, or 0 for an empty input
max uint64 Largest value, or 0 for an empty input

The input and output commitments use Ethereum ABI encoding:

inputHash = keccak256(abi.encode(uint64[] values))
statsBytes = abi.encode(uint32 n, uint256 sum, uint64 min, uint64 max)
outputHash = keccak256(statsBytes)

With Foundry, these commands compute the commitments for [12, 7, 31, 18]:

Terminal window
cast abi-encode 'f(uint64[])' '[12,7,31,18]' | cast keccak
cast abi-encode 'f(uint32,uint256,uint64,uint64)' 4 68 7 31 | cast keccak

Expected results:

0x5b6905319938f5495a99de731708eec290e59875f02f89942418a37028bbe64b
0x0f122179aebafa90e177add9d76b0e4ba837e1faad6a03fee77c0d3cdc1cc4aa

The proof commits this exact flat static ABI payload:

abi.encode(
uint256 taskId,
bytes32 inputHash,
bytes32 outputHash,
uint32 n,
uint256 sum,
uint64 min,
uint64 max
)

Each field occupies one 32-byte ABI word, producing exactly 224 bytes:

Byte range Value
0..31 taskId
32..63 inputHash
64..95 outputHash
96..127 n
128..159 sum
160..191 min
192..223 max
Terminal window
cast abi-encode \
'f(uint256,bytes32,bytes32,uint32,uint256,uint64,uint64)' \
"$NORTHSET_TASK_ID" \
"$NORTHSET_INPUT_HASH" \
"$NORTHSET_OUTPUT_HASH" \
"$NORTHSET_N" \
"$NORTHSET_SUM" \
"$NORTHSET_MIN" \
"$NORTHSET_MAX"

The encoded result is 224 bytes, represented as 0x followed by 448 hexadecimal characters.

A valid STATS_V1 proof establishes that the program identified by the deployed programVKey computed n, sum, min, and max over a uint64[] witness whose ABI encoding matches the task’s committed inputHash, and that outputHash commits to those results.

The hub independently matches the first three words to the target task and stores the proven outputHash on completion. The embedded taskId binds the proof to that task, and the task state machine permits one settlement.

Read contracts for the active deployed route or proof binding for the hub-level checks.