Respostas>Saiba mais sobre o MEV e a ordenação das transações>Como funciona a ordenação das transações
Como funciona a ordenação de transações
// Tags
ordenação de transaçõesmempool
TL;DR: Transaction ordering is the process by which a blockchain decides which pending transactions get included in the next block and in what sequence. This ordering directly affects which transactions succeed, which fail, and how much value each participant receives. On most blockchains, the entity producing the block has full discretion over transaction order. Historically, transactions were ordered by gas price, with the highest bidder going first. Today, the process is far more complex, involving base fees, priority fees, private order flow, specialized block builders, and auction mechanisms that have transformed block construction into a sophisticated marketplace.
A Explicação Simples
When you submit a transaction to a blockchain, it enters the mempool, a public holding area where every pending transaction waits to be included in a block. The mempool is not a queue. There is no guaranteed first-come-first-served ordering. Instead, the block producer (a validator on Proof of Stake chains, a miner on Proof of Work chains) selects which transactions to include and arranges them in whatever order they choose.
This is fundamentally different from how traditional systems work. When you place an order on a stock exchange, the exchange has strict rules about time priority: orders that arrive first are executed first. On a blockchain, the block producer is the exchange, and they can reorder the trades however they want. The only constraint is that each transaction must be valid given the state produced by the transactions before it in the same block.
Por que é que a ordem é tão importante? Porque na DeFi, a ordem das transações dentro de um bloco pode determinar preços, liquidações e resultados de arbitragem. Se duas pessoas estiverem a tentar comprar o mesmo token do mesmo pool de liquidez, a pessoa cuja transação for executada primeiro obtém um preço melhor. A transação da segunda pessoa é executada num pool com menos liquidez e a um preço mais elevado. A diferença entre ser o primeiro e ser o segundo pode valer milhares ou milhões de dólares.
O modelo tradicional: ordenação dos preços da gasolina
Before Ethereum's EIP-1559 upgrade (August 2021), transaction ordering was straightforward: users attached a gas price to their transaction, and block producers sorted the mempool by gas price, highest first. If you wanted your transaction to land before someone else's, you paid a higher gas price. This created a simple but brutal auction system called a Priority Gas Auction (PGA).
PGAs were chaotic during high-demand periods. MEV searchers competing for arbitrage or liquidation opportunities would rapidly outbid each other, incrementing their gas prices in real time. A single profitable MEV opportunity could trigger dozens of competing transactions, each with progressively higher gas prices, consuming block space and driving up costs for everyone else on the network. Users trying to make a simple token transfer would see their gas costs spike because bots were bidding up the price of block space in pursuit of MEV profits.
The PGA model also meant that transaction ordering was entirely determined by willingness to pay. There was no concept of fairness, no consideration of when a transaction was submitted, and no mechanism to protect regular users from being outbid by sophisticated bots with faster mempool monitoring and higher capital reserves.
A EIP-1559 e o modelo de taxas em duas partes
A atualização EIP-1559 Ethereum substituiu o preço único do gás por uma estrutura de taxas composta por dois componentes: uma taxa base e uma taxa de prioridade (gorjeta). A taxa base é definida algoritmicamente pelo protocolo com base no nível de ocupação do bloco anterior. Quando os blocos estão ocupados em mais de 50%, a taxa base aumenta. Quando os blocos estão ocupados em menos de 50%, a taxa base diminui. A taxa base é queimada (retirada de circulação), o que significa que não reverte para os validadores.
The priority fee is the amount a user pays directly to the validator as an incentive to include their transaction. In a world where every transaction pays the same base fee, the priority fee becomes the differentiator for ordering. Transactions with higher priority fees get included first.
This model improved fee predictability for users (the base fee adjusts smoothly rather than spiking unpredictably) and reduced the effectiveness of PGAs (since competing bots can no longer spike the overall gas price for everyone, only their own priority fee). However, it did not eliminate ordering-based value extraction. Validators (or the builders they delegate to) still control the sequence of transactions within a block, and the priority fee still creates an auction for positioning.
Construção em blocos moderna: separação entre promotor e construtor
Atualmente, a ordenação de transações na Ethereum dominada por um sistema denominado «Proposer-Builder Separation» (PBS), implementado através do MEV-Boost e do ecossistema Flashbots. O PBS divide o processo de produção de blocos em duas funções: os «builders», que organizam o conteúdo do bloco, e os «proposers» (validadores), que aprovam o bloco final.
The process works as follows. Users submit transactions to the public mempool or directly to builders through private channels. MEV searchers monitor the mempool and construct bundles, which are ordered groups of transactions designed to capture specific MEV opportunities (arbitrage, liquidation, sandwich). Builders collect these bundles along with regular user transactions, assemble them into a complete block ordered to maximize total value, and submit their block as a bid to a relay. The relay validates the block and forwards the highest-value bid to the proposer. The proposer selects the winning bid (typically the one that pays them the most), signs the block header, and the relay publishes the full block to the network.
Mais de 90% Ethereum são agora produzidos através deste fluxo de trabalho PBS. O sistema profissionalizou a ordenação das transações a um nível que teria sido inimaginável nos primórdios da rede. A construção de blocos tornou-se um negócio competitivo e de elevado investimento, em que um pequeno número de construtores produz a maioria dos blocos com base na sua capacidade de extrair e distribuir MEV de forma eficiente.
Flow de ordens privadas
One of the most significant developments in transaction ordering is the rise of private order flow. Instead of broadcasting transactions to the public mempool (where they are visible to front-running bots), users can submit transactions directly to builders through private channels. Services like Flashbots Protect, MEV Blocker, and private transaction relays accept user transactions and forward them to builders without exposing them to the public mempool.
Private order flow protects users from sandwich attacks (since bots cannot see the transaction to front-run it) but creates new dynamics in the block building market. Builders with access to exclusive private order flow have a competitive advantage because they can construct more valuable blocks than builders limited to public mempool transactions. This has led to a concentration of block building among a small number of builders with the best order flow relationships, raising concerns about centralization in a system designed to be decentralized.
Transaction Ordering on Other Chains
Solana a ordenação das transações de forma diferente devido à sua arquitetura. Não existe um mempool tradicional. As transações são enviadas diretamente para o líder atual (o validador responsável pela produção do bloco do slot atual). O líder determina a ordenação, e o protocolo Gulf Stream Solana encaminha as transações antecipadamente para o próximo líder. Isto reduz alguns vetores de ataque MEV (como o tradicional «mempool sniping»), mas confere ao líder um poder significativo de ordenação durante o seu slot.
Os rollups de Camada 2, como Arbitrum, Base e Optimism , utilizam Optimism sequenciadores centralizados que ordenam as transações segundo o princípio «primeiro a chegar, primeiro a ser servido». O sequenciador recebe as transações, ordena-as por hora de chegada e agrupa-as em lotes para envio para Ethereum . Este modelo reduz o MEV baseado na ordenação em comparação com Ethereum , mas concentra o poder de ordenação numa única entidade. Os esforços para descentralizar os sequenciadores, incluindo redes de sequenciamento partilhadas e mecanismos de rotação de sequenciadores, constituem áreas ativas de desenvolvimento.
De que forma a ordenação das transações gera MEV?
Because the block producer chooses the sequence of transactions, that sequence itself becomes a source of profit. Reordering, inserting, or censoring transactions can capture value that would otherwise go to ordinary users, and this captured value is called MEV. A searcher who sees a large swap in the mempool can place a buy just before it and a sell just after to pocket the price impact. The deeper reason this is possible is structural: as long as someone controls ordering and transactions are visible before they execute, the opportunity exists, which is exactly why MEV exists.
How does transaction ordering differ across blockchains?
Each chain hands ordering power to a different actor, which changes how much MEV users are exposed to. Ethereum uses builders and proposers, Solana hands the current leader control, and most rollups rely on a single sequencer. The table below compares the three models.
Chain
Mecanismo de encomendas
Exposição ao MEV
Ethereum
Ordem das construtoras por valor total através da PBS
Elevado; ataques de arbitragem e «sandwich» são comuns
Solana
Ordens do líder atual, sem mempool público
Menos «sniping» no mempool, mas o líder continua a controlar a ordem
Rollups de L2 (Arbitrum, Base)
Sequenciador centralizado, por ordem de chegada
MEV de reordenação reduzido, mas o sequenciador é considerado fiável
Quais são os principais tipos de extração de valor com base em encomendas?
Not all ordering-based value extraction is harmful. Some forms keep markets efficient, while others come directly at the expense of the user being ordered around. The table below summarizes the most common categories searchers pursue.
Tipo MEV
O que faz
Quem é afetado
Arbitragem
Lucros decorrentes das diferenças de preço entre diferentes mercados ou plataformas
Na sua maioria, de natureza benigna; harmoniza os preços
Liquidação
Reembolsa empréstimos com garantia insuficiente para receber um bónus
Mutuários near do near limite
Sanduíche
Operações de «front-run» e «back-run» e a troca de vítimas
Operadores no mempool público
Retrocesso
Inserir uma transação imediatamente a seguir a um alvo
Varia; frequentemente benigno
É possível proteger as transações contra uma ordenação prejudicial?
Yes, to a meaningful degree. The simplest defense is to keep a transaction out of the public mempool by routing it through a private order flow service, so front-running bots never see it before it executes. Setting tight slippage limits also caps how much a sandwich can extract. These approaches, along with fair-ordering research and encrypted mempools, are part of a broader set of MEV mitigation strategies that aim to protect users without sacrificing the openness of the network.
Perguntas frequentes
A ordenação das transações é o mesmo que o princípio «primeiro a chegar, primeiro a ser atendido»?
Usually not. On most blockchains the block producer can arrange included transactions in any valid order, so arrival time does not guarantee execution order. Some Layer 2 sequencers do order by arrival time today, but that is a property of those specific systems, not of blockchains in general.
O facto de pagar uma taxa mais elevada garante que a minha transação seja processada em primeiro lugar?
Aumenta as suas hipóteses, mas não garante a posição. Uma taxa de prioridade mais elevada aumenta a probabilidade de inclusão e de colocação mais cedo; no entanto, os criadores otimizam com base no valor total de todo o bloco, pelo que um pacote que pague mais no total pode ainda assim ter prioridade sobre a sua transação individual.
A ordenação das transações está relacionada com a finalidade?
Estão relacionados, mas são distintos. A ordenação determina a sequência dentro de um bloco, enquanto a finalidade determina quando esse bloco já não pode ser revertido. Uma transação pode ser ordenada e incluída, mas ainda assim ser revertida se o bloco for reorganizado antes de se tornar definitiva.
A ordem das transações pode alterar-se após a criação de um bloco?
Dentro de um único bloco, não; a ordem fica fixa assim que o bloco é assinado. Mas o próprio bloco pode ser substituído durante uma reorganização da cadeia, o que pode eliminar ou reordenar transações em relação à cadeia canónica até que se alcance a finalidade.
As camadas 2 eliminam o MEV?
Não totalmente. Um sequenciador centralizado que ordena as transações por ordem de chegada reduz o MEV de reordenação comum na Ethereum , mas concentra o poder de ordenação num único operador e não elimina todas as formas de extração. A descentralização dos sequenciadores é uma área de investigação ativa que visa resolver esta questão.
Como é que Quicknode nisto
Transaction ordering affects every application that submits or monitors transactions on a blockchain. Quicknode's Core API provides the low-latency RPC access developers need to submit transactions with accurate fee estimation and precise timing. Fast response times ensure your application's transactions reach the network with minimal delay, which is especially important in competitive environments where milliseconds determine transaction positioning.
For applications that need to monitor how transactions are being ordered and included, Quicknode Streams delivers real-time block data with guaranteed delivery and finality-order processing. By streaming transaction data filtered to your contracts and addresses, you can analyze ordering patterns, detect MEV activity affecting your users, and build systems that respond to block-level dynamics in real time. Quicknode's infrastructure ensures your application has the speed, reliability, and data access needed to navigate the complex realities of modern transaction ordering.