Designing a Web3 Game
In GameFi, an average on-chain transaction on Polygon costs $0.01, but if you put all smart contracts on-chain, the game becomes unplayable due to 15-second block delays. The right Web3 game architecture is a clear boundary between what should be on-chain and what should remain off-chain. Without this, the game is either unplayable or the blockchain part is decorative. Our 10+ years of experience in GameFi development ensures robust smart contracts and tokenomics. 95% of gameplay should be off-chain to ensure responsiveness. Assess your project — get a developer consultation.
Why Games Need Blockchain
Blockchain adds trustless ownership and transparent economics. Players truly own their assets, can trade them outside the game, and participate in project governance. But simply adding blockchain to a game is a bad idea. It's important to correctly separate on-chain and off-chain logic. Assess your project — contact us for a consultation.
How to Split On-Chain and Off-Chain
Here are clear criteria:
| Aspect | Must be on-chain | Must be off-chain |
|---|---|---|
| Ownership of assets (NFT characters, items, land) | ✅ | ❌ |
| Financial operations (buying, selling, staking, rewards) | ✅ | ❌ |
| Critical results affecting economy (tournament win, rare drop) | ✅ | ❌ |
| Governance decisions (DAO) | ✅ | ❌ |
| Real-time game mechanics (player positions, collisions, physics) | ❌ | ✅ |
| Most gameplay events | ❌ | ✅ |
| Social functions (chat, guilds) | ❌ | ✅ |
| Analytics and logging | ❌ | ✅ |
A good model: the game server is the source of truth for gameplay, the blockchain is the source of truth for ownership and economy. Synchronization occurs at defined checkpoints.
Architecture: Servers, Contracts, Client
Game Backend
Game Client (Unity/Unreal/Web)
↓
Game Server (authoritative)
└── Game State DB (Redis for real-time, PostgreSQL for persistence)
↓ (at significant events)
Blockchain Sync Service
↓
Smart Contracts (Assets, Economy, Rewards)
↓
The Graph (indexing for UI/leaderboards)
Authoritative server model — the client never makes final decisions. The client sends input, the server verifies and applies it. This prevents cheating without any blockchain. The authoritative server model is 100 times more effective than client-side anti-cheat because the client does not control the outcome.
The Blockchain Sync Service is a separate service that listens to game events and broadcasts significant ones as on-chain transactions. It works asynchronously, not blocking gameplay.
NFT Assets: Standards and Metadata
According to ERC-1155 (EIP-1155), the multi-token standard allows managing multiple NFT types in one contract. We use a combination of ERC-721 for unique items and ERC-1155 for stackable items. Metadata: on-chain (maximum permanence, but 10 times more expensive than IPFS), IPFS (compromise), or centralized server (fast, cheap, but dependent on us).
contract GameItem is ERC1155 {
struct ItemType {
string name;
uint8 rarity; // 1=Common, 2=Rare, 3=Epic, 4=Legendary
uint16 baseAttack;
uint16 baseDefense;
bool tradeable;
}
mapping(uint256 => ItemType) public itemTypes;
mapping(uint256 => uint256) public itemMaxSupply;
mapping(uint256 => uint256) public itemCurrentSupply;
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
function mintItem(
address to,
uint256 itemTypeId,
uint256 amount,
bytes memory data
) external onlyRole(MINTER_ROLE) {
require(
itemCurrentSupply[itemTypeId] + amount <= itemMaxSupply[itemTypeId],
"Max supply exceeded"
);
itemCurrentSupply[itemTypeId] += amount;
_mint(to, itemTypeId, amount, data);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal override {
for (uint i = 0; i < ids.length; i++) {
if (from != address(0) && to != address(0)) {
require(itemTypes[ids[i]].tradeable, "Item is soulbound");
}
}
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
}
Game Token: Tokenomics
Most failed GameFi projects failed due to poor tokenomics, not the game. Common mistakes: inflationary spiral (token emitted without sufficient sink — example Axie Infinity); two-token model without proper peg. The right approach is to balance emission and sink.
contract GameEconomy {
function claimDailyReward(
address player,
uint256 amount,
uint256 nonce,
bytes memory serverSignature
) external {
bytes32 message = keccak256(abi.encodePacked(player, amount, nonce));
require(
ECDSA.recover(message.toEthSignedMessageHash(), serverSignature) == GAME_SERVER,
"Invalid server signature"
);
require(!usedNonces[nonce], "Nonce already used");
usedNonces[nonce] = true;
require(dailyClaimed[player][today()] + amount <= MAX_DAILY_REWARD, "Daily limit");
dailyClaimed[player][today()] += amount;
gameToken.mint(player, amount);
}
function craftItem(uint256 recipeId) external {
Recipe memory recipe = recipes[recipeId];
gameToken.burnFrom(msg.sender, recipe.tokenCost);
// mint NFT item
}
}
Game Server Signature Pattern
A critical pattern for Web3 games: the game server is the trusted source of truth, its decisions are verified on-chain via signature. The user cannot call claimReward themselves — they receive a server-signed voucher. This prevents fabrication, double-spending, and cheating.
// Game Server side (Node.js)
import { ethers } from "ethers";
const serverWallet = new ethers.Wallet(process.env.SERVER_PRIVATE_KEY);
async function generateRewardVoucher(
playerAddress: string,
rewardAmount: bigint,
gameSessionId: string
): Promise<{ nonce: string; signature: string; amount: string }> {
const nonce = ethers.hexlify(ethers.randomBytes(32));
const message = ethers.solidityPackedKeccak256(
["address", "uint256", "bytes32"],
[playerAddress, rewardAmount, nonce]
);
const signature = await serverWallet.signMessage(ethers.getBytes(message));
return { nonce, signature, amount: rewardAmount.toString() };
}
Anti-Cheat at the Blockchain Level
On-chain verification using commit-reveal for randomness: the player commits hash(seed) before the game, reveals the seed after the game, the blockchain verifies random = hash(seed, block.hash). Chainlink VRF v2 for on-chain randomness (drops, matchmaking).
import { VRFConsumerBaseV2 } from "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
contract LootBox is VRFConsumerBaseV2 {
mapping(uint256 => address) public requestToPlayer;
function openLootBox() external returns (uint256 requestId) {
requestId = vrfCoordinator.requestRandomWords(
keyHash, subscriptionId, 3, 100_000, 3
);
requestToPlayer[requestId] = msg.sender;
}
function fulfillRandomWords(uint256 requestId, uint256[] memory words) internal override {
address player = requestToPlayer[requestId];
uint256 itemTier = words[0] % 1000;
_mintReward(player, itemTier);
}
}
Technical Stack for Web3 Games
Game Engine: Unity (WebGL + native mobile) or Phaser 3 (browser-first). Web3 integration: Nethereum for EVM, Solana.Unity-SDK for Solana. Backend: Go or Node.js for game server, separate TypeScript service for blockchain interactions. Indexing: The Graph for leaderboards and history, custom PostgreSQL for analytics. Networks: Polygon PoS or Arbitrum Nova for frequent transactions, Ethereum mainnet for valuable assets. Gas savings ~90% when using L2.
| Network | TPS | Transaction Cost | Finality | Suitable for |
|---|---|---|---|---|
| Polygon PoS | 7000 | $0.01 | 2-3 min | Frequent microtransactions |
| Arbitrum Nova | 40000 | $0.001 | 5-10 min | High-throughput game actions |
| Ethereum L1 | 15 | $5-50 | ~13 sec | High-value assets, governance |
| Solana | 50000 | $0.0001 | 400 ms | Real-time gameplay |
Common Tokenomics Mistakes in GameFi
- Infinite emission without burn mechanisms — inflation kills the economy. - Two-token model without a stable peg (e.g., governance token with fixed price) — leads to collapse. - Lack of sink mechanics: players don't know what to spend tokens on except selling.The right approach: every emitted token should have a planned use (crafting, fee payment, leveling up).
Step-by-Step Work Process for GameFi Projects
- Tokenomics design and game design (4-6 weeks).
- Smart contract development (ERC-1155, marketplace, staking) (4-8 weeks).
- Authoritative game server development on Go or Node.js (4-8 weeks).
- Client integration (Unity/Phaser) with Web3 (6-12 weeks).
- Smart contract audit and testnet (4-6 weeks).
- Mainnet launch and monitoring (2 weeks).
How to Prevent Cheating Through Blockchain
- Use authoritative server model: the server makes decisions, the client only sends input.
- Apply commit-reveal for random events — this prevents players from predicting outcomes.
- Sign every economic action with the server (server signature pattern).
Scope of Work
Within the project, we provide: documentation (architecture, specifications), full source code, security audit, mainnet deployment, monitoring and support post-launch. We guarantee correct operation of smart contracts and the game server. Assess your project — contact us.
The team has certifications and 10+ years of experience. We ensure a transparent process and audit. Contact us to discuss your GameFi project.







