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:
| Layer | Purpose | Interface |
|---|---|---|
| GX Core | Native trading engine — orderbooks, matching, clearing | REST + WebSocket API |
| GX EVM | Smart contract execution — Solidity, Vyper, ERC-20s | Standard 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
| Parameter | Value |
|---|---|
| Chain ID | 42069 |
| RPC URL (Mainnet) | https://rpc.gx.exchange |
| RPC URL (Testnet) | https://rpc.gx-exchange-testnet.xyz |
| RPC Port (Local) | 3001 |
| Block architecture | Dual: Fast (1s) + Slow (1min) |
| Native token | GX |
| EVM version | Shanghai |
Adding GX Chain to MetaMask
| Field | Value |
|---|---|
| Network Name | GX Chain |
| RPC URL | https://rpc.gx.exchange |
| Chain ID | 42069 |
| Currency Symbol | GX |
| Block Explorer | https://explorer.gx.exchange |
Dual Block Architecture
GX EVM produces two types of blocks to balance throughput and finality:
| Block Type | Interval | Gas Limit | Purpose |
|---|---|---|---|
| Fast | 1 second | 2,000,000 | Low-latency transactions, DEX interactions |
| Slow | 1 minute | 30,000,000 | High-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:
- System precompiles — call pre-defined addresses to read trading data (prices, positions, balances)
- GX Core bridge contract — transfer assets between GX EVM and GX Core
- Event-driven integration — emit events that off-chain systems use to trigger trading actions
See Interacting with GX Core for implementation details.
Sections
- Dual Block Architecture — Fast and slow block model
- Raw EVM Block Data — Accessing raw block data
- Interacting with GX Core — System contracts and precompiles
- GX Core EVM Transfers — Moving assets between engines
- Interaction Timings — Latency between layers
- Wrapped GX — WGXT ERC-20 wrapper
- JSON-RPC — Supported RPC methods