For DevelopersGX EVMGX EVM

GX EVM

The GX EVM is an Ethereum-compatible execution environment embedded within the GX Chain L1. It enables smart contract deployment and execution alongside the native high-performance trading engine, allowing DeFi protocols, automated strategies, and custom logic to interact directly with GX Exchange.

Architecture

GX Chain runs two parallel execution environments:

LayerPurposeInterface
GX CoreNative trading engine — orderbooks, matching, clearingREST + WebSocket API
GX EVMSmart contract execution — Solidity, Vyper, ERC-20sStandard EVM JSON-RPC

The two layers share state through system precompiles and a bridge contract, allowing EVM contracts to interact with the trading engine and vice versa.

Key Parameters

ParameterValue
Chain ID42069
RPC URL (Mainnet)https://rpc.gx.exchange
RPC URL (Testnet)https://rpc.gx-exchange-testnet.xyz
RPC Port (Local)3001
Block architectureDual: Fast (1s) + Slow (1min)
Native tokenGX
EVM versionShanghai

Adding GX Chain to MetaMask

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

Dual Block Architecture

GX EVM produces two types of blocks to balance throughput and finality:

Block TypeIntervalGas LimitPurpose
Fast1 second2,000,000Low-latency transactions, DEX interactions
Slow1 minute30,000,000High-throughput batch operations, contract deployments

See Dual Block Architecture for details.

Smart Contract Development

GX EVM supports standard Ethereum development tools:

  • Solidity / Vyper — compile and deploy contracts using standard compilers
  • Hardhat / Foundry — use your existing development framework
  • ethers.js / web3.py / viem — interact with contracts using standard libraries

Hardhat Configuration

// hardhat.config.js
module.exports = {
  networks: {
    gx: {
      url: "https://rpc.gx.exchange",
      chainId: 42069,
      accounts: ["0xYourPrivateKey..."],
    },
    gxTestnet: {
      url: "https://rpc.gx-exchange-testnet.xyz",
      chainId: 42069,
      accounts: ["0xYourPrivateKey..."],
    },
  },
  solidity: "0.8.24",
};

Foundry Configuration

# foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.24"
 
[rpc_endpoints]
gx = "https://rpc.gx.exchange"
gx_testnet = "https://rpc.gx-exchange-testnet.xyz"

Interacting with GX Core

EVM contracts can interact with the native trading engine through:

  1. System precompiles — call pre-defined addresses to read trading data (prices, positions, balances)
  2. GX Core bridge contract — transfer assets between GX EVM and GX Core
  3. Event-driven integration — emit events that off-chain systems use to trigger trading actions

See Interacting with GX Core for implementation details.

Sections