A decentralized NFT crafting game where players forge unique weapons on the blockchain, level up their smithing skills, and collect rare weapons as ERC721 tokens.
Blacksmith Game is an on-chain progression system where players act as blacksmiths, forging weapons of increasing power and rarity. Each weapon is a unique NFT stored with metadata on IPFS, featuring procedurally generated stats based on tier and luck. Players gain experience with each forge, unlocking higher tiers and more powerful creations.
- Swords: Balanced weapons for close combat
- Bows: Ranged weapons with high speed
- Axes: Heavy weapons with devastating damage
- Each weapon type has 10 tiers of progression
- Player Leveling: Gain 1000 XP per weapon forged
- Tier Unlocking: Higher tiers require higher player levels
- Tier 1: Level 1
- Tier 2: Level 11
- Tier 3: Level 21
- ...up to Tier 10: Level 91
- Max Level: 100
- Stats vary based on tier and randomness (Β±20% variation)
- Damage: Increases with tier (30-120 base range)
- Durability: Weapon longevity (58-130 base range)
- Speed: Attack/draw speed (35-80 base range)
Weapons can roll different rarities based on tier:
- Common: Base tier weapons
- Uncommon: Tier 3+ (60% chance)
- Rare: Tier 5+ (35% chance)
- Epic: Tier 7+ (15% chance)
- Legendary: Tier 9+ (5% chance)
All weapon metadata is stored on IPFS for decentralized, permanent storage:
- Weapon images
- Trait metadata (type, tier, rarity, stats)
- Crafting history (timestamp, creator)
- Minimal minting fee: 0.000001 ETH per forge
- Owner can withdraw accumulated fees
- Optimized gas costs for crafting
- Connect Wallet: Connect your Web3 wallet to the game
- Auto-Registration: Players are automatically registered on first forge
- Choose Weapon: Select weapon type (Sword/Bow/Axe) and tier
- Upload to IPFS: Generate or upload weapon metadata to IPFS
- Forge Weapon: Pay minimal fee and mint your unique NFT
- Level Up: Gain XP and unlock higher tier weapons
- Collect & Trade: View your arsenal and trade on NFT marketplaces
blacksmithgame/
βββ contracts/ # Smart contracts (Solidity + Foundry)
β βββ src/
β β βββ BlacksmithNFT.sol
β βββ test/
β βββ script/
βββ frontend/ # Web interface (Next.js + TypeScript)
βββ app/
βββ components/
βββ lib/
- BlacksmithNFT:
[To be deployed]- ERC721 token for forged weapons
- Stores weapon stats and player progression
- IPFS integration for metadata
- ERC721: Weapon NFTs with full metadata
- ERC721URIStorage: IPFS-based token URIs
- OpenZeppelin: Audited, secure implementations
Each component has its own setup:
cd contracts
# Install dependencies
forge install
# Build contracts
forge build
# Run tests
forge test
# Deploy to network
forge script script/Deploy.s.sol --rpc-url <RPC_URL> --private-key <PRIVATE_KEY> --broadcastcd frontend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Add your contract address and RPC URL
# Run development server
npm run devOpen http://localhost:3000 to play the game.
Create a .env.local file in the frontend directory:
NEXT_PUBLIC_CONTRACT_ADDRESS=0x...
NEXT_PUBLIC_CHAIN_ID=43113 # Avalanche Fuji testnet
NEXT_PUBLIC_IPFS_GATEWAY=https://gateway.pinata.cloud/ipfs/- Smart Contracts: Solidity 0.8.19, OpenZeppelin, Foundry
- Frontend: Next.js 14, TypeScript, Tailwind CSS, Wagmi, Viem
- Blockchain: Avalanche (or any EVM-compatible chain)
- Storage: IPFS for NFT metadata
- Web3: Reown AppKit for wallet connections
Base Stats by Tier:
- Damage = tier Γ 10 + 20
- Durability = tier Γ 8 + 50
- Speed = tier Γ 5 + 30
Random Variation: Β±20% on all stats
XP per forge: 1,000 XP
XP per level: 1,200 XP
Level formula: (Total XP / 1,200) + 1
Required Level = (Tier - 1) Γ 10 + 1
Example:
- Tier 1: Level 1+
- Tier 5: Level 41+
- Tier 10: Level 91+
- Level and experience points
- Weapon crafting statistics (swords/bows/axes)
- Complete weapon collection per player
- Auto-registration on first forge (no separate transaction)
- Efficient storage with packed structs
- ReentrancyGuard for security
- Withdraw accumulated fees
- Update minting fee (if needed)
- Owner-only controls
- Deploy to Avalanche Fuji testnet
- Add weapon upgrade/repair mechanics
- Implement weapon trading marketplace
- Add weapon burning for resources
- PvP combat system
- Guild/clan features
- Seasonal events and limited editions
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source and available under the MIT License.
[Coming Soon - Deploy to production]
Built with βοΈ by blacksmiths, for blacksmiths