TestForge is a comprehensive, AI-powered smart contract testing platform that automatically deploys, tests, and analyzes Solidity contracts on Monad Testnet. Built for the Monad Hackathon.
- Claude Sonnet 4.5 integration for intelligent contract analysis
- Automatic test case generation based on contract logic
- Security vulnerability detection
- Gas optimization recommendations
- 100% function coverage - Tests every function in your contract
- Expected vs Actual result comparison for every test
- Transaction hashes for all write operations
- Multi-wallet testing (owner/non-owner) for access control
- Edge case testing (zero values, max uint256, overflow protection)
- Parameter validation with automatic test data generation
- Function Coverage Tracker - Ensure all functions are tested
- Gas Metrics Dashboard - Track gas usage for every function
- Security Findings - Categorized by severity (Critical/Warning/Info)
- Gas Optimization Tips - Smart recommendations based on actual usage
- Test History - Track improvements over time
- Export test results to CSV/JSON
- Transaction explorer links for every deployment and test
- Real-time progress tracking with percentages
- Detailed error reporting with stack traces
- Downloadable reports in multiple formats
- Monad Testnet deployment and testing
- Automatic mock token deployment for ERC20/ERC721 contracts
- Multi-network support (easily configurable)
- Block explorer integration (Monadscan)
- Node.js 18+ installed
- Monad Testnet wallet with MON tokens
- Anthropic API Key for AI features
# Clone the repository
git clone https://github.com/bilal07karadeniz/TestForge.git
cd TestForge
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm install- Backend Setup (
backend/.env):
# Monad Network
MONAD_PRIVATE_KEY=your_private_key_here
MONAD_PRIVATE_KEY_2=second_wallet_for_testing
MONAD_RPC_URL=https://rpc.ankr.com/monad_testnet
# AI Configuration
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Server
PORT=3000
NODE_ENV=development- Frontend Setup (optional -
frontend/.env):
VITE_API_URL=http://localhost:3000Terminal 1 - Backend:
cd backend
npm startTerminal 2 - Frontend:
cd frontend
npm run devOpen http://localhost:5173 in your browser.
- File Upload: Drag and drop your
.solfile - Paste Code: Copy and paste your Solidity code directly
The platform will automatically:
- β Analyze contract dependencies (ERC20, ERC721, etc.)
- β Deploy mock tokens if needed
- β Compile the contract
- β Deploy to Monad Testnet
- β Execute comprehensive tests
- β Generate AI security report
View detailed results including:
- Function Coverage: See which functions were tested
- Test Results: Expected vs actual outcomes with transaction hashes
- Gas Metrics: Analyze gas consumption across functions
- Security Findings: AI-detected vulnerabilities
- Optimization Tips: Recommendations to reduce gas costs
- Download comprehensive reports
- Export test data as CSV/JSON
- Share results via unique URLs
TestForge/
βββ backend/ # Node.js + Express backend
β βββ services/
β β βββ ai.service.js # Claude AI integration
β β βββ deploy.service.js # Contract compilation & deployment
β β βββ test.service.js # Comprehensive testing engine
β β βββ mock.service.js # Mock token deployment
β βββ routes/
β β βββ analyze.js # API endpoints
β βββ utils/
β β βββ monad.config.js # Network configuration
β β βββ scoring.js # Score calculation
β βββ server.js # Express + Socket.IO server
β
βββ frontend/ # React + Vite frontend
β βββ src/
β β βββ components/
β β β βββ ContractUpload.jsx
β β β βββ ProgressTracker.jsx
β β β βββ ResultsDashboard.jsx
β β β βββ TestResults.jsx
β β β βββ FunctionCoverage.jsx
β β β βββ GasMetrics.jsx
β β β βββ GasOptimizationTips.jsx
β β β βββ SecurityFindings.jsx
β β βββ services/
β β β βββ api.js # API client
β β βββ utils/
β β βββ constants.js # Configuration
β βββ index.html
β
βββ contracts/ # Sample contracts for testing
- View Functions: Read-only contract state
- Transaction Functions: State-changing operations
- Parameterized Functions: Functions with inputs (automatic test data)
- Access Control: Owner vs non-owner testing
- Edge Cases: Zero values, max uint256, overflow tests
- Payable Functions: ETH/MON transfer testing
- Token Functions: ERC20/ERC721 interactions
Each test includes:
{
"functionName": "increment",
"type": "transaction",
"status": "passed",
"walletType": "owner",
"parameters": [],
"expectedResult": "Transaction executed successfully",
"actualResult": "Transaction confirmed",
"transactionHash": "0x1234...5678",
"gasUsed": "43234",
"blockNumber": 12345678
}- Reentrancy vulnerabilities
- Integer overflow/underflow
- Access control issues
- Unprotected functions
- Gas optimization opportunities
- π΄ Critical: Must fix before deployment
- π‘ Warning: Should be addressed
- π΅ Info: Best practices and optimizations
=== Analysis Complete ===
Overall Score: 84/100 (Good)
Contract: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1
Test Results:
βββ Total: 27 tests
βββ Passed: 25 tests
βββ Failed: 2 tests
βββ Coverage: 100%
Gas Analysis:
βββ Total Gas: 1,234,567
βββ Average: 45,724 per function
βββ Most Expensive: transfer() - 52,341 gas
βββ Optimization Score: 85/100
Security Findings:
βββ Critical: 0
βββ Warnings: 3
βββ Info: 5
- Node.js + Express.js - Server framework
- Socket.IO - Real-time communication
- ethers.js - Blockchain interactions
- solc - Solidity compiler
- Anthropic Claude API - AI analysis
- React - UI framework
- Vite - Build tool
- Tailwind CSS - Styling
- Framer Motion - Animations
- Socket.IO Client - Real-time updates
- Monad Testnet - Deployment network
- Hardhat - Development environment
- β Test contracts before mainnet deployment
- β Identify gas optimization opportunities
- β Verify function behavior with real blockchain state
- β Ensure access control is properly implemented
- β Automated security analysis
- β Comprehensive test coverage reports
- β Transaction-level verification
- β Export data for further analysis
- β CI/CD integration for continuous testing
- β Track improvements over multiple versions
- β Team collaboration with shareable results
- β Documentation generation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Monad for the amazing blockchain platform
- Anthropic for Claude AI
- OpenZeppelin for smart contract standards
- Hardhat team for development tools
Bilal Karadeniz
- GitHub: @bilal07karadeniz
- Twitter: @bilal07kara
- Multi-chain support (Ethereum, Polygon, etc.)
- Code generation (Hardhat tests, deployment scripts)
- Test history and comparison
- Attack vector simulation
- Differential testing (compare versions)
- Interactive test builder
- Team workspaces
- CI/CD integration
Built with β€οΈ for the Monad Hackathon