G3X
  • Introduction
  • Use Cases
  • Core Features of G3X
  • Advantages of G3X
  • How to Use G3X
    • For Game Developers
    • For Node Operators
    • For Players
  • G3X Infrastructure Overview
  • G3X Access Panel
  • FAQ
  • Tokenomics
  • Roadmaps
  • Social Media
Powered by GitBook
On this page
  1. How to Use G3X

For Game Developers

Step-by-Step Guide:

  1. Install the SDK

    bashSalinEditnpm install @g3x/sdk
  2. Initialize the Client

    jsSalinEditimport { G3XClient } from '@g3x/sdk';
    
    const client = new G3XClient({
      nodeUrl: 'https://node.g3x.network',
      walletProvider: window.ethereum,
    });
  3. Sync Game State (Off-Chain)

    jsSalinEditclient.syncGameState({
      playerId: '0x123...',
      action: 'move',
      data: { x: 10, y: 5 },
    });
  4. Finalize Match (On-Chain)

    jsSalinEditclient.finalizeMatch({
      matchId: 'match-123',
      winner: '0xabc...',
      rewards: ['NFT', 'Token'],
    });
  5. Integrate Smart Contracts Use Solidity contracts to handle XP, rewards, NFTs, etc. Example: rewardXP(address player, uint256 amount)

PreviousHow to Use G3XNextFor Node Operators

Last updated 3 days ago