Skip to content

CodewMilan/dot402

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

dot402 - Cross-Parachain Autonomous Agent Workflow Builder

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.

dot402 Demo

๐ŸŒŸ Features

  • 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

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Frontend      โ”‚    โ”‚   Backend API    โ”‚    โ”‚   Parachains    โ”‚
โ”‚   (Next.js)     โ”‚โ”€โ”€โ”€โ–ถโ”‚   (Express)      โ”‚โ”€โ”€โ”€โ–ถโ”‚   (Mock XCM)    โ”‚
โ”‚   refpage.tsx   โ”‚    โ”‚   TaskOrchestratorโ”‚    โ”‚   AI/Compute/   โ”‚
โ”‚   refglobe.css  โ”‚    โ”‚                  โ”‚    โ”‚   Storage/ID    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚  x402 Payments   โ”‚
                       โ”‚  (Micropayments) โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+ installed
  • Basic understanding of Polkadot/Substrate

Setup for Real Transactions

  1. Install Dependencies

    # Install all dependencies
    npm install
    cd server && npm install && cd ..
  2. 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
  3. Get Test Funds (for Paseo testnet)

  4. Start Services

    # Start backend (from server directory)
    npm run dev
    
    # Start frontend (from project root, new terminal)
    npm run dev
  5. Verify Setup

๐Ÿ“– Detailed Setup: See SETUP.md for complete instructions

๐ŸŽฏ How It Works

Workflow Types

  1. Initialize (dot402 init)

    • Sets up identity on Identity parachain
    • Allocates compute resources
    • Configures storage
  2. Generate (dot402 generate)

    • Verifies identity
    • Requests AI generation from AI parachain
    • Processes with compute resources
    • Stores results
  3. Review (dot402 review)

    • Loads content from storage
    • AI-powered code review
    • Processes review results
  4. Deploy (dot402 deploy)

    • Verifies deployment permissions
    • Optimizes with compute parachain
    • Stores deployment artifacts
    • AI security scanning

Parachain Operations

Each workflow step involves:

  1. XCM Message: Sent to target parachain
  2. x402 Payment: Micropayment for the operation
  3. Result Processing: Handle parachain response
  4. Status Update: Real-time progress tracking

๐Ÿ”ง Development

Project Structure

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

API Endpoints

  • POST /api/submitTask - Submit new workflow
  • GET /api/taskStatus/:id - Get task status
  • POST /api/executeMicroTask - Execute specific step
  • GET /health - Health check

Frontend Integration

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'
  })
});

๐Ÿ”ฎ Future Roadmap

Phase 1: Real Transaction Foundation โœ…

  • Real Polkadot SDK integration
  • Actual DOT payments on AssetHub
  • Transaction signing and monitoring
  • Environment validation and setup
  • Graceful fallback mechanisms

Phase 2: Cross-Chain Expansion (In Progress)

  • XCM message construction framework
  • Real parachain connections
  • Multi-parachain workflow orchestration
  • Cross-chain payment routing

Phase 3: Advanced Features (Planned)

  • Custom workflow builder
  • Multi-user support with authentication
  • Workflow templates and marketplace
  • Analytics dashboard
  • Mobile app and API extensions

๐Ÿ› ๏ธ Technologies

  • 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

๐Ÿ“ Configuration

Environment Variables

Backend (server/.env):

PORT=3001
NODE_ENV=development
MOCK_MODE=true
XCM_SIMULATION_DELAY=2000
X402_PAYMENT_DELAY=1000

Customization

  • 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

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published