
Decentralized GameNFT Marketplace
Blockchain marketplace for game NFTs using Solidity, OpenZeppelin, Hardhat, Moralis, and IPFS, with off-chain storage, creator royalties, and hash-based anti-cheating validation.
At a Glance
The Problem
Game asset marketplaces need transparent ownership and secure transfers, but storing everything directly on-chain is expensive and inflexible. The project needed to preserve decentralization and verifiability while keeping storage and computation costs practical for a real marketplace workflow.
System Architecture
The On-Chain / Off-Chain Split
Decentralization is a spectrum. Storing every asset and computation on-chain would make the marketplace prohibitively expensive. Instead, the design draws a deliberate trust boundary: ownership, transfers, and royalty rules live on-chain where they must be tamper-proof; media, metadata, and heavy computation live off-chain where storage and gas costs are manageable. SHA-3 hash anchoring bridges the two sides so off-chain results remain publicly verifiable.
On-chainSource of truth
- ·NFT ownership — ERC721 transfer events are the authoritative ledger
- ·Marketplace listings — Listing price and seller stored in contract state
- ·Royalty enforcement — EIP-2981 royaltyInfo called on every sale, on-chain
- ·SHA-3 hashes — Off-chain result digests anchored in contract events
Off-chainCost reduction
- ·Media + metadata — IPFS CIDs stored on-chain; files live off-chain
- ·Game result computation — Moralis cloud functions run expensive logic off-chain
- ·Leaderboard aggregation — Too expensive to compute on-chain per transaction
- ·Anti-cheat verification — Results hashed and anchored — off-chain speed, on-chain proof
NFT Lifecycle Flows
Two flows cover the core marketplace lifecycle. Minting traces a game asset from IPFS upload through metadata anchoring to on-chain token creation. The purchase flow shows how a buyer's ETH is split between royalty, seller proceeds, and NFT ownership transfer in a single atomic contract call. Click any step to inspect the contract interaction.
Key Decisions
- 1
Kept large asset payloads in IPFS so the chain stores references, not the full media payload, dramatically reducing cost.
- 2
Extended OpenZeppelin contracts instead of writing token logic from scratch to inherit audited ERC721 behavior.
- 3
Used Moralis for off-chain workflows where raw on-chain execution would make gas costs unreasonable.
- 4
Added on-chain SHA-3 verification to preserve trust even when some calculations happen off-chain.
Outcomes
- Delivered a working NFT marketplace flow covering minting, listing, purchase, and asset lookup.
- Reduced blockchain storage overhead by moving media and metadata to IPFS while preserving immutable references.
- Introduced creator royalty and anti-cheating mechanisms that improved both marketplace utility and user trust.
Lessons Learned
- 1Decentralization is a spectrum; practical products often need carefully bounded off-chain systems to stay usable.
- 2Using audited contract libraries is almost always the right default for student and early-stage blockchain projects.
- 3Hash anchoring is a strong compromise when you need off-chain speed without giving up verifiability.
- 4Developer tooling matters a lot in smart contract work — Hardhat made iteration far safer and faster.