Reference demo for the Pact Network protocol deployed on Circle Arc Testnet (chain 5042002). Drives the live contracts end-to-end and ships a read-only dashboard that mirrors the same on-chain state.
Built for the Circle 2026 Cohort 2 grant submission. Prototype, not production.
Every transaction this script sends is a real Arc Testnet tx against arcscan-verified contracts:
| Contract | Address |
|---|---|
PactRegistry |
0x056BAC33546b5b51B8CF6f332379651f715B889C |
PactPool |
0xa6135d9C6BFA0F256B9DeBa10d76C7698329aFdE |
PactSettler |
0xe461CE50ef53BFC10945B101FB94b11Ec5eB591f |
| Arc Testnet USDC | 0x3600000000000000000000000000000000000000 (6 decimals, native gas) |
USDC moves on-chain: pool top-up, premium pulled from the agent, refund paid out on breach.
- The agent EOA + the
SettlementEventpayload (latency, breach flag, refund amount) come from this script, not from an x402 facilitator listening to real paid HTTP calls. The facilitator is Milestone 1 in the grant and the next ticket on this repo. - The "agent" is a freshly funded throwaway key, not a deployed agent runtime.
registerEndpoint— registers a demo slug with a 2s SLA, 1 USDC/hour exposure cap. Skipped if already registered.grantRole(SETTLER_ROLE, …)— grants the settler EOA the role on both Registry and Pool. Skipped if already granted.topUp— funds the pool with 0.05 USDC.approve— agent approves PactSettler to pull premium.settleBatch(PASS) — 0.01 USDC premium, latency 500ms, no breach.settleBatch(BREACH) — 0.01 USDC premium, latency 3000ms (over the 2000ms SLA), 0.008 USDC refund paid to the agent.settleBatch(REPLAY) — same callId as PASS. Simulated and expected to revert withDuplicateCallId(0x4999df69).
The pool's currentBalance / totalPremiums / totalRefunds are read back at the end and printed.
- Node ≥ 20.
- Three EOAs on Arc Testnet, each with a small drip of USDC from faucet.circle.com:
- AUTHORITY — must be
registry.authority(). This is the deployer of the contracts. - SETTLER — calls
settleBatch. ReceivesSETTLER_ROLEfrom AUTHORITY on first run. - AGENT — pays the premium and receives any refund.
- AUTHORITY — must be
- Recommended drip: 1 USDC to each.
cp .env.example .env
# fill in AUTHORITY_PRIVATE_KEY, SETTLER_PRIVATE_KEY, AGENT_PRIVATE_KEY
./demo.sh --preflight-only # verify env + balances without touching state
./demo.sh # run the full 5-settlement flownpm run dashboard
# open http://localhost:8910/?slug=arc-grant-demoThe dashboard polls Arc RPC every 8 seconds. It shows pool balance, totals, the endpoint config, and the last 20 CallSettled events for the chosen slug. No keys, no wallet, no tx.
- Contracts:
pact-monitorbranchfeat/arc-protocol-v1, PR #204. Deployed + arcscan-verified 2026-05-19 in WP-EVM-07. - ABI files in
src/abi/: vendored verbatim frompackages/protocol-evm-v1-client/src/abi/(D-A ABI drift guard kept green in WP-EVM-06). - Phase-07b live economic e2e (the run this demo is shaped after): 7/7 steps PASS, zero parity findings vs the Solana program.
This is a protocol-only demo. It proves the contracts work end-to-end on Arc Testnet. It does NOT yet show:
- An x402 paid HTTP call (no facilitator in this repo yet).
- Agent retrying with payment proof.
- Circle Wallets / Paymaster / CCTP / Gateway integration.
Those are the funded milestones in the grant.
.env.example Env template; copy to .env locally
demo.sh Wrapper around `tsx src/demo.ts`
src/demo.ts End-to-end script
src/config.ts Chain config + env loader
src/util.ts Slug encoding, formatting, console helpers
src/abi/*.ts Vendored ABIs from the deployed contracts
dashboard/ Read-only HTML+viem dashboard
EVIDENCE.md Tx hashes + arcscan URLs from the most recent run
- Email: rick@quantum3labs.com
- Telegram: t.me/metalboyrick
- Repo: https://www.pactnetwork.io