Skip to content
 
 

Latest commit

 

History

155 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protocol Banks

Protocol Banks Logo

企业级 Web3 支付基础设施 | Enterprise-Grade Web3 Payment Infrastructure for the AI Era

Next.js TypeScript Go Prisma License

English | 中文


Overview

Protocol Banks is a non-custodial, multi-chain payment solution designed for DAOs, AI Agents, and enterprise users. It abstracts blockchain complexity and provides a unified financial management interface with batch payments, multi-sig approvals, subscription management, and AI agent integration. We bridge traditional financial workflows with the Web3 value network, enabling a programmable treasury layer for the next-generation digital economy.

System Architecture

┌──────────────────────────────────────────────────────────────────────────────┐
│                             User Layer                                      │
├──────────────────────────────────────────────────────────────────────────────┤
│  Web Browser (PWA)  │  Mobile App (PWA)  │  AI Agents  │  API Clients       │
└──────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌──────────────────────────────────────────────────────────────────────────────┐
│                          Frontend Layer (Next.js 15)                        │
├──────────────────────────────────────────────────────────────────────────────┤
│  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐       │
│  │    Pages     │ │  Components  │ │    Hooks     │ │  Contexts    │       │
│  │   (app/)     │ │ (components/)│ │   (hooks/)   │ │ (contexts/)  │       │
│  └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘       │
└──────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌──────────────────────────────────────────────────────────────────────────────┐
│                         API Layer (Next.js API Routes)                      │
├──────────────────────────────────────────────────────────────────────────────┤
│  /api/agents  │  /api/payments  │  /api/vendors  │  /api/webhooks          │
│  /api/subscriptions  │  /api/x402  │  /api/invoice  │  /api/batch-payment  │
└──────────────────────────────────────────────────────────────────────────────┘
                                    │
                    ┌───────────────┼───────────────┐
                    ▼              ▼              ▼
┌─────────────────────────┐┌─────────────┐┌─────────────────────────┐
│  TypeScript Services    ││ gRPC Bridge ││  Go Microservices       │
│  lib/services/          ││             ││  services/              │
├─────────────────────────┤└─────────────┘├─────────────────────────┤
│• agent-service          │      │        │• payout-engine (Go)     │
│• payment-service        │      │        │• event-indexer (Go)     │
│• webhook-service        │◄─────┼───────►│• webhook-handler (Go)   │
│• subscription-service   │                │                        │
│• multisig-service       │                │ Throughput: 500+ TPS   │
└─────────────────────────┘                └─────────────────────────┘
                                    │
                                    ▼
┌──────────────────────────────────────────────────────────────────────────────┐
│                             Data Layer                                      │
├──────────────────────────────────────────────────────────────────────────────┤
│  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐       │
│  │  Prisma 7    │ │    Redis     │ │    Vault     │ │  Blockchain  │       │
│  │ (PostgreSQL) │ │   (Queue)    │ │  (Secrets)   │ │  (Multi)     │       │
│  └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘       │
└──────────────────────────────────────────────────────────────────────────────┘

Core Features

Feature Description Status
Dual Authentication Personal (Email/Google + Embedded Wallet) / Business (Hardware Wallets) ✅ Done
Single Payments Multi-chain payments with ENS resolution, real-time gas estimation ✅ Done
Batch Payments Excel/CSV import, 500+ TPS concurrent processing ✅ Done
Multi-Sig Wallets Gnosis Safe protocol, mobile approvals, push notifications ✅ Done
Cross-Chain Rango Exchange aggregation, ZetaChain bridging, CCTP support ✅ Done
Subscriptions Recurring payments, auto-debit, balance monitoring ✅ Done
AI Agent API Agent budget management, x402 protocol, auto-execute ✅ Done
Agent Link [NEW] Financial API for AI Agents — budget requests, auto-execution, on-chain identity ✅ Done
Settlement Checkout [NEW] Unified checkout: mixed-currency payments, smart routing, atomic state sync ✅ Done
Webhooks Event notifications with HMAC signature verification ✅ Done
Analytics Real-time balance, transaction history, network visualization ✅ Done
Vendor Security Address change signature verification, 24h cooldown, notifications ✅ Done
Invoice System On-chain invoice generation with blockchain tx linking ✅ Done
Acquiring (POS) Merchant payment acceptance, payment links ✅ Done

AI Agent Integration

Protocol Banks provides a comprehensive API for AI agents to interact with the treasury system programmatically.

AI Agent Architecture

┌──────────────────────────────────────────────────────────────────────────────┐
│                        AI Agent Integration                                 │
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Trading Bot  │ │ Payroll Bot  │ │ Expense Bot  │ │ Custom Agent │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
       │                │                │                │
       └────────────────┼────────────────┼────────────────┘
                                   │
                                   ▼
                    ┌──────────────────────────────────┐
                    │    Agent Authentication     │
                    │  (API Key: agent_xxxxxx)    │
                    └──────────────┬───────────────┘
                                   │
                    ┌──────────────┼───────────────┐
                    ▼                             ▼
         ┌─────────────────────┐     ┌─────────────────────┐
         │  Budget Service     │     │ Proposal Service    │
         │                     │     │                     │
         │• Daily/Monthly      │     │• Create proposals   │
         │• Token limits       │     │• Batch proposals    │
         │• Chain restrictions │     │• Auto-execute       │
         └─────────────────────┘     └──────────┬──────────┘
                                                 │
                    ┌────────────────────────────┼────────────────────────────┐
                    ▼                           ▼                           ▼
         ┌─────────────────────┐     ┌─────────────────────┐     ┌─────────────────────┐
         │  Auto-Execute       │     │  Human Approval     │     │  x402 Protocol      │
         │  (Within Budget)    │     │  (Over Budget)      │     │  (Gasless)          │
         └─────────────────────┘     └─────────────────────┘     └─────────────────────┘

AI Agent Features

Feature Description
Agent Registration Create agents with unique API keys (agent_xxxxxx)
Budget Management Set daily/weekly/monthly spending limits per token/chain
Payment Proposals Agents propose payments, humans approve or auto-execute
Auto-Execute Rules Configure rules for automatic approval within budget
x402 Protocol Gasless payments using ERC-3009 authorization
Webhook Notifications Real-time events (proposal.approved, payment.executed)
Activity Tracking Full audit trail of all agent actions
Emergency Pause Instantly pause all agents with one click

Agent Types

  • Trading Agent: Automated trading operations
  • Payroll Agent: Scheduled salary payments
  • Expense Agent: Vendor and expense management
  • Subscription Agent: Recurring payment automation
  • Custom Agent: User-defined automation

Agent API Example

// Create payment proposal
const response = await fetch('/api/agents/proposals', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer agent_xxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    recipient_address: '0x...',
    amount: '100',
    token: 'USDC',
    chain_id: 1,
    reason: 'Monthly subscription payment',
  }),
});

// Response
{
  "id": "proposal_123",
  "status": "pending",  // or "executed" if auto-execute enabled
  "auto_executed": false
}

Supported Blockchains

Chain Type Status Batch Payment Note
Ethereum EVM ✅ Done ✅ Supported Mainnet, high-value settlement
Polygon EVM L2 ✅ Done ✅ Supported Low cost, high throughput
Arbitrum EVM L2 ✅ Done ✅ Supported Leading L2 solution
Base EVM L2 ✅ Done ✅ Supported Coinbase ecosystem, Web2 onboarding
Optimism EVM L2 ✅ Done 🚧 Planned OP Stack ecosystem
BNB Chain EVM ✅ Done ✅ Supported Asia's largest ecosystem
Solana Non-EVM ✅ Done 🚧 Planned High-speed, low-cost payments
Bitcoin Non-EVM ✅ Done 🚧 Planned Native BTC transfer support
Tron (波场) Non-EVM 🚧 Integrating 🚧 Planned [NEW] TRC20-USDT deep integration
HashKey EVM L1 ✅ Done 🚧 Planned RWA settlement, compliance-first

Tech Stack

Frontend:

  • Next.js 15 (App Router)
  • React 19
  • TypeScript 5.x
  • Tailwind CSS 4.x
  • shadcn/ui
  • Framer Motion
  • viem / ethers.js
  • Reown AppKit

Backend:

  • Next.js API Routes
  • Go 1.21 (High-performance microservices: Payout Engine, Event Indexer)
  • gRPC (service-to-service communication)
  • Prisma 7 (Serverless ORM with pg adapter)
  • PostgreSQL (via Supabase with RLS)
  • Vercel Cron (scheduled jobs)
  • Redis (Upstash)

Security:

  • Shamir Secret Sharing (2-of-3)
  • HashiCorp Vault
  • AES-256-GCM encryption
  • HMAC-SHA256 signatures

Project Structure

protocol-banks/
├── app/                          # Next.js App Router
│  ├── page.tsx                   # Marketing landing page
│  ├── (products)/                # Route group (with sidebar layout)
│  │  ├── dashboard/              # User dashboard
│  │  ├── pay/                    # Send payment
│  │  ├── receive/                # Receive payment
│  │  ├── batch-payment/          # Batch payments
│  │  ├── balances/               # Multi-chain balances
│  │  ├── history/                # Transaction history
│  │  ├── vendors/                # Contacts / Wallet tags
│  │  ├── agents/                 # AI Agent dashboard
│  │  ├── swap/                   # Token swap (Rango)
│  │  ├── omnichain/              # Cross-chain vault
│  │  ├── checkout/               # Payment checkout
│  │  ├── subscriptions/          # Subscription management
│  │  ├── acquiring/              # POS / Merchant acquiring
│  │  ├── terminal/               # Payment terminal
│  │  ├── analytics/              # Analytics dashboard
│  │  └── products/               # Products overview
│  ├── api/                       # REST API endpoints
│  │  ├── agents/                 # AI Agent management
│  │  ├── payments/               # Payment processing
│  │  ├── vendors/                # Vendor CRUD + batch update
│  │  ├── subscriptions/          # Subscription management
│  │  ├── webhooks/               # Webhook delivery
│  │  ├── invoice/                # Invoice system
│  │  ├── x402/                   # x402 protocol
│  │  └── notifications/          # Email + push notifications
│  ├── admin/                     # Admin panel
│  └── settings/                  # User settings
├── components/                   # React components
├── contexts/                     # React Context
├── hooks/                        # Custom Hooks
├── lib/                          # Core libraries
│  ├── auth/                      # Auth logic (Shamir)
│  ├── services/                  # Business services
│  ├── security/                  # Security middleware + utilities
│  └── prisma.ts                  # Prisma client (serverless)
├── services/                     # Go microservices
├── contracts/                    # Solidity smart contracts
├── prisma/                       # Prisma schema
│  └── schema.prisma              # Database schema
├── scripts/                      # SQL migrations & deploy scripts
└── docs/                         # Documentation

Quick Start

1. Clone Repository

git clone https://github.com/everest-an/protocol-banks---web3.git
cd protocol-banks---web3

2. Install Dependencies

pnpm install

3. Configure Environment

cp .env.example .env.local

Edit .env.local:

# Database (Prisma + Supabase PostgreSQL)
DATABASE_URL=your_postgresql_connection_string
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key

# Reown AppKit (Wallet Connection)
NEXT_PUBLIC_REOWN_PROJECT_ID=your_project_id

# Optional: Go Services
ENABLE_GO_SERVICES=false

4. Start Development Server

pnpm dev

Visit http://localhost:3000

Go Services (Optional)

Go microservices are for high-throughput scenarios. Not required for development.

# Configure environment
cd services
cp .env.example .env

# Start services (requires Docker)
docker-compose up -d

Security Architecture

┌──────────────────────────────────────────────────────────────────────────────┐
│                          Security Layers                                    │
└──────────────────────────────────────────────────────────────────────────────┘
Layer 1: Network
┌──────────────────────────────────────────────────────────────────────────────┐
│  • Rate Limiting (100 req/15min per user)                                   │
│  • HTTPS Only (HSTS)                                                        │
│  • Security Headers (X-Frame-Options, CSP)                                  │
└──────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
Layer 2: Authentication
┌──────────────────────────────────────────────────────────────────────────────┐
│  • Session Management (HTTP-only Cookies)                                   │
│  • API Key Authentication (HMAC-SHA256)                                     │
│  • Agent Authentication (JWT + Permissions)                                 │
└──────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
Layer 3: Data
┌──────────────────────────────────────────────────────────────────────────────┐
│  • Row Level Security (Supabase RLS)                                        │
│  • Encryption at Rest (AES-256)                                             │
│  • Shamir Secret Sharing (2-of-3)                                           │
└──────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
Layer 4: Keys
┌──────────────────────────────────────────────────────────────────────────────┐
│  • HashiCorp Vault (Production)                                             │
│  • Key Rotation (90 days)                                                   │
│  • Zero-Knowledge Architecture                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Performance Metrics

Metric Target Current
Single Payment Latency <3s 2.1s
Batch Payment (100 tx) <60s 45s
API Response Time (p95) <200ms 180ms
Go Service Throughput 500+ TPS 650 TPS
System Availability 99.9% 99.95%

Documentation

Document Description
WHITEPAPER.md Project whitepaper
docs/FEATURES_DOCUMENTATION.md Feature usage guide
docs/GO_SERVICES_ARCHITECTURE.md Go services architecture
docs/SECURITY.md Security architecture
docs/SECURITY_AUDIT.md Security audit report
docs/HASHKEY_INTEGRATION.md HashKey Chain integration
ENV_SETUP.md Environment configuration
REOWN_SETUP.md Reown AppKit integration guide

Roadmap

  • Q4 2024 - Core payment features (single pay, batch pay, multi-sig)
  • Q1 2025 - Multi-sig wallets, AI Agent API, x402 protocol
  • Q2 2025 - Invoice system, POS acquiring, vendor security hardening
  • Q3 2025 - Prisma migration, Vercel Cron, multi-chain balance dashboard
  • Q4 2025 - Omnichain vault, session keys, subscription MCP
  • Q1 2026 - Agent Link API, Settlement Checkout, HashKey Chain integration
  • Q2 2026 - Tron TRC20 full support, mobile native app, fiat on/off ramp
  • Q3 2026 - AI-powered budget analytics, ZK privacy payments
  • Q4 2026 - HSM hardware security module, MSafe (Aptos) integration

中文文档

项目简介

Protocol Banks 是一个非托管、多链支付解决方案,专为 DAO、AI Agent 和企业级用户设计。通过抽象链上复杂性,提供统一的财务管理界面,支持批量支付、多签审批、订阅管理和 AI Agent 集成。我们致力于连接传统金融工作流与 Web3 价值网络,为下一代数字经济体提供可编程的资金管理层。

核心功能

功能模块 描述 状态
双模式认证 个人用户 (Email/Google + 嵌入式钱包) / 企业用户 (硬件钱包) ✅ 已完成
单笔支付 多链支付,支持 ENS 解析,实时 Gas 估算 ✅ 已完成
批量支付 Excel/CSV 导入,500+ TPS 并发处理 ✅ 已完成
多签钱包 Gnosis Safe 协议,移动端审批,推送通知 ✅ 已完成
跨链操作 Rango Exchange 聚合,ZetaChain 桥接,CCTP 支持 ✅ 已完成
订阅管理 定期支付,自动扣款,余额监控 ✅ 已完成
AI Agent API Agent 预算管理,x402 协议,自动执行 ✅ 已完成
Agent Link [新增] 专为 AI Agent 设计的金融接口,支持预算申请与自动执行 ✅ 已完成
Settlement Checkout [新增] 统一结算收银台,支持多币种混合支付与智能路由 ✅ 已完成
Webhook 事件通知,HMAC 签名验证 ✅ 已完成
联系人安全 地址变更签名验证、24h 冷却期、邮件/推送通知 ✅ 已完成
发票系统 链上发票生成,区块链交易关联 ✅ 已完成
收单 (POS) 商户收款、支付链接 ✅ 已完成

AI Agent 功能

  • Agent 注册: 创建带有唯一 API 密钥的 Agent
  • 预算管理: 设置每日/每周/每月支出限额
  • 支付提案: Agent 提议支付,人工审批或自动执行
  • 自动执行规则: 配置预算内自动审批规则
  • x402 协议: 使用 ERC-3009 授权的无 Gas 支付
  • Webhook 通知: 实时事件通知
  • 活动追踪: 完整的 Agent 操作审计日志
  • 紧急暂停: 一键暂停所有 Agent

支持的区块链

类型 状态 说明
Ethereum EVM 主网支持,高价值结算
Polygon EVM L2 低成本,高吞吐量
Arbitrum EVM L2 领先的 L2 解决方案
Optimism EVM L2 OP Stack 生态
Base EVM L2 Coinbase 生态,连接 Web2 用户
BNB Chain EVM 亚洲最大生态
Solana Non-EVM 高性能,极速确认
Bitcoin Non-EVM 原生 BTC 转账支持
Tron (波场) Non-EVM 🚧 [新增] TRC20-USDT 深度集成中
HashKey EVM L1 RWA 结算,合规优先

快速开始

# 克隆
git clone https://github.com/everest-an/protocol-banks---web3.git
cd protocol-banks---web3

# 安装
pnpm install

# 配置
cp .env.example .env.local
# 编辑 .env.local

# 运行
pnpm dev

详细文档


Contact

License

MIT License - see LICENSE for details.


Built for the Web3 Future 🚀

About

On-Chain Banking

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages