Maximal Extractable Value (MEV) relays are critical infrastructure in Ethereum's post-merge landscape. They act as a trusted intermediary between block builders (who construct full blocks) and validators (who propose them). A relay's primary function is to receive block bids from builders, verify their validity and payment, and present the most profitable, compliant block to a validator. By running a relay, you contribute to a more competitive and decentralized block-building market, which can help mitigate centralization risks and censorship. This guide details the components and considerations for launching your own high-performance relay.
Launching a High-Performance MEV Relay Infrastructure
Launching a High-Performance MEV Relay Infrastructure
A technical guide to building and operating a production-grade MEV relay, covering architecture, software selection, and performance optimization.
The core software stack for a relay typically consists of three main services. First, the relay software itself, such as the open-source Flashbots Relay or the Ultra Sound Relay. Second, a block builder API (like mev-boost) that validators connect to. Third, a database (PostgreSQL is common) to store bid data and a Redis instance for caching to ensure low-latency responses. These services must be orchestrated, often using Docker and a process manager like systemd or Kubernetes for resilience.
Performance and reliability are paramount. Your relay must have sub-second latency to receive bids from global builders and deliver the winning block to a proposer within the 12-second slot time. This requires high-specification hardware: a multi-core CPU, ample RAM, and a low-latency NVMe SSD for the execution client data. Network infrastructure is equally critical; co-location in a major data center with excellent peering reduces latency. You must also run a fully synced execution client (e.g., Geth, Nethermind) and consensus client (e.g., Lighthouse, Teku) to validate block correctness locally, a process known as local payload validation.
Security and operational integrity require rigorous configuration. The relay's signing key, used to attest to received blocks, must be stored in a hardware security module (HSM) or secure enclave. You need to configure JWT authentication for secure communication between your clients and the relay. Monitoring with Prometheus/Grafana for metrics like bid latency, win rate, and error rates is essential. Furthermore, you must establish a profitable payment channel with builders, often by setting up a secure feeRecipient address and potentially running a sidecar service to aggregate payments from multiple builders.
Launching involves several concrete steps. After provisioning infrastructure, clone and build your chosen relay software. Configure the environment variables for your Ethereum endpoints, database connection, and signer. Initialize the PostgreSQL database with the provided schema. Start the services, ensuring your execution and consensus clients are synced and connected. Finally, test the relay endpoint using the mev-boost client in a testnet environment like Goerli or Holesky before proceeding to mainnet. Continuous maintenance involves updating client software, monitoring for missed bids, and optimizing database performance as the bid volume grows.
Prerequisites and System Requirements
This guide details the hardware, software, and network prerequisites for launching a production-grade MEV relay.
A high-performance MEV relay requires robust infrastructure to handle high-frequency transaction processing, low-latency network communication, and secure validator interactions. The core components are a relay server that receives bundles from searchers and a validator client that signs and proposes blocks. These components must operate with sub-second latency to win block auctions on networks like Ethereum. The primary technical challenge is optimizing the data pipeline between the relay's block building engine and the connected validators to minimize missed opportunities.
The hardware foundation is critical. For a mainnet Ethereum relay, we recommend a bare-metal server or a high-performance cloud instance with at least 16 CPU cores (modern Intel Xeon or AMD EPYC), 64 GB of RAM, and fast NVMe SSD storage (1+ TB). High network throughput is non-negotiable; you need a dedicated connection with at least 1 Gbps bandwidth and a public static IP address. Geographic proximity to major validator pools and execution/consensus layer client endpoints is essential to reduce network propagation delays, a key factor in relay performance.
Software prerequisites begin with a modern Linux distribution like Ubuntu 22.04 LTS. You must install and configure an execution client (e.g., Geth, Erigon, Nethermind) and a consensus client (e.g., Lighthouse, Teku, Prysm) in archive mode to access full historical chain data. The relay software itself, such as the open-source Flashbots Relay, requires Go 1.19+, Node.js, and PostgreSQL 13+ for persisting auction data. Containerization with Docker and orchestration with Docker Compose or Kubernetes are standard for managing these interdependent services.
Network and security setup involves configuring firewall rules to allow inbound connections on key ports: port 443 (HTTPS for searcher API), port 28545 (TCP for the builder API), and the P2P ports for your execution and consensus clients. You must generate and secure validator keys, configuring your validator client to connect to your relay's mev-boost endpoint. A critical step is registering your relay's public endpoint with the MEV-Boost Relay Registry to make it discoverable by the validator community.
Before going live, conduct thorough testing on a testnet like Goerli or Sepolia. Simulate load by sending mock bundles to validate your system's throughput and latency under stress. Monitor key metrics: proposal latency (time from receiving a block to delivery), uptime, and bundle success rate. Establish logging (e.g., Loki), metrics (e.g., Prometheus/Grafana), and alerting to ensure operational visibility. This foundational setup ensures your relay can compete effectively in the real-time auction for block space.
Core Concepts: PBS, Bids, and Commit-Reveal
Understanding the fundamental mechanisms of Proposer-Builder Separation (PBS), bid submission, and the commit-reveal scheme is essential for operating a secure and profitable MEV relay.
Proposer-Builder Separation (PBS) is the architectural cornerstone of modern Ethereum block production. It decouples the role of the block proposer (a validator) from the block builder (a specialized entity). Builders compete to construct the most valuable block by including transactions and MEV opportunities, then submit their block along with a bid to a relay. The relay forwards the highest-bid block to the proposer, who simply signs and publishes it. This separation enhances network decentralization and censorship resistance by preventing proposers from needing sophisticated MEV extraction capabilities.
The bid is the builder's payment to the proposer for including their block. It is submitted to the relay in a structured format, typically as a signed message containing the block hash and the bid amount in Ether. The relay's primary function is to aggregate these bids, validate the associated blocks, and present the most profitable option to the proposer. A high-performance relay must process bids with ultra-low latency to ensure proposers receive the best available offer before the slot deadline, directly impacting their revenue.
To prevent front-running and ensure fair auction mechanics, bids are submitted using a commit-reveal scheme. In the first phase, the builder sends a commitment—a cryptographic hash of their actual bid data (bid amount, block hash, etc.). After a predefined period, in the reveal phase, the builder discloses the original data. The relay verifies that the hash of the revealed data matches the initial commitment. This two-step process prevents other participants from seeing the bid value instantly and copying or outbidding it unfairly, creating a sealed-bid auction environment.
Implementing this flow requires handling the BuilderBid and SignedBuilderBid data structures defined in the Ethereum Builder API. A builder's submission to your relay will include a signature, the bid message, and the execution payload. Your relay must verify the builder's signature, ensure the bid is higher than the current best, and check the block's validity via local execution or a trusted proof-of-concept (POC) system before forwarding it to the proposer.
For infrastructure operators, optimizing the commit-reveal window and bid propagation latency is critical. A shorter commit phase reduces uncertainty for builders but increases front-running risk; a longer phase does the opposite. Your relay's performance during the reveal and forwarding stages directly determines if a proposer acts on your winning bid. Network topology, efficient signature aggregation, and integration with tools like MEV-Boost are key engineering challenges in launching a competitive relay service.
Ultimately, a successful relay provides a trusted, neutral marketplace for block space. It must maintain liveness (always having a block to propose), profitability (selecting the highest valid bid), and security (resisting DOS attacks and ensuring data availability). Understanding PBS, bids, and commit-reveal is the first step in building infrastructure that aligns incentives between builders, proposers, and the health of the Ethereum network.
Essential Resources and Codebases
Key open-source projects, specifications, and infrastructure components required to launch and operate a high-performance MEV relay. Each resource maps directly to a concrete part of the relay stack, from builder integration to validator connectivity and security hardening.
Builder Onboarding, Trust, and DoS Protection
A high-performance relay is also a high-value attack target. Builder access and network exposure must be tightly controlled from day one.
Operational best practices:
- Builder allowlists with authenticated public keys
- Rate limiting on submission endpoints to prevent slot flooding
- Payload size and gas checks before expensive validation
- Geographic redundancy to reduce latency and regional outages
Most relays start with a small set of trusted builders and gradually expand. Public, permissionless submission increases decentralization but requires hardened infrastructure and real-time monitoring. Builder misbehavior, even accidental, can quickly degrade validator trust in your relay.
Step 1: Designing Low-Latency Network Architecture
The foundation of a high-performance MEV relay is a network designed for minimal latency and maximum reliability. This step covers the core architectural decisions that determine your relay's speed and uptime.
MEV relay performance is measured in milliseconds, making network topology the most critical design decision. A low-latency architecture minimizes the time between receiving a block from a builder and delivering it to a validator. This requires deploying relay nodes in strategic geographic locations close to major validator pools and builder clusters, such as Frankfurt, Virginia, and Singapore. The goal is to reduce network hops and physical distance, which are primary sources of delay in block propagation.
To achieve this, you must implement a multi-region deployment using cloud providers like AWS, GCP, or specialized bare-metal hosts. Each region should run redundant relay instances behind a global load balancer that uses Anycast routing or geographic DNS to direct connections to the nearest node. This setup ensures validators always connect to the lowest-latency endpoint. Internal communication between relay nodes for consensus or data synchronization must also use optimized, private backbone connections to prevent public internet congestion from affecting performance.
Beyond physical placement, the software stack must be optimized for speed. This involves using high-performance web servers (e.g., Nginx, Caddy) with HTTP/2 or HTTP/3 support for faster multiplexed connections, and implementing efficient WebSocket handlers for the validator-builder communication. Database choices for storing bid data should favor in-memory stores like Redis or Apache Kafka for streaming, as disk I/O is too slow for the sub-second response times required. Every component must be benchmarked and profiled to eliminate serialization bottlenecks and unnecessary computational overhead.
Reliability is as important as speed. The architecture must be designed for high availability (HA) and fault tolerance. This means implementing automatic failover mechanisms, where if a primary relay node in a region fails, traffic is instantly rerouted to a healthy standby. Use health checks that monitor not just process status but also critical metrics like end-to-end latency to validator targets and bid submission success rates. A relay that is fast but unstable will be abandoned by validators seeking consistent rewards.
Finally, monitor everything. Deploy comprehensive observability using tools like Prometheus, Grafana, and distributed tracing (e.g., Jaeger). Key Performance Indicators (KPIs) to track include p95 latency for bid delivery, validator connection churn, packet loss between regions, and builder submission success rates. This data is essential for continuous optimization, informing decisions on whether to add new node locations or upgrade network links. The architecture is never static; it must evolve based on measurable performance data and the shifting geographic distribution of the Ethereum network.
Step 2: Implementing Bid Aggregation and Auction Logic
This section details the core auction mechanism that processes incoming validator bids and selects the most profitable block for relay.
The auction logic is the central nervous system of your MEV relay. Its primary function is to aggregate bids from multiple searchers for the same block space, run a first-price sealed-bid auction, and select the winning payload to propose to the connected validator. A typical implementation involves a BidManager service that receives SignedBidSubmission objects over a WebSocket or RPC connection. Each bid contains the searcher's signed transaction bundle, a blockNumber, and a fee (often in wei) representing their payment to the validator. The relay must validate the bid signature and ensure the transactions are valid for the target chain state.
Once validated, bids are grouped by target blockNumber. For each slot, the auction logic must identify the highest-paying bid. This is a first-price auction, meaning the highest bidder wins and pays exactly their bid amount. The logic must also handle edge cases: expired bids for past blocks, insufficient bid fees, and bundles that fail simulation. A critical security measure is to simulate the winning bundle in a forked execution environment (using tools like Geth's eth_call in a custom state) to verify it does not revert and actually produces the promised payment to the validator's fee recipient address.
The output of this process is a WinningBid object. This object must be formatted into a complete block proposal (ExecutionPayloadV1 or V3 per the Engine API specification) for the validator. The relay constructs this block by taking the base block from the execution client, inserting the winning transaction bundle at the top of the block, and updating the block's gasUsed, receiptsRoot, and stateRoot. The coinbase (or feeRecipient) address in the block header must be set to the validator's specified address to receive the MEV payment.
Performance is paramount. The entire cycle—from receiving the last bid, running the auction, simulating the winner, and building the payload—must complete within the slot time (12 seconds on Ethereum). To achieve this, relays implement concurrent bid processing and use efficient in-memory data structures. Open-source references like the Flashbots Relay showcase production patterns for bid aggregation, while the Ethereum Builder API defines the standard getPayload and submitBlindedBlock endpoints your relay must expose to validators.
Step 3: Database Optimization for Fast Auction Processing
Optimizing your database layer is critical for handling the high throughput and low-latency demands of a competitive MEV relay. This step focuses on schema design, indexing strategies, and query optimization.
MEV auctions involve processing thousands of bids per second with sub-second finality. Your database must efficiently store and retrieve complex bid objects containing fields like block_number, builder_pubkey, fee_recipient, gas_limit, and the full execution_payload. A well-designed schema separates immutable auction metadata from volatile bid data. Use a relational database like PostgreSQL or TimescaleDB for strong consistency, with a separate time-series database like QuestDB for high-frequency metrics logging. The primary auctions table should be partitioned by slot_number to enable fast pruning of old data and improve query performance on recent blocks.
Strategic indexing is non-negotiable. For the auctions table, create a composite index on (slot_number, received_at) to optimize the common query for bids within a specific slot, ordered by arrival time. Index builder_pubkey and proposer_pubkey for analytics and slashing detection. For the bid_submissions table, which logs every incoming bid, a BRIN index on received_at is efficient for time-range queries on massive datasets. Avoid over-indexing on frequently updated tables, as it increases write latency. Use EXPLAIN ANALYZE on your critical read queries (e.g., SELECT * FROM auctions WHERE slot_number = $1 ORDER BY value DESC LIMIT 1) to identify and eliminate sequential scans.
Implement connection pooling (using PgBouncer or a library like sqlx's pool) to manage database connections efficiently under load. For read-heavy operations, such as serving bid history to a dashboard, set up a read replica to offload queries from the primary database handling live auctions. Employ materialized views for expensive aggregations, like hourly builder market share, and refresh them asynchronously. Consider using an in-memory cache like Redis as a write-through cache for the current highest bid per slot, reducing database load during the peak auction period. This layered approach ensures millisecond response times for the critical path of bid comparison and validation.
Monitor database performance with key metrics: queries per second, average query latency, and connection pool utilization. Set up alerts for slow queries (e.g., >100ms) using tools like PostgreSQL's pg_stat_statements. For long-term data retention, implement an archival strategy. Hot data (last 1000 slots) stays in the optimized primary tables. Warm data can be moved to cheaper storage with less aggressive indexing, and cold data can be exported to object storage like S3. This tiered storage model controls costs while maintaining fast access to recent, operationally critical auction data.
Builder and Validator Client Integration Methods
Methods for connecting MEV-Boost relays to Ethereum consensus clients, with trade-offs for performance, complexity, and security.
| Integration Feature | HTTP API (Standard) | gRPC | LibP2P (Prysm) |
|---|---|---|---|
Communication Protocol | HTTP/1.1 or HTTP/2 | gRPC over HTTP/2 | LibP2P pubsub |
Default Port | 18550 | 50051 | 13000 (TCP) |
Latency Overhead | Medium (5-15 ms) | Low (1-5 ms) | Lowest (< 1 ms) |
Client Support | All (Lighthouse, Teku, Nimbus, Lodestar, Prysm) | Most (Lighthouse, Teku, Nimbus, custom) | Prysm only |
Encryption (TLS) | |||
Bidirectional Streaming | |||
Setup Complexity | Low | Medium | High |
Primary Use Case | Standard relay integration | High-performance, low-latency relays | Native integration within Prysm network |
Step 4: Configuring Security and Rate Limiting
This step secures your MEV relay against abuse and ensures stable performance under load by implementing authentication, request validation, and traffic controls.
A public-facing MEV relay is a high-value target for spam and denial-of-service (DoS) attacks. The primary security layer is authentication. You must configure your relay to only accept bundles from registered builders. This is typically done by requiring a signed JWT (JSON Web Token) or an API key in the request header. For example, using the flashbots relay software, you would generate a secret key and distribute the corresponding public keys or signed tokens to your approved builder partners. Unauthenticated requests should be rejected immediately at the API gateway level.
Beyond authentication, request validation is critical for protecting the connected validator. Your relay must rigorously check every incoming bundle payload. This includes verifying the bundle's blockNumber matches the current target, ensuring the minTimestamp and maxTimestamp are sensible, and validating the cryptographic signatures of all transactions within the bundle. A single invalid or maliciously crafted bundle could cause the validator to reject the entire block proposal. Implementing these checks in your relay's validateBundle middleware prevents garbage data from reaching the consensus layer.
Rate limiting protects your relay's resources and ensures fair access. Without it, a single builder could monopolize the relay's CPU and network bandwidth. Implement limits based on the builder's authentication token. Common strategies include: requests per second (RPS), concurrent connections, and total bundles per slot. Use a sliding window algorithm, often available via middleware like express-rate-limit for Node.js or django-ratelimit for Python. For instance, you might limit each builder to 50 RPS on the eth_sendBundle endpoint and 5 RPS on the eth_callBundle endpoint, with stricter limits for unauthenticated health-check endpoints.
For advanced threat mitigation, integrate an IP reputation service or a Web Application Firewall (WAF) like Cloudflare to filter out traffic from known botnets. You should also configure timeouts and payload size limits on your HTTP server (e.g., Nginx or your application framework) to prevent slow loris attacks and resource exhaustion. Monitor key metrics such as request volume per builder, error rates (4xx, 5xx), and system resource usage to identify anomalous patterns that may indicate an attack in progress.
Finally, document your security policies and rate limits clearly for your builder partners. Provide them with dedicated endpoints for checking their current usage and the health of the relay. A transparent and well-defended relay infrastructure builds trust with builders and validators, forming the foundation of a robust and resilient MEV ecosystem. Your configuration directly impacts the network's liveness and the economic security of the blocks you propose.
Step 5: Setting Up Performance Monitoring and Metrics
Proactive monitoring is critical for maintaining a competitive, reliable, and secure MEV relay. This guide covers the essential metrics to track and the tools to alert you to performance degradation or security threats.
Track these core metrics to assess relay health and competitiveness:
Latency: Measure end-to-end processing time from receiving a bundle to submitting it on-chain. Use percentiles (p50, p95, p99) to identify tail latency. Bundle Success Rate: The percentage of submitted bundles that land on-chain. A drop indicates network issues or bid miscalculations. Win Rate: The percentage of auction rounds where your relay's bundle is selected by the proposer. This directly measures competitiveness. Gas Usage Efficiency: Monitor the gas used by your winning bundles versus the gas limit. Consistently low usage may indicate missed optimization opportunities. Block Builder Connections: Track the number of active, healthy connections from builders. Sudden drops can signal network or authentication problems.
Frequently Asked Questions (FAQ)
Common technical questions and solutions for developers building and operating high-performance MEV relay infrastructure.
An MEV relay acts as a trust-minimized intermediary between block builders and validators in Ethereum's Proposer-Builder Separation (PBS) model. Its core functions are:
- Bid Aggregation: Receiving sealed block bids from multiple builders.
- Bid Validation: Performing basic sanity checks on block contents and bid authenticity.
- Bid Ranking: Ordering valid bids by their proposed value (e.g., highest priority fee to the validator).
- Secure Delivery: Presenting the top-ranked bid to the validator (proposer) for inclusion, without revealing the full block contents until the validator commits.
This process prevents validators from stealing MEV opportunities from builders and ensures builders compete on a level playing field, ultimately increasing validator revenue and network efficiency.
Conclusion and Next Steps
Your MEV relay is now operational. This section covers essential post-launch actions, ongoing maintenance, and paths for advanced optimization.
Launching the relay is the first step. The next critical phase is monitoring and alerting. You should track key metrics like bid volume, win rate, latency percentiles, and error rates. Tools like Prometheus for metrics collection and Grafana for dashboards are standard. Set up alerts for sudden drops in performance or connectivity issues with builders and validators. Proactive monitoring is essential for maintaining the high uptime and reliability that searchers and validators demand.
Security is a continuous process. Regularly update your mev-boost and geth/reth client software to patch vulnerabilities. Implement a robust key management strategy for your proposer payment wallet, considering hardware security modules (HSMs) or multi-signature setups. Conduct periodic security audits of your configuration and network exposure. Staying informed about new MEV-related exploits, such as those documented by the Ethereum Foundation, is crucial for risk mitigation.
To optimize performance and profitability, consider these advanced steps. Network optimization involves choosing data centers with low latency to major validator pools and potentially using dedicated fiber connections. You can experiment with different bid simulation and validation logic to improve inclusion efficiency. For scaling, research deploying multiple relay instances behind a load balancer in different geographic regions to increase redundancy and handle higher throughput from a growing searcher ecosystem.
Finally, engage with the ecosystem. Join communities like the Flashbots Discord to stay updated on protocol changes like PBS (Proposer-Builder Separation) developments. Consider open-sourcing non-critical parts of your tooling to contribute back and establish credibility. The MEV landscape evolves rapidly; continuous learning and adaptation are the keys to running a high-performance, sustainable relay infrastructure that contributes positively to Ethereum's consensus health.