byte_verify_payload
Verify that a received data payload matches the on-chain cryptographic attestation before acting on it. Prevents use of tampered or corrupted data from BYTE publishers.
Instructions
Verify-before-act: confirm a data payload an agent is about to act on actually matches what the publisher cryptographically attested to on-chain. Recomputes keccak256 of the received bytes and compares it to the on-chain EIP-712 PayloadAttestation hash. ALWAYS call this on BYTE-sourced data before acting on it; if verified=false the bytes were tampered/corrupted in transit and MUST NOT be used. Anchor the check with EITHER expectedHash (an on-chain payloadHash you already hold, e.g. from byte_query_fact / byte_buy_data) OR txHash (the settlement tx — also recovers the attestation signer and confirms it is the named publisher). Read-only; no wallet or payment required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | The exact payload bytes the agent received and is about to act on — the raw delivered string, or a 0x-prefixed hex byte string. | |
| expectedHash | No | On-chain payloadHash to verify against (0x + 64 hex), e.g. the payloadHash returned by byte_query_fact or byte_buy_data. | |
| txHash | No | Settlement tx hash whose on-chain BroadcastStreamed attestation to verify against. When provided, also recovers the EIP-712 signer and confirms it is the attesting publisher. | |
| hashMode | No | How to hash structured payloads: 'raw' (keccak of the utf8 string, default — matches byte_publish_data) or 'canonical' (keccak of key-sorted, whitespace-free JSON). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| verified | Yes | True only if the recomputed hash matches the on-chain attested hash AND (when a signer was recovered) the signer is the publisher. If false: do NOT act on the data. | |
| recomputedHash | Yes | keccak256 of the received bytes | |
| onChainHash | Yes | The on-chain attested payloadHash compared against | |
| hashMatch | Yes | Whether the recomputed hash equals the on-chain hash | |
| signer | No | Recovered EIP-712 attestation signer (txHash mode) | |
| attestingPublisher | No | Publisher named in the on-chain event (txHash mode) | |
| signerMatch | No | Whether the recovered signer is the attesting publisher | |
| source | No | Which anchor was used: 'txHash' or 'expectedHash' | |
| txHash | No | Settlement tx hash verified against (txHash mode) | |
| blockNumber | No | Block number of the settlement tx (txHash mode) | |
| reason | Yes | Human-readable verdict an agent can surface when it acts or refuses |