Skip to main content
Use real-time gas statistics from the Relayer to submit transactions at the selected gas price for cost and confirmation speed.

Gas pricing fundamentals

Every MultiversX transaction specifies a gasPrice in atomic EGLD units (10^-18 EGLD) and a gasLimit in gas units:
The network enforces a minimum gasPrice of 1,000,000,000 (10^9). Validators prioritize higher-priced transactions, so the minimum price during congestion risks delayed inclusion. PPU (price per unit) is the effective cost per gas unit. For transactions with a non-empty data field, each byte costs an additional 1,500 gas units. PPU accounts for this overhead, so it compares costs across transaction types more accurately than raw gasPrice.

The sliding window

Gas statistics are computed over a 30-minute sliding window of 10-second buckets (180 buckets total). As time advances, the oldest bucket expires and the window shifts forward. Spam attacks cluster at the minimum price. The p75 percentile filters these out and reflects what legitimate transactions paid, making it a stronger default for most applications.

Choosing the right percentile

When a shard reports all gas price fields as 1000000000 and PPU as 0, it has no recent transaction history. The minimum price is sufficient.

Using mempool pressure

The networkStats stream on wss://relayer.xoxno.com/ws/stats pushes updates at adaptive intervals. Each message includes mempool.pressure per shard, representing current queue depth relative to throughput capacity.

Block time expectations

The blockTimeMsP50ByShard field in networkStats gives the current median block time per shard. For cross-shard transactions, sum both shards.

Adaptive gas pricing example

Practical guidelines

Do:
  • Subscribe to gasStats before your first transaction; the first message arrives immediately
  • Default to p75 for user-facing swaps
  • Escalate to p90 during periods of high network activity
  • Use bucketAvg for background or non-urgent operations
Avoid:
  • Using the raw avg field (spam volume biases it low)
  • Setting gasPrice below 1,000,000,000 (the network rejects it)
  • Caching gas stats beyond a few seconds; conditions shift within a single block

Gas statistics

Full gasStats message schema and field descriptions.

Network stats

networkStats stream with mempool pressure data.