Decentralized GameNFT Marketplace cover
All Projects
Side Project2022

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.

SolidityOpenZeppelinHardhatIPFSMoralisERC721SHA-3

At a Glance

Token standardERC721
Asset storageIPFS
Off-chain computeMoralis
Security checkSHA-3

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 ownershipERC721 transfer events are the authoritative ledger
  • ·Marketplace listingsListing price and seller stored in contract state
  • ·Royalty enforcementEIP-2981 royaltyInfo called on every sale, on-chain
  • ·SHA-3 hashesOff-chain result digests anchored in contract events

Off-chainCost reduction

  • ·Media + metadataIPFS CIDs stored on-chain; files live off-chain
  • ·Game result computationMoralis cloud functions run expensive logic off-chain
  • ·Leaderboard aggregationToo expensive to compute on-chain per transaction
  • ·Anti-cheat verificationResults 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.

1Upload game asset (image/model/audio)2Return asset CID3Build metadata JSON (name, description, image=CID)4Upload metadata JSON5Return metadata CID6mint(metadataCID, royaltyBps)7Assign tokenId; store tokenURI = metadata CID; register royalty8Emit Transfer(address(0) → minter)9Return tokenIdUser / dAppSmart ContractIPFSMoralisEthereum ChainUser / dAppSmart ContractIPFSMoralisEthereum Chain

Key Decisions

  1. 1

    Kept large asset payloads in IPFS so the chain stores references, not the full media payload, dramatically reducing cost.

  2. 2

    Extended OpenZeppelin contracts instead of writing token logic from scratch to inherit audited ERC721 behavior.

  3. 3

    Used Moralis for off-chain workflows where raw on-chain execution would make gas costs unreasonable.

  4. 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.

Related Reading