UnityPay is an enterprise-grade programmable treasury and stablecoin commerce stack built for automated corporate operations, developer payrolls, and autonomous AI agents. Powered by Circle Modular Wallets, developer-controlled vaults, and the native USDC-gas Arc Testnet, UnityPay enables companies to consolidate fragmented cross-chain liquidity, enforce strict spending governance via passkeys, and execute frictionless gasless payouts.
UnityPay bridges the gap between traditional banking structures, decentralized multichain finance, and autonomous software agents. It functions as a complete treasury management hub where human managers set daily spending limits and biometric guardrails, while automated software agents execute high-velocity micro-transactions, merchant invoicing, and cross-chain rebalancing without exposing raw private keys or requiring manual blockchain fee management.
- Autonomous AI Agent Payroll: Set granular spending limits and let computational agents execute API micro-transactions and reward distributions gaslessly.
- Consolidated Enterprise Liquidity: Automate CCTP (Cross-Chain Transfer Protocol) swaps to pull fragmented USDC deposits from L2s (Base Sepolia) into the Arc Testnet hub.
- Corporate Banking Integration: Seamlessly link traditional bank wire account details using encrypted-at-rest storage to reconcile digital assets with fiat ledgers.
- Multi-Signature Executive Consent: Prevent unauthorized smart contract execution through on-chain approval requests that require consensus before dispatching high-value payouts.
Modern corporate treasury faces three severe friction points when transitioning to digital asset rails:
- Gas Friction & UX Complexity: Requiring employees or automated agent scripts to manage separate gas tokens (like ETH or MATIC) introduces severe security risks and accounting overhead.
- Key Custody & Single Points of Failure: Centralized custody compromises security, while self-custody EOAs are vulnerable to phishing or rogue agent scripts executing unauthorized transfers.
- Liquidity Fragmentation: Inbound merchant stablecoin payments accumulate across multiple L2 networks, diluting purchasing power and complicating unified balance management.
UnityPay resolves these systemic issues through a highly integrated, non-custodial architecture:
- Native USDC Gas & Sponsorship: Deployed on Arc Testnet, where USDC is the native gas token. Backed by ERC-4337 Paymaster contracts, UnityPay offers fully gasless operations for end-users.
- Circle WebAuthn Passkey Wallets: Restricts hot-wallet vulnerabilities by provisioning non-custodial Smart Contract Accounts via Circle Modular Wallets. Users authenticate securely via WebAuthn corporate biometrics.
- Autonomous Rebalancing (CCTP & Smart Router): Consolidates cross-chain assets natively by burning stablecoins on source chains (such as Base Sepolia) and minting them on the Arc Testnet hub.
- Executive Safety Lock: Implements on-chain multisig-style approvals for any transaction exceeding pre-configured daily spending thresholds.
- Real-time balance consolidation across Arc Testnet, Base Sepolia, and mock Ethereum L1 networks.
- Drift simulation for chain balance weights showing real-time active treasury rebalancing allocations.
- Compact transaction ledgers showing event type, source chain, gas status, and settlement duration.
- Plain-text conversational assistant powered by a DeepSeek-based AI reasoning swarm.
- Natural speech transcription via browser-native web voice input.
- Interactive, self-healing Secure Shield PIN Setup that dynamically launches if a user's wallet is not initialized.
- Safe-Lock auto-approve toggles with a 5-second safety grace window.
- High-speed stablecoin FX swaps (USDC to EURC) simulating stablecoin foreign exchange settlements.
- Automatic routing of transactions through optimized liquidity pools.
- Custom on-chain policy thresholds (e.g., maximum transaction amount, required approval count).
- Fully interactive pending transaction queue where executives review metadata, cast approval votes, and execute transactions once the consensus threshold is met.
- Automated payroll triggers that match contractor escrows based on budget status and deliverable hashes.
- Open, funded, submitted, completed, and rejected job lifecycles.
- Local Sandbox URL:
http://localhost:3000 - Autonomous Autopilot Sandbox: Navigate to
/autopilotto chat with the AI Treasury assistant or configure hands-free execution. - Biometric Sign-in: Enter your email at
/loginto trigger the Circle PIN creation challenge and set up your biometric passkey.
- Core Framework: Next.js 16.2.10 (App Router), React 19.2.7
- Database & ORM: SQLite, Prisma ORM 5.12.1
- AI & Reasoning Swarm: DeepSeek-v4 API, Browser-native SpeechRecognition API
- Web3 & Wallet Infrastructure:
- Circle App Kit (
@circle-fin/app-kitv1.5.1) - Circle Developer-Controlled Wallets SDK (
@circle-fin/developer-controlled-walletsv1.2.0) - Circle Modular Wallets SDK (
@circle-fin/modular-wallets-corev1.0.13) - Circle WebAuthn Passkey Web SDK (
@circle-fin/w3s-pw-web-sdkv1.1.11) - Circle Unified Balance Kit (
@circle-fin/unified-balance-kitv1.1.1)
- Circle App Kit (
- Blockchain Networks: Arc Testnet (Chain ID
5042002), Base Sepolia (Chain ID84532) - Wagmi & Client Viem: Wagmi v2.19.5, Viem v2.50.3, TanStack React Query v5
- Styling & UI Components: TailwindCSS, Framer Motion, Lucide Icons
graph TD
User([User / Passkey Auth]) -->|Wagmi / Circle Web SDK| FE[Next.js Frontend]
FE -->|Autopilot Prompt / Voice| AP_API[/api/chat Route]
AP_API -->|AI Context & Intent| DS_API[DeepSeek AI API]
FE -->|Initiate Payout / Swap| API_Gateways[Backend REST APIs]
API_Gateways -->|Prisma ORM| DB[(SQLite Database)]
API_Gateways -->|Circle SDKs| Circle_API[Circle Web3 Services]
Circle_API -->|Developer Vaults| Dev_Wallets[Circle Dev-Controlled Wallets]
Circle_API -->|Smart Contract Accounts| SC_Wallets[Circle Modular Wallets]
SC_Wallets -->|Zero Gas Transactions| Arc[Arc Testnet Chain]
Dev_Wallets -->|Consolidated Liquid Funds| Arc
Dev_Wallets -->|CCTP Cross-Chain Transfers| Base[Base Sepolia]
├── contracts/ # Smart contracts for test deployments
├── prisma/ # SQLite schema definitions & migration seeds
│ ├── schema.prisma # Consolidated local database schema
│ └── seed.js # Database bootstrap script
├── public/ # Static assets and favicon configurations
├── scripts/ # Administration and database cleanup scripts
└── src/
├── app/ # Next.js App Router Pages & API Routes
│ ├── api/ # Backend API handlers (Circle, Chat, FX, Gas)
│ ├── approvals/ # Executive approvals dashboard
│ ├── autopilot/ # Immersive fullscreen AI control console
│ ├── dashboard/ # Treasury balance overview & transaction ledger
│ └── orchestration/ # Vault settings & rebalancing setup
├── components/ # Reusable UI components (Autopilot chat card, modals)
├── hooks/ # Custom React hooks (Wagmi, User Wallet, Modular Wallet)
└── lib/ # Core utilities (Circle Client, smart router, rebalance engine)
- Node.js v20.x or higher
- npm or yarn package manager
-
Clone the repository:
git clone https://github.com/soutanhanh/UnityPay.git cd UnityPay -
Install the project dependencies:
npm install
-
Initialize the database and run migrations:
npx prisma db push
-
Seed the database with mock configurations:
node prisma/seed.js
Create a .env file in the root of the project with the following configuration:
# Circle Web3 Services API Keys
CIRCLE_API_KEY=your_circle_api_key_here
CIRCLE_KIT_KEY=your_circle_kit_key_here
NEXT_PUBLIC_CIRCLE_CLIENT_KEY=your_circle_client_key_here
NEXT_PUBLIC_CIRCLE_CLIENT_URL=https://modular-sdk.circle.com/v1/rpc/w3s/buidl
# Circle Application IDs & Security Secret
CIRCLE_ENTITY_SECRET=your_32_byte_hex_entity_secret_here
CIRCLE_APP_ID=your_circle_app_id_here
NEXT_PUBLIC_CIRCLE_APP_ID=your_circle_app_id_here
# AI Autopilot Settings
DEEPSEEK_API_KEY=your_deepseek_api_key_hereNote: If CIRCLE_API_KEY is left blank, the application will fallback to mock operations, allowing frontend workflow checks without active API connections.
To launch the hot-reloaded development environment:
npm run devNavigate to http://localhost:3000 to interact with the application.
To compile the codebase for production optimization:
npm run build
npm startDefined in package.json:
npm run dev: Starts the Next.js development server with custom Webpack configuration.npm run build: Compiles the Next.js frontend pages and API routes for production.npm run start: Launches the compiled production build server.npm run lint: Analyzes the codebase for syntax or styling errors using ESLint.
- Circle Programmable Wallets: Provisions non-custodial user-controlled and developer-controlled wallets using secure API structures.
- Circle Cross-Chain Transfer Protocol (CCTP): Used to natively burn stablecoins on source networks and mint them on target networks without third-party bridge risks.
- DeepSeek AI Reasoning: Decodes unstructured natural language instructions into concrete smart contract executions (e.g., transfers, swaps, rebalances).
All routes reside under /src/app/api/:
POST /api/users/session: Fetches or creates a user's Circle session and returns current status.- Payload:
{ email: string, provider: string, smartContractAddress?: string } - Response:
{ userToken: string, encryptionKey: string, circleUserId: string, walletAddress: string, initialized: boolean }
- Payload:
POST /api/users/transfer: Initiates a user-controlled token transfer challenge.- Payload:
{ walletId: string, destinationAddress: string, amount: string, token: string, userToken: string, circleUserId: string }
- Payload:
GET /api/users/transfer/status: Polls status of a processed transaction on Circle.- Query Parameters:
?walletId=...&recipient=...&amount=...
- Query Parameters:
POST /api/bank-accounts: Links a corporate bank account. Nickname, bank name, account number, and routing number details are encrypted at rest.GET /api/bank-accounts: Retrieves the list of linked bank accounts.
UnityPay uses SQLite via Prisma for low-overhead database management.
User: Stores the email identifier (userToken), role, uniquecircleUserId, and corresponding smart accountwalletAddress.Transaction: Logs on-chain hashes, source/destination chains, gas fee calculations, and transaction screening results.BankAccount: Stores bank routing codes, encrypted ending numbers, and verification statuses.ApprovalRequest: Manages the multisig console, storing voting logs and thresholds required to dispatch pending transactions.
- Passkey Authentication: User keys are generated on-device via WebAuthn, meaning the server never sees, stores, or handles private keys.
- Biometric PIN Protection: Transactions require entering the user's PIN to finalize the Circle challenge, protecting against hot-session hijack.
- Encryption At Rest: High-value database inputs (such as banking details) are stored as encrypted blobs.
- Automatic Address Screening: System automatically scans destination addresses to reject blocklisted assets and compliance risks.
- Zero-Gas Optimizations: Uses Arc Testnet's native gas mechanism to sponsor transaction operations, preventing delays caused by checking or topping up gas tokens.
- Optimized Webpack Compilations: Uses Next.js custom Webpack bundlings to separate heavy blockchain modules, optimizing page speed.
- Client-Side Polling Limits: Polls the status of pending transactions up to 15 seconds to ensure fast UI updates without overloading API endpoints.
The project is fully compatible with Vercel:
- Push your codebase changes to a GitHub repository.
- Link the repository to your Vercel Dashboard.
- Supply the environment variables specified in the Environment Variables section.
- Deploy the project. The custom
.npmrcfile is already pre-configured to bypass peer dependency conflicts during build time.
- Format Standards: Run
npm run lintbefore committing any files to format codebase formatting. - Database Schema Update: If you update the database models in
prisma/schema.prisma, run:npx prisma db push
- Commit Messages: Follow Conventional Commits convention (e.g.
feat: ...,fix: ...,chore: ...).
- Status: Hackathon Submission Ready.
- Tests: End-to-end user-controlled transfer and smart autopilot reasoning flows have been validated on the Arc Testnet.
Contributions to the UnityPay treasury stack are welcome:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/amazing-feature. - Commit your changes:
git commit -m "feat: add amazing feature". - Push to the branch:
git push origin feature/amazing-feature. - Open a Pull Request.
This repository is licensed under the MIT License.
- Next.js & React Teams for web UI framework foundations.
- Circle Devs for the App Kit, developer-controlled wallets, and modular smart accounts SDKs.
- Wagmi & Viem Teams for developer-friendly EVM client interfaces.