Skip to content

[Proposal] On-chain settlement-side mandate binding for AP2 #255

@hilarl

Description

@hilarl

On-chain settlement-side mandate binding for AP2

Acknowledgment of repo scope

Per CONTRIBUTING.md, the AP2 core specification has been donated to FIDO; this repo's scope is samples and SDK only. The core proposal below is intended for the FIDO working group; I'm filing here to:

  1. Surface the on-chain reference implementation to AP2 sample/SDK maintainers and contributors who may want to consume it,
  2. Get an early read on whether the envelope shape aligns with what the SDK currently emits, so the FIDO submission can land with concrete sample/SDK alignment evidence.

Happy to redirect this discussion to the FIDO working group if that's the appropriate venue.

Context

AP2 specifies the off-chain agent-payment authorization protocol — verifiable agent credentials, intent mandates, payment mandates. The gap, when AP2 lands on a public chain, is that the on-chain settlement layer typically doesn't verify the mandate; it trusts the wallet client or the relaying facilitator to honor the constraints.

We've shipped a stablecoin (RIVR) where the AP2-compatible mandate envelope is verified at the token contract. Every transferring path runs the full constraint chain: principal+agent EIP-712 signatures (EIP-1271 fall-through for smart accounts), per-tx cap, cumulative cap, asset allowlist, expiry, sanctions, KYA, Travel Rule attestation. The token reverts with a typed RefusalReason if any check fails.

Proposal

A reference on-chain implementation of the AP2 IntentMandate / PaymentMandate constraints, with a normative MandateEnvelope EIP-712 typehash so AP2-emitting agents can target multiple compliant chains without re-shaping the mandate per-chain.

The constraint envelope is rail-agnostic. The same shape applies to card-network mandates and ACH/SEPA/FedNow agent-bound authorizations. Rivier — the platform shipping this — is an agentic commerce + finance platform spanning fiat and crypto rails; RIVR is the crypto-side reference settler. Submissions to fiat-rail venues are happening in parallel.

Reference implementation

MIT, at https://github.com/rivier-ai/rivr.

  • Token contract: contracts/src/rivier-token/RivierTokenCCT.sol (transferWithMandate entry point)
  • Mandate type: contracts/src/rivier-token/types/MandateEnvelope.sol
  • Test suite: contracts/test/rivier-token/ — 113 forge tests covering the dryRun byte-equivalence invariant (off-chain simulation byte-equivalent to on-chain revert), namespace sum-preservation under fuzzing, replay protection, and reentrancy safety.

Audit: not yet commissioned. Independent contributor, pre-funding; engagement is planned post-launch.

What I'm asking for

  1. Sample/SDK maintainer feedback on whether the envelope shape aligns with what the AP2 SDK currently emits.
  2. Pointer to the right FIDO working-group venue for the normative submission.
  3. Whether the AgentAttestation v1 extensionData shape (model id, version, confidence, reasoning hash, prompt hash, MCP server DID, TEE attestation hash, policy compliance proof) aligns with FIDO's existing attestation taxonomy.

FIDO Alliance Liaison membership is on the roadmap once the project's legal entity is formed; for now I'm contributing as an individual.


Disclosure: parts of this issue body were drafted with assistance from an AI model and reviewed before submission. The reference implementation, test suite, and design decisions are human-authored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions