Protecting Transactions with Flashbots

Other wallets will make you manually enter an RPC endpoint to get this best-in-class protection, but now it’s built directly into Swaps on Rainbow.

Flashbots are currently available on Ethereum Mainnet, where MEV matters most. As additional approaches for MEV mitigation emerge for L2 Networks, we’ll work to adopt them as well.

What is MEV and Flashbots?

Flashbots is a research and development organization, that’s focused on mitigating the harmful effects of MEV or Miner Extractable Value. The MEV Crisis is a bit complicated, but the synopsis is that arbitrage traders have devised strategies that can squeeze profits out of everyday transactors.

When you’re executing a token swap, miners and arbitragers can unconventionally profit (i.e. not from transaction fees and block rewards) but by reordering, inserting, and censoring transactions. It’s a new cascade of problems unique to blockchains. You can think of Flashbots as the good guys in the arbitrage game, with goals that align with the Ethereum Foundation and the guiding principle of maintaining decentralization and accessibility for the average user.

In recent years, arbitrage bots have become exceptionally good at this cat-and-mouse game, and this new profit motive for miners is becoming a risk to network security. Flashbots stepped ahead of the bots and devised a strategy to arbitrage the arbitragers by making MEV infrastructure accessible and transparent:

Flashbots Auction is a transparent marketplace where Ethereum users and miners can work together to keep transactions off of the public mempool and reduce bot attack surface area.Flashbots Protect is a service built on top of Flashbots Auction that makes this private mempool accessible to everyday transactors — and Rainbow brings it to even more users.

What are the attacks I should worry about?

Frontrunning:

In traditional asset markets, “frontrunning” trades are performed by buying an asset and marking it up just-in-time to meet an order. This requires access to transactions and is isolated to order-flow agreements. In other cases, frontrunning market movements, more broadly, requires access to insider knowledge.

In the DeFi world where Ethereum transactions are publicly visible in the mempool before they are executed, it’s free game. Flashbots mitigate this by keeping transactions out of the mempool before they are executed.

Backrunning:

In backrunning, an arbitrager acts as the buyer for tokens on one exchange, and flips them for more on another. In aggregate, arbitrators compete, drive down the swap slippage, and balance DEX prices. But, in the decentralized world, arbitrageurs can abuse the network and spam miners to always get ahead of everyday transactors.

If an Ethereum user submits a transaction, bots will race to get their transaction to miners first by spamming transactions with increasing fees to beat out each other. This drives up congestion and gas prices.

Sandwich Attacks:

In sandwich attacks, both frontrunning and backrunning are applied simultaneously to “sandwich” a user’s transaction, squeezing value from them from both directions.

The attack vector is about manipulating the miner prioritization mechanism to work faster than a transactor to create an artificially inflated exchange price. This causes an end-user to lose value due to unnecessary, artificial market slippage. Flashbots mitigates many of the underlying mechanisms of this vector of attack.

There’s More!

Flashbots transactions are prioritized over other mempool transactions, and are mined at the top of blocks. The off-chain auction infrastructure is also faster in most cases than a purely on-chain transaction submission. In periods of congestion, Flashbots are also more efficient because Flashbots users won’t pay gas fees for transaction failures. When on-chain transactions are failing, Flashbots-assisted transactions are queued and executed at just the right time to mitigate failures.

Flashbots Protect for Swaps on Rainbow 🌈

With the launch of improved Swaps on Rainbow, Rainbow is rolling out Flashbots Protect for Ethereum Mainnet. We leverage Flashbots to hide your transactions, mitigate sandwhich attacks, and save you gas when transactions fail. When you want to swap a token on Mainnet, you’ll find Flashbots as a toggle in the Transaction Options.

Today, it’s for the users that know what they’re doing and are performing transactions where the benefits of Flashbots really matter! In the future, we expect to introduce Flashbots for other types of network transactions, and ultimately provide it as the Smart Default.