No-Code Blockchain Workflow Automation on Polkadot
Autometa is a comprehensive automation platform that enables users to create, schedule, and execute blockchain workflows without writing code. Built on Moonbeam (a Polkadot parachain), it combines smart contracts, a Python backend/worker system, and a modern web interface to automate on-chain actions based on time triggers, price conditions, or wallet events.
Autometa allows users to:
- Create workflows with triggers (time-based, price-based, or event-based) and actions (token transfers, contract calls)
- Schedule automated execution of workflows at specified intervals
- Monitor execution through a comprehensive dashboard with real-time transaction tracking
- Manage gas budgets via an escrow system that handles execution costs
The platform leverages the Polkadot ecosystem through Moonbeam's EVM compatibility layer, enabling Ethereum-compatible smart contracts to run on a Polkadot parachain while benefiting from Polkadot's security and interoperability.
βββββββββββββββββββ
β Frontend β Next.js + Wagmi + Viem
β (User Portal) β - Create/manage workflows
ββββββββββ¬βββββββββ - View dashboards & transactions
β - Connect wallet (MetaMask)
β
βΌ
βββββββββββββββββββ
β Backend API β FastAPI + Web3.py
β (REST Service) β - Workflow CRUD operations
ββββββββββ¬βββββββββ - Escrow balance queries
β - Price feed integration
β - Event log querying
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββ
β Moonbase Alpha (Polkadot) β
β β
β βββββββββββββββββ ββββββββββββββββ β
β β WorkflowRegistryβ β FeeEscrow β β
β β - Stores workflowsβ - Gas depositsβ β
β β - Owner mappings β - Gas chargingβ β
β βββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β
β ββββββββββββ¬ββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β ActionExecutor β β
β β - Execute workflowsβ β
β β - Handle gas fees β β
β βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββ
β²
β
ββββββββββ΄βββββββββ
β Worker System β Python + Redis + Web3.py
β β
β ββββββββββββ β - Scheduler: Monitors workflows
β βScheduler β β every 10s, enqueues ready jobs
β βββββββ¬βββββ β
β β β - Worker: Executes workflows from
β βΌ β Redis queue, calls contracts
β ββββββββββββ β
β β Worker β β - Single execution attempt
β ββββββββββββ β - No infinite retries
βββββββββββββββββββ
Three core contracts deployed on Moonbase Alpha:
-
WorkflowRegistry.sol
- Stores workflow definitions (trigger, action, schedule, owner)
- Tracks workflow state (active/paused, next run time)
- Emits events for workflow lifecycle (created, updated, executed)
-
FeeEscrow.sol
- Manages gas deposits for users
- Allows worker to charge gas from user balances
- Provides deposit/withdrawal functionality
-
ActionExecutor.sol
- Executes workflow actions on-chain (token transfers, contract calls)
- Updates workflow
nextRuntimestamp after execution - Charges gas fees from escrow (only for successful executions in updated version)
- Restricted to authorized worker addresses via
WORKER_ROLE
Moonbeam is an Ethereum-compatible smart contract parachain on Polkadot. By building on Moonbeam, Autometa gains:
- EVM Compatibility: Deploy Solidity contracts without modifications
- Polkadot Security: Inherit security from Polkadot's shared security model
- Cross-Chain Potential: Future integration with other Polkadot parachains via XCM (Cross-Consensus Messaging)
- Low Fees: Benefit from Polkadot's efficient consensus and Moonbeam's gas optimization
- Developer Tooling: Use familiar Ethereum tools (Hardhat, Web3.py, Ethers.js, MetaMask)
The project is configured for Moonbase Alpha, Moonbeam's testnet:
- Chain ID: 1287
- RPC:
https://rpc.api.moonbase.moonbeam.network - Native Token: DEV (test token)
- Explorer: Moonbase Moonscan
- Faucet: Get testnet DEV
- POA Middleware: Web3.py configured with Proof-of-Authority middleware for Moonbeam compatibility
- EIP-1559 Transactions: Worker uses EIP-1559 format (maxFeePerGas, maxPriorityFeePerGas) adapted for Moonbeam
- Token Mappings: Price adapters support DOT β Polkadot and GLMR β Moonbeam asset mappings
- Moonbeam Libraries: Frontend uses
viem/chainswithmoonbaseAlphachain configuration
User Journey:
User β Frontend β Backend API β WorkflowRegistry Contract
- User connects wallet (MetaMask) to frontend
- User creates workflow via UI:
- Trigger: Time-based (interval in seconds), price condition, or wallet event
- Action: Token transfer, native currency transfer, or contract call
- Schedule: Next run time and recurrence interval
- Gas Budget: Amount (in DEV) allocated for execution
- Frontend calls backend API
/api/workflow/create - Backend validates workflow and calls
WorkflowRegistry.createWorkflow() - Contract stores workflow on-chain with unique
workflowId - Event
WorkflowCreatedemitted - User deposits gas to
FeeEscrowcontract for execution costs
Automated Execution Flow:
Scheduler β WorkflowRegistry (read) β Redis Queue β Worker β ActionExecutor Contract
Every 10 seconds, the Scheduler:
- Queries
WorkflowRegistryfor all active workflows - Checks
nextRuntimestamp for each workflow - If
currentTime >= nextRun, enqueues workflow to Redis queue - Workflow job includes:
workflowId,owner,actionData,gasBudget,interval
Worker Process:
- Dequeues job from Redis
- Balance Check: Queries
FeeEscrowto verify user has sufficient balance- If insufficient β logs warning, skips execution (waits for next scheduled time)
- Prepares transaction data:
- Decodes
actionDatafrom workflow - Calculates
newNextRun = currentTime + interval
- Decodes
- Calls
ActionExecutor.executeWorkflow():function executeWorkflow( uint256 workflowId, bytes calldata actionData, uint256 newNextRun, address userToCharge, uint256 gasToCharge )
- ActionExecutor Logic:
- Executes the action (transfer, contract call, etc.)
- If successful: Charges gas from user's escrow balance
- If failed: No gas charged (in updated version), logs error
- Updates
workflow.nextRuninWorkflowRegistry - Emits
WorkflowExecutedevent
- Worker logs result (success/failure) with transaction hash
- No retries: Failed workflows wait for next scheduled execution time
User Dashboard:
- View all workflows with status badges (Active, Paused, Pending)
- See execution counts, creation timestamps, next run times
- Monitor escrow balance
- View transaction history with Moonscan links
- Pause/resume/delete workflows
- Deposit/withdraw gas funds
Transaction Tracking:
- Each execution emits blockchain events
- Frontend queries events via backend API
- Displays: workflow ID, timestamp, gas used, success/failure status
- Links to Moonscan for full transaction details
autometa/
βββ contracts/ # Solidity smart contracts
β βββ contracts/
β β βββ WorkflowRegistry.sol # Workflow storage & management
β β βββ ActionExecutor.sol # Execute workflows on-chain
β β βββ FeeEscrow.sol # Gas deposit & charging
β β βββ MockERC20.sol # Test token for development
β βββ scripts/ # Hardhat deployment & helper scripts
β βββ test/ # Contract unit tests
β βββ hardhat.config.js # Hardhat config (Moonbase Alpha)
β
βββ backend/ # FastAPI REST service
β βββ src/
β β βββ api/ # API route handlers
β β β βββ workflow.py # Workflow CRUD + metadata
β β β βββ escrow.py # Balance queries
β β β βββ price.py # Price feed integration
β β β βββ utils.py # Action templates
β β βββ services/ # Business logic
β β β βββ registry_service.py
β β β βββ escrow_service.py
β β β βββ price_service.py
β β βββ utils/ # Web3 provider, config, logging
β β βββ main.py # FastAPI app entry point
β βββ abi/ # Contract ABIs (synced from contracts/)
β βββ requirements.txt # Python dependencies
β
βββ worker/ # Python scheduler + worker
β βββ src/
β β βββ scheduler/ # Workflow monitoring & enqueueing
β β βββ executors/ # Job execution logic
β β β βββ job_worker.py # Main workflow executor
β β β βββ evm_executor.py # EVM transaction handling
β β βββ triggers/ # Trigger evaluation (time, price)
β β βββ adapters/ # Price feeds (CoinGecko)
β β βββ main.py # Worker entry point
β βββ tools/ # Utility scripts
β βββ requirements.txt # Python dependencies
β
βββ frontend/ # Next.js web application
β βββ src/
β β βββ app/ # Next.js app router pages
β β β βββ dashboard/ # Workflow dashboard
β β β βββ create/ # Workflow creation wizard
β β β βββ layout.tsx # Root layout
β β βββ components/ # React components
β β β βββ dashboard/ # Dashboard cards & tables
β β β βββ wallet/ # Wallet connection UI
β β β βββ footer.tsx # Footer with Moonbeam links
β β βββ config/ # Contract addresses & ABIs
β β βββ lib/ # Utilities
β βββ public/ # Static assets
β βββ package.json # Node dependencies
β
βββ README.md # This file
- Node.js 18+ (for frontend)
- Python 3.10+ (for backend & worker)
- Redis (for worker queue)
- MetaMask or compatible wallet
- DEV tokens from Moonbeam Faucet
cd contracts
# Install dependencies
npm install
# Compile contracts
npx hardhat compile
# Deploy to Moonbase Alpha (requires DEPLOYER_PRIVATE_KEY in .env)
npx hardhat run scripts/deploy.js --network moonbaseAlpha
# Grant WORKER_ROLE to worker address
npx hardhat run scripts/grant-worker-role.js --network moonbaseAlphaNote the deployed contract addresses - you'll need them for backend/worker/frontend configuration.
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment (.env file)
cat > .env << EOF
MOONBASE_RPC=https://rpc.api.moonbase.moonbeam.network
CHAIN_ID=1287
WORKFLOW_REGISTRY=<your_deployed_address>
ACTION_EXECUTOR=<your_deployed_address>
FEE_ESCROW=<your_deployed_address>
BACKEND_API_URL=http://localhost:8000/api
EOF
# Start backend server
uvicorn src.main:app --reload --port 8000Backend will be available at http://localhost:8000
cd worker
# Create virtual environment (or reuse backend's)
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment (.env file)
cat > .env << EOF
MOONBASE_RPC=https://rpc.api.moonbase.moonbeam.network
CHAIN_ID=1287
WORKFLOW_REGISTRY=<your_deployed_address>
ACTION_EXECUTOR=<your_deployed_address>
FEE_ESCROW=<your_deployed_address>
BACKEND_API_URL=http://localhost:8000/api
REDIS_URL=redis://localhost:6379/0
WORKER_PRIVATE_KEY=<your_worker_private_key>
EOF
# Start Redis (in separate terminal)
redis-server
# Start scheduler
nohup python -m src.main scheduler >> scheduler.log 2>&1 &
# Start worker
nohup python -m src.main worker >> worker.log 2>&1 &
# Monitor logs
tail -f worker.logcd frontend
# Install dependencies
npm install
# Configure environment (.env.local file)
cat > .env.local << EOF
NEXT_PUBLIC_WORKFLOW_REGISTRY=<your_deployed_address>
NEXT_PUBLIC_ACTION_EXECUTOR=<your_deployed_address>
NEXT_PUBLIC_FEE_ESCROW=<your_deployed_address>
NEXT_PUBLIC_CHAIN_ID=1287
NEXT_PUBLIC_CHAIN_NAME=Moonbase Alpha
NEXT_PUBLIC_RPC_URL=https://rpc.api.moonbase.moonbeam.network
NEXT_PUBLIC_BACKEND_API=http://localhost:8000/api
EOF
# Start development server
npm run devFrontend will be available at http://localhost:3000
-
Get Testnet Tokens
- Visit Moonbeam Faucet
- Request DEV tokens for your wallet address
-
Connect Wallet
- Open frontend at
http://localhost:3000 - Click "Connect Wallet" and approve MetaMask connection
- Ensure you're on Moonbase Alpha network (Chain ID 1287)
- Open frontend at
-
Deposit Gas to Escrow
- Navigate to Dashboard β Escrow
- Deposit DEV tokens (e.g., 1.0 DEV) to cover execution costs
- Confirm transaction in MetaMask
-
Create Workflow
- Click "Create Workflow"
- Configure Trigger:
- Time-based: Set interval (e.g., 60 seconds)
- Price-based: Set token and threshold
- Configure Action:
- Transfer: Specify recipient and amount
- Contract call: Provide contract address and calldata
- Set Schedule:
- Next run: When first execution should occur
- Interval: How often to repeat (0 for one-time)
- Set Gas Budget: Amount allocated per execution (e.g., 0.1 DEV)
- Submit transaction and confirm in MetaMask
-
Monitor Execution
- View workflow in dashboard
- Check status badges (Pending β Active β Executed)
- See execution count increment
- Click transaction links to view on Moonscan
- Pause: Temporarily disable execution (keeps schedule)
- Resume: Re-enable paused workflow
- Delete: Permanently remove workflow (cannot undo)
- View Logs: See execution history and gas consumption
Backend/Worker (.env):
# Moonbase Alpha RPC
MOONBASE_RPC=https://rpc.api.moonbase.moonbeam.network
CHAIN_ID=1287
# Contract addresses (from deployment)
WORKFLOW_REGISTRY=0x...
ACTION_EXECUTOR=0x...
FEE_ESCROW=0x...
# API configuration
BACKEND_API_URL=http://localhost:8000/api
# Redis queue (worker only)
REDIS_URL=redis://localhost:6379/0
# Worker private key (worker only)
WORKER_PRIVATE_KEY=0x...
# Price feed API keys (optional)
COINGECKO_API_KEY=your_api_keyFrontend (.env.local):
# Contract addresses
NEXT_PUBLIC_WORKFLOW_REGISTRY=0x...
NEXT_PUBLIC_ACTION_EXECUTOR=0x...
NEXT_PUBLIC_FEE_ESCROW=0x...
# Network configuration
NEXT_PUBLIC_CHAIN_ID=1287
NEXT_PUBLIC_CHAIN_NAME=Moonbase Alpha
NEXT_PUBLIC_RPC_URL=https://rpc.api.moonbase.moonbeam.network
# Backend API
NEXT_PUBLIC_BACKEND_API=http://localhost:8000/apiIf you need to update contracts:
cd contracts
# Update contract code
# Then redeploy
npx hardhat run scripts/deploy.js --network moonbaseAlpha
# Grant roles to worker
npx hardhat run scripts/grant-worker-role.js --network moonbaseAlpha
# Update contract addresses in all .env files
# Restart backend, worker, and frontend- Worker executes each workflow once per scheduled time
- Failed executions wait for next scheduled interval
- Prevents gas waste from repeated failures
- Balance checks before execution to avoid unnecessary transactions
- User deposits DEV to escrow before creating workflows
- Gas charged only for successful executions
- Transparent balance tracking in dashboard
- Users can withdraw unused funds anytime
- Live workflow status updates
- Execution count tracking
- Creation timestamps and next run times
- Transaction history with blockchain explorer integration
- Multiple trigger types (time, price, events)
- Various actions (transfers, contract calls)
- Recurring or one-time execution
- Pause/resume without losing schedule
1. Worker Not Executing Workflows
# Check if scheduler is running
pgrep -af "src.main scheduler"
# Check if worker is running
pgrep -af "src.main worker"
# View worker logs
tail -f worker/worker.log
# Check Redis connection
redis-cli ping2. Insufficient Balance Errors
# Check escrow balance via API
curl http://localhost:8000/api/escrow/balance/<your_wallet_address>
# Deposit more DEV via frontend
# Or check on Moonscan: https://moonbase.moonscan.io/address/<FEE_ESCROW_ADDRESS>3. Transaction Failures
- Verify you're on Moonbase Alpha network (Chain ID 1287)
- Check gas budget is sufficient (minimum ~0.1 DEV per execution)
- Ensure worker has WORKER_ROLE on ActionExecutor contract
- View transaction details on Moonscan for specific error messages
4. Frontend Not Connecting
# Check backend is running
curl http://localhost:8000/api/utils/info
# Verify contract addresses match in .env.local
# Clear browser cache and reconnect wallet
# Check MetaMask network (should be Moonbase Alpha)- Scheduler interval: 10 seconds (configurable)
- Worker concurrency: Single worker (horizontally scalable)
- Redis queue: Reliable job persistence
- Gas efficiency: Single transaction per execution (no retries)
- Run multiple worker processes for higher throughput
- Use Redis Cluster for distributed queue
- Deploy backend with load balancer
- Consider L2/rollup solutions for even lower fees
- β AccessControl for role-based permissions
- β ReentrancyGuard on all state-changing functions
- β Only authorized workers can execute workflows
- β Users control their own workflows (owner checks)
β οΈ Worker private key must be securely storedβ οΈ Backend should use API authentication in productionβ οΈ Redis should require authenticationβ οΈ Use HTTPS/WSS in production deployments
- Enable API rate limiting
- Add authentication middleware (JWT/OAuth)
- Use secure Redis (password + TLS)
- Store private keys in HSM or secret manager
- Enable CORS restrictions
- Add monitoring/alerting (Grafana, Prometheus)
- Moonbase Moonscan - Block explorer
- Moonbeam Faucet - Get testnet DEV
- Polkadot.js Apps - Polkadot ecosystem UI
Contributions are welcome! Please:
- Fork the repository
- Create a 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.
- Moonbeam Foundation for providing EVM compatibility on Polkadot
- Polkadot for the interoperable multi-chain ecosystem
- OpenZeppelin for secure smart contract libraries
- CoinGecko for price feed data
Built with β€οΈ on the Polkadot ecosystem
- Backend
- Create a Python venv and install requirements from
backend/requirements.txt. - Set
MOONBASE_RPCand other env variables inbackend/.env. - Start FastAPI server (example):
cd backend
# activate venv
python -m uvicorn src.main:app --reload --port 8000- Worker & Scheduler
- Create a Python venv and install
worker/requirements.txt. - Configure
worker/.env(ensureMOONBASE_RPC,BACKEND_API_URL, Redis URL, private keys, etc.). - Start scheduler and worker (examples):
cd worker
# activate venv
nohup python -m src.main scheduler >> scheduler.log 2>&1 &
nohup python -m src.main worker >> worker.log 2>&1 &- Frontend
cd frontendand install node deps- Add
frontend/.env.localvalues (RPC and contract addresses) - Start Next.js dev server:
npm run dev
- Although running on Moonbeam (an ecosystem project inside Polkadot), this code is EVM-oriented β contracts are Solidity and interactions use web3/ethers-style patterns.
- The current setup uses Moonbase Alpha testnet for development and tests.
- Some behavior (for example gas charging on failed contract calls) may require contract redeploys to change; the worker fixes can mitigate operational issues without redeploying contracts.
- Moonbeam docs: https://docs.moonbeam.network/
- Moonbase Alpha info: https://docs.moonbeam.network/networks/testnet/
- Moonscan (Moonbase explorer): https://moonbase.moonscan.io/
- Moonbeam faucet: https://faucet.moonbeam.network/