{"id":48648417,"url":"https://github.com/circlefin/arc-escrow","last_synced_at":"2026-04-10T08:17:12.348Z","repository":{"id":344242180,"uuid":"1177420004","full_name":"circlefin/arc-escrow","owner":"circlefin","description":"This sample app demonstrates an end-to-end escrow workflow — from contract creation and deposit, through AI-validated deliverable submission, to fund release or refund on Arc.","archived":false,"fork":false,"pushed_at":"2026-03-27T07:01:51.000Z","size":1722,"stargazers_count":10,"open_issues_count":6,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-27T19:06:42.787Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/circlefin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-10T02:22:46.000Z","updated_at":"2026-03-27T12:45:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/circlefin/arc-escrow","commit_stats":null,"previous_names":["circlefin/arc-escrow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/circlefin/arc-escrow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circlefin%2Farc-escrow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circlefin%2Farc-escrow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circlefin%2Farc-escrow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circlefin%2Farc-escrow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/circlefin","download_url":"https://codeload.github.com/circlefin/arc-escrow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circlefin%2Farc-escrow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31634342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-10T08:17:11.115Z","updated_at":"2026-04-10T08:17:12.341Z","avatar_url":"https://github.com/circlefin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Workflow Escrow Refund Protocol\n\nAutomate escrow-backed freelance agreements with AI-powered work validation using USDC on Arc testnet. This sample application uses Next.js, Supabase, Circle Developer Controlled Wallets, and OpenAI to demonstrate an end-to-end escrow workflow — from contract creation and deposit, through AI-validated deliverable submission, to fund release or refund.\n\n\u003cimg width=\"830\" height=\"467\" alt=\"Escrow agreement dashboard\" src=\"public/screenshot.png\" /\u003e\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Getting Started](#getting-started)\n- [How It Works](#how-it-works)\n- [Environment Variables](#environment-variables)\n- [User Accounts](#user-accounts)\n\n## Prerequisites\n\n- **Node.js v22+** — Install via [nvm](https://github.com/nvm-sh/nvm)\n- **Supabase CLI** — Install via `npm install -g supabase` or see [Supabase CLI docs](https://supabase.com/docs/guides/cli/getting-started)\n- **Docker Desktop** (only if using the local Supabase path) — [Install Docker Desktop](https://www.docker.com/products/docker-desktop/)\n- **[ngrok](https://ngrok.com/)** — For local webhook testing\n- Circle Developer Controlled Wallets **[API key](https://console.circle.com/signin)** and **[Entity Secret](https://developers.circle.com/wallets/dev-controlled/register-entity-secret)**\n- **[OpenAI API key](https://platform.openai.com/api-keys)** — Used for AI-powered work validation\n\n## Getting Started\n\n1. Clone the repository and install dependencies:\n\n   ```bash\n   git clone git@github.com:akelani-circle/workflow-escrow-refund-protocol.git\n   cd workflow-escrow-refund-protocol\n   npm install\n   ```\n\n2. Set up environment variables:\n\n   ```bash\n   cp .env.example .env.local\n   ```\n\n   Then edit `.env.local` and fill in all required values (see [Environment Variables](#environment-variables) section below). Leave `NEXT_PUBLIC_AGENT_WALLET_ID`, `NEXT_PUBLIC_AGENT_WALLET_ADDRESS`, and `CIRCLE_BLOCKCHAIN` blank — they will be auto-generated in the next step.\n\n3. Generate the agent wallet:\n\n   ```bash\n   npm run generate-wallet\n   ```\n\n   This creates a Circle developer-controlled wallet and writes the wallet ID, address, and blockchain values into your `.env.local`.\n\n4. Set up the database — Choose one of the two paths below:\n\n   \u003cdetails\u003e\n   \u003csummary\u003e\u003cstrong\u003ePath 1: Local Supabase (Docker)\u003c/strong\u003e\u003c/summary\u003e\n\n   Requires Docker Desktop installed and running.\n\n   ```bash\n   npx supabase start\n   npx supabase migration up\n   ```\n\n   The output of `npx supabase start` will display the Supabase URL and API keys needed for your `.env.local`.\n\n   \u003c/details\u003e\n\n   \u003cdetails\u003e\n   \u003csummary\u003e\u003cstrong\u003ePath 2: Remote Supabase (Cloud)\u003c/strong\u003e\u003c/summary\u003e\n\n   Requires a [Supabase](https://supabase.com/) account and project.\n\n   ```bash\n   npx supabase link --project-ref \u003cyour-project-ref\u003e\n   npx supabase db push\n   ```\n\n   Retrieve your project URL and API keys from the Supabase dashboard under **Settings → API**.\n\n   \u003c/details\u003e\n\n5. Start the development server:\n\n   ```bash\n   npm run dev\n   ```\n\n   The app will be available at `http://localhost:3000`.\n\n6. Set up Circle Webhooks (for local development):\n\n   In a separate terminal, expose your local server:\n\n   ```bash\n   ngrok http 3000\n   ```\n\n   Copy the HTTPS URL from ngrok and configure a webhook in the Circle Console:\n   - Navigate to [Circle Console → Webhooks](https://console.circle.com/webhooks)\n   - Add a new webhook endpoint: `https://your-ngrok-url.ngrok.io/api/webhooks/circle`\n   - Keep ngrok running while developing to receive webhook events\n\n## How It Works\n\n- Built with [Next.js](https://nextjs.org/) and [Supabase](https://supabase.com/)\n- Uses [Circle Developer Controlled Wallets](https://developers.circle.com/wallets/dev-controlled) for USDC escrow transactions on Arc testnet\n- Smart contracts (EIP-712 Refund Protocol) deployed and managed via `@circle-fin/smart-contract-platform`\n- [OpenAI](https://platform.openai.com/) validates submitted work deliverables against agreement criteria using vision models\n- Webhook signature verification ensures secure transaction notifications\n- Agent wallet automatically initialized via the `generate-wallet` script\n- Real-time UI updates powered by Supabase Realtime subscriptions\n\n## Environment Variables\n\nCopy `.env.example` to `.env.local` and fill in the required values:\n\n```bash\n# Deployment URL\nVERCEL_URL=http://localhost:3000\nNEXT_PUBLIC_VERCEL_URL=http://localhost:3000\n\n# Supabase\nNEXT_PUBLIC_SUPABASE_URL=\nNEXT_PUBLIC_SUPABASE_ANON_KEY=\n\n# USDC Smart Contract\nNEXT_PUBLIC_USDC_CONTRACT_ADDRESS=\n\n# Agent Wallet (auto-generated by npm run generate-wallet)\nNEXT_PUBLIC_AGENT_WALLET_ID=\nNEXT_PUBLIC_AGENT_WALLET_ADDRESS=\n\n# Circle\nCIRCLE_API_KEY=\nCIRCLE_ENTITY_SECRET=\nCIRCLE_BLOCKCHAIN=\n\n# OpenAI\nOPENAI_API_KEY=\n```\n\n| Variable | Scope | Purpose |\n| --- | --- | --- |\n| `VERCEL_URL` | Server-side | Base URL of the deployment (e.g., `http://localhost:3000`). |\n| `NEXT_PUBLIC_VERCEL_URL` | Public | Public-facing base URL for client-side usage. |\n| `NEXT_PUBLIC_SUPABASE_URL` | Public | Supabase project URL. |\n| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Public | Supabase anonymous/public key. |\n| `NEXT_PUBLIC_USDC_CONTRACT_ADDRESS` | Public | USDC token contract address on the target blockchain. |\n| `NEXT_PUBLIC_AGENT_WALLET_ID` | Public | Circle wallet ID for the escrow agent. Auto-generated. |\n| `NEXT_PUBLIC_AGENT_WALLET_ADDRESS` | Public | Wallet address for the escrow agent. Auto-generated. |\n| `CIRCLE_API_KEY` | Server-side | Circle API key for wallet and contract operations. |\n| `CIRCLE_ENTITY_SECRET` | Server-side | Circle entity secret for signing transactions. |\n| `CIRCLE_BLOCKCHAIN` | Server-side | Blockchain network identifier (e.g., `ARC-TESTNET`). Auto-generated. |\n| `OPENAI_API_KEY` | Server-side | OpenAI API key for AI-powered work validation. |\n\n## User Accounts\n\n### Default Account\n\nOn first visit, sign up with any email and password. The first user created can act as both a depositor (client) and a beneficiary (freelancer) across different agreements.\n\n### Signup Rate Limits\n\nSupabase limits email signups to **2 per hour** by default (unless custom SMTP is configured). If you hit an \"email rate limit exceeded\" error during testing:\n\n- **Local Supabase (Docker):** Email verification is handled by the built-in [Inbucket](http://127.0.0.1:54324) mail server — check it to confirm signups. The rate limit can be adjusted in `supabase/config.toml` under `[auth.rate_limit]`.\n- **Remote Supabase (Cloud):** Use real email addresses (disposable emails may fail verification). If you hit the limit, you can manually add users via the Supabase dashboard under **Authentication → Users**.\n\n## Security \u0026 Usage Model\n\nThis sample application:\n- Assumes testnet usage only\n- Handles secrets via environment variables\n- Verifies webhook signatures for security\n- Is not intended for production use without modification\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcirclefin%2Farc-escrow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcirclefin%2Farc-escrow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcirclefin%2Farc-escrow/lists"}