AI-powered tool that helps developers create secure and optimised smart contracts using natural language descriptions. Built with React, TypeScript, and OpenAI's GPT-4.
- 🤖 Natural language to Solidity code generation
- 🔒 Built-in security considerations and best practices
- ⚡ Gas optimization suggestions
- 💬 Interactive conversation interface
- 📋 One-click code copying
- 🚦 Rate limiting for API protection
- 📝 Markdown support for code blocks and explanations
- Node.js 16.x or higher
- npm 7.x or higher
- OpenAI API key
- Clone the repository:
git clone https://github.com/jennievon/smart-contract-ai-assistant.git
cd smart-contract-ai-assistant
- Install dependencies:
npm install
- Create a
.env
file in the root directory and add your OpenAI API key:
VITE_OPENAI_API_KEY=your-api-key-here
- Start the development server:
npm run dev
- Enter your smart contract requirements in natural language
- The AI will generate Solidity code based on your description
- Review the generated code, security considerations, and best practices
- Ask follow-up questions or request modifications
- Copy the final code to your clipboard with one click
src/
├── components/ # React components
│ ├── ContractInput/ # User input handling
│ └── ContractOutput/ # Conversation display
├── config/ # Configuration files
├── types/ # TypeScript type definitions
└── utils/ # Utility functions and services
- OpenAIService: Handles communication with the OpenAI API
- RateLimiter: Prevents API abuse through request rate limiting
- ContractInput: User interface for entering requirements
- ContractOutput: Displays the conversation and generated code
- API key validation
- Rate limiting implementation
- Input validation
- Error handling
- Secure environment variable usage
- TypeScript for type safety
- Component-based architecture
- Clean code principles
- Error boundary implementation
- Responsive design
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
For support, please open an issue in the GitHub repository or contact me :)