Skip to main content

MEV Protection

MEV (Maximal Extractable Value) protection is a critical feature in BozoBot that helps protect your trades from front-running and other forms of transaction manipulation. This guide explains what MEV is, how it affects your trades, and how to use BozoBot's MEV protection features.

What is MEV?

MEV (Maximal Extractable Value) refers to the profit that can be extracted from blockchain users by reordering, inserting, or censoring transactions. In the context of trading:

  • Front-running: Validators or searchers see your pending transaction and insert their own transaction before yours to profit from your trade
  • Sandwiching: Your transaction is sandwiched between two transactions by the same actor to profit from the price impact
  • Back-running: Someone places a transaction immediately after yours to capitalize on the price movement you create

These MEV attacks can significantly reduce your profits or increase your losses, especially when trading low-liquidity tokens or during high-demand token launches.

How BozoBot Protects Your Trades

BozoBot offers integration with two leading MEV protection services:

  1. Jito: A Solana-native MEV protection service
  2. Bloxroute: A cross-chain MEV protection solution

These services work by sending your transactions through private channels directly to validators, bypassing the public mempool where they could be seen and front-run.

Setting Up MEV Protection

Basic Configuration

To enable MEV protection, configure the transaction dispatchers in your .env file:

# TX Dispatcher: standard or jito or bloxroute
BUY_TRANSACTION_DISPATCHER=jito
SELL_TRANSACTION_DISPATCHER=jito

You can set different dispatchers for buys and sells, depending on your strategy.

Fee Configuration

Set the priority fees for MEV protection:

# Priority fees for all transaction types (in SOL)
# These fees are used both for standard transaction priority
# and for Jito/Bloxroute tips
BUY_PRIORITY_FEE=0.000123
SELL_PRIORITY_FEE=0.000123

These values represent the amount in SOL that you're willing to pay for transaction priority and MEV protection tips.

Note: The legacy settings MAX_BUY_FEE, MAX_SELL_FEE, BUY_COMPUTE_UNIT_PRICE, etc. are no longer used.

Bloxroute Specific Configuration

If using Bloxroute, you'll need to set your API key:

BLOXROUTE_KEY=your_bloxroute_key_here

When to Use MEV Protection

High-Priority Situations

MEV protection is particularly valuable in these scenarios:

  1. Token Launches: When sniping new token launches where competition is high
  2. Low Liquidity Tokens: When trading tokens with limited liquidity where price impact is significant
  3. Large Trades: When making trades with substantial value that could attract attention
  4. Market Volatility: During periods of high volatility when transaction ordering is crucial

Balancing Costs and Benefits

MEV protection comes with additional fees, so consider:

  • For small trades (less than 0.1 SOL), the protection fee might outweigh the benefits
  • For larger trades or competitive situations, the fee is often worth the protection
  • During congested network periods, MEV protection also provides faster transaction processing

For General Trading

BUY_TRANSACTION_DISPATCHER=standard
SELL_TRANSACTION_DISPATCHER=standard

Standard transactions are sufficient for regular trading in established tokens with good liquidity.

For Sniping New Tokens

BUY_TRANSACTION_DISPATCHER=jito
SELL_TRANSACTION_DISPATCHER=standard
BUY_PRIORITY_FEE=0.000250

Protect your buy transactions during competitive sniping while using standard transactions for sells.

For Maximum Protection

BUY_TRANSACTION_DISPATCHER=jito
SELL_TRANSACTION_DISPATCHER=jito
BUY_PRIORITY_FEE=0.000500
SELL_PRIORITY_FEE=0.000500

Full protection on both buys and sells with higher allowed fees for critical transactions.

Combining with Priority Fees

The new fee system automatically handles both standard priority fees and MEV protection tips using the same parameters (BUY_PRIORITY_FEE and SELL_PRIORITY_FEE), which simplifies configuration.

Note: The legacy priority fee settings (BUY_COMPUTE_UNIT_LIMIT, BUY_COMPUTE_UNIT_PRICE, etc.) are no longer required.

Monitoring Protection Effectiveness

When MEV protection is active, BozoBot will display in the console:

  • Whether protection was successfully applied
  • The fee paid for protection
  • Confirmation when your protected transaction is executed

This allows you to assess whether the protection is providing value for your trading strategy.

Troubleshooting

Common Issues

  • Protection Unavailable: Occasionally MEV protection services may experience downtime. BozoBot will fall back to standard transactions in these cases.
  • Insufficient Priority Fee: If your BUY_PRIORITY_FEE or SELL_PRIORITY_FEE is too low for current network conditions, your transaction might be processed slowly or might not be prioritized by validators.

Transaction Failures

If your protected transactions are failing:

  1. Check that your fee settings are sufficient for current network conditions
  2. Verify that your account has enough SOL to cover the additional protection fees
  3. Consider increasing your slippage tolerance as protected transactions may still experience some price impact

Advanced Considerations

MEV Economics

The cost of MEV protection should be viewed as insurance against potential losses. For example:

  • A 0.5% fee on a 1 SOL trade costs 0.005 SOL
  • But front-running could cost you 5-10% or more in adverse price movement
  • For token launches, being front-run could mean missing the opportunity entirely

Network-Specific Settings

Different networks and market conditions may require different protection settings:

  • During network congestion, increase priority fees
  • During high MEV activity periods (like major token launches), consider increasing your maximum fee allowance