An autonomous AI security agent for Web3 wallet protection that combines zero-knowledge proofs, AI-powered risk analysis, and onchain execution on X Layer.
- Zero-Knowledge Proofs: Private risk computation using Circom circuits and SnarkJS
- AI-Powered Analysis: LLM-based risk analysis and action recommendations
- Autonomous Execution: Onchain transaction execution via OKX Onchain OS plugin on X Layer
- Continuous Protection Loop: Analyze → Prove (zk) → Decide → Act → Repeat
- Frontend: Next.js 14 (App Router), React 18, TypeScript, TailwindCSS
- Web3: wagmi, viem, ethers
- Zero-Knowledge: Circom, SnarkJS, circomlib
- AI: OpenAI API
- Execution: OKX Onchain OS SDK
- Testing: Vitest, fast-check (property-based testing)
- Node.js 18+ and npm/yarn/pnpm
- MetaMask or compatible Web3 wallet
- X Layer network access
- Clone the repository:
git clone https://github.com/sambitsargam/zkSentinel.git
cd zkSentinel- Install dependencies:
npm install
# or
yarn install
# or
pnpm install- Set up environment variables:
cp .env.example .env.localEdit .env.local with your configuration:
- X Layer RPC URL
- OKX Onchain OS plugin credentials
- OpenAI API key
- Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev- Open http://localhost:3000 in your browser.
zkSentinel/
├── app/ # Next.js App Router
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Main dashboard
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ └── api/ # API routes
├── lib/ # Core engine modules
│ ├── risk-engine.ts # Zero-knowledge risk computation
│ ├── ai-agent.ts # AI-powered analysis
│ └── execution-engine.ts # Onchain execution
├── circuits/ # Circom circuits
├── test/ # Test files
└── public/ # Static assets
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run test- Run testsnpm run test:watch- Run tests in watch mode
zkSentinel uses property-based testing with fast-check to validate correctness properties:
npm run testISC
Contributions are welcome! Please open an issue or submit a pull request.
An autonomous AI security agent for Web3 wallet protection that combines zero-knowledge proofs, AI-powered risk analysis, and onchain execution on X Layer.
-
Clone and Install
npm install
-
Configure Environment
cp .env.example .env.local
Edit
.env.localand add:- OpenAI API key (already configured)
- OKX Onchain OS plugin credentials (get from https://www.okx.com/web3/build)
-
Run Development Server
npm run dev
/circuits- Circom circuits for zk risk computation/lib- Core engines (Risk, AI, Execution)/app- Next.js frontend and API routes/app/components- React UI components
- Frontend: Next.js 14, TailwindCSS, wagmi, ethers
- Backend: Next.js API Routes
- AI: OpenAI GPT-4 with function calling
- zk: Circom + SnarkJS
- Blockchain: X Layer (zkEVM)
- Execution: OKX Onchain OS plugin
MIT zkSentinel is an autonomous AI agent that continuously monitors wallet risk and executes private, zero-knowledge-powered protective actions onchain.