HashMon is an innovative blockchain-based Pokรฉmon mini-game built on the Pharos Network, featuring strategic battles, NFT collection, and Web3 integration. Players can battle AI opponents, level up their HashMons, and mint unique NFTs as rewards.
- Epic Battles: Strategic turn-based combat with type advantages
- HashMon Collection: Collect and train unique HashMon creatures
- NFT Rewards: Mint HashMon NFTs as battle rewards
- Level System: Gain XP and level up your HashMons
- Leaderboards: Compete with other players globally
- Web3 Integration: Built on Pharos Network with wallet connectivity
- Real-time Stats: Track battles and achievements on-chain
- Node.js 18+ and npm
- Git
- MetaMask wallet
- Supabase account (for database)
- Pharos testnet tokens
-
Clone the repository
git clone https://github.com/your-username/hashmon.git cd hashmon -
Install dependencies
npm install cd contracts && npm install cd ../backend && npm install cd ../frontend && npm install
-
Set up environment variables
Backend (
backend/.env):PORT=3001 NODE_ENV=development # Blockchain Configuration PHAROS_RPC_URL=https://testnet.dplabs-internal.com BACKEND_PRIVATE_KEY=your_backend_wallet_private_key HASHMON_CONTRACT_ADDRESS=deployed_contract_address # Supabase Configuration SUPABASE_URL=your_supabase_project_url SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key # Security JWT_SECRET=your_jwt_secret VOUCHER_EXPIRY_HOURS=24
Frontend (
frontend/.env):VITE_API_URL=http://localhost:3001/api VITE_HASHMON_CONTRACT_ADDRESS=deployed_contract_address
-
Set up Supabase Database
- Create a new Supabase project
- Run the SQL schema from
backend/supabase/schema.sql - Get your project URL and API keys
-
Deploy Smart Contracts
cd contracts # Set your private key npx hardhat vars set PRIVATE_KEY # Deploy to Pharos testnet npm run deploy:pharos
-
Start the development servers
# From the root directory npm run dev
- HashMon.sol: ERC-721 NFT contract with battle logging
- Voucher System: Secure minting with backend-signed vouchers
- Battle Logging: On-chain battle results for TPS demonstration
- Battle Engine: Deterministic battle logic with AI opponents
- Voucher Service: EIP-712 signed mint vouchers
- Blockchain Service: Contract interaction and transaction management
- Player Service: Supabase integration for off-chain data
- React + Vite: Modern React application
- Phaser.js: 2D game engine for battle animations
- Ethers.js: Blockchain interaction
- Framer Motion: Smooth animations and transitions
- Select HashMon: Choose from your collection
- Choose Difficulty: 1-10 difficulty levels
- Strategic Combat: Turn-based battles with type advantages
- Move Selection: Choose from 4 different moves
- XP & Leveling: Gain experience and level up
- NFT Rewards: Mint NFTs for special achievements
- Fire ๐ฅ: Strong against Grass, weak to Water
- Water ๐ง: Strong against Fire, weak to Electric
- Grass ๐ฟ: Strong against Water, weak to Fire
- Electric โก: Strong against Water, weak to Ground
- Psychic ๐ฎ: Strong against Fighting, weak to Dark
- Fighting ๐: Strong against Normal, weak to Psychic
- Dark ๐: Strong against Psychic, weak to Fighting
- Steel โ๏ธ: High defense, weak to Fire
hashmon/
โโโ contracts/ # Smart contracts (Hardhat)
โโโ backend/ # Node.js API server
โโโ frontend/ # React application
โโโ docs/ # Documentation
โโโ README.md
Root level:
npm run dev: Start all development serversnpm run build: Build all projectsnpm run test: Run contract tests
Contracts:
npm run compile: Compile smart contractsnpm run deploy:pharos: Deploy to Pharos testnetnpm run test: Run contract tests
Backend:
npm run dev: Start development servernpm start: Start production server
Frontend:
npm run dev: Start development servernpm run build: Build for productionnpm run preview: Preview production build
- Chain ID: 688688
- RPC URL: https://testnet.dplabs-internal.com
- Explorer: https://testnet.pharosscan.xyz
- Currency: PHAR
- Chain ID: 688689
- RPC URL: https://atlantic.dplabs-internal.com
- Explorer: https://pharos-atlantic-testnet.socialscan.io
- Currency: PHAR
HashMon showcases Pharos Network's high TPS capabilities through:
- Battle Logging: Each battle result is logged on-chain
- Parallel Processing: Multiple battles can be processed simultaneously
- Gas Efficiency: Optimized smart contracts for minimal gas usage
- Real-time Stats: Live blockchain statistics in the UI
We provide detailed guides for deploying to Vercel:
- Quick Start: See QUICK_DEPLOY.md for fastest deployment
- Full Guide: See VERCEL_DEPLOYMENT.md for complete instructions
Recommended Approach: Deploy frontend and backend as separate Vercel projects for better isolation and scaling.
-
Deploy Smart Contracts
cd contracts npx hardhat ignition deploy ./ignition/modules/HashMon.js --network pharos -
Deploy Backend
- Use Vercel (see deployment guides above)
- Or use services like Render, Railway, or AWS
- Set environment variables
- Ensure Supabase is configured
-
Deploy Frontend
- Use Vercel (see deployment guides above)
- Or use Netlify or similar
- Set environment variables
- Update API URLs
Production Backend:
NODE_ENV=production
PORT=3001
PHAROS_RPC_URL=https://testnet.dplabs-internal.com
BACKEND_PRIVATE_KEY=your_production_private_key
HASHMON_CONTRACT_ADDRESS=deployed_contract_address
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_keyProduction Frontend:
VITE_API_URL=https://your-api-domain.com/api
VITE_HASHMON_CONTRACT_ADDRESS=deployed_contract_address- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Pharos Network for providing the blockchain infrastructure
- OpenZeppelin for secure smart contract libraries
- Phaser.js for the game engine
- Supabase for the backend-as-a-service platform
- React and Vite for the frontend framework
- Discord: Join our Pharos Discord
- Documentation: Pharos Docs
- Issues: GitHub Issues
- Multiplayer battles
- HashMon breeding system
- Guild/Team features
- Mobile app
- Advanced AI opponents
- Seasonal events
- Cross-chain integration
Built with โค๏ธ on Pharos Network
Experience the future of gaming with Web3 technology!