Skip to content

ShahiTechnovation/zerothon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Zerothon - Python Smart Contract Platform

Build, compile, and deploy Python smart contracts with an AI-powered IDE

Next.js TypeScript Python License


πŸ“‹ Table of Contents


🎯 Overview

Zerothon is a comprehensive platform for developing Python-based smart contracts. It features:

  • Unified IDE: Monaco-based code editor with Python and Solidity support
  • Zero Wizard: Interactive contract generator (OpenZeppelin-style)
  • Python Compiler: Transpiles Python to EVM bytecode
  • AI Assistant: Integrated AI chat for contract development
  • Contract Explorer: View and interact with deployed contracts
  • Template Library: Pre-built contract templates

✨ Features

🎨 Zero Wizard (/wizard)

Interactive smart contract builder with:

  • Contract Types: Token (ERC20), NFT (ERC721), Vault, Governance
  • Modules: Ownable, Mintable, Burnable, Pausable, ReentrancyGuard
  • Real-time Code Generation: Compiler-compatible Python code
  • Security Analysis: Built-in security checks
  • Production-Ready: 500-650 lines per contract, 30-40 functions

πŸ’» Playground (/playground)

Full-featured IDE with:

  • Monaco Editor: Syntax highlighting, autocomplete
  • Multi-language: Python, Solidity, JavaScript
  • Compiler Integration: Real-time compilation
  • Deployment: Deploy to blockchain
  • Interaction: Call contract functions
  • File Management: Save/load contracts

πŸ€– AI Chat (/ai-chat)

AI-powered development assistant:

  • Contract generation
  • Code explanation
  • Bug fixing
  • Best practices

πŸ“š Templates (/templates)

Pre-built contracts:

  • Python Contracts: TokenMint, NFTSimple, Staking, DeFiSwap
  • Wizard Examples: AdvancedToken, AdvancedNFT, SecureVault
  • Production-Ready: Fully tested and documented

πŸ” Explorer (/explorer)

Blockchain explorer:

  • View deployed contracts
  • Transaction history
  • Contract interaction
  • Event logs

πŸ›  Tech Stack

Frontend

  • Framework: Next.js 14.2.25
  • Language: TypeScript 5
  • Styling: Tailwind CSS 4.1.9
  • UI Components: Radix UI
  • Animations: Framer Motion, GSAP
  • 3D Graphics: Three.js, React Three Fiber
  • Code Editor: Monaco Editor

Backend

  • Runtime: Node.js
  • API: Next.js API Routes
  • Database: Dexie (IndexedDB)
  • Authentication: JWT

Blockchain

  • Library: ethers.js
  • Compiler: solc 0.8.30
  • Python Runtime: Pyodide 0.29.0

AI

  • Provider: OpenRouter
  • SDK: Vercel AI SDK

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or pnpm
  • Git

Installation

# Clone the repository
git clone https://github.com/ShahiTechnovation/zerothon.git
cd zerothon

# Install dependencies
npm install --legacy-peer-deps

# Run development server
npm run dev

The app will be available at http://localhost:3000

Build for Production

# Create production build
npm run build

# Start production server
npm start

πŸ“ Project Structure

zerothon/
β”œβ”€β”€ app/                          # Next.js app directory
β”‚   β”œβ”€β”€ ai-chat/                  # AI assistant page
β”‚   β”œβ”€β”€ api/                      # API routes
β”‚   β”œβ”€β”€ contract/                 # Contract details page
β”‚   β”œβ”€β”€ docs/                     # Documentation page
β”‚   β”œβ”€β”€ explorer/                 # Blockchain explorer
β”‚   β”œβ”€β”€ features/                 # Features showcase
β”‚   β”œβ”€β”€ playground/               # IDE page
β”‚   β”œβ”€β”€ templates/                # Template gallery
β”‚   └── wizard/                   # Zero Wizard page
β”œβ”€β”€ components/                   # React components
β”‚   β”œβ”€β”€ bottom-dock-menu.tsx      # Navigation dock
β”‚   β”œβ”€β”€ ui/                       # UI components (Radix)
β”‚   └── zerothan-ai/              # IDE components
β”‚       └── unified-ide.tsx       # Main IDE component
β”œβ”€β”€ lib/                          # Utilities and libraries
β”‚   β”œβ”€β”€ pychain/                  # Python smart contract library
β”‚   β”‚   └── std/                  # Standard library
β”‚   β”‚       β”œβ”€β”€ base/             # Base contracts (Token, NFT)
β”‚   β”‚       └── mixins/           # Composable modules
β”‚   β”œβ”€β”€ plugins/                  # Compiler plugins
β”‚   └── utils/                    # Helper functions
β”œβ”€β”€ templates/                    # Contract templates
β”‚   β”œβ”€β”€ python_contracts/         # Basic Python contracts
β”‚   └── wizard_examples/          # Generated examples
β”œβ”€β”€ zerothan_cli/                 # Python to EVM compiler
β”‚   β”œβ”€β”€ transpiler.py             # AST analyzer & bytecode generator
β”‚   β”œβ”€β”€ compiler.py               # Compilation orchestration
β”‚   β”œβ”€β”€ py_contracts.py           # Base contract classes
β”‚   └── deployer.py               # Deployment utilities
β”œβ”€β”€ python-compiler-service/      # Compiler microservice
β”œβ”€β”€ docs/                         # Documentation
β”‚   β”œβ”€β”€ ZERO_WIZARD_*.md          # Wizard documentation
β”‚   └── *.md                      # Other guides
β”œβ”€β”€ public/                       # Static assets
β”œβ”€β”€ scripts/                      # Build scripts
β”‚   └── sync-cli.js               # CLI sync script
└── package.json                  # Dependencies

🌐 Available Routes

Route Description Features
/ Home page Landing, features showcase
/playground IDE Code editor, compiler, deployment
/wizard Contract wizard Interactive contract builder
/templates Template gallery Pre-built contracts
/ai-chat AI assistant Contract generation, help
/explorer Blockchain explorer View contracts, transactions
/contract/[address] Contract details Interact with deployed contracts
/docs Documentation Guides, API reference
/features Features page Platform capabilities

πŸ“ Smart Contract Templates

Python Contracts (templates/python_contracts/)

  1. TokenMint.py (~90 lines)

    • Basic ERC20 token
    • Minting and burning
    • Admin controls
  2. NFTSimple.py (~95 lines)

    • Basic ERC721 NFT
    • Minting and transfers
    • Approval system
  3. Staking.py (~95 lines)

    • Token staking
    • Reward calculation
    • Stake/unstake
  4. DeFiSwap.py (~100 lines)

    • Token swapping
    • Liquidity pools
    • Price calculation

Wizard Examples (templates/wizard_examples/)

  1. MyToken.py (~500 lines, 30+ functions)

    • Complete ERC20 implementation
    • Minting, burning, pausing
    • Blacklist, transfer controls
    • Statistics tracking
  2. MyNFT.py (~600 lines, 35+ functions)

    • Complete ERC721 implementation
    • Metadata management
    • Royalty system
    • Operator approvals
  3. SecureVault.py (~650 lines, 40+ functions)

    • Time-locked withdrawals
    • Fee system
    • Whitelist/blacklist
    • Emergency mode

πŸ§™β€β™‚οΈ Zero Wizard

The Zero Wizard is an interactive contract builder inspired by OpenZeppelin's Contracts Wizard.

Features

  • 4-Step Process:

    1. Select contract type (Token, NFT, Vault, Governance)
    2. Configure parameters (name, symbol, decimals, supply)
    3. Enable modules (Ownable, Mintable, Burnable, Pausable, etc.)
    4. Preview and export code
  • Module System:

    • Ownable: Single-owner access control
    • Mintable: Create new tokens/NFTs
    • Burnable: Destroy tokens/NFTs
    • Pausable: Emergency pause
    • ReentrancyGuard: Attack prevention
  • Security Analysis:

    • Conflict detection
    • Access control checks
    • Reentrancy warnings
    • Best practice suggestions

Generated Code

All generated contracts:

  • βœ… Import from zerothan.py_contracts
  • βœ… Use @public_function and @view_function decorators
  • βœ… Include comprehensive error handling
  • βœ… Emit events for all state changes
  • βœ… Are compiler-compatible

πŸ”§ Python Compiler

The zerothan_cli transpiles Python smart contracts to EVM bytecode.

Architecture

Python Source Code
       ↓
AST Analysis (transpiler.py)
       ↓
State Variables & Functions Extraction
       ↓
EVM Bytecode Generation
       ↓
Deployable Contract

Key Components

  1. transpiler.py: AST analyzer and bytecode generator
  2. compiler.py: Compilation orchestration
  3. py_contracts.py: Base contract classes
  4. deployer.py: Deployment utilities

Usage

from zerothan.py_contracts import PySmartContract

class MyContract(PySmartContract):
    def __init__(self):
        super().__init__()
        self.my_var = self.state_var("my_var", 0)
    
    @public_function
    def set_value(self, value: int):
        self.my_var = value
        self.event("ValueSet", value)
    
    @view_function
    def get_value(self) -> int:
        return self.my_var

πŸ’» Development

Scripts

# Development server (with CLI sync)
npm run dev

# Production build
npm run build

# Start production server
npm start

# Lint code
npm run lint

Environment Variables

Create .env.local:

# Optional: Add your environment variables here
NEXT_PUBLIC_APP_NAME=Zerothon
NEXT_PUBLIC_APP_URL=http://localhost:3000

Adding New Templates

  1. Create contract in templates/python_contracts/ or templates/wizard_examples/
  2. Follow the compiler-compatible format
  3. Add to template gallery in app/templates/page.tsx

πŸš€ Deployment

Vercel (Recommended)

  1. Push to GitHub
  2. Import project in Vercel
  3. Deploy automatically
# Or use Vercel CLI
npm install -g vercel
vercel --prod

Manual Deployment

# Build
npm run build

# Start
npm start

See DEPLOYMENT.md for detailed instructions.


πŸ“š Documentation

Zero Wizard Docs

Other Guides


🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.


πŸ™ Acknowledgments

  • OpenZeppelin: Inspiration for the Wizard
  • Next.js Team: Amazing framework
  • Vercel: Hosting and deployment
  • Monaco Editor: Code editor
  • Radix UI: UI components

πŸ“ž Support


🎯 Roadmap

Current (v1.0)

  • βœ… Zero Wizard with 5 modules
  • βœ… Production-ready contracts
  • βœ… Unified IDE
  • βœ… Python compiler
  • βœ… Template library

Upcoming (v1.1)

  • More wizard modules (AccessControl, Permit, Upgradeable)
  • Enhanced compiler optimizations
  • Contract verification
  • Testnet deployment
  • Wallet integration

Future (v2.0)

  • Multi-chain support
  • Contract marketplace
  • Audit integration
  • Advanced analytics
  • Team collaboration

Built with ❀️ by the Zerothon Team

Making Python smart contract development accessible to everyone


Last Updated: January 15, 2026
Version: 1.0.0
Status: Production Ready

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors