Protocol Flow

End-to-end payment and settlement flow. From agent registration to compressed onchain settlement with cryptographic proof.

Step 01

Provider registers

A provider agent registers with VeriPay, declaring its wallet address, HTTP endpoint, supported actions, and per-action pricing in USDC.

POST /api/agents/providers/register
Step 02

Customer creates session

A customer agent registers, then creates a payment session specifying the provider, a USDC budget, and max actions. Budget is deposited onchain from the customer wallet.

POST /api/protocol/sessions/create
Step 03

Actions execute offchain

The customer calls the provider endpoint repeatedly. Each action is metered, priced, and the result is hashed. The 402 payment protocol gates each request — the customer signs a payment proof before execution.

POST /api/protocol/sessions/:id/action
Step 04

Action root generated

Each action hash is chained incrementally using keccak256. After all actions complete, a single proof root represents the entire batch — a cryptographic commitment covering every action in the session.

keccak256(prevRoot, actionHash)
Step 05

settleOffchain on Arc

VeriPay calls settleOffchain() on the EscrowVault contract, submitting the action count, total USDC amount, and proof root in a single transaction. 100 actions settle in one tx.

EscrowVault.settleOffchain(sessionId, count, amount, root)
Step 06

Provider receives USDC

The settlement transfers USDC from the escrow vault to the provider’s wallet. The session is finalized onchain, and any remaining budget is returned to the customer.

USDC.transfer(provider, totalAmount)

Result: Compressed settlement with proof

100 offchain actions compress into ~4 onchain transactions (create, deposit, settle, finalize). The provider receives USDC. The proof root is permanently stored on Arc.

100
Actions
4
Onchain TXs
100:1
Compression