Public application: https://chainforge-production.up.railway.app/
ChainForge is a decentralized Web3 application developed as part of the 5BLOC – Advance Your Skills in the Blockchain program.
The application allows players to mint, own, transfer, and forge weapon NFTs using a simple RPG-inspired mechanic, fully backed by on-chain logic. Weapons are implemented as ERC-721 tokens deployed on Ethereum Sepolia, with metadata and images stored on IPFS.
- Overview
- Core Features
- Weapon Tiers System
- Technology Stack
- Prerequisites
- Local Installation
- Smart Contract Deployment
- Frontend Configuration
- Testing
- Important Notes
ChainForge combines blockchain fundamentals with a game-like user experience inspired by RPGs. Players can mint, own, trade, and upgrade weapon NFTs through an innovative forge mechanic, entirely managed on-chain.
- ERC-721 NFTs on Ethereum Sepolia
- Metadata and images stored on IPFS
- 100% on-chain game logic
- Intuitive and responsive web interface
- Fully decentralized architecture (no server, no database)
- Connect via MetaMask or WalletConnect
- Automatic Sepolia network detection
- Responsive UI for wrong network or disconnected wallet
Supported Providers: MetaMask, WalletConnect
Network Detection: Automatic (Sepolia)
UI Feedback: Real-time
- Free minting of a Bronze weapon
- One mint per wallet per cooldown period
- Cooldown enforced directly in the smart contract
- Smooth minting animation in the frontend
Fully on-chain inventory per wallet displaying:
| Information | Description |
|---|---|
| Name | Unique weapon name |
| Tier | Rarity level (Bronze to Platinum) |
| Damage | Weapon power |
| Status | Lock status after forge |
| Date | Creation date |
| History | Transfer history |
Metadata and images loaded from IPFS
Mechanics:
- Combine 4 weapons of the same tier
- The 4 NFTs are burned
- 1 higher-tier weapon is minted
- Forge cooldown applied on-chain
- The forged weapon is temporarily locked
Progression:
- 4 Bronze Weapons → 1 Silver Weapon
- 4 Silver Weapons → 1 Gold Weapon
- 4 Gold Weapons → 1 Platinum Weapon
- Direct transfer between wallets
- No recipient validation required
- Uses ERC-721 safeTransferFrom
- Recipient sees the weapon immediately
- No backend, no escrow, no offers
- Maximum weapons per wallet enforced
- Forge cooldowns managed on-chain
- Lock system after forge
- No centralized authority after deployment
| Tier | Name | Damage |
|---|---|---|
| 0 | Bronze | 10 |
| 1 | Silver | 25 |
| 2 | Gold | 50 |
| 3 | Platinum | 100 |
- Smart Contracts: Solidity ^0.8.0
- Framework: Hardhat
- Libraries: OpenZeppelin Contracts
- Network: Ethereum Sepolia Testnet
- Framework: Next.js (App Router)
- UI Library: React 18+
- Styling: TailwindCSS
- Web3 Tools: wagmi, RainbowKit, viem
- Animations: Framer Motion
- Protocol: IPFS
- Service: Pinata
Required:
- Node.js version 18 or higher
- npm version 9 or higher
Check installed versions:
node -v
npm -vA MetaMask account is required to use the application.
Setup steps:
- Install the MetaMask browser extension
- Create or import a wallet
- Enable test networks
- Switch to the Sepolia network
Installation link:
https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn
You need SepoliaETH to:
- Deploy the smart contract
- Mint, forge, and transfer weapons
Available Faucets:
| Service | Type | Link |
|---|---|---|
| Mining Faucet | PoW | https://sepolia-faucet.pk910.de/ |
| Google Cloud | Direct | https://cloud.google.com/application/web3/faucet/ethereum/sepolia |
git clone https://github.com/MathisDulieu/ChainForge.git
cd chainforge-project# Root dependencies
npm install
# Frontend dependencies
cd frontend
npm installCreate a .env file at the project root:
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY
PRIVATE_KEY=0xYOUR_PRIVATE_KEY- Go to https://app.infura.io
- Create an account
- Create a new Ethereum project
- Copy the Project ID
- Insert it into the RPC URL
From MetaMask:
- Open MetaMask
- Click on the account menu
- Open account details
- Export private key
- Paste it into the
.envfile
IMPORTANT: NEVER share your private key!
# Compile smart contracts
npx hardhat compile
# Deploy to Sepolia
npx hardhat run scripts/deploy.js --network sepoliaNote: Save the deployed contract address!
Before configuring the frontend, you need to deploy the metadata and images to IPFS using Pinata.
Project structure:
ipfs/
├── images/
│ ├── bronze.png
│ ├── silver.png
│ ├── gold.png
│ └── platinum.png
└── metadata/
├── bronze.json
├── silver.json
├── gold.json
└── platinum.json
Step 1: Deploy images to Pinata
- Go to https://app.pinata.cloud/ipfs/files
- Upload the 4 images from the
ipfs/images/folder - Copy the CID (Content Identifier) for each image
Step 2: Update JSON files with image CIDs
For each JSON file in ipfs/metadata/, update the "image" field with the corresponding CID:
{
"name": "Bronze Weapon",
"description": "A basic bronze weapon",
"image": "ipfs://YOUR_IMAGE_CID_HERE",
...
}Example:
"image": "ipfs://bafkreidfvoldosbeajtqevthi5mrryf6b6lta2tazu255ez5dsleiooomy"Step 3: Deploy metadata JSON files to Pinata
- Upload the 4 updated JSON files from the
ipfs/metadata/folder to Pinata - Copy the CID for each JSON file
Create a frontend/.env.local file:
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=YOUR_PROJECT_ID
NEXT_PUBLIC_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY
NEXT_PUBLIC_CHAIN_ID=11155111
NEXT_PUBLIC_IPFS_GATEWAY=https://gateway.pinata.cloud/ipfs/
NEXT_PUBLIC_CONTRACT_ADDRESS=DEPLOYED_CONTRACT_ADDRESS
NEXT_PUBLIC_TIER0_URI=ipfs://YOUR_BRONZE_JSON_CID
NEXT_PUBLIC_TIER1_URI=ipfs://YOUR_SILVER_JSON_CID
NEXT_PUBLIC_TIER2_URI=ipfs://YOUR_GOLD_JSON_CID
NEXT_PUBLIC_TIER3_URI=ipfs://YOUR_PLATINUM_JSON_CID
NEXT_PUBLIC_DEPLOY_BLOCK=YOUR_DEPLOY_BLOCK_NUMBER- Go to https://cloud.walletconnect.com
- Create a project
- Copy the Project ID
The deploy block is the block number where your smart contract was deployed on Sepolia.
- Go to https://sepolia.etherscan.io/
- Search for your deployed contract address
- On the contract page, look for the "Contract Creation" transaction
- Click on the transaction hash
- The block number is displayed on the transaction details page
- Copy this block number and paste it as
NEXT_PUBLIC_DEPLOY_BLOCK
Example: If your contract was deployed at block 10104574, set:
NEXT_PUBLIC_DEPLOY_BLOCK=10104574cd frontend
npm run devOpen http://localhost:3000 in your browser.
Run the smart contract test suite:
npx hardhat testTests covered:
- Weapon minting
- Forge system
- NFT transfers
- Cooldown management
- Wallet limits
- No backend used
- No database
- Full decentralization
- 100% on-chain logic
- Frontend = blockchain mirror
- Immutable after deployment
- Hosted on Railway
- Production mode
- Available 24/7
- All game logic is executed on-chain
- The frontend only reflects the blockchain state
- No centralized server is required
- NFTs and metadata are stored in a decentralized manner
- The public deployment is accessible to everyone
Developed as part of the 5BLOC – Advance Your Skills in the Blockchain program