Avalanche AI Copilot is an advanced web-based development platform designed to revolutionize blockchain development on Avalanche. By leveraging Google's Gemini AI, the platform provides intelligent contract generation, analysis, and deployment capabilities, drastically reducing the learning curve for blockchain developers and accelerating time-to-market for decentralized applications.
- AI-Powered Contract Creation: Convert natural language descriptions into professional-grade Solidity contracts
- OpenZeppelin Integration: Automatically incorporate security best practices through industry-standard libraries
- Inline Dependency Resolution: Seamlessly handle all contract dependencies without import errors
- Template Library: Access pre-built templates for common contract types (ERC20, ERC721, Marketplaces, etc.)
- Code Explanation: Transform complex Solidity into plain English descriptions
- Security Audit Highlights: Identify potential vulnerabilities and security concerns
- Gas Optimization Tips: Suggestions for reducing transaction costs
- Best Practices Review: Ensure adherence to Avalanche development standards
- One-Click Deployment: Deploy directly to Avalanche Fuji Testnet or C-Chain Mainnet
- MetaMask Integration: Seamless wallet connection for transaction signing
- Network Configuration: Pre-configured connection to Avalanche networks
- Transaction Monitoring: Track contract deployment status in real-time
- Snowtrace Integration: Instant access to blockchain explorer for verification
- Gemini Contract Processing: Automated fixing of AI-generated contracts
- Custom Contract Templates: Save and reuse your contract designs
- Import Resolution: Automatically handle OpenZeppelin dependencies
- Contract Verification: Verify contract source code on Snowtrace
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Backend โ โ Blockchain โ
โ (Next.js/React) โโโโโบโ (Express/Node.js) โโโโโบโ Networks โ
โ โ โ โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโโโโค โโโโโโโโโโโโโโโโโโโค
โ โข Contract Editor โ โ โข Google Gemini AI โ โ โข Avalanche โ
โ โข MetaMask Connect โ โ โข Contract Fixer โ โ Fuji Testnet โ
โ โข Deployment UI โ โ โข Solidity Compilerโ โ โข Avalanche โ
โ โข Template Selector โ โ โข Import Resolver โ โ C-Chain โ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
- Framework: Next.js with React
- UI Components: Tailwind CSS
- Blockchain Connectivity: ethers.js
- Wallet Integration: MetaMask
- Code Editor: React-based code editor with syntax highlighting
- Server: Node.js with Express
- AI Integration: Google Gemini API
- Contract Processing: Custom processing pipeline for AI-generated contracts
- Compilation: solc.js and Hardhat compilation engine
- Security: Import sanitization and validation
- Networks: Avalanche Fuji Testnet and C-Chain Mainnet
- Contract Standards: ERC20, ERC721, ERC1155
- Libraries: OpenZeppelin (local vendor approach)
- Explorer: Snowtrace API integration
Users describe their desired contract functionality in natural language, and the system:
- Processes the request through Google's Gemini AI
- Applies custom transformations to ensure compilation success
- Inlines all necessary dependencies
- Produces a complete, ready-to-deploy contract
Upload existing contracts to:
- Receive plain English explanations of functionality
- Identify potential security issues
- Understand gas optimization opportunities
- Review against best practices
With a finalized contract, users can:
- Connect their MetaMask wallet
- Select target network (Testnet/Mainnet)
- Deploy with a single click
- Monitor transaction status
- View deployed contract on Snowtrace
Our system implements a sophisticated multi-stage processing pipeline for AI-generated contracts:
- Pre-processing: Cleans Markdown artifacts and formats code
- Dependency Analysis: Identifies required OpenZeppelin contracts
- Dependency Resolution: Inlines necessary code without imports
- Compiler Feedback Loop: Uses compilation errors to guide fixes
- Post-processing: Optimizes gas usage and improves readability
The platform includes an advanced pattern recognition system that:
- Identifies common contract types (tokens, NFTs, marketplaces)
- Suggests appropriate security features
- Recommends established patterns for common functionality
- Ensures compliance with Avalanche best practices
Unlike traditional import-based approaches, we implement:
- Local vendor approach for core contracts
- Dynamic inline resolution of dependencies
- Consistent versioning across projects
- Optimized code through selective inclusion
- Node.js (v18+)
- Google Gemini API key
- MetaMask browser extension for deployment
- AVAX tokens for deployment (use the Avalanche Faucet for Fuji Testnet)
-
Clone the repository
git clone https://github.com/rohan911438/Avalanche-AI-copilot.git cd Avalanche-AI-copilot -
Install backend dependencies
cd backend npm install -
Configure backend environment variables
# Create/edit .env file in the backend directory GEMINI_API_KEY=your_gemini_api_key PORT=3001 -
Install frontend dependencies
cd ../avalanche-frontend npm install
-
Start the backend server
cd backend node server.jsThe server will start on port 3001 (or the port specified in your .env file). You should see: "๐ Server running on port 3001"
-
Start the frontend development server
cd avalanche-frontend npm run dev -
Access the application Open your browser and navigate to http://localhost:3000
-
Generate a Contract:
- Navigate to the "Generate" tab
- Enter a description of the contract you want to create
- Click "Generate Contract"
-
Explain a Contract:
- Navigate to the "Explain" tab
- Paste the Solidity code you want to analyze
- Click "Explain Contract"
-
Deploy a Contract:
- Navigate to the "Deploy" tab
- Ensure you have a contract ready (either generated or pasted)
- Connect your MetaMask wallet
- Select the network (Fuji Testnet recommended for testing)
- Click "Compile Contract" and then "Deploy to Avalanche"
- Confirm the transaction in MetaMask
- View your deployed contract on Snowtrace
Backend won't start:
- Ensure you have installed all dependencies:
npm install - Verify your .env file contains the required GEMINI_API_KEY
- Check if the port is already in use
MetaMask Connection Issues:
- Ensure MetaMask is installed and unlocked
- Add Avalanche networks to MetaMask if they aren't already configured
Deployment Errors:
- For Fuji Testnet: Make sure you have testnet AVAX from the faucet
- Check compilation errors in the console
- Verify you're on the correct network in MetaMask
- Avalanche Documentation
- Snowtrace Explorer
- Fuji Testnet Explorer
- Avalanche Faucet
- OpenZeppelin Contracts
- Contract Interaction Interface: GUI for interacting with deployed contracts
- Contract Verification: Automated verification on Snowtrace
- Advanced Template System: Expanded library of contract templates
- Multi-contract Projects: Support for complex multi-contract systems
- Gas Optimization Engine: Advanced suggestions for gas efficiency
- Automated Testing: Generation of unit tests for contracts
We welcome contributions from the community! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details. Copyright (c) 2025 Rohan Kumar (@rohan911438).
- Avalanche Documentation
- Snowtrace Explorer
- Fuji Testnet Explorer
- Avalanche Faucet
- OpenZeppelin Contracts
- Google Gemini AI
- OpenZeppelin in Avalanche Copilot
To configure MetaMask for Avalanche networks:
Fuji Testnet:
Network Name: Avalanche Fuji Testnet
New RPC URL: https://api.avax-test.network/ext/bc/C/rpc
Chain ID: 43113 (0xA869 in hex)
Currency Symbol: AVAX
Block Explorer URL: https://testnet.snowtrace.io/
Avalanche Mainnet:
Network Name: Avalanche C-Chain
New RPC URL: https://api.avax.network/ext/bc/C/rpc
Chain ID: 43114 (0xA86A in hex)
Currency Symbol: AVAX
Block Explorer URL: https://snowtrace.io/
Built with โค๏ธ by Rohan Kumar (@rohan911438) for the Avalanche developer community