Home / Cases / Guide to GameFi development

A complete guide to blockchain game GameFi development

📅 Last updated: May 2025 ⏱ Reading time: about 22 minutes 👤 By NovaLinkR technical team

GameFi(Game + Finance)It is an emerging field that deeply integrates blockchain financial mechanisms with video games. The assets (characters, equipment, currency) that players acquire in the game exist on-chain in the form of NFTs and tokens, with real economic value and ownership. This article will comprehensively analyze GameFi's architecture design, economic models, smart contract development, and full-stack engineering practices from a technical perspective.

What is GameFi?

GameFi concept map

GameFi is Game with Finance refers to a blockchain game ecosystem that integrates DeFi mechanisms into gaming experiences. Its core philosophy is:"Play-to-Earn"- Players earn digital assets with real value through game behavior.

The core features of GameFi

🎮 Asset ownership

In-game characters, equipment, land exist as NFTs, and players truly own these assets – freely tradable, used across games, or held permanently.

💰 Play-to-Earn

Players earn token rewards by completing quests, PVP battles, staking assets, and other game behaviors, which can be exchanged for fiat currency.

🏛️ Player governance

Players holding governance tokens can vote on game rules, economic parameters, and content updates, enabling decentralized game governance.

🔄 Interoperability

Game assets based on open standards can be freely circulated between different games, platforms and markets, breaking the closed ecology of traditional games.

GameFi vs traditional gaming

DimensionsTraditional gamesGameFi chain game
Asset ownershipThe platform owns it, and the account will be lost if it is bannedHeld by the player's wallet, it belongs in perpetuity
economic systemClosed economy and banned RMTOpen economy and free trading of assets
Yield modelPlayers spend money, and platforms make moneyPlayers participate in the game to earn money
Data transparencyBlack box (probability opaque)On-chain verifiable (probability public)
Governance methodsThe manufacturer decides unilaterallyCommunity voting governance
InteroperabilityData silosCirculation across game assets

GameFi history

2017

CryptoKitties — The first year of blockchain gaming

The first blockchain game to explode, each cat is a unique ERC-721 NFT. Demonstrates market demand for on-chain gaming assets, but is limited by Ethereum performance.

2020

DeFi Summer gave birth to the GameFi concept

The liquidity mining boom has inspired the idea of "gamified finance". Andre Cronje first proposed the concept of GameFi – gamifying the yield mechanism of DeFi.

2021

Axie Infinity detonates P2E

Axie Infinity earns more than $350 million per month, and Filipino players make ends meet by playing gold. The P2E model has exploded globally, and the blockchain game track has raised more than $4 billion.

2022-2023

3A blockchain games and infrastructure upgrades

Illuvium, Star Atlas, Big Time and other 3A quality chain games entered the market. Gaming-specific chains like Immutable X and Ronin address performance bottlenecks. Account abstraction lowers the barrier to entry for players.

2024-2025

Full-chain gaming meets AI

Dark Forest, Loot Survivor, and other full-chain games are on the rise. AI NPC, AI-GENERATED CONTENT (AIGC) and blockchain games are combined. The user experience is gradually approaching the level of traditional games.

Game mode classification

GameFi game mode classification
modeHow to playIncome methodRepresentative projectTechnical complexity
P2E goldsmithingPVE/PVP battles to obtain tokensIn-game tokens → exchanged for fiat currencyAxie InfinityMedium
Move-to-EarnExercise/Walk to earn tokensSports data → token rewardsSTEPN, SweatcoinMedium
Virtual real estateBuy/build/rent virtual landProperty appreciation + rentDecentraland, SandboxHigh
Cards/StrategiesCollect card battlesRare card tradingGods Unchained, SplinterlandsMedium
MMORPGMassively multiplayer online role-playingEquipment/Character TradingBig Time, IlluviumExtremely high
Full chain gameThe logic runs entirely on-chainStrategy game + asset appreciationDark Forest, PrimodiumExtremely high
Leisure/socialLight play + social interactionMission rewards + social tokensPixels, Nifty IslandMedium low

Technical architecture design

The technical architecture of production-grade GameFi projects needs to balance game performance, on-chain security, and user experience:

Game Client
Unity/UnrealWebGL H5Mobile appsPC client
Game Server
Combat logicMatching systemLeaderboardSocial systemMission system
Web3 Middleware
Wallet IntegrationTransaction signaturesAsset bridgingOn-chain event monitoringGas payment
Blockchain Layer
NFT contractToken contractMarket contractsStaking contractsGovernance contracts

On-chain vs. off-chain design decisions

Data typeRecommended locationCause
Asset ownership (NFT/token)on-chainMake sure players truly own the assets
Trading/market behavioron-chainImmutable, transparent and verifiable
Key Game Results (PVP Wins & Loses)On-chain validationPrevent cheating and ensure fairness
Real-time combat logicOff-chain (server)High performance requirements and not suitable for on-chain
Player position/movementOff-chainHigh-frequency updates, gas costs are too high
Social messaging/chattingOff-chainHigh real-time requirements
Draw/unboxing resultsOn-chain random numbersProbability is transparent to prevent black box operation

Token Economy Model

Tokenomics is the key to the success or failure of GameFi projects – it determines the long-term sustainability of the gaming ecosystem.

Dual Token Model (Recommended)

🏆 Governance Token

Fixed total for governance voting, advanced staking, and store of value. Usually distributed through IDOs/airdrops. Similar to AXS.

💎 In-Game Token (Utility Token)

No cap or deflationary mechanic for in-game consumption (upgrades, breeding, repairs). Output through game behavior. Similar to SLP.

Token circulation design

// tokenomics/GameToken.sol - 游戏代币合约
// 支持铸造(游戏奖励)和销毁(游戏消耗)

contract GameUtilityToken is ERC20, AccessControl {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");

    uint256 public dailyMintCap = 1_000_000 * 1e18;  // 每日铸造上限
    uint256 public todayMinted;
    uint256 public lastMintDay;

    constructor() ERC20("Game Gold", "GOLD") {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    /// @notice 游戏服务器调用 - 奖励玩家
    function mintReward(address player, uint256 amount) external onlyRole(MINTER_ROLE) {
        _checkDailyCap(amount);
        _mint(player, amount);
    }

    /// @notice 游戏内消耗 - 升级/繁殖/修理
    function burn(address player, uint256 amount) external onlyRole(BURNER_ROLE) {
        _burn(player, amount);
    }

    function _checkDailyCap(uint256 amount) internal {
        uint256 today = block.timestamp / 1 days;
        if (today != lastMintDay) {
            lastMintDay = today;
            todayMinted = 0;
        }
        todayMinted += amount;
        require(todayMinted <= dailyMintCap, "Daily mint cap exceeded");
    }
}

// 代币消耗场景示例:
// - 角色升级: burn 100 GOLD
// - 装备强化: burn 50 GOLD (失败也消耗)
// - 宠物繁殖: burn 200 GOLD + 2 父母NFT → 1 新NFT
// - 进入副本: burn 10 GOLD (门票)
// - 市场手续费: 5% 交易额 burn

Key points of economic balance

  • Faucet < sink: The token output rate must be lower than the consumption rate, otherwise inflation will lead to a death spiral
  • Multi-layer consumption design: At least 5 consumption scenarios to disperse the selling pressure
  • Dynamic adjustment: Dynamically adjusts output/consumption parameters based on the number of players and token prices
  • New player subsidies: Free admission + high rewards in the early stage, lowering the entry barrier
  • Lock-up mechanism: Premium rewards require a time lock to prevent immediate sell-offs

NFT game asset system

GameFi NFT asset system

NFTs are the asset foundation of GameFi – characters, equipment, land, mounts, and other game items are all on-chain in the form of NFTs.

Game NFT metadata design

{
  "name": "Shadow Warrior #1042",
  "description": "A legendary warrior from the Dark Realm",
  "image": "ipfs://Qm.../warrior_1042.png",
  "animation_url": "ipfs://Qm.../warrior_1042_idle.glb",
  "attributes": [
    { "trait_type": "Class", "value": "Warrior" },
    { "trait_type": "Rarity", "value": "Legendary" },
    { "trait_type": "Level", "value": 45, "display_type": "number", "max_value": 100 },
    { "trait_type": "Attack", "value": 892, "display_type": "number" },
    { "trait_type": "Defense", "value": 654, "display_type": "number" },
    { "trait_type": "HP", "value": 12500, "display_type": "number" },
    { "trait_type": "Element", "value": "Dark" },
    { "trait_type": "Generation", "value": 2, "display_type": "number" },
    { "trait_type": "Experience", "value": 85420, "display_type": "number" }
  ],
  "properties": {
    "skills": ["Shadow Strike", "Dark Shield", "Void Step"],
    "equipment_slots": ["weapon", "armor", "helmet", "boots", "ring", "amulet"]
  }
}

Dynamic NFTs (dNFTs)

NFTs in GameFi need to change dynamically (upgrade, evolve, damage) as the game progresses:

// nft/DynamicGameNFT.sol - 动态游戏NFT
contract DynamicGameNFT is ERC721 {
    struct CharacterStats {
        uint16 level;
        uint32 experience;
        uint16 attack;
        uint16 defense;
        uint32 hp;
        uint8 rarity;      // 0-Common, 1-Rare, 2-Epic, 3-Legendary
        uint8 element;     // 0-Fire, 1-Water, 2-Earth, 3-Dark, 4-Light
        uint64 lastBattle; // 上次战斗时间
    }

    mapping(uint256 => CharacterStats) public characters;
    mapping(uint256 => uint256[]) public equippedItems; // tokenId → 装备NFT列表

    event LevelUp(uint256 indexed tokenId, uint16 newLevel);
    event StatsUpdated(uint256 indexed tokenId, uint16 attack, uint16 defense);

    /// @notice 增加经验值(仅游戏服务器)
    function addExperience(uint256 tokenId, uint32 exp) external onlyGameServer {
        CharacterStats storage char = characters[tokenId];
        char.experience += exp;

        // 检查升级
        uint16 newLevel = calculateLevel(char.experience);
        if (newLevel > char.level) {
            char.level = newLevel;
            // 升级加点
            char.attack += 10 * (newLevel - char.level);
            char.defense += 8 * (newLevel - char.level);
            char.hp += 500 * uint32(newLevel - char.level);
            emit LevelUp(tokenId, newLevel);
        }
    }

    /// @notice 装备物品(影响角色属性)
    function equip(uint256 characterId, uint256 itemId) external {
        require(ownerOf(characterId) == msg.sender, "Not owner");
        require(itemNFT.ownerOf(itemId) == msg.sender, "Not item owner");

        equippedItems[characterId].push(itemId);
        // 装备加成
        ItemStats memory item = itemNFT.getStats(itemId);
        characters[characterId].attack += item.attackBonus;
        characters[characterId].defense += item.defenseBonus;
    }

    /// @notice tokenURI 动态生成(反映当前属性)
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        CharacterStats memory char = characters[tokenId];
        // 动态生成 JSON 元数据
        return generateDynamicMetadata(tokenId, char);
    }
}

Asset scarcity design

ScarcityDrop probabilityAttribute bonusesOutput Limits
Common60%Base valueUnlimited
Rare (Rare)25%+20%Limited to daily limits
Epic12%+50%Limited weekly
Legendary3%+100%The entire server is limited to 100

Smart Contract Development

The GameFi smart contract system includes multiple contract modules that work together:

Core contract architecture

  • GameNFT.sol — Game Character/Equipment NFTs (ERC-721/1155)
  • GameToken.sol — Game token (ERC-20, supports mint/burn)
  • Marketplace.sol — In-game NFT trading marketplace
  • Staking.sol — NFT/token staking income
  • Breeding.sol — Breeding/synthesis system
  • BattleVerifier.sol — On-chain verification of battle results
  • LootBox.sol — Unboxing/Drawing Cards (VRF Randoms)
  • Governance.sol — Community governance voting

Breeding/synthesis contracts

// breeding/BreedingSystem.sol
contract BreedingSystem is ReentrancyGuard {
    IGameNFT public nft;
    IGameToken public token;
    IRandomOracle public randomOracle;

    uint256 public breedingFee = 200 * 1e18;  // 200 GOLD
    uint256 public cooldownPeriod = 7 days;

    struct BreedingInfo {
        uint256 breedCount;
        uint256 lastBreedTime;
    }
    mapping(uint256 => BreedingInfo) public breedingInfo;

    event Bred(uint256 parent1, uint256 parent2, uint256 childId, uint8 rarity);

    function breed(uint256 parent1Id, uint256 parent2Id) external nonReentrant {
        require(nft.ownerOf(parent1Id) == msg.sender, "Not owner of parent1");
        require(nft.ownerOf(parent2Id) == msg.sender, "Not owner of parent2");
        require(parent1Id != parent2Id, "Cannot self-breed");

        // 冷却检查
        BreedingInfo storage info1 = breedingInfo[parent1Id];
        BreedingInfo storage info2 = breedingInfo[parent2Id];
        require(block.timestamp >= info1.lastBreedTime + cooldownPeriod, "Parent1 on cooldown");
        require(block.timestamp >= info2.lastBreedTime + cooldownPeriod, "Parent2 on cooldown");

        // 消耗代币(繁殖次数越多费用越高)
        uint256 totalFee = breedingFee * (info1.breedCount + info2.breedCount + 2) / 2;
        token.burn(msg.sender, totalFee);

        // 获取随机数决定后代属性
        uint256 randomSeed = randomOracle.getRandomNumber();
        (uint8 rarity, uint16 attack, uint16 defense) = _calculateChildStats(
            parent1Id, parent2Id, randomSeed
        );

        // 铸造后代 NFT
        uint256 childId = nft.mint(msg.sender, rarity, attack, defense);

        // 更新繁殖信息
        info1.breedCount++;
        info1.lastBreedTime = block.timestamp;
        info2.breedCount++;
        info2.lastBreedTime = block.timestamp;

        emit Bred(parent1Id, parent2Id, childId, rarity);
    }

    function _calculateChildStats(uint256 p1, uint256 p2, uint256 seed)
        internal view returns (uint8 rarity, uint16 attack, uint16 defense)
    {
        // 遗传算法:继承父母属性 + 随机变异
        uint16 p1Attack = nft.getAttack(p1);
        uint16 p2Attack = nft.getAttack(p2);
        uint16 baseAttack = (p1Attack + p2Attack) / 2;

        // 10% 概率变异(属性提升 20-50%)
        if (seed % 10 == 0) {
            baseAttack = baseAttack * (120 + seed % 30) / 100;
        }

        attack = baseAttack;
        defense = (nft.getDefense(p1) + nft.getDefense(p2)) / 2;
        rarity = _calculateRarity(seed);
    }
}

Game engine integration with Web3

Game engine Web3 integration

Integrating traditional game engines with blockchain technology is a core challenge in GameFi development:

Mainstream engine Web3 integration solution

engineIntegrated solutionsApplicable scenariosDifficulty
UnityThirdweb SDK / Moralis Unity / Web3UnityMobile/PC 3D gameMedium
Unreal EngineThirdweb C++ SDK / Built-in HTTP bridge3A quality PC/console gameHigh
Cocos CreatorWeb3.js Direct integrationH5/mini-gamelow
Phaser/PixiJSethers.js / viem call2D Web Casual Gamelow
GodotGDScript HTTP + signature libraryIndie gameMedium

Unity Web3 integration example

// Unity C# - Web3 钱包连接与 NFT 交互
using Thirdweb;

public class Web3GameManager : MonoBehaviour
{
    private ThirdwebSDK sdk;
    private Contract nftContract;

    async void Start()
    {
        sdk = new ThirdwebSDK("polygon");
        nftContract = sdk.GetContract("0x1234...NFT_ADDRESS");
    }

    // 连接钱包
    public async void ConnectWallet()
    {
        string address = await sdk.wallet.Connect(
            new WalletConnection(WalletProvider.MetaMask, chainId: 137)
        );
        Debug.Log($"Connected: {address}");
        LoadPlayerNFTs(address);
    }

    // 加载玩家 NFT 角色
    async void LoadPlayerNFTs(string playerAddress)
    {
        var nfts = await nftContract.ERC721.GetOwned(playerAddress);
        foreach (var nft in nfts)
        {
            // 解析 NFT 属性 → 游戏内角色数据
            var stats = ParseNFTToCharacter(nft.metadata);
            SpawnCharacter(stats);
        }
    }

    // 战斗胜利后铸造奖励
    public async void ClaimBattleReward(int battleId, int rewardAmount)
    {
        var contract = sdk.GetContract("0x5678...REWARD_CONTRACT");
        var result = await contract.Write("claimReward", battleId, rewardAmount);
        Debug.Log($"Reward claimed! TX: {result.receipt.transactionHash}");
    }
}

Account abstraction lowers the threshold

  • Sensorless wallet: Players log in with their email/social account to automatically create a smart contract wallet
  • Gas payment: The project team pays gas fees for players, and players do not need to hold native tokens
  • Session Key: In-game operations do not need to be confirmed, and are automatically signed within a specified time after one authorization
  • Bulk trading: Multiple operations are packaged into one transaction (Reward Claim + Upgrade + Equipment completed at once)

On-chain random numbers

Fair random numbers are a cornerstone of GameFi – mechanics like unboxing, dropping, matchmaking, and more rely on unpredictable and verifiable randomness.

Random number scheme comparison

SchemeSecurityCostDelayApplicable scenarios
Chainlink VRFVery high (verifiable)$0.1-1/timeBlocks 1-3High-value unboxing and card drawing
Commit-RevealHigh2 Gas2 transactionsPVP game selection
Block HashMedium (can be controlled by miners)lowInstantLow-value random events
RANDAOMiddle and highlowInstantEthereum PoS

Chainlink VRF is implemented out of the box

// lootbox/LootBox.sol - VRF 开箱合约
import "@chainlink/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol";

contract LootBox is VRFConsumerBaseV2 {
    struct BoxRequest {
        address player;
        uint8 boxType;   // 0-Bronze, 1-Silver, 2-Gold
        bool fulfilled;
    }

    mapping(uint256 => BoxRequest) public requests; // requestId → request
    IGameNFT public nft;

    // 开箱(请求随机数)
    function openBox(uint8 boxType) external returns (uint256 requestId) {
        require(boxType <= 2, "Invalid box type");
        // 消耗开箱券或代币...

        requestId = COORDINATOR.requestRandomWords(
            keyHash, subscriptionId, 3, 100000, 1
        );
        requests[requestId] = BoxRequest(msg.sender, boxType, false);
    }

    // Chainlink 回调(发放奖励)
    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        BoxRequest storage req = requests[requestId];
        require(!req.fulfilled, "Already fulfilled");
        req.fulfilled = true;

        uint256 random = randomWords[0];
        uint8 rarity = _determineRarity(random, req.boxType);

        // 铸造随机属性的 NFT 奖励
        nft.mintWithRandomStats(req.player, rarity, random);
    }

    function _determineRarity(uint256 random, uint8 boxType) internal pure returns (uint8) {
        uint256 roll = random % 10000;
        if (boxType == 2) { // Gold Box: 更高概率出稀有
            if (roll < 500) return 3;  // 5% Legendary
            if (roll < 2000) return 2; // 15% Epic
            if (roll < 5000) return 1; // 30% Rare
            return 0;                   // 50% Common
        }
        // ... Bronze/Silver 概率表
    }
}

Anti-cheat system

Since gaming behavior in GameFi is directly linked to financial gains, anti-cheat is crucial:

Multi-layered anti-cheat strategy

🔍 Server-side authentication

All key game logic is executed on the server, and the client is only responsible for displaying. The battle results are calculated by the server and signed and submitted on-chain.

🧮 ZK proof

Use zero-knowledge proofs to verify the legitimacy of player actions (e.g., prove that "my character did defeat the boss" without exposing the specific process).

📊 Behavioral analysis

AI models detect abnormal patterns: superhuman speed, impossible operation, 24-hour uninterrupted online and other robot characteristics.

⚖️ Economic constraints

Daily gain cap, energy/stamina system, cooldown. Limit the efficiency of gold mining and reduce the motivation for cheating.

Verification of the results of the battle

// anti-cheat/BattleVerifier.sol
contract BattleVerifier {
    address public gameServer; // 游戏服务器签名地址

    struct BattleResult {
        uint256 battleId;
        address winner;
        address loser;
        uint256 rewardAmount;
        uint256 timestamp;
    }

    mapping(uint256 => bool) public processedBattles;

    /// @notice 验证并发放战斗奖励
    function claimBattleReward(
        BattleResult calldata result,
        bytes calldata serverSignature
    ) external {
        require(msg.sender == result.winner, "Not winner");
        require(!processedBattles[result.battleId], "Already claimed");
        require(block.timestamp - result.timestamp < 1 hours, "Expired");

        // 验证游戏服务器签名
        bytes32 hash = keccak256(abi.encode(result));
        require(recoverSigner(hash, serverSignature) == gameServer, "Invalid signature");

        processedBattles[result.battleId] = true;
        gameToken.mint(result.winner, result.rewardAmount);
    }
}

In-game marketplace

The in-game marketplace, which allows players to freely buy and sell NFT assets, is the core hub of the GameFi economic cycle:

Market function design

  • Sold at a fixed price: Seller prices, buyers buy with one click
  • Auction mode: English Auction (higher price) and Dutch Auction (decreasing price)
  • Sold in bundles: Multiple equipment/character package trades
  • Rental system:ERC-4907 NFTs can be rented, and powerful characters are rented out to new players
  • Buy in installments: High-value NFTs support installment payments (DeFi lending integration)
  • Cross-game trading: A unified NFT marketplace that supports multi-game within the ecosystem
💡 Market fee design

It is proposed to charge a transaction fee of 2.5-5%, with half injected into the treasury (team operation) and half used for token buyback and burning (deflationary mechanism). High fees drive players to use third-party marketplaces.

Recommended technology stack

moduleTechnical selectionDescription
game engineUnity / Unreal Engine / CocosUnity/UE for 3D and Cocos for 2D/H5
BlockchainPolygon / Immutable X / Ronin / BaseLow-gas, high-TPS game-specific chain
Smart ContractSolidity + Foundry + OpenZeppelinRapid testing, standardized templates
Web3 SDKThirdweb / Moralis / SequenceSimplify wallet integration and NFT operations
Random numberChainlink VRF / Gelato VRFVerifiable, fair, and random
Game serverGo / Rust + Photon / MirrorHigh-concurrency real-time multi-person service
databasePostgreSQL + Redis + MongoDBRelational data + cache + game state
Asset storageIPFS + Arweave + CDNNFT metadata + game assets acceleration
Data indexingThe Graph / GoldskyReal-time querying of on-chain events
MonitoringDune Analytics + GrafanaEconomic data dashboard + O&M monitoring

Development process

Based on the NovaLinkR team's experience in delivering blockchain game projects, the following development processes are recommended:

01

Game Design and Economic Modeling

Gameplay design, token economic model modeling (Excel/Token Engineering), NFT asset system planning, numerical balance design. Output GDD + Economic White Paper.

02

Smart Contract Development

NFT contract, token contract, market contract, staking contract development. Foundry unit tests are 100% covered, and testnet deployments validate economic models.

03

Game core development

The game engine develops core gameplay, combat system, and mission system. Web3 SDK integrates wallet connectivity and on-chain interactions.

04

Backend services and anti-cheating

Game server, matchmaking system, leaderboard, anti-cheat engine, on-chain event indexing service development.

05

Security audit and testing

Contract security audit, game balance test, economic model stress test, penetration test. Players are invited to participate in the closed beta.

06

Online operation and iteration

Mainnet deployment, NFT launch/public sale, community operation, season updates, dynamic adjustment of economic parameters, and continuous output of new content.

💡 Need professional blockchain game development services?

The NovaLinkR team has extensive experience in delivering GameFi projects, providing one-stop services from economic model design and smart contracts to full-stack game development.Contact us todayGet a free technical consultation and project quote.