OnStore is a web3-enabled platform that implements NFT-based game licensing. Users can purchase games and receive NFTs that serve as proof of ownership and license to play the games.
The project consists of two main parts:
- Implementation of ERC1155-based NFT contract for game licenses
- Written in Solidity with Hardhat development environment
- Includes deployment scripts and tests
- Features:
- Minting game license NFTs
- Transfer restrictions for license NFTs
- Balance checking functionality
- Express.js-based web application
- Integrates with Ethereum blockchain through ethers.js
- Features:
- User authentication
- Wallet connection
- NFT minting interface
- Game purchase processing
- Solidity ^0.8.28
- Hardhat
- OpenZeppelin Contracts
- TypeScript (for testing and deployment)
- Ethers.js
- Node.js
- Express.js
- MongoDB (with Mongoose)
- Pug templating engine
- Ethers.js for blockchain interaction
- Session-based authentication
- Node.js v24.7.0 or higher
- MongoDB instance
- MetaMask wallet
- Sepolia testnet ETH for gas fees
Create a .env file in the root directory with the following variables:
# MongoDB Connection
MONGO_URI=your_mongodb_uri
# Session Secret
SESSION_SECRET=your_session_secret
# Ethereum Configuration
SEPOLIA_RPC_URL=your_sepolia_rpc_url
CONTRACT_ADDRESS=your_deployed_contract_address
SEPOLIA_PRIVATE_KEY=your_private_key-
Clone the repository:
git clone https://github.com/numboxia/OnStore.git cd OnStore -
Install Smart Contract dependencies:
cd SmartContract npm install -
Install Server dependencies:
cd ../Server npm install
- Configure your .env file with your Sepolia private key and RPC URL
- Deploy the contract:
cd SmartContract npx hardhat run scripts/deploy.ts --network sepolia - Copy the deployed contract address to your .env file
- Start MongoDB service
- Start the server:
cd Server node app.js - Access the application at http://localhost:3000
- User Authentication: Register and login functionality
- Wallet Connection: Connect MetaMask wallet
- Game Purchase: Buy games and receive NFT licenses
- NFT Management: View and manage owned game licenses
- Secure Sessions: Session-based user authentication
- Error Handling: Comprehensive error handling for blockchain operations
- ERC1155 Implementation: Multiple games can be represented in one contract
- Transfer Restrictions: NFT licenses cannot be transferred between users
- Minting Controls: Each address can only mint one license per game
- Gas Optimization: Efficient implementation for lower gas costs
/auth: Authentication routes (login, register, wallet connection)/purchase: Game purchase and NFT minting/user: User dashboard and profile management/: Home and game browsing
- Session-based authentication
- Secure password hashing
- Protected API endpoints
- Wallet address verification
- Smart contract access controls
cd SmartContract
npx hardhat testcd Server
npm testMIT
- Metadata implementation for NFTs
- Multiple game support
- Secondary market restrictions
- User profile enhancement
- Transaction history
- Game download integration
- Automated testing for server
- Enhanced error handling
- Performance optimization
- UI/UX improvements
For support, please open an issue in the GitHub repository.