AI-powered P2P trade escrow protocol built on GenLayer Bradbury Testnet. Deal terms are written in plain English, funds lock in escrow, and GenLayer's AI validators autonomously verify whether conditions are met by fetching web evidence and reasoning about the terms.
Every existing escrow protocol on any blockchain relies on binary oracle feeds or a centralized arbitrator. ClauseGuard is the first escrow that can read and understand deal terms and evidence, because GenLayer validators can reason about subjective conditions via LLMs and verify them against live web data.
Traditional smart contract escrow requires rigid boolean logic: "if X address calls release(), funds move." ClauseGuard replaces that with natural language: "Release payment when the shipment clears customs and buyer confirms quality." The intelligent contract does the rest.
Seller creates deal Buyer funds escrow Either party submits
with plain English ---> locking tokens into ---> evidence (URLs to
terms and price the contract tracking, reports, etc.)
| | |
v v v
AI validators fetch Validators reason about Consensus via Optimistic
web evidence from whether evidence satisfies Democracy: majority vote
submitted URLs the natural-language terms determines the outcome
|
v
Funds auto-release to seller (conditions met)
or refund to buyer (conditions not met)
or escalate to larger validator pool (disputed)
gl.nondet.web.render()— Validators crawl tracking pages, delivery confirmations, and inspection reportsgl.nondet.exec_prompt()— LLM reasons about whether evidence satisfies the deal termsgl.eq_principle.strict_eq()— Validators reach consensus on the subjective assessment- Optimistic Democracy appeals — Disputed verdicts escalate to larger validator pools automatically
clauseguard/
├── contracts/
│ └── clauseguard.py # Intelligent contract (deploy via GenLayer Studio)
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── CreateDealForm.jsx # Deal creation with natural language terms
│ │ │ ├── DealCard.jsx # Deal card for marketplace grid
│ │ │ ├── DealDetail.jsx # Full deal view with actions
│ │ │ ├── EvidencePanel.jsx # Evidence submission and display
│ │ │ ├── StatusBadge.jsx # Status indicator component
│ │ │ ├── StatusTimeline.jsx # Visual deal progress tracker
│ │ │ └── VerdictPanel.jsx # AI verdict display
│ │ ├── lib/
│ │ │ ├── constants.js # Shared config and enums
│ │ │ └── genlayer-integration.js # GenLayer JS SDK bridge
│ │ └── frontend.jsx # Main app (self-contained demo version)
│ ├── .env.example
│ └── package.json
├── deploy/
│ └── deploy.js # Deployment helper script
└── docs/
└── deal-flow.md # Detailed deal lifecycle documentation
Open GenLayer Studio, paste the contents of contracts/clauseguard.py, and deploy to Bradbury testnet. Copy the contract address.
cd frontend
cp .env.example .env.local
# Edit .env.local and set your contract address
npm install
npm run devOpen http://localhost:3000, connect your wallet, and create your first deal.
| Method | Description |
|---|---|
create_deal(terms, price_description, deadline_description, verification_urls) |
Seller creates a deal with natural language terms |
fund_deal(deal_id) |
Buyer deposits funds into escrow |
submit_evidence(deal_id, evidence_type, evidence_url, description) |
Either party submits proof |
request_verification(deal_id) |
Triggers AI verification by validators |
settle_deal(deal_id) |
Releases funds to seller after verification |
claim_refund(deal_id) |
Buyer reclaims funds from a rejected deal |
cancel_deal(deal_id) |
Seller cancels an unfunded deal |
| Method | Description |
|---|---|
get_deal(deal_id) |
Full deal data as JSON |
get_open_deals() |
All open deals (marketplace view) |
get_all_deals() |
All deals (dashboard view) |
get_deal_status(deal_id) |
Current status string |
get_deal_verdict(deal_id) |
AI verification verdict details |
get_user_deals(user_address) |
Deal IDs for a specific user |
get_deal_count() |
Total deals created |
open --> funded --> evidence_submitted --> verified --> settled
| |
v v
cancelled rejected --> refunded
|
v
disputed (escalates)
- open — Deal listed, waiting for buyer to fund
- funded — Buyer has deposited, escrow is active
- evidence_submitted — One or both parties have submitted proof
- verified — AI validators confirm conditions are met
- settled — Funds released to seller, deal complete
- rejected — AI validators determine conditions are not met
- refunded — Buyer has reclaimed funds from a rejected deal
- disputed — Low-confidence verdict, escalated to larger validator pool
- cancelled — Seller withdrew an unfunded deal
When submitting evidence, use one of these categories:
delivery_proof— Shipping confirmations, delivery receiptsquality_report— Inspection results, lab analyses, certificationstracking— Live tracking page URLsreceipt— Purchase receipts, invoicesother— Any other supporting evidence
When request_verification() is called, each GenLayer validator independently:
- Fetches all submitted evidence URLs using
gl.nondet.web.render() - Fetches all verification URLs specified when the deal was created
- Constructs a prompt with the deal terms + all fetched web content
- Asks the LLM to assess whether every condition in the terms is satisfied
- Returns a structured verdict with
conditions_met,confidence,reasoning, andunmet_conditions
Validators then vote via Optimistic Democracy. If the majority agrees, the verdict stands. If contested, it escalates through appeal rounds with progressively larger validator pools.
The LLM prompt is designed to be rigorous: it only returns conditions_met: true if ALL terms are clearly satisfied by the evidence. Ambiguous or unverified conditions result in rejection.
- Multi-milestone deals with partial fund releases
- Reputation scoring based on completed deal history
- Invoice factoring module for business-to-business finance
- Escrow templates for common trade types (freelance, commodity, digital goods)
- DAO governance for protocol parameter tuning
- Cross-chain settlement bridges
- GenLayer — AI-native blockchain with Intelligent Contracts
- GenLayer JS SDK — Frontend contract interaction
- GenVM — Python execution environment for Intelligent Contracts
- React / Next.js — Frontend framework
MIT