aps_verify_settlement
Validate a signed SettlementRecord by verifying S1-S5: signature, Merkle root, conservation (prevents share inflation), residual shape, and optional input receipt cross-check. Returns validity with reason.
Instructions
Verify a signed SettlementRecord under S1-S5 (signature, Merkle roots, conservation, residual shape, optional input-receipts cross-check). S3 conservation is the strongest invariant: a gateway cannot inflate or suppress any contributor's share without breaking it. Returns {valid: true} or {valid: false, reason, detail}. Pass inputReceipts to also recompute input_receipts_hash.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| record | No | A signed SettlementRecord | |
| gateway_public_key | Yes | Gateway Ed25519 public key hex | |
| input_receipts | No | Optional — the input Attribution Primitives that fed the settlement. When supplied, S5 cross-checks input_receipts_hash and verifies each receipt individually. |