MEV-Boost is a middleware protocol that enables Ethereum validators to outsource block construction to a competitive market of specialized builders. At its core is the relay, a trusted, neutral server that sits between block builders and validators (proposers). The relay's primary function is to receive execution payloads—fully built blocks—from builders, validate them, and present the most profitable option to the next validator in the proposer duty queue. This architecture enforces proposer-builder separation (PBS), a critical design pattern that prevents validators from seeing the transaction ordering within a block before committing to it, thereby mitigating centralization risks and certain MEV extraction attacks.
Setting Up Infrastructure for MEV Protection Relays
Introduction to MEV-Boost Relay Infrastructure
A technical overview of the relay layer in Ethereum's MEV-Boost ecosystem, explaining its role in block building, proposer-builder separation, and validator protection.
Setting up a relay requires running software that implements the MEV-Boost Relay API. The two primary implementations are the Flashbots Relay (written in Go) and the Ultra Sound Relay (written in Rust). A relay must connect to both the consensus layer (Beacon Chain) and execution layer (Execution Client) to perform critical duties: verifying block validity, checking the builder's signature, ensuring the block's parent hash is correct, and confirming the claimed block value. Relays also maintain a cancun-upgraded data availability layer to store transaction data for blocks that may need to be reconstructed, a requirement post-EIP-4844.
From a validator's perspective, connecting to a relay is straightforward. A validator configures its mev-boost client with the URLs of one or more trusted relays. When it's the validator's turn to propose a block, mev-boost queries all configured relays for their best header, selects the one with the highest bid, and commits to it by signing a blinded beacon block. Only after this commitment does the relay reveal the full block body to the validator, who then publishes it to the network. This "blinding" is what protects proposers from being exploited.
Running a private relay can be beneficial for staking pools or solo stakers seeking maximum control, redundancy, or censorship resistance. The key steps involve: cloning the relay software repository, configuring environment variables for Ethereum node RPC endpoints (e.g., a Geth and a Prysm node), setting the external IP and port, and initializing the required EIP-712 signing key. A critical security configuration is the MIN_BID value, which rejects builder bids below a certain threshold (e.g., 0.05 ETH) to prevent spam and ensure economic viability.
The relay landscape includes both permissioned and permissionless models. Major permissioned relays like Flashbots, BloXroute, and Ultra Sound require builders to register and pass compliance checks, offering additional fraud proof systems and data availability guarantees. In contrast, a permissionless relay accepts payloads from any builder, maximizing censorship resistance but placing more validation burden on the relay operator. The choice depends on the operator's priorities: profit optimization, network resilience, or ideological alignment with permissionless principles.
Ongoing developments continue to shape relay infrastructure. PBS via protocol, a potential future Ethereum protocol upgrade, aims to bake proposer-builder separation directly into the consensus layer, which would reduce the need for the current trusted relay model. However, until such an upgrade is live, relays remain an essential piece of infrastructure for secure, efficient, and fair MEV distribution on Ethereum, directly impacting validator rewards and network health.
Prerequisites and System Requirements
A guide to the hardware, software, and network configurations required to deploy a secure MEV protection relay.
Running a production-grade MEV protection relay requires robust infrastructure. The core components are a relay server that receives and processes blocks from builders, a validator client to sign and propose blocks, and a secure signing mechanism. These services must be highly available and fault-tolerant to prevent missed block proposals, which can lead to slashing penalties for the validator. The system must also handle high-throughput data from the builder network, often requiring optimized networking and database layers.
The primary hardware requirement is a dedicated server with sufficient CPU, RAM, and SSD storage. For mainnet Ethereum, a recommended baseline includes a multi-core CPU (8+ cores), 32GB of RAM, and a 2TB NVMe SSD. High-speed, low-latency internet connectivity with a static IP is non-negotiable. Network latency directly impacts your ability to win auctions and propose blocks on time. Many operators use cloud providers like AWS, GCP, or OVH, or dedicated bare-metal servers for maximum performance and control.
Software prerequisites begin with a modern Linux distribution such as Ubuntu 22.04 LTS. You will need Docker and Docker Compose to containerize the relay services, ensuring consistent environments and easier updates. Essential background services include a firewall (ufw or iptables), a process manager like systemd or supervisord to keep services running, and monitoring tools such as Prometheus and Grafana. A secure key management solution, like Hashicorp Vault or a hardware security module (HSM), is critical for protecting validator signing keys.
Before installing the relay software, you must have a fully synchronized Ethereum execution client (e.g., Geth, Nethermind, Erigon) and consensus client (e.g., Lighthouse, Teku, Prysm) pair running on the same machine or a trusted private network. The relay communicates with these clients via their RPC endpoints. Your validator client must be configured with a fee recipient address to receive MEV rewards and must grant the relay permission to propose blocks using the ETHEREUM_CONSENSUS_VALIDATOR_PROPOSER duty.
Finally, configure your relay's environment variables for critical parameters: the beacon node and execution engine API URLs, the validator's graffiti message, the relay's public endpoint for builders, and connection details for the preferred builder network (e.g., the Flashbots builder-relay-mainnet). Thorough testing on a testnet like Goerli or Holesky is mandatory before mainnet deployment to validate your setup, monitor performance, and ensure slashing protection is correctly configured.
Key Concepts: Relays, Builders, and Validators
Understanding the three core roles in the post-merge Ethereum block production pipeline is essential for implementing MEV protection.
The transition to Ethereum's Proof-of-Stake consensus introduced a separation of duties in block creation, formalizing roles for MEV extraction and protection. This separation occurs through three distinct actors: validators, who propose and attest to blocks; builders, who construct block contents; and relays, which act as trusted intermediaries between them. This architecture, known as Proposer-Builder Separation (PBS), is designed to democratize access to MEV and mitigate its negative externalities like frontrunning and chain congestion.
Validators are the network's block proposers. Their primary role is to add new blocks to the blockchain. With PBS, they no longer construct the block's transaction list themselves. Instead, they receive full block "bids" from builders via a relay. The validator's job is to select the most profitable, valid block to propose. This shifts the complex and resource-intensive work of transaction ordering and MEV extraction away from the validator, allowing them to focus on consensus duties.
Builders are specialized entities that compete to construct the most valuable block possible. They source transactions from the mempool, private orderflows, and MEV opportunities like arbitrage and liquidations. Using sophisticated algorithms, they order these transactions to maximize the total value of the block, which includes both transaction fees and extracted MEV. The builder then creates a complete block header and body, signs it, and submits it as a bid to one or more relays, specifying the fee they will pay to the proposing validator.
Relays are the critical, trust-minimized hubs connecting builders and validators. They receive encrypted block bids from multiple builders and present them to the current block proposer (validator). The relay's core functions are to attest to the validity of a builder's block (ensuring it pays the stated fee and is technically correct) and to prevent censorship by presenting all available bids. Major relays include the Flashbots Relay, BloXroute, and Eden Network. Validators typically connect to multiple relays to maximize their profit and decentralization.
For a validator seeking MEV protection, the setup involves configuring their consensus client (like Lighthouse or Prysm) to connect to one or more relay endpoints. This is often done by specifying the relay's URL in the validator client's configuration. For example, a common practice is to use the mev-boost middleware, which orchestrates communication between the validator client and multiple relays, automatically selecting the most profitable block bid. This setup allows validators to capture MEV rewards without needing to run complex extraction infrastructure themselves.
The security and decentralization of this ecosystem depend heavily on relay behavior. A malicious or faulty relay could censor transactions or present invalid blocks. Therefore, the community relies on relay transparency—publicly auditable data feeds of received bids—and validator client software that can fall back to local block production if relays are unresponsive. Understanding this tripartite relationship is the first step in deploying or interacting with MEV-aware infrastructure on Ethereum.
Essential Resources and Documentation
Core documentation and tooling required to deploy, configure, and operate MEV protection relays and private transaction pathways. These resources focus on Ethereum post-merge infrastructure using PBS, relays, and private orderflow.
Step 1: Deploying the Relay Service
This guide details the initial infrastructure deployment for a MEV protection relay, focusing on the core relay service that receives and processes user transactions.
The relay service is the central off-chain component of a MEV protection system. It acts as a trusted intermediary between users and the blockchain network, receiving signed transactions from users via a private RPC endpoint. Its primary functions are to receive, validate, and temporarily hold transactions before submitting them to a builder network in a way that minimizes front-running and sandwich attacks. For production, this service must be deployed on a secure, low-latency server with high availability, typically using a cloud provider like AWS, GCP, or a dedicated bare-metal setup.
A typical deployment uses a containerized application, such as a Docker image, for consistency and scalability. You can deploy the service using orchestration tools like Kubernetes or a simpler docker-compose setup. The core configuration involves setting environment variables for the target chain (e.g., ETHEREUM_MAINNET), the private key for the relayer's fee wallet, and connection details for a full node RPC (like an Infura or Alchemy endpoint). The service also needs access to a secure keystore for managing the relayer's signing key.
Key configuration parameters include the RELAYER_PRIVATE_KEY, ETHEREUM_RPC_URL, and CHAIN_ID. The service exposes an HTTP or WebSocket API (commonly on port 3000) for the private RPC endpoint. You must configure network security groups or firewalls to restrict access to this port, allowing connections only from your user-facing application or specific IP ranges. High-availability setups require load balancers and health checks to ensure the relay service remains online during high transaction volume.
After deployment, verify the service is operational by checking its health endpoint (e.g., GET /health). You should also test the private RPC by sending a signed transaction payload to the /relay endpoint. The relay must successfully forward this transaction to the configured builder network, such as the Flashbots Protect RPC or a private mev-boost relay. Monitoring with tools like Prometheus and Grafana is essential to track metrics like transaction receipt latency, error rates, and gas fee performance.
Step 2: Configuring the Database and Redis
A robust backend is essential for a high-performance MEV protection relay. This step configures PostgreSQL for persistent data and Redis for low-latency caching.
The core of your relay's state management is a PostgreSQL database. It stores critical, persistent data including registered validators, builder registrations, delivered payloads, and historical auction summaries. For production, use PostgreSQL 13 or later. Configure the connection in your relay's environment variables, typically DATABASE_URL. Ensure your database user has privileges to create tables and indices. High-throughput relays require optimized settings; consider adjusting max_connections, shared_buffers, and work_mem based on your server's RAM.
Redis acts as the relay's high-speed memory layer, caching data that requires sub-millisecond access. This includes the current best bid for each slot, recent block headers for validation, and validator preferences. Use Redis 6+ with persistence (appendonly yes) to prevent data loss on restart. The maxmemory policy should be set to allkeys-lru to evict old data gracefully. Connection details are set via REDIS_URL. For redundancy in production, a Redis Sentinel cluster is recommended over a single instance.
Here is a basic docker-compose.yml snippet to spin up both services for development:
yamlservices: postgres: image: postgres:15-alpine environment: POSTGRES_DB: mevrelay POSTGRES_USER: user POSTGRES_PASSWORD: securepassword ports: - "5432:5432" redis: image: redis:7-alpine command: redis-server --appendonly yes ports: - "6379:6379"
Run docker-compose up -d and verify connectivity using pg_isready and redis-cli ping.
After the services are running, you must run the relay's database migrations. If using a common relay codebase like the Flashbots SUAVE-Relay or EigenLayer, this is typically done with a command like npm run db:migrate or go run cmd/migrate/main.go. These migrations create the necessary tables (validators, blocks, payloads). Always check the specific instructions in your chosen relay's repository. Failure to run migrations will cause the relay application to crash on startup.
For production deployment, security is paramount. Never expose your database or Redis ports to the public internet. Use a cloud provider's managed services (e.g., AWS RDS, Google Cloud SQL, Upstash for Redis) which handle encryption, backups, and patching. Configure firewall rules (security groups) to only allow traffic from your relay application servers. Use strong, randomly generated passwords and consider using IAM roles or connection strings with SSL/TLS enforcement (sslmode=require).
Finally, integrate these services with your relay application. The main application logic will query PostgreSQL for persistent state and use Redis for real-time auction data. Monitor performance metrics: database connection pool saturation, Redis memory usage, and cache hit rates. High latency or errors here directly impact your relay's ability to receive and process bids within the tight 12-second slot window, potentially causing missed opportunities or failed blocks.
Step 3: Connecting to Builder Networks
This guide details the technical process of connecting your validator's infrastructure to MEV-Boost relays and builder networks, a critical step for enabling MEV protection.
After configuring your consensus and execution clients, the next step is to integrate the MEV-Boost middleware. MEV-Boost is a sidecar service that sits between your validator client and the network. Its primary function is to outsource block production to a competitive marketplace of specialized block builders. By connecting to this network, your validator can propose blocks that include proposer payments (MEV rewards) while still receiving the standard block reward, significantly increasing your staking yield.
The core of this setup is the mev-boost binary. You must install and run it on the same machine as your validator client. A typical launch command includes a list of trusted relays. Relays are neutral intermediaries that receive blocks from builders and forward the most profitable, valid ones to validators. For example: ./mev-boost -relays https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net. Each relay URL contains its public key for verification.
You must then reconfigure your validator client (e.g., Lighthouse, Prysm, Teku) to connect to the local MEV-Boost service. This is done by setting the --builder or --enable-builder-api flag and pointing it to http://localhost:18550. This instructs the validator to query MEV-Boost for block proposals during its assigned slot. Crucially, your validator will still fall back to local block production if MEV-Boost fails, ensuring liveness. Always verify the connection in your logs for messages confirming registration with relays.
Choosing which relays to use is a key security and economic decision. You should connect to multiple relays from different providers (e.g., Flashbots, bloXroute, Ultra Sound) to maximize competition and reward opportunities. However, **only use relays that are permissionless and commit to censorship resistance principles, such as publishing a signed getValidatorRegistration message. Avoid relays that filter transactions based on OFAC sanctions lists if your goal is to preserve network neutrality.
Finally, monitor the performance of your setup. Use tools like mev-boost's metrics endpoint (typically on port 18551) or community dashboards to track metrics like: the number of received header bids, the value of won bids, and relay latency. A healthy setup will show regular, valuable bids. If you see no bids, check your firewall settings, ensure your relay URLs are correct and online, and confirm your validator's fee recipient address is properly set and recognized by the builders.
Step 4: Enabling Validator Registration
Configure your validator client to connect to the MEV-Boost relay network, enabling access to MEV opportunities while protecting against harmful extraction.
With your beacon node and execution client running, the next step is to configure your validator client to use an MEV-Boost relay. This middleware sits between your validator and block builders, allowing you to receive blocks that include proposer payments (like MEV tips and transaction ordering fees) while outsourcing the complex task of block construction. To enable this, you must modify your validator client's startup command or configuration file to include the --builder flag and specify one or more relay URLs. For example, a common configuration for a Lighthouse validator would be: lighthouse vc --builder http://localhost:18550. This tells the validator to connect to the MEV-Boost service running locally on port 18550.
The --builder flag is the critical switch that enables validator registration with the relay network. When this flag is set, your validator client will sign and submit a ValidatorRegistrationV1 message to the connected relay(s) each epoch. This registration contains your validator's public key, a fee recipient address (where MEV rewards are sent), and a gas limit for the blocks you are willing to propose. This gas limit is a crucial safety parameter; setting it too high could allow a malicious builder to create a block so large it causes your validator to miss its slot. A common safe default is 30 million gas, aligning with the network's typical block size.
You must provide at least one, but preferably multiple, relay URLs for redundancy and censorship resistance. Relays are operated by different entities and curate their own lists of trusted builders. Using multiple relays increases your chances of receiving a high-value block and protects against a single relay going offline. Add them to your configuration with the --builder-relay flag. For instance: --builder-relay https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net. Ensure you only use relays from reputable, publicly-audited sources like Flashbots, BloxRoute, or Blocknative.
After restarting your validator client with the new configuration, verify that registration is active. Check your validator client logs for messages like "Published validator registration" or "Successfully registered validator with builder API". You can also query your local MEV-Boost instance's API endpoint (e.g., curl http://localhost:18550/relay/v1/data/validator_registration?pubkey=0x...) to confirm your validator's registration data is present. Successful registration means your validator is now visible to the network of block builders and eligible to receive MEV-Boost payloads when it is selected to propose a block.
It is essential to understand the trust model. By using MEV-Boost, you are trusting the relay to deliver a valid, executable block header and the associated builder to provide the full block body that matches that header. The relay acts as an intermediary that verifies the builder's block and its payment to you before forwarding the header. This system, defined by the builder API specification, is designed to prevent validator theft—where a builder could steal your block proposal reward—by ensuring payment is committed to in the header itself.
Step 5: Implementing Ethical Filtering Rules
This guide explains how to configure a relay to filter transactions based on ethical rules, a core component of MEV protection infrastructure.
Ethical filtering rules are the logic layer of an MEV protection relay that determines which transactions are allowed to proceed. Unlike a standard relay that forwards all valid transactions, a protection relay inspects the intent and potential impact of each transaction. This involves analyzing the transaction's calldata, destination contracts, and simulated outcomes to identify malicious patterns like sandwich attacks, frontrunning, or harmful arbitrage that extracts value from ordinary users. The goal is to create a censorship-resistant but value-aligned mempool.
Rules are typically implemented as a series of checks that run after a transaction passes basic validation (e.g., signature, nonce, gas). A common approach is to use a rules engine that evaluates transactions against a set of predicates. For example, a rule might block any transaction that interacts with a known malicious contract address from the Ethereum Phishing Detector. Another might simulate a swap and reject it if the execution results in a price impact above a set threshold (e.g., >0.5%) for the user. Rules can be allow-lists (only permitted actions), deny-lists (blocked actions), or heuristic-based (block based on behavior).
Here is a simplified conceptual example of a rule written in pseudo-code that checks for a simple sandwich attack pattern:
codefunction isPotentialSandwich(tx, mempool) { // 1. Check if tx is a swap on a known DEX (e.g., Uniswap V3) if (tx.to != UNISWAP_V3_ROUTER) return false; // 2. Simulate the swap to get expected output amount let userOutput = simulateSwap(tx); // 3. Check pending mempool for a larger swap in same pool let pendingSwap = findSimilarSwapInMempool(tx, mempool); if (pendingSwap && pendingSwap.amount > tx.amount) { // 4. Simulate the sandwich: attacker's tx before and after user let sandwichProfit = simulateSandwichProfit(tx, pendingSwap); if (sandwichProfit > MIN_PROFIT_THRESHOLD) { return true; // Flag as malicious sandwich } } return false; }
This rule would flag a transaction for review or rejection if it detects the classic sandwich setup.
Implementing these rules requires access to a transaction simulation environment. Relays often integrate with tools like Tenderly, Foundry's cast, or custom EVM simulators to fork the current state and test transaction outcomes. The simulation must be fast and gas-accurate to avoid introducing latency. After simulation, rules can inspect the diff in state changes, particularly token balances for the user and the searcher's address. It's critical to maintain a blocklist of known malicious contract addresses and update it frequently, sourcing from community efforts like the Revoke.cash approvals database.
The final step is defining the relay's action when a rule is triggered. Actions can be hard rejection (drop the transaction), soft rejection (delay forwarding), or flagging (add metadata for downstream validators). A robust system logs all rule violations with the transaction hash, triggered rule ID, and simulation data for auditability. Governance over the rule set is a key consideration; it can be managed by a multi-sig, a DAO, or be immutable. The implementation must balance protection with neutrality to avoid becoming a centralized point of censorship.
Relay Configuration and Builder Network Options
Key configuration parameters and supported builder networks for major MEV protection relays.
| Configuration / Network | Flashbots Protect | BloXroute Max Profit | Eden Network | Manifold |
|---|---|---|---|---|
Primary Execution Client | Geth, Nethermind | Geth, Erigon | Geth | Geth, Nethermind, Besu |
Validator Client Support | Lighthouse, Prysm, Teku | Lighthouse, Prysm, Teku, Nimbus | Lighthouse, Prysm | Lighthouse, Prysm, Teku |
Default Priority Fee Mode | EIP-1559 (Dynamic) | Fixed + EIP-1559 | Fixed Fee | EIP-1559 (Dynamic) |
Max Block Build Time | 12 seconds | 8 seconds | 10 seconds | 12 seconds |
Supported Builder APIs | mev-boost v1.5+ | mev-boost v1.4+, bloxroute API | mev-boost v1.5+ | mev-boost v1.5+, manifold API |
Cross-Chain MEV Protection | ||||
Relay Fee | 0% | 0.25 ETH/day or 10% of profit | 0% | 0% |
Minimum Bid Inclusion | 0.1 ETH | 0.05 ETH | 0.1 ETH | 0.1 ETH |
Step 6: Setting Up Monitoring and Metrics
After deploying your MEV protection relay, continuous monitoring is essential for ensuring reliability, detecting anomalies, and maintaining a competitive edge. This guide covers the key metrics to track and how to set up a robust observability stack.
Effective monitoring for an MEV relay focuses on three core pillars: system health, economic performance, and network integrity. For system health, track standard infrastructure metrics like CPU/memory usage, disk I/O, and network latency from your node providers (e.g., Alchemy, Infura, or your own Geth/Erigon nodes). However, the critical differentiator is tracking blockchain-specific latencies. You must monitor the time delta between receiving a transaction bundle and its inclusion in a block (bundle_submission_latency), as well as your node's synchronization status with the network head (block_lag). A lag of more than 1-2 blocks can render your relay non-competitive.
Economic performance metrics directly impact your relay's profitability and attractiveness to searchers. The primary metric is inclusion rate, calculated as (bundles_landed / bundles_submitted). A low rate suggests issues with bid competitiveness or propagation. Track the average profit per bundle and total value extracted (EVM: priority_fee + coinbase_transfer, Solana: prioritization_fee). Use tools like Etherscan or Solana Explorer to verify on-chain settlements. It's also crucial to monitor for reverted bundles, which incur costs without revenue, and analyze the gas usage patterns of your successful bundles to optimize efficiency.
To capture these metrics, implement a telemetry stack. A common setup uses Prometheus for time-series data collection and Grafana for visualization. Instrument your relay software to expose a /metrics endpoint in Prometheus format. Key counters and gauges to expose include relay_bundles_received_total, relay_bundles_submitted_total, and relay_profit_wei. For logging, use structured JSON logging with Loki or a similar aggregator, ensuring each log entry includes critical context like bundle_hash, target_block, and searcher_address. Set up alerts in Alertmanager or PagerDuty for critical failures, such as a sustained drop in inclusion rate or RPC endpoint failures.
Network integrity monitoring guards against security threats and ensures protocol compliance. Implement surveillance for malicious payloads attempting to exploit your relay. Monitor for unusual patterns, such as a single searcher submitting a high volume of low-profit bundles, which could be a spam attack. You should also track the source diversity of your bundles to avoid over-reliance on a few searchers. Furthermore, subscribe to validator and builder communities (e.g., Flashbots Discord, builder0x69) for real-time network updates and fork events. Setting up a dedicated alert for chain reorganizations (reorgs) is vital, as they can invalidate previously accepted bundles.
Finally, establish a dashboard that synthesizes these metrics for at-a-glance operational awareness. A typical Grafana dashboard should have panels for: Live Inclusion Rate, Current Block Lag, Profit (ETH/hr), Top Searchers by Volume, and System Resource Usage. Regularly review these dashboards and refine your alerting thresholds. Proactive monitoring transforms your relay from a deployed service into a resilient, high-performance piece of critical infrastructure, enabling rapid response to issues and data-driven optimization of your bidding strategies.
Frequently Asked Questions (FAQ)
Common technical questions and troubleshooting for developers setting up and operating MEV protection relays.
In Proposer-Builder Separation (PBS), the builder and relay are distinct, specialized components. A builder is responsible for constructing the most profitable block possible by aggregating transactions, including MEV opportunities. It creates a block and submits a bid to a relay.
The relay acts as a trusted intermediary. Its core functions are:
- Receiving block bids from multiple builders.
- Validating bid correctness and compliance (e.g., fee recipient, gas limit).
- Running a cancellation list to filter out malicious or censoring builders.
- Forwarding the highest valid bid to the proposer (validator).
This separation prevents the proposer from seeing the block contents before committing, reducing the risk of them stealing the MEV. Popular relays include the Flashbots Relay, bloXroute, and Eden Network.