Transaction Ordering

Archer Team
Archer DAO
Published in
3 min readNov 20, 2020

The important details even ETH experts miss

How are transactions ordered in a block? If you’re like a lot of Ethereum experts and confidently answered “gas price”, keep reading.

Miners have an enormous amount of flexibility to order transactions however they like. Ethereum only requires that account nonces are respected. Geth, the most popular client, uses gas price and time for its default ordering method. But that’s simply the default. Transaction ordering can be further optimized.

The code snippet below shows how Geth orders transactions by gas price and time (source). See also #21358 and #21350.

func (s TxByPriceAndTime) Less(i, j int) bool {
// If the prices are equal, use the time the transaction was first seen for
// deterministic sorting

cmp := s[i].data.Price.Cmp(s[j].data.Price)
if cmp == 0 {
return s[i].time.Before(s[j].time)
}
return cmp > 0
}

Archer Advances Transaction Ordering Optimization

Ethereum’s rich application layer gives miners a lot more information to consider than just gas price when forming blocks. For example, miners could choose to:

  • Order all dex trades to respect slippage requirements and avoid failed transactions in order to produce more fees.
  • Lift transactions that are commonly back-run to be executed earlier in each block in order to re-enable gas price auctions.
  • Execute transactions for an account with many high-value transactions that happens to be stuck on a low-nonce transaction with a low gas price.

Miners who react to the application layer will maximize their revenue.

Today, Archer injects transactions to extract value from on-chain incentive mechanisms. This activity represents the foundation to develop and deploy more advanced optimization strategies.

Miners who do not optimize transaction ordering will fall behind those who do. For example, a block producer in ETH2 who orders transactions will earn more, stake more and produce more blocks compared to a block producer who sticks to the default settings.

Emerging Game Theories in Our Dark Forest

Harmful strategies have emerged to take advantage of the default transaction ordering by gas price.

Dan Robinson and Georgios Konstantopoulos describe generalized front-running bots in Ethereum is a Dark Forest. These bots steal profitable transactions from network users. Under such conditions, no one can take advantage of the incentives designed to maintain Ethereum applications. Productive users like network keepers simply give up and move on.

Archer suppliers are not subject to having transactions stolen by generalized front-running bots.

Other emerging projects also aim to solve this tragedy of the commons. The latest strategies encourage keepers to coordinate and pay less gas and/or implement some form of permissioned access to keeper functions. Archer is technically compatible with both permissioned and unpermissioned keeper networks (unlike generalized front-running bots).

The Threat to Ethereum’s Consensus Layer

Order optimization is described as a threat to the stability of Ethereum’s consensus layer in Flash Boys 2.0: Frontrunning, Transaction Reordering, and Consensus Instability in Decentralized Exchanges. Through order optimization, miners have enormous power to influence how transactions are processed on Ethereum — potentially in ways that are harmful to the network. Taken to an extreme, miners could try to take the best opportunities for themselves by re-mining previous blocks, ultimately breaking the network and all applications that rely on it.

We agree with the threats posited by this research and take them very seriously. With that in mind, we encourage members of Archer DAO to respect three principles:

  1. Avoid censorship
  2. Prioritize sustainable revenue
  3. Keep the network open to new stakeholders

The founding team commits to use its voting power towards these ideas intended to minimize negative externalities. To this end, external stakeholders are invited to join Archer DAO and shape the future of the network.

Mine Smarter

Archer boosts miner revenue with a five-minute integration. Live now on Ethereum. Visit our website and join Discord to learn more.

--

--