dot402 is a cross-parachain autonomous agent workflow builder using Polkadot + x402 micropayments. Build workflows that span multiple parachains with AI, compute, storage, and identity services, all connected through XCM messages and x402 micropayments.
- Real DOT Transactions: Actual DOT payments on AssetHub with transaction confirmations
- Cross-Parachain Ready: Architecture prepared for XCM integration when parachains are available
- x402 Micropayments: Real micropayments for each workflow step (0.001 DOT per step)
- Blockchain Integration: Full Polkadot SDK integration with real transaction signing
- Graceful Fallbacks: Demo mode when blockchain unavailable, real mode when configured
- Modern UI: Beautiful terminal-inspired interface with live transaction monitoring
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Backend API โ โ Parachains โ
โ (Next.js) โโโโโถโ (Express) โโโโโถโ (Mock XCM) โ
โ refpage.tsx โ โ TaskOrchestratorโ โ AI/Compute/ โ
โ refglobe.css โ โ โ โ Storage/ID โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ x402 Payments โ
โ (Micropayments) โ
โโโโโโโโโโโโโโโโโโโโ
- Node.js 18+ installed
- Basic understanding of Polkadot/Substrate
-
Install Dependencies
# Install all dependencies npm install cd server && npm install && cd ..
-
Configure Environment
# Create environment file in server directory cd server cp .env.example .env.local # Create from template # Edit .env.local with your values: # DOT402_MNEMONIC=your twelve word mnemonic phrase here # ASSET_HUB_RPC=wss://passet-hub-paseo.ibp.network
-
Get Test Funds (for Paseo testnet)
- Generate account at Polkadot.js Apps
- Get test DOT from Paseo Faucet
-
Start Services
# Start backend (from server directory) npm run dev # Start frontend (from project root, new terminal) npm run dev
-
Verify Setup
- Backend: http://localhost:3001/health
- Frontend: http://localhost:3000
- Look for "REAL BLOCKCHAIN MODE" in server logs
๐ Detailed Setup: See SETUP.md for complete instructions
-
Initialize (
dot402 init)- Sets up identity on Identity parachain
- Allocates compute resources
- Configures storage
-
Generate (
dot402 generate)- Verifies identity
- Requests AI generation from AI parachain
- Processes with compute resources
- Stores results
-
Review (
dot402 review)- Loads content from storage
- AI-powered code review
- Processes review results
-
Deploy (
dot402 deploy)- Verifies deployment permissions
- Optimizes with compute parachain
- Stores deployment artifacts
- AI security scanning
Each workflow step involves:
- XCM Message: Sent to target parachain
- x402 Payment: Micropayment for the operation
- Result Processing: Handle parachain response
- Status Update: Real-time progress tracking
dot402/
โโโ refpage.tsx # Main UI component
โโโ refglobe.css # Styling and animations
โโโ server/ # Backend server
โ โโโ src/
โ โ โโโ index.ts # Server entry point
โ โ โโโ services/
โ โ โ โโโ TaskOrchestrator.ts # Main workflow logic
โ โ โ โโโ xcm.ts # Mock XCM service
โ โ โ โโโ x402.ts # Mock x402 payments
โ โ โโโ routes/
โ โ โ โโโ taskRoutes.ts # API endpoints
โ โ โโโ types/
โ โ โโโ Task.ts # TypeScript interfaces
โ โโโ package.json
โโโ start-dot402.sh # Linux/macOS startup script
โโโ start-dot402.bat # Windows startup script
โโโ README.md
POST /api/submitTask- Submit new workflowGET /api/taskStatus/:id- Get task statusPOST /api/executeMicroTask- Execute specific stepGET /health- Health check
The UI connects to the backend through minimal fetch calls:
// Submit a task
const response = await fetch('http://localhost:3001/api/submitTask', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'generate',
description: 'Generate code using cross-parachain AI'
})
});- Real Polkadot SDK integration
- Actual DOT payments on AssetHub
- Transaction signing and monitoring
- Environment validation and setup
- Graceful fallback mechanisms
- XCM message construction framework
- Real parachain connections
- Multi-parachain workflow orchestration
- Cross-chain payment routing
- Custom workflow builder
- Multi-user support with authentication
- Workflow templates and marketplace
- Analytics dashboard
- Mobile app and API extensions
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Backend: Node.js, Express, TypeScript
- Blockchain: Polkadot (simulated), XCM (mock), x402 (mock)
- Styling: Custom CSS animations, Terminal theme
Backend (server/.env):
PORT=3001
NODE_ENV=development
MOCK_MODE=true
XCM_SIMULATION_DELAY=2000
X402_PAYMENT_DELAY=1000- Parachain Pricing: Edit
server/src/services/x402.ts - Workflow Steps: Modify
server/src/services/TaskOrchestrator.ts - UI Styling: Update
refglobe.css - Mock Responses: Customize
server/src/services/xcm.ts
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Polkadot ecosystem for cross-chain innovation
- x402 protocol for micropayment infrastructure
- Next.js team for the excellent framework
Built with โค๏ธ for the future of cross-parachain autonomous workflows