A production-ready, fully onchain trading bot framework built natively for Base L2. Designed for traders and developers who demand complete sovereignty over their funds with emergency-ready offline capabilities and transparent execution.
- 🔗 Fully Onchain Logic - All trading decisions executed transparently on Base L2
- 🔒 Offline Emergency Mode - Sign critical operations offline with replay protection
- 📊 Multi-Oracle Price Validation - Pyth Network + RedStone Finance + TWAP aggregation
- 📱 Multi-Channel Alerts - Telegram, SMS, Discord, and Farcaster notifications
- 🔐 Account Abstraction Ready - ERC-4337 + EOA support with smart wallet integration
- 🏠 Local Sovereignty - Private keys never leave your device (OS Secure Enclave)
- ⚡ Gas Efficient - Optimized for Base L2 (< $0.01 per trade)
- 🛡️ MEV Protection - Built-in slippage protection and deadline validation
- 🔄 Auto-Broadcast - Automatic retry with exponential backoff for failed operations
- 📈 Strategy Registry - Pluggable external strategies with bytecode validation
graph TB
subgraph "Desktop Application (Tauri)"
UI[React Frontend]
Rust[Rust Backend]
Store[Secure Storage<br/>OS Keychain/DPAPI]
end
subgraph "Offchain Services"
Executor[Executor Node<br/>TypeScript]
Notifier[Notification Service<br/>Multi-channel]
end
subgraph "Base L2 Blockchain"
Bot[BotController.sol]
Emergency[EmergencyModule.sol]
Registry[StrategyRegistry.sol]
end
subgraph "Oracle Network"
Pyth[Pyth Network]
RedStone[RedStone Finance]
TWAP[Uniswap V3 TWAP]
end
subgraph "External Integrations"
Telegram[Telegram Bot]
Discord[Discord Webhook]
SMS[Twilio SMS]
Farcaster[Warpcast API]
end
UI <--> Rust
Rust <--> Store
Rust <--> Executor
Executor <--> Bot
Executor <--> Pyth
Executor <--> RedStone
Executor <--> TWAP
Bot <--> Emergency
Bot <--> Registry
Executor <--> Notifier
Notifier --> Telegram
Notifier --> Discord
Notifier --> SMS
Notifier --> Farcaster
classDef secure fill:#e1f5fe
classDef onchain fill:#f3e5f5
classDef oracle fill:#fff3e0
classDef external fill:#e8f5e8
class Store,Rust secure
class Bot,Emergency,Registry onchain
class Pyth,RedStone,TWAP oracle
class Telegram,Discord,SMS,Farcaster external
Our framework has been audited and approved for mainnet deployment with the following security guarantees:
- ✅ Private Keys in OS Secure Enclave - DPAPI (Windows), Keychain (macOS), Secret Service (Linux)
- ✅ Emergency Operations Protected - uniqueId + nonce + EIP-712 signatures + expiry timestamps
- ✅ Bytecode Hash Validation - All external strategies verified before execution
- ✅ Zero Cloud Key Exposure - Private keys never transmitted to Executor or cloud services
- ✅ Replay Attack Prevention - Nonce-based protection with automatic increment
- ✅ Gas Limit Enforcement - 200k gas limit per strategy execution via delegatecall
- ✅ Multi-Oracle Validation - Price manipulation protection through aggregated feeds
- ✅ Slippage & Deadline Protection - Configurable limits on all trades
📋 Full Security Audit Report: SECURITY_AUDIT_REPORT.md
- Node.js 18+ and npm
- Rust 1.70+ (for Tauri desktop app)
- Git
# Clone the repository
git clone https://github.com/your-org/base-trading-bot.git
cd base-trading-bot
# Install root dependencies
npm install
# Install service dependencies
cd executor-node && npm install && cd ..
cd notification-service && npm install && cd ..
cd desktop-app && npm install && cd ..
# Set up environment variables
cp .env.example .env
cp executor-node/.env.example executor-node/.env
cp notification-service/.env.example notification-service/.env
# Configure your .env files with RPC URLs and API keys# Compile smart contracts
npx hardhat compile
# Run tests
npm test # All contract tests
npm run test:unit # Unit tests only
npm run test:fork # Fork tests (requires Base RPC)
# Deploy to Base Sepolia testnet
npm run deploy:sepolia
# Start the desktop application
cd desktop-app
npm run tauri dev# Deploy contracts to Base Mainnet
npm run deploy:mainnet
# Build desktop application
cd desktop-app
npm run tauri build
# Deploy services with Docker
docker-compose up -d- Smart Contracts - Solidity contracts for onchain execution
- Desktop App - Tauri-based desktop application with React frontend
- Executor Node - TypeScript service for offchain coordination
- Notification Service - Multi-channel alert system
- Deployment Guide - Complete deployment instructions
- Security Guide - Security best practices and audit results
- API Documentation - Executor Node API reference
- Desktop App Guide - Desktop application usage
# Base RPC Configuration
BASE_MAINNET_RPC_URL=https://mainnet.base.org
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
# Contract Addresses (auto-populated after deployment)
BOT_CONTROLLER_ADDRESS=0x...
EMERGENCY_MODULE_ADDRESS=0x...
STRATEGY_REGISTRY_ADDRESS=0x...
# Oracle Configuration
PYTH_ENDPOINT=https://hermes.pyth.network
REDSTONE_API_URL=https://api.redstone.finance
# Notification Channels
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
DISCORD_WEBHOOK_URL=your_discord_webhook_url
TWILIO_ACCOUNT_SID=your_twilio_account_sid// Example configuration in desktop app
const config = {
gasLimit: 200000, // Max gas per strategy execution
slippageTolerance: 0.005, // 0.5% slippage tolerance
maxPriorityFee: "0.001", // Base L2 priority fee in ETH
emergencyModeTimeout: 3600, // 1 hour emergency mode timeout
autoReconnect: true, // Auto-reconnect WebSocket
maxReconnectAttempts: 5 // Max reconnection attempts
};# Run all tests
npm test
# Run with gas reporting
REPORT_GAS=true npm test
# Run coverage analysis
npm run coverage
# Fork testing against Base Mainnet
npm run test:fork# Executor Node tests
cd executor-node && npm test
# Notification Service tests
cd notification-service && npm test
# Desktop App tests (Rust)
cd desktop-app/src-tauri && cargo testWe welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run the test suite:
npm test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Solidity: Follow Solidity Style Guide
- TypeScript: ESLint + Prettier configuration included
- Rust: Standard
rustfmtformatting - React: Functional components with hooks
| Metric | Base Sepolia | Base Mainnet |
|---|---|---|
| Average Gas Cost | ~45,000 gas | ~45,000 gas |
| Transaction Cost | ~$0.001 | ~$0.008 |
| Strategy Execution | <200ms | <200ms |
| Oracle Aggregation | <500ms | <500ms |
| Emergency Op Signing | <100ms | <100ms |
- Base Mainnet (Chain ID: 8453) - Production deployment
- Base Sepolia (Chain ID: 84532) - Testnet deployment
- EOA Wallets: MetaMask, WalletConnect, Coinbase Wallet
- Smart Wallets: ERC-4337 compatible (Biconomy, Alchemy, etc.)
- Hardware Wallets: Ledger, Trezor (via WalletConnect)
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Developer: LogicCrafterDZ
- Email: logiccrafterdz@gmail.com
- Twitter: @Arana_lib
- Telegram: https://t.me/LogicCrafterDZ
- Base Team - For building an amazing L2 platform
- Pyth Network - For reliable oracle infrastructure
- RedStone Finance - For flexible oracle solutions
- Tauri Team - For the excellent desktop app framework
- OpenZeppelin - For battle-tested smart contract libraries
🔒 Security: Always verify contract addresses and audit any external strategies before deployment. Never share your private keys or seed phrases.