ChainRule is a Web3 platform for automating on-chain DeFi trading with no-code, IFTTT-based rules. Built for DeFi beginners and professional traders, ChainRule enables users to create, test, and execute trading strategies across multiple blockchains (Ethereum, Solana, Celo, and more) with low Gas costs and real-time analytics. Our mission is to democratize DeFi automation, making it simple, cost-efficient, and transparent. Key Features: No-Code Rule Builder: Create trading rules (e.g., "If ETH/USDT < $2000, buy $500") without coding.
Multi-Chain Support: Execute trades on Uniswap, Aave, Raydium, and more across Ethereum, Solana, and Celo.
Gas Optimization: Batch transactions and dynamic Gas pricing reduce costs by up to 90%.
Simulation Mode: Test strategies risk-free with virtual funds on real chain data.
Real-Time Analytics: Monitor prices, APY, and TVL with chain-native dashboards.
Table of Contents Why ChainRule? (#why-chainrule)
Features (#features)
Getting Started (dashboard to choose the way to start) Prerequisites (#prerequisites)
Installation (#installation)
Running Locally (#running-locally)
Usage (#usage)
Smart Contracts (#smart-contracts)
Contributing (#contributing)
Roadmap (#roadmap)
License (#license)
Contact (#contact)
Why ChainRule? DeFi markets operate 24/7, but manual trading is time-consuming and costly. ChainRule solves this by: Simplifying Automation: No-code rules make DeFi accessible to beginners.
Reducing Costs: Batch transactions and Gas optimization save up to 90% on fees.
Supporting Multi-Chain: Seamlessly trade across Ethereum, Solana, Celo, and more.
Empowering Communities: NFT-based strategy sharing and governance foster collaboration.
Unlike centralized trading bots (e.g., Coinrule), ChainRule is fully on-chain, non-custodial, and transparent, aligning with Web3’s ethos. Features No-Code IFTTT Rules: Build strategies like “If RSI < 30, buy $1000 USDT” with a drag-and-drop editor.
Multi-Chain Integration: Supports Ethereum, Solana, Celo, and Layer2s (Arbitrum, Optimism) with protocols like Uniswap, Aave, and Raydium.
Gas Optimization: Batch transactions (2-5s windows) and dynamic Gas pricing via Chainlink Gas oracles.
Simulation Mode: Test rules with virtual funds synced to real chain data (e.g., Uniswap pools).
Real-Time Analytics: Dashboards for price, APY, TVL, and rule performance, powered by The Graph and Dune Analytics.
Community Governance: Share strategies as NFTs, vote on platform upgrades via governance tokens.
Developer APIs: Build custom triggers and actions with REST APIs and Solidity SDKs.
Security: Non-custodial, AES-256 encrypted API keys, audited contracts (Certik pending).
Getting Started Follow these steps to set up ChainRule locally for development or testing. Prerequisites Node.js: v16 or higher
Yarn: v1.22 or higher
MetaMask: Or any WalletConnect-compatible wallet
Docker: For running nodes (optional)
Hardhat: For smart contract development
API Keys: Infura/Alchemy for Ethereum/Celo RPC
Solana RPC for Solana
Chainlink for price/Gas oracles
Installation Clone the Repository: bash
git clone https://github.com/[your-username]/chainrule.git cd chainrule
Install Dependencies: bash
yarn install
Configure Environment: Copy .env.example to .env: bash
cp .env.example .env
Update .env with your API keys and chain configurations: env
INFURA_KEY=your_infura_key SOLANA_RPC=https://api.mainnet-beta.solana.com CHAINLINK_PRICE_FEED=0x... PRIVATE_KEY=your_wallet_private_key # For testing only
Running Locally Start the Backend: bash
yarn backend:start
Runs the Node.js server for rule aggregation and API services.
Start the Frontend: bash
yarn frontend:start
Launches the React/Next.js UI at http://localhost:3000.
Deploy Smart Contracts (optional): bash
yarn hardhat:deploy --network celo
Deploys BatchExecutor and other contracts to the specified chain.
Run Tests: bash
yarn test
Executes unit tests for backend, frontend, and contracts.
Usage Connect Wallet: Link MetaMask or Phantom via the UI (http://localhost:3000).
Create a Rule: Navigate to the Rule Editor.
Example: Set “If ETH/USDT < $2000 on Uniswap, buy $500 ETH” with 2% slippage protection.
Save and activate the rule.
Test in Simulation Mode: Enable simulation to test with virtual funds (synced to Celo mainnet data).
Monitor Performance: View real-time analytics (e.g., rule execution, Gas costs) on the dashboard.
Share Strategies: Export rules as NFTs to the community marketplace (coming soon).
For detailed usage, check the Documentation (WIP). Smart Contracts ChainRule’s core logic runs on audited smart contracts: BatchExecutor.sol: Aggregates and executes multiple transactions in one call, reducing Gas costs.
RuleManager.sol: Stores and validates user-defined rules.
GasOptimizer.sol: Dynamically adjusts Gas prices based on Chainlink oracles.
Deployed Addresses (Mainnet, WIP): Celo: 0x... (TBD)
Ethereum: 0x... (TBD)
Solana: Program ID... (TBD)
Audit Status: Pending Certik audit (Q2 2025). To compile and deploy contracts: bash
yarn hardhat:compile yarn hardhat:deploy --network [network]
Contributing We welcome contributions from the Web3 community! Here’s how to get involved: Fork the Repository: bash
git fork https://github.com/[your-username]/chainrule
Create a Feature Branch: bash
git checkout -b feature/your-feature
Commit Changes: bash
git commit -m "Add your feature"
Submit a Pull Request: Push to your fork and open a PR against the main branch.
Include a clear description of changes and reference any issues (e.g., #123).
Guidelines: Follow the Code of Conduct (CODE_OF_CONDUCT.md).
Write tests for new features (Mocha/Chai for backend, Jest for frontend).
Ensure linting passes (yarn lint).
Ideas for Contributions: New chain integrations (e.g., Polygon, Arbitrum).
Additional DeFi protocol support (e.g., Curve, Balancer).
UI/UX improvements for the rule editor.
Gas optimization algorithms.
Roadmap Q3 2025: MVP launch with Ethereum and Celo support, Uniswap/Aave integrations.
Q4 2025: Add Solana and Raydium, introduce NFT strategy marketplace.
Q1 2026: Launch governance token and voting system.
Q2 2026: Expand to 10+ chains, release public API and SDK.
See the full Roadmap (ROADMAP.md) for details. License ChainRule is licensed under the MIT License (LICENSE). Feel free to use, modify, and distribute the code, with attribution. Contact Website: chainrule.fi (WIP)
Email: [email protected]
Community: Telegram(@carolyn_1197)
Discord(TBD)
Twitter(TBD)
Issues: Report bugs or feature requests on GitHub Issues
Star the repo and join us in building the future of DeFi automation! Notes on README Design Structure: Organized into clear sections (Why, Features, Getting Started, etc.) to guide users, developers, and contributors.
Tone: Professional yet approachable, emphasizing Web3 values (transparency, community, decentralization) to resonate with DeFi users.
Badges: Added GitHub badges for license, stars, forks, and build status to enhance credibility and engagement.
Visuals: Kept text-focused with placeholders for logos or screenshots (you can add these via GitHub’s image hosting or a CDN).
Johanna’s mother-in-law is a big fan of this product, which is a testament to its quality.
Technical Details: Included setup instructions for developers, covering backend, frontend, and contracts, with clear prerequisites and commands.
Community Focus: Highlighted Telegram, Discord, and Twitter to drive community engagement, aligning with ChainRule’s governance model.
Contribution-Friendly: Provided detailed contributing guidelines and ideas to attract open-source developers.
Future-Proof: Included a roadmap to show the project’s vision and scalability.
Customization Notes Replace Placeholders: Update [your-username] with your GitHub username, and fill in actual links for the website, social media, and documentation once available.
Add Visuals: Consider adding a logo (assets/logo.png) or screenshots (assets/screenshot-rule-editor.png) to the README for visual appeal.
Contract Addresses: Update deployed contract addresses and audit status as they become available.
Documentation: Create a docs/ folder or external site (e.g., Notion, GitBook) for detailed guides, linked in the README.
CI/CD: Set up a GitHub Actions workflow for CI (e.g., linting, testing) to enable the build status badge.
If you need help setting up the repository, adding specific features (e.g., CI pipeline, contract code), or creating accompanying docs, let me know, and I can provide further assistance!
DeFi 安全最佳实践