Skip to content

Commit 9b80143

Browse files
committed
docs: add PGAP architecture, deployments, and verified Arc USDC transaction
1 parent e32cdb3 commit 9b80143

File tree

1 file changed

+140
-41
lines changed

1 file changed

+140
-41
lines changed

README.md

Lines changed: 140 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Policy-Governed Agent Payments (PGAP)
23

34
## Overview
@@ -8,26 +9,34 @@ PGAP is a trust-minimized agentic payment system built on Arc using USDC. AI age
89

910
This architecture prevents rogue agents, hallucinated payments, and uncontrolled spending—key risks in agentic commerce systems.
1011

12+
---
13+
1114
## Problem Statement
1215

1316
As AI agents begin to autonomously purchase APIs, data, compute, or services, a critical risk emerges:
1417

15-
* Agents may overspend
16-
* Agents may hallucinate recipients or amounts
17-
* Off-chain safeguards can be bypassed
18-
* Humans lose deterministic control over funds
18+
- Agents may overspend
19+
- Agents may hallucinate recipients or amounts
20+
- Off-chain safeguards can be bypassed
21+
- Humans lose deterministic control over funds
1922

2023
Existing systems rely on off-chain trust or agent self-restraint, which does not scale safely.
2124

25+
---
26+
2227
## Design Goals
2328

24-
1. **Trust minimization** — AI never has custody or signing power
25-
2. **Deterministic enforcement** — all payment rules enforced on-chain
26-
3. **Composable agent logic** — any AI model can propose intents
27-
4. **Clear authority boundaries** — identity, policy, treasury separated
28-
5. **Auditability** — every payment is verifiable on Arc
29+
1. **Trust minimization** — AI never has custody or signing power
30+
2. **Deterministic enforcement** — all payment rules enforced on-chain
31+
3. **Composable agent logic** — any AI model can propose intents
32+
4. **Clear authority boundaries** — identity, policy, treasury separated
33+
5. **Auditability** — every payment is verifiable on Arc
34+
35+
---
2936

3037
## High-Level Architecture
38+
39+
3140
```
3241
User / Service Request
3342
@@ -46,88 +55,178 @@ TreasuryWithPolicy (on-chain)
4655
- executes or reverts
4756
4857
USDC (native Arc settlement)
58+
4959
```
5060

61+
---
62+
5163
## Key Components
5264

5365
### 1. Agent Registry (On-Chain Identity)
5466

5567
**Purpose:** Bind an agent address to an owner and activation state.
5668

5769
**Properties:**
58-
* Explicit agent registration
59-
* Owner-controlled revocation/reactivation
60-
* No implicit trust in msg.sender
61-
* Immutable audit trail via events
70+
- Explicit agent registration
71+
- Owner-controlled revocation/reactivation
72+
- No implicit trust in `msg.sender`
73+
- Immutable audit trail via events
6274

6375
**Security Insight:** Even if an agent key is compromised, the owner can immediately revoke it on-chain.
6476

77+
---
78+
6579
### 2. Treasury with Policy Enforcement
6680

6781
**Purpose:** Act as a firewall between AI intent and real funds.
6882

6983
**Enforced Invariants (examples):**
70-
* Per-transaction spending limit
71-
* Daily spending cap
72-
* Cooldown between payments
73-
* Recipient allowlist
74-
* Replay protection via nonces
75-
* Global pause for emergencies
84+
- Per-transaction spending limit
85+
- Daily spending cap
86+
- Cooldown between payments
87+
- Recipient allowlist
88+
- Replay protection via nonces
89+
- Global pause for emergencies
7690

7791
**Critical Property:** The treasury does not care how the intent was generated—only whether it satisfies policy.
7892

93+
---
94+
7995
### 3. Gemini AI Agent (Off-Chain Reasoning)
8096

8197
**Role:** The agent performs bounded reasoning, not execution.
8298

8399
**What the agent does:**
84-
* Interprets user or system requests
85-
* Evaluates them against known policy
86-
* Adjusts amounts if needed
87-
* Outputs a structured `PaymentIntent`
100+
- Interprets user or system requests
101+
- Evaluates them against known policy
102+
- Adjusts amounts if needed
103+
- Outputs a structured `PaymentIntent`
88104

89105
**What the agent does NOT do:**
90-
* Hold funds
91-
* Sign transactions
92-
* Bypass policy
93-
* Retry execution on failure
106+
- Hold funds
107+
- Sign transactions
108+
- Bypass policy
109+
- Retry execution on failure
94110

95111
This preserves a strict trust boundary.
96112

113+
---
114+
97115
### 4. Backend Executor
98116

99117
**Purpose:** Bridge AI output to on-chain execution.
100118

101119
**Responsibilities:**
102-
* Accept structured intent from Gemini
103-
* Call `validateIntent()` (optional pre-check)
104-
* Submit `executePayment()` transaction
105-
* Log transaction hash and result
120+
- Accept structured intent from Gemini
121+
- Optionally call `validateIntent()`
122+
- Submit `executePayment()` transaction
123+
- Log transaction hash and result
106124

107125
The backend is stateless and replaceable.
108126

127+
---
128+
109129
## Why This Architecture Is Trustless
110130

111131
| Layer | Trust Model |
112-
|-------|-------------|
132+
|------|-------------|
113133
| Gemini AI | Untrusted proposer |
114134
| Backend | Untrusted relayer |
115135
| Smart Contracts | Fully trusted enforcement |
116136
| Arc + USDC | Deterministic settlement |
117137

118138
Even if:
119-
* the AI hallucinates
120-
* the backend is malicious
121-
* requests are spammed
139+
- the AI hallucinates
140+
- the backend is malicious
141+
- requests are spammed
122142

123143
➡️ **Funds remain safe.**
124144

145+
---
146+
125147
## Why Arc + Native USDC
126148

127-
* USDC is both gas and value
128-
* No volatile token exposure
129-
* Predictable fees
130-
* Clean accounting for agents
131-
* Ideal for agentic commerce
149+
- USDC is both gas and value
150+
- No volatile token exposure
151+
- Predictable fees
152+
- Clean accounting for agent-driven payments
153+
- Ideal for agentic commerce
154+
155+
The treasury enforces policy directly on the settlement asset, not a wrapper.
156+
157+
---
158+
159+
## Deployment Variants
160+
161+
PGAP was deployed in two configurations during development for clear and intentional reasons.
162+
163+
### 1. Arc Testnet USDC Deployment (Primary)
164+
165+
This deployment represents the intended production architecture using native Arc USDC.
166+
167+
**Contracts:**
168+
- AgentRegistry: `0xa2225ce1F9e764bF11a57d3E8dea0492487562Ea`
169+
- TreasuryWithPolicy: `0x9fB95CE21352d7FAB5A8A79aEB1E30B76F11B034`
170+
171+
**Properties:**
172+
- Uses native Arc Testnet USDC
173+
- Demonstrates real agentic commerce flow
174+
- No mock tokens or wrappers
175+
176+
A successful on-chain payment was executed from this treasury using Arc Testnet USDC, proving end-to-end policy-governed execution on the native settlement asset.
177+
178+
---
179+
180+
### 2. MockUSDC Deployment (Testing)
181+
182+
This deployment exists solely to enable exhaustive testing without faucet constraints.
183+
184+
**Contracts:**
185+
- AgentRegistry: `0x853b31b0541059c72a76deeB23eA4414AdB42B58`
186+
- TreasuryWithPolicy: `0x2c90738D80C19dDe2094B5E58b4dC06202fa1243`
187+
- MockUSDC: `0xBa9c42df8e2b800902A5191971634825F958DA04`
188+
189+
**Rationale:**
190+
- Arc Testnet USDC is faucet-limited
191+
- Policy logic requires stress testing (cooldowns, caps, nonce replay)
192+
- Treasury logic remains identical; only the token differs
193+
194+
This separation ensures testing rigor without weakening the real deployment.
195+
196+
---
197+
198+
199+
## Verified Arc USDC Transaction
200+
201+
PGAP successfully executed a live payment using **native Arc Testnet USDC**, fully governed by on-chain policy.
202+
203+
- **Network:** Arc Testnet
204+
- **Asset:** Native USDC (gas + value)
205+
- **Treasury:** `0x9fB95CE21352d7FAB5A8A79aEB1E30B76F11B034`
206+
- **Relayer:** `0x8eCaDD0bA353048e9c92A5a2be341ce902250C41`
207+
- **Amount:** 1 USDC
208+
- **Transaction Hash:**
209+
`0x735a3abf24866c376d8150c7698d001d3f36183ee991c77633cf08c24c818185`
210+
211+
This transaction demonstrates that:
212+
- AI proposed the payment
213+
- Smart contracts enforced all limits
214+
- Settlement occurred directly in Arc USDC
215+
216+
217+
## Note on USDC Availability
218+
219+
Arc Testnet USDC is currently faucet-limited.
220+
A request has been submitted to Circle for additional testnet USDC to enable higher-volume and multi-payment demonstrations.
221+
222+
---
223+
224+
## Design Intent
225+
226+
Maintaining both deployments is a deliberate engineering decision:
227+
228+
- Native USDC deployment proves correctness and settlement integrity
229+
- MockUSDC deployment proves safety under adversarial conditions
230+
231+
This mirrors real-world protocol development with production contracts and isolated test environments.
132232

133-
The treasury enforces policy directly on the settlement asset, not a wrapper.

0 commit comments

Comments
 (0)