> For the complete documentation index, see [llms.txt](https://docs.aftermath.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aftermath.finance/perpetuals/architecture/fees/reference-gas-price.md).

# Reference Gas Price

Reference Gas Price (RGP) is a fee-aware toxicity filtering mechanism adopted from DeepBook. It creates economic dis-incentives against toxic flow without requiring protocol-level changes to transaction prioritization.

### Background

In order book markets, toxic flow occurs when fast or informed takers systematically exploit stale maker quotes. This forces market makers to widen spreads or reduce size, degrading liquidity quality for everyone including retail traders.

Centralized exchanges address this through cancel prioritization, where cancel requests are processed before new orders. However, this approach requires sequencer-level control that general-purpose L1s like Sui cannot provide without protocol updates. RGP offers an alternative that works within existing chain constraints.

### How It Works

On Sui, every transaction declares a gas price, and the validator set publishes a network-wide **reference gas price** each epoch. Wallets submit at the reference price by default, so paying above it is an explicit bid for sequencing priority — typically to front-run or exploit stale maker quotes. RGP uses this gas premium as a toxicity signal.

The system operates as follows:

1. When an order transaction is executed, the contracts compare its gas price against the epoch's reference gas price
2. If the gas price is strictly above the reference gas price, a **priority taker fee** is added on top of the regular taker fee for every taker fill in that transaction (0.10% by default; a per-market parameter)
3. Maker volume is unaffected — the surcharge applies to taker fills only

A market can also disallow priority gas entirely: if no priority taker fee is configured, transactions paying above the reference gas price abort instead of trading.

Conditional orders executed by keepers — stop orders, SL/TP, and TWAP executions — must be submitted at exactly the reference gas price, so this class of transactions can never buy sequencing priority at all.

### Key Properties

RGP does not slow down retail users or penalize typical trading flow: wallets submit at the reference gas price by default, so the surcharge is only ever paid by transactions that deliberately overbid for sequencing priority — the most toxic class of flow. The mechanism is transparent and operates entirely within onchain execution logic.

The penalty fees accrue to the market's fee pool together with all other trading fees, the same pool that funds maker rebates. This creates a positive feedback loop: the more aggressive the toxic behavior, the more fees flow toward liquidity providers, which incentivizes continued liquidity provision and helps maintain tighter spreads.

Unlike cancel prioritization, RGP can be implemented on general-purpose chains without protocol updates. It treats all order actions (place, cancel, post) fairly, and the priority taker fee is a tunable per-market parameter that can be adjusted based on observed market behavior.

### Why Not Cancel Prioritization?

Cancel prioritization systems introduce their own form of toxicity: adverse cancels. When cancels are prioritized, market makers can wait to see where the price moves and then cancel orders that would result in unfavorable fills. This creates a scenario where makers effectively get free optionality at the expense of takers.
