For DevelopersGX EVMInteraction Timings

Interaction Timings

This page documents the latency characteristics of interactions between GX Core, GX EVM, and external chains. Understanding these timings is essential for building reliable integrations.

Internal Latencies

GX Core Operations

OperationLatencyDescription
Order placement< 1 msMatching engine processing time
Order cancellation< 1 msImmediate removal from orderbook
USD transfer< 2 sProcessed in the next Core block
Leverage update< 2 sProcessed in the next Core block
Agent approval< 2 sProcessed in the next Core block

GX EVM Operations

OperationLatencyDescription
Fast block transaction1-2 sConfirmed in the next fast block
Slow block transaction60-120 sConfirmed in the next slow block
Contract deployment60-120 sTypically requires a slow block
Event log emissionSame as block confirmationLogs are available when the block is mined

Cross-Layer Operations

OperationDirectionLatencyNotes
Core to EVM transferCore -> EVM1-2 sCredited after next Core block
EVM to Core transferEVM -> Core2-5 sEVM block finality + next Core block
Precompile readEVM -> Core0 ms (view call)Reads finalized Core state
Bridge depositExternal -> Core1-5 minDepends on source chain finality
Bridge withdrawalCore -> External5-30 minDepends on destination chain

Block Production Timeline

Time    Event
────────────────────────────────────
t=0.0s  Fast block #N produced
t=0.0s  Core block processes: orders matched, transfers settled
t=1.0s  Fast block #N+1 produced
t=1.0s  EVM transactions from #N are finalized
...
t=59.0s Fast block #N+59 produced
t=60.0s Slow block #N+60 produced (30M gas limit)
t=60.0s Heavy EVM transactions confirmed
t=61.0s Fast block #N+61 produced

Precompile Data Freshness

When an EVM contract reads data from GX Core via a precompile, it accesses the state as of the last finalized Core block:

Data TypeFreshnessUpdate Frequency
Oracle prices1-2 seconds staleUpdated every Core block
User positions1-2 seconds staleUpdated on every fill/liquidation
Account values1-2 seconds staleRecalculated each Core block
Market metadataEffectively staticChanges only on market listings

For time-critical decisions (e.g., liquidation), account for this staleness window. An oracle price read from EVM may be up to 2 seconds behind the real-time price used by the matching engine.

Optimizing Cross-Layer Interactions

Minimize Round Trips

If your application needs both EVM execution and Core trading:

  1. Batch EVM operations into a single transaction where possible.
  2. Use precompile reads within the same transaction to avoid separate RPC calls.
  3. Pre-position assets in the correct layer before they are needed.

Event-Driven Architecture

For workflows that span both layers:

EVM Contract emits event
    -> Off-chain service detects event via WebSocket/polling
    -> Service calls GX Core API to place orders
    -> Service monitors fills via WebSocket
    -> Service calls EVM contract to settle

This pattern avoids the latency of cross-layer transfers during the critical path.

Asset Pre-Positioning

If your strategy requires rapid asset movement:

  1. Keep a reserve balance in both GX Core and GX EVM.
  2. Rebalance periodically during low-activity periods.
  3. Avoid transferring assets in the critical path of a trade.

Confirmation Guarantees

LayerFinality ModelReorg Risk
GX CoreImmediate finalityNone
GX EVMImmediate finality (same consensus)None
Bridge (source chain)Depends on source chainWait for required confirmations

GX Chain provides immediate finality for both Core and EVM operations. Once a block is produced, it is final. There are no reorgs, uncle blocks, or chain reorganizations.

Timing Diagram: Full Cross-Layer Trade

t=0ms     User submits order via Core API
t=<1ms    Order matched by engine
t=0-2s    Fill confirmed in Core block
t=0-2s    User receives fill via WebSocket
t=2-4s    On-chain settlement (if EVM integration required)

Total end-to-end: under 5 seconds for a complete trade with EVM settlement.