Agentic Payments on Miden #2919
Replies: 8 comments 17 replies
|
Thank you for writing this up! For now, just commenting about x402 part: There was a pretty in-depth discussion about how to support x402 on Miden here: 0xMiden/node#1796. Key takeaways from it (at least for me) summarized in 0xMiden/node#1796 (comment):
So, I think one of the main questions is whether we are OK with 5 - 10 second latency (at least initially). I think one of the nice aspects in how agentic payments could interact with the Guardian-based architecture is the following (and I think you mention similar above): In the setup of 1 hot key + 1 cold key + 1 guardian key, we could give the agent the hot key and not worry too much about the downside because all agent actions can be monitored/assessed by the guardian which could enforce very sophisticated rules. So, the downside to the agent doing something wrong is pretty limited. And not all of this needs to be enforced by on-chain code - some basic things could be, but the Guardian could go way beyond what's possible with on-chain code too. |
Idea: Guardian as x402 Facilitator (Batched Settlement)Following the latency discussion in node#1796, I want to float an architectural alternative that I think collapses three roles into the Guardian and changes our competitive position on M2M latency. The patternStandard x402 on Miden (per Digine-Labs/miden-x402): agent constructs note, proves locally, submits to network, waits for block inclusion, sends Standard x402 on Base: agent signs an EIP-3009 authorization, facilitator verifies signature, merchant delivers, facilitator settles on-chain async. Sub-second perceived latency, but trust assumption that facilitator submits and merchant delivers. Proposed pattern: use the Guardian as the x402 facilitator with batched settlement. The 402 response follows the standard x402 spec structure, with Miden-specific note parameters carried in the {
"x402Version": 1,
"accepts": [
{
"scheme": "miden-p2id-private",
"network": "miden-mainnet",
"payTo": "<recipient_account_id>",
"asset": "<faucet_id>",
"maxAmountRequired": "100000",
"resource": "https://api.example.com/premium",
"maxTimeoutSeconds": 60,
"extra": {
"note_tag": "<tag>",
"serial_num": "<server_generated>"
}
}
]
}The merchant's trust model here is the same as on Base: trust the facilitator's verification message and deliver. The merchant does not independently verify on-chain inclusion at delivery time. Batch settlement produces an auditable on-chain record post-hoc, useful for accounting and reconciliation but not on the critical path. Why so?Same trust assumptions as Base, better latency profile. The agent trusts the Guardian (which it already does, by definition of Guardian). The merchant trusts the Guardian to settle (same trust model as trusting Coinbase's CDP facilitator). No new trust assumptions added, one trust assumption reused. Proving moves off the critical path. Steps 1-5 take maybe 200-500ms. Proving and settlement happen asynchronously, amortized across a batch. Per-transaction proving cost drops to 1/N. This is what makes sub-cent micropayments economically viable. Guardian is doing 3 jobs at once. Mandate enforcement (already), payment verification (new), batch settlement (new). For users who already have a Guardian, the facilitator role comes for free. For Guardian operators, this is a new revenue stream that fits the "custody economics without custody liability" framing of Phase 1b. Privacy doesn't degrade. Guardian sees its users' transactions (it would anyway). Merchant sees CompetitionRight now our honest benchmark story is "Miden settles privately in 5-10s, Tempo in ~500ms, Base in ~2-4s." That's cool, but we can do better. With Guardian-as-facilitator the story becomes "Miden settles privately with sub-second perceived latency. Faster and more private than base and tempo." That sounds better if we make it happen :). Open question1. Nullifier reservation for verify-before-prove. To prevent the Guardian from verifying two transactions that consume the same input note, the Guardian maintains an in-memory
This is structurally the same mechanism Does that make sense? (@bobbinth, @partylikeits1983, @ermvrs, @Mirko-von-Leipzig ) PlanFor the next 4 weeks: Miden team / Digine Labs operates one Guardian with a facilitator module as the reference implementation. Single endpoint (e.g. For year 1: package the facilitator module as a drop-in component that existing x402 facilitator operators (PayAI, Dexter, x402.rs) can integrate to add Miden as a supported chain. They already run facilitator infrastructure across Base, Solana, Polygon. Adding Miden is a module, not a new operation. This is how we get to facilitator diversity without asking anyone to stand up a Guardian. |
|
Big +1 on Guardian-as-facilitator. One thing that is still needed is a standard for the x402 note, below is a brief outline of essentially what I presented at the technical offsite. Concrete shape for the x402 note that makes the verify step enforceable in the note itself, not just a Guardian-side policy check:Model it on PSWAP ( For x402, the agent funds an x402 note with some ASSET; consuming it emits a P2ID note to the merchant/recipient for the charged amount, and an x402 remainder note with the change. That remainder roll-forward is a good fit for the sequential-API-call M2M workload - one funded note covers many calls. The twist vs PSWAP: the x402 note script would require two signatures to release funds - On open question 1:agreed, the Guardian holding an in-memory |
|
Repo: Miden x402 What's shippedPhase A — settled-at-commit, public + private P2ID (the standard x402
Phase B — Guardian verify-before-prove + nullifier reservation
86 Rust tests passing. Public/Phase-A path is byte-for-byte What we deliberately didn't buildThese are gaps relative to the architecture described in this thread, all
We also took one deliberate divergence from @Dominik1999's wire example: Open questions we need your input onQ1 — Which architectural direction do you want for Guardian (a) (b) Custom x402 note modelled on PSWAP, per @partylikeits1983's reply. (c) Status quo — Guardian-as-facilitator with no co-signing. Mandate We can implement any of these; we'd rather not pick the wrong one Q2 — Which account consumes the x402 notes? @partylikeits1983 raised Q3 — Durability of the reserved-nullifier set. Three options: (a) In-memory (what we have). Restart wipes pending reservations. We'd recommend (b) for production; flagging in case (c) is the Q4 — Should we keep the unified Happy to take any of this through implementation once we have answers. |
Update: Prefunded Agent Debit Notes for Guardian-Facilitated PaymentsComing back to the design after thinking through the actor-model implications with @partylikeits1983 . The "agent signs unproven tx" pattern I proposed earlier doesn't work in Miden, and Digine-Labs' planned Why "agent signs unproven tx" failsA signed-but-unproven Miden transaction commits to a specific account state. The proof, when eventually generated, must verify against that exact state. So between sign-time and prove-time:
This is structurally the same problem Digine-Labs' So the design needs to avoid the agent's account state being on the critical path. Proposed pattern: prefunded agent debit notesInstead of the agent signing tx authorizations, the user prefunds a custom Setup happens once. Per-payment, the agent signs only a consumption authorization. No account state involvement, no kernel execution, no proving. LifecycleWhy this worksNo agent account state on the critical path. The agent's signature authorizes consumption of an immutable note. The agent's account is uninvolved. Sign-time and prove-time can be arbitrarily far apart without invalidation. This is the core insight that makes the pattern viable. No agent-side proving or kernel execution. Agent just signs Merchant compatibility preserved. The output is a standard P2ID note to the merchant. From the merchant's side, x402 verification looks identical to Digine-Labs' existing Privacy preserved. Mandate enforcement composes. Guardian's signing policy enforces AP2 mandates before co-signing the batch consumption. The note script can also encode hard limits (per-tx max, daily caps) as a belt-and-braces layer. Revocation is built in. The note script requires both How does the
|
Proposed Design: Guardian-as-Facilitator for x402 on MidenFollowing @bobbinth's clarification on in-flight state, this is a concrete proposal that builds on the original sketch without requiring protocol changes. The goal is sub-second perceived latency for x402 payments on Miden by moving proving off the agent's critical path and into a Guardian-operated facilitator. The pattern reuses primitives that already exist (the multisig PoC ships a "sign-without-prove" client and a coordinator that batches and submits) and applies them to the agent-payment shape. No new note types, no new account types, no MASM changes. Detailed flowWhat changes whereNo Miden protocol changes. No new note types. No new account types. The work splits cleanly into two components. 1.
|
|
Hi everyone, I might have an unpopular opinion here and could be completely wrong, please correct me if so. In the current Guardian-as-facilitator design, the merchant still has to trust the Guardian of agent. I also worry that adding payment verification, nullifier reservation, and batch settlement on top of Guardian's existing responsibilities makes it significantly more complex over time. I really liked the AgentDebitNote idea that was briefly proposed. It feels cleaner to me, and maps naturally onto MPP's session escrow model:
This keeps the Guardian simple, removes per-payment trust assumptions, and gives Miden a cleaner MPP Level 2 equivalent than any EVM chain has. And more importantly it keeps the number of transaction and prove generation very less. |
|
OK, so I read the x402 whitepaper and the spec. Initially, I just trusted Claude for the analysis, but this was not as helpful as I thought and led to a bit of more discussion than needed. A few key considerations that define our design for x402 on Miden:
Normal Guardian model does not fitThe Guardian as a co-signer does not match the specification - it would require a mandatory signature from the Guardian and the merchant could not settle without the Guardian (easily). It would create a liveness issue and bind the merchant and agent to a facilitator. However merchants are free to choose any facilitator. The agent doesn't even know which facilitator the agent has chosen.
|

Uh oh!
There was an error while loading. Please reload this page.
Building Agentic Payments Support on Miden
Overview
This doc suggests what to build and why. The goal is native support for the primary agentic payment protocols on Miden, positioning Miden as a privacy-preserving settlement layer for autonomous agent transactions, with Guardian-enforced authorization as the technical differentiator.
Background: three categories of agentic payments
The agentic payments space spans three categories with very different dynamics. Understanding which one we're targeting matters for design decisions.
Agent-to-Service (M2M). An agent calls an API and pays per request. Currently the most active category. Coinbase reports 140M x402 transactions. MPP launched March 2026 with 100+ adopters including Anthropic, OpenAI, Shopify, Alchemy, Dune, Browserbase, Parallel Web Systems. AWS shipped AgentCore Payments and CloudFront x402 reference architecture in March. Sub-dollar transactions, sub-second settlement, machines on both sides.
Agent-to-Merchant (e-commerce). Agent buys consumer products from merchants. Live via ChatGPT Instant Checkout with Walmart, Target, Sephora and others. Flows through ACP and settles in fiat via Stripe. The merchant is locked to their existing payment processor. Hard to get it tbh, because Stripe settles crypto vs. Fiat in the end and they won't accept Miden payments (today).
Agent-to-Agent. Two autonomous agents transacting directly. Mostly aspirational today. Real production volumes are not reported. Not realistic future bs.
We're targeting M2M. Reasons: real volume today, settlement choice is genuinely open (API providers choose what they accept, unlike merchants who are locked to Stripe), privacy actually matters (agent API call patterns reveal strategy and customer lists), and buyers are addressable.
For the future, we also target e-commerce.
The full agentic commerce stack has four layers. We touch two.
Our work lives at layers 2 (Guardian-as-mandate via AP2) and 4 (Miden as settlement chain). The x402 and MPP work at layer 3 is the integration glue that makes layer 4 reachable.
Scope of work
Four deliverables, in priority order.
1. x402 facilitator on Miden
x402 is the crypto-native HTTP 402 protocol from Coinbase, open-sourced under Apache 2.0.
Flow:
Build:
2. MPP integration
MPP is Stripe and Tempo's machine payments protocol. Similar 402-based flow, broader payment method support, on the IETF track.
Three implementation levels exist in the spec:
For this initial work, build level 1 only. Onchain escrow for streaming vouchers is significant additional engineering and is out of scope for now.
Build:
3. AP2 + Guardian integration
AP2 is Google's agent payments protocol. It defines verifiable digital credentials that encode delegated authority: spend limits, time windows, merchant allowlists, transaction categories. The standard implementation pattern is "merchant verifies the mandate signature, decides whether to accept."
Our implementation pattern is different and is the technical wedge: Guardian co-signs every transaction, and the Guardian signing policy directly encodes AP2 mandate conditions. Authorization is enforced at the chain layer, not the application layer.
What this means in practice:
Build:
4. Benchmarks
Once the above is working, produce a benchmark matrix comparing Miden against the main alternatives.
Chains to benchmark:
Metrics to measure:
Workload should be a realistic M2M pattern, not synthetic stress testing. Suggested reference workload: an agent making sequential API calls of varying cost, mixed payment methods, occasional mandate validation.
Why this matters: the settlement adoption challenge
Important context for design decisions.
Today's M2M flow: agent pays in USDC on Base via x402, or pays via MPP with Stripe converting to fiat at the boundary. The API provider gets paid in their existing rail and doesn't care which chain settled it.
For Miden to actually be a settlement layer, three things need to work:
Implication for design: the SDKs and facilitator need to be drop-in easy. If integrating Miden takes more effort than integrating Base, providers won't bother. Target: an API provider should be able to add Miden as an accepted settlement chain in under an hour, given they already accept x402 elsewhere.
The privacy story is what gets providers to consider Miden in the first place. The integration ease is what gets them to actually ship.
Out of scope
Explicit list to avoid ambiguity:
References
All reactions