GX EVMTools for GX EVM Builders

Tools for GX EVM Builders

Overview

GX EVM supports the full Ethereum developer toolkit. Any tool that works with EVM-compatible chains works with GX Chain. This page covers RPC endpoints, development frameworks, client libraries, and integration patterns.

RPC Endpoints

NetworkRPC URLChain IDExplorer
Mainnethttps://rpc.gx.exchangeTBDhttps://explorer.gx.exchange
Testnethttps://testnet-rpc.gx.exchangeTBDhttps://testnet-explorer.gx.exchange

Development Frameworks

Hardhat

// hardhat.config.js
module.exports = {
  solidity: "0.8.27",
  networks: {
    gx: {
      url: "https://rpc.gx.exchange",
      accounts: [process.env.PRIVATE_KEY],
    },
    gxTestnet: {
      url: "https://testnet-rpc.gx.exchange",
      accounts: [process.env.PRIVATE_KEY],
    },
  },
};

Foundry

# Deploy with Foundry
forge create --rpc-url https://rpc.gx.exchange \
  --private-key $PRIVATE_KEY \
  src/MyContract.sol:MyContract
 
# Verify contract
forge verify-contract <address> src/MyContract.sol:MyContract \
  --verifier-url https://explorer.gx.exchange/api

Client Libraries

LibraryLanguageInstallation
ethers.js v6JavaScript/TypeScriptnpm install ethers
viemTypeScriptnpm install viem
wagmiReactnpm install wagmi
web3.pyPythonpip install web3
ethers-rsRustcargo add ethers

ethers.js Example

import { ethers } from "ethers";
 
const provider = new ethers.JsonRpcProvider("https://rpc.gx.exchange");
const wallet = new ethers.Wallet(privateKey, provider);
 
// Read GX balance
const balance = await provider.getBalance(wallet.address);
console.log("GX Balance:", ethers.formatEther(balance));
 
// Deploy a contract
const factory = new ethers.ContractFactory(abi, bytecode, wallet);
const contract = await factory.deploy();
await contract.waitForDeployment();

viem Example

import { createPublicClient, createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
 
const gxChain = {
  name: "GX Chain",
  nativeCurrency: { name: "GX", symbol: "GX", decimals: 18 },
  rpcUrls: {
    default: { http: ["https://rpc.gx.exchange"] },
  },
};
 
const publicClient = createPublicClient({
  chain: gxChain,
  transport: http(),
});

Wallet Configuration (MetaMask)

FieldValue
Network NameGX Chain
RPC URLhttps://rpc.gx.exchange
Chain IDTBD
Currency SymbolGX
Block Explorerhttps://explorer.gx.exchange

Supported Contract Standards

StandardDescription
ERC-20Fungible tokens
ERC-721Non-fungible tokens
ERC-1155Multi-token standard
ERC-4626Tokenized vaults
EIP-2612Permit (gasless approvals)
EIP-712Typed structured data signing

GX Core Trading API

Beyond standard EVM RPC, GX Core exposes trading-specific APIs.

REST API (Port 4001)

# Get orderbook
curl https://api.gx.exchange/v4/orderbook?market=BTC-USD
 
# Get account positions
curl https://api.gx.exchange/v4/account?address=0x...

WebSocket API (Port 4000)

const ws = new WebSocket("wss://ws.gx.exchange");
 
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "l2Book", coin: "BTC" }
}));

Deployment Workflow

  1. Write contracts using Hardhat or Foundry (Solidity 0.8.27+)
  2. Test locally using Hardhat node or Foundry Anvil
  3. Deploy to GX testnet at https://testnet-rpc.gx.exchange
  4. Verify on the GX Explorer
  5. Deploy to mainnet at https://rpc.gx.exchange

Security Best Practices

  • Use OpenZeppelin v5 audited contract libraries
  • GX Core enforces overflow-checks = true at the protocol level
  • EIP-712 signature verification includes low-s normalization
  • All integer arithmetic uses checked/saturating operations — no floating point in matching or settlement
  • Validator keys are stored via environment variables, never exposed in CLI arguments or logs