ChainForge is a Web3 decentralized application developed as part of the 5BLOC – Advance Your Skills in the Blockchain program.
The application allows users to own, manage, and forge weapon NFTs on the Ethereum blockchain.
Weapons are implemented as ERC-721 tokens, forged through a gameplay mechanic where four weapons of the same tier can be burned to create a stronger one.
The smart contract is deployed on Ethereum Sepolia, metadata and images are stored on IPFS, and the frontend is built with Next.js.
ChainForge combines blockchain fundamentals with a simple RPG-style forging system:
- Each weapon is an NFT with a tier and damage value
- Players can hold a limited number of weapons
- Weapons can be forged into higher-tier weapons
- Forging burns existing NFTs and mints a new one
- Metadata and images are decentralized via IPFS
This project demonstrates smart contract development, frontend Web3 integration, and decentralized storage usage.
- ERC-721 NFT smart contract based on OpenZeppelin
- Weapon tiers with increasing damage
- Forge mechanism (burn 4 weapons → mint 1 higher-tier weapon)
- Cooldown and lock system to prevent abuse
- Wallet connection using MetaMask / WalletConnect
- Fully on-chain inventory
- IPFS-hosted metadata and images
- Modern Web3 frontend with Next.js and TailwindCSS
- Automated tests with Hardhat
| Tier | Name | Damage |
|---|---|---|
| 0 | Bronze | 10 |
| 1 | Silver | 25 |
| 2 | Gold | 50 |
| 3 | Platinum | 100 |
- Solidity
- Hardhat
- OpenZeppelin Contracts
- Ethereum Sepolia Testnet
- Next.js
- React
- TailwindCSS
- wagmi
- RainbowKit
- viem
- IPFS
- Pinata
Before running or deploying this project, you must have the following:
- Node.js version 18 or higher
- npm (comes with Node.js)
Check installation: node -v npm -v
A MetaMask account is mandatory to interact with the application.
You must:
- Install the MetaMask browser extension
- Create or import a wallet
- Enable test networks
- Switch to Sepolia test network
MetaMask Chrome extension: https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn
You need SepoliaETH to deploy the contract and interact with it (minting, forging).
You can obtain SepoliaETH using one of the following methods:
You can mine SepoliaETH using this faucet: https://sepolia-faucet.pk910.de/#/mine/2aeba069-3eea-4ef8-9a67-de5d033d83c8
This method requires leaving the browser open while mining.
You can request SepoliaETH here: https://cloud.google.com/application/web3/faucet/ethereum/sepolia
This method requires a Google account.
Clone the repository and install dependencies:
git clone https://github.com/MathisDulieu/ChainForge.git cd chainforge-project npm install
Then install frontend dependencies:
cd frontend npm install
Create a .env file at the project root:
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY PRIVATE_KEY=0xYOUR_PRIVATE_KEY
The private key must belong to your MetaMask test account.
npx hardhat compile npx hardhat run scripts/deploy.js --network sepolia
After deployment, copy the contract address.
Create frontend/.env.local:
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
cd frontend npm run dev
Open: http://localhost:3000
Only the contract owner can mint weapons.
Run the mint script:
npx hardhat run scripts/mint.js --network sepolia
This will mint initial Bronze weapons using IPFS metadata.
Smart contract tests are written using Hardhat and Chai.
Run tests:
npx hardhat test