Docs/Relayer/Economics

Relayer Economics

Fee structure and incentives for relayer operators

Relayer Economics

Operating a ZKMix relayer is an economic activity: relayers spend SOL on transaction fees and earn revenue from withdrawal fees. This page describes the fee structure, cost breakdown, revenue potential, and competitive dynamics of the relayer market.

Fee Calculation

The relayer fee is calculated as a percentage of the pool denomination. This percentage is set by the relayer operator and advertised through the relayer's /fees endpoint and the on-chain registry.

Formula

relayer_fee = max(denomination * fee_percentage / 100, min_fee)

Where:

  • denomination is the pool's fixed deposit/withdrawal amount
  • fee_percentage is the relayer's configured percentage (e.g., 0.3%)
  • min_fee is the relayer's minimum fee floor in lamports or token units

Example Calculations

For a relayer charging 0.3% with a minimum fee of 10,000 lamports:

PoolDenominationFee (0.3%)Min FeeActual Fee
SOL-0.10.1 SOL0.0003 SOL0.00001 SOL0.0003 SOL
SOL-11 SOL0.003 SOL0.00001 SOL0.003 SOL
SOL-1010 SOL0.03 SOL0.00001 SOL0.03 SOL
SOL-100100 SOL0.3 SOL0.00001 SOL0.3 SOL

For SPL token pools, fees are denominated in the same token:

PoolDenominationFee (0.3%)Actual Fee
USDC-100100 USDC0.30 USDC0.30 USDC
USDC-10001,000 USDC3.00 USDC3.00 USDC
USDC-1000010,000 USDC30.00 USDC30.00 USDC

Fee Binding

The relayer fee is cryptographically bound to the withdrawal proof. When a user generates a proof, they include the relayer fee as a public input to the circuit. This means:

  • The relayer cannot increase the fee after receiving the proof -- the proof would be invalid with a different fee amount.
  • The relayer cannot take less than the stated fee either -- the exact fee amount is enforced by the on-chain program.
  • The user agrees to the fee before generating the proof, providing full transparency.

Minimum Fees

Relayer operators can set a minimum fee floor to ensure every transaction is profitable regardless of the pool denomination. This is important for small-denomination pools where a percentage-based fee might not cover costs.

Why Minimum Fees Exist

Consider a 0.1 SOL pool with a 0.3% fee. The relayer fee would be 0.0003 SOL (300,000 lamports). However, the transaction cost (base fee + priority fee) might be 0.0001 SOL or more during congestion. The minimum fee ensures the relayer always covers its costs with margin.

Network ConditionRecommended Min FeeRationale
Low congestion10,000 lamportsCovers base fee with margin
Normal50,000 lamportsCovers typical priority fees
High congestion200,000 lamportsCovers elevated priority fees

Some relayers implement dynamic minimum fees that adjust based on recent Solana priority fee levels. The relayer software supports this through the monitoring.dynamicFees configuration option.

Gas Cost Coverage

Every withdrawal transaction costs the relayer SOL in transaction fees. Understanding these costs is essential for profitable operation.

Cost Breakdown Per Transaction

Cost ComponentAmount (lamports)Notes
Base transaction fee5,000Fixed per signature
Priority fee (typical)10,000 - 100,000Varies with network congestion
Compute unit cost0 - 500,000Depends on priority fee market
Account rent (if needed)0Accounts already exist for active pools
Typical total cost15,000 - 105,000

The priority fee market on Solana is dynamic. During periods of heavy network usage, priority fees can spike significantly. Relayers should monitor the priority fee market and adjust their minimum fees accordingly.

Profit Margin Per Transaction

Using the SOL-1 pool as an example with a 0.3% fee:

Revenue per withdrawal:  3,000,000 lamports (0.003 SOL)
Transaction cost:          ~50,000 lamports (typical)
------------------------------------------------------
Net profit:              2,950,000 lamports (0.00295 SOL)
Profit margin:           ~98.3%

For the smaller SOL-0.1 pool:

Revenue per withdrawal:    300,000 lamports (0.0003 SOL)
Transaction cost:           ~50,000 lamports (typical)
------------------------------------------------------
Net profit:                250,000 lamports (0.00025 SOL)
Profit margin:             ~83.3%

The margins are high because the relayer's only cost is the Solana transaction fee, which is low relative to the fees charged. However, the absolute revenue per transaction is modest, so relayers need consistent volume to generate meaningful income.

Revenue Potential

The revenue a relayer can earn depends on its share of the withdrawal volume and the mix of pool denominations.

Scenario Modeling

Conservative scenario -- A relayer processing 50 withdrawals per day with an average fee of 0.003 SOL:

Daily revenue:    50 * 0.003 SOL    = 0.15 SOL
Monthly revenue:  0.15 * 30         = 4.5 SOL
Daily costs:      50 * 0.00005 SOL  = 0.0025 SOL
Monthly profit:   ~4.5 SOL

Moderate scenario -- A relayer processing 200 withdrawals per day across multiple pools:

Daily revenue:    ~0.8 SOL (mix of pool sizes)
Monthly revenue:  ~24 SOL
Daily costs:      200 * 0.00005     = 0.01 SOL
Monthly profit:   ~24 SOL

Aggressive scenario -- A popular relayer processing 1,000+ withdrawals per day:

Daily revenue:    ~5 SOL (mix of pool sizes, including large pools)
Monthly revenue:  ~150 SOL
Daily costs:      1000 * 0.00005    = 0.05 SOL
Monthly profit:   ~150 SOL

SPL Token Revenue

For USDC and other SPL token pools, fees are earned in the token itself. A relayer processing USDC withdrawals earns USDC, which can be held or converted to SOL. The per-transaction SOL gas cost still applies, so the relayer needs a SOL balance for gas regardless of the token pool being served.

Revenue per Pool Type

PoolFee (0.3%)USD Value (approx)Transactions for $100/day
SOL-0.10.0003 SOL~$0.052,000
SOL-10.003 SOL~$0.50200
SOL-100.03 SOL~$5.0020
SOL-1000.3 SOL~$50.002
USDC-10003 USDC$3.0034
USDC-1000030 USDC$30.004

Note: USD values assume a SOL price of approximately $150. Actual values will vary.

Competition Between Relayers

The relayer market is competitive. Multiple relayers serve the same pools, and the SDK selects relayers based on fee, reliability, and latency. This creates market dynamics that benefit users while still allowing profitable relayer operation.

How Users Choose Relayers

The SDK's default relayer selection algorithm considers the following factors, in order of priority:

  1. Fee -- Lower fees are preferred. The SDK sorts available relayers by fee amount for the relevant pool.
  2. Reliability -- Relayers with higher success rates and longer uptime are preferred. The SDK tracks success rates from the /status endpoint.
  3. Latency -- Relayers that respond faster are preferred when fees are equal. The SDK measures round-trip time to each relayer.
  4. Availability -- Relayers that are currently at capacity (queue full) are excluded.

Competitive Dynamics

  • Race to the bottom -- Fee competition pushes fees down over time. However, fees cannot go below the transaction cost without the relayer losing money, creating a natural floor.
  • Differentiation -- Relayers can differentiate on reliability (better uptime), speed (faster confirmation), or geography (lower latency for regional users).
  • Niche pools -- Relayers that support less common pools (large denominations, specific SPL tokens) face less competition and can charge higher fees.
  • Volume advantages -- Relayers with more volume can afford lower per-transaction margins because they benefit from economies of scale in server costs.

For new relayer operators:

  1. Start at 0.3% -- This is the current market baseline. Starting higher will result in little traffic as the SDK will prefer cheaper alternatives.
  2. Monitor competitors -- Check other relayers' fees through the registry. Adjust to remain competitive.
  3. Focus on reliability -- Users will pay slightly higher fees for relayers with a proven track record. Invest in uptime and monitoring.
  4. Consider specialization -- If you can reliably serve high-denomination pools or niche token pools, you can sustain higher margins due to less competition.

Fee Floor Protection

The protocol does not enforce a minimum fee across relayers. However, the community-recommended minimum of 0.1% exists to prevent unsustainable pricing that would drive relayers out of the market, ultimately harming the protocol's decentralization. Relayers that charge below cost are likely operating at a loss for strategic reasons (market entry, market share capture) and may not be sustainable long-term.

Operational Costs Summary

Beyond transaction fees, relayer operators should account for the following ongoing costs:

CostMonthly EstimateNotes
Server hosting$5 - $50VPS or cloud instance
RPC provider$0 - $100Free tier may suffice for low volume
Domain and TLS$1 - $5Required for HTTPS
Monitoring/alerting$0 - $20Grafana Cloud free tier or similar
SOL floatVariableInitial capital, recovered via fees
Total overhead$6 - $175/month

These costs are modest relative to potential revenue, making relayer operation accessible to individual operators, not just large infrastructure providers.