Skip to content

Gas Provider - Optional

Every transaction has to set a gas price which the transaction is willing to pay, and this is computed by how active the chain is at a given time like a market. A few gas price providers exist, but all require signup; we do recommend that you use a provider over the fallback when possible as it will be more aligned to the prices but fallback will work out the box.

Fallback

The fallback gas provider uses simple RPC calls to the blockchain node to estimate gas prices. It works out of the box without requiring any API keys or external services, making it perfect for development and testing.

The fallback provider queries the network's current base fee and priority fee to generate gas estimates across different speed tiers. While it may not be as optimized as dedicated gas price services, it provides reliable estimates for most use cases.

rrelayer.yaml
name: first-rrelayer
description: "my first rrelayer"
api_config:
  port: 3000
  authentication_username: "${RRELAYER_AUTH_USERNAME}"
  authentication_password: "${RRELAYER_AUTH_PASSWORD}"
signing_provider:
  aws_kms:
    region: "eu-west-1"
networks:
- name: "sepolia_ethereum"
  chain_id: 11155111
  provider_urls:
  - "https://sepolia.gateway.tenderly.co"
  block_explorer_url: "https://sepolia.etherscan.io"
  max_gas_price_multiplier: 4
  gas_bump_blocks_every:
    slow: 10
    medium: 5
    fast: 4
    super_fast: 2
  gas_provider: "FALLBACK"
# No additional configuration needed for fallback 

Block Native

Block Native provides real-time gas price estimates based on their global mempool monitoring network, making it one of the most accurate gas estimation services available. They currently support 43+ chains including Ethereum, Polygon, Arbitrum, Optimism, Base, and most major EVM networks. You can sign up for a free API key at https://www.blocknative.com/request-api-key. The free tier provides updated gas estimates every 5 seconds, while paid tiers offer per-second updates. For most use cases, the free tier works perfectly with rrelayer's cron-based gas polling.

rrelayer.yaml
name: first-rrelayer
description: "my first rrelayer"
api_config:
  port: 3000
  authentication_username: "${RRELAYER_AUTH_USERNAME}"
  authentication_password: "${RRELAYER_AUTH_PASSWORD}"
signing_provider:
  aws_kms:
    region: "eu-west-1"
networks:
- name: "sepolia_ethereum"
  chain_id: 11155111
  provider_urls:
  - "https://sepolia.gateway.tenderly.co"
  block_explorer_url: "https://sepolia.etherscan.io"
  max_gas_price_multiplier: 4
  gas_bump_blocks_every:
    slow: 10
    medium: 5
    fast: 4
    super_fast: 2
  gas_provider: "BLOCKNATIVE"
gas_providers: 
  blocknative: 
    api_key: "${BLOCK_NATIVE_API_KEY}"

Infura

Infura provides gas price APIs through MetaMask's developer platform, supporting Ethereum mainnet and testnets, along with Polygon, Arbitrum, Optimism, and other major EVM chains. You can view the full list of supported chains at https://docs.metamask.io/services/get-started/endpoints#gas-api. Sign up for a free API key at https://developer.metamask.io/register. The free tier provides 2,000 credits per second and 6 million credits per day, which is more than sufficient since rrelayer queries gas prices every few seconds via cron.

rrelayer.yaml
name: first-rrelayer
description: "my first rrelayer"
api_config:
  port: 3000
  authentication_username: "${RRELAYER_AUTH_USERNAME}"
  authentication_password: "${RRELAYER_AUTH_PASSWORD}"
signing_provider:
  aws_kms:
    region: "eu-west-1"
networks:
- name: "sepolia_ethereum"
  chain_id: 11155111
  provider_urls:
  - "https://sepolia.gateway.tenderly.co"
  block_explorer_url: "https://sepolia.etherscan.io"
  max_gas_price_multiplier: 4
  gas_bump_blocks_every:
    slow: 10
    medium: 5
    fast: 4
    super_fast: 2
  gas_provider: "INFURA"
gas_providers: 
  infura: 
    api_key: "${INFURA_API_KEY}"
    secret: "${INFURA_SECRET_KEY}"

Tenderly

Tenderly provides gas price estimation for most EVM chains, supporting Ethereum, Polygon, Arbitrum, Optimism, Base, and many more. You can view the complete list of supported networks at https://docs.tenderly.co/supported-networks. Sign up for a free API key at https://dashboard.tenderly.co/. The free tier works well for rrelayer since gas prices are queried every few seconds via cron, keeping API usage within free tier limits.

rrelayer.yaml
name: first-rrelayer
description: "my first rrelayer"
api_config:
  port: 3000
  authentication_username: "${RRELAYER_AUTH_USERNAME}"
  authentication_password: "${RRELAYER_AUTH_PASSWORD}"
signing_provider:
  aws_kms:
    region: "eu-west-1"
networks:
- name: "sepolia_ethereum"
  chain_id: 11155111
  provider_urls:
  - "https://sepolia.gateway.tenderly.co"
  block_explorer_url: "https://sepolia.etherscan.io"
  max_gas_price_multiplier: 4
  gas_bump_blocks_every:
    slow: 10
    medium: 5
    fast: 4
    super_fast: 2
  gas_provider: "TENDERLY"
gas_providers: 
  tenderly: 
    api_key: "${TENDERLY_API_KEY}"

Etherscan

Etherscan provides gas price APIs for multiple EVM chains. You can sign up at https://etherscan.io/apis to get a free API key. The free tier provides 5 calls/second which is more than sufficient since rrelayer queries gas prices every few seconds via cron. Etherscan supports Ethereum mainnet and testnets (Sepolia, Holesky), along with other major chains through their multi-chain explorer network (Polygonscan, Arbiscan, Optimistic Etherscan, etc.).

rrelayer.yaml
name: first-rrelayer
description: "my first rrelayer"
api_config:
  port: 3000
  authentication_username: "${RRELAYER_AUTH_USERNAME}"
  authentication_password: "${RRELAYER_AUTH_PASSWORD}"
signing_provider:
  aws_kms:
    region: "eu-west-1"
networks:
- name: "sepolia_ethereum"
  chain_id: 11155111
  provider_urls:
  - "https://sepolia.gateway.tenderly.co"
  block_explorer_url: "https://sepolia.etherscan.io"
  max_gas_price_multiplier: 4
  gas_bump_blocks_every:
    slow: 10
    medium: 5
    fast: 4
    super_fast: 2
  gas_provider: "ETHERSCAN"
gas_providers: 
  etherscan: 
    api_key: "${ETHERSCAN_API_KEY}"

Custom

You can implement your own custom gas fee estimator by providing an API endpoint that returns gas price estimates. This allows you to integrate with any gas price service or build your own gas estimation logic.

The custom gas provider expects your endpoint to return gas estimates in a specific JSON format with four speed tiers: SLOW, MEDIUM, FAST, and SUPER_FAST. Each tier should include suggested gas prices and optional wait time estimates.

Expected API Response Format

Your custom endpoint should return a JSON response with this structure:

{
  "slow": {
    "suggestedMaxPriorityFeePerGas": "0.1",
    "suggestedMaxFeePerGas": "2.5",
    "minWaitTimeEstimate": 180,
    "maxWaitTimeEstimate": 300
  },
  "medium": {
    "suggestedMaxPriorityFeePerGas": "0.5",
    "suggestedMaxFeePerGas": "4.0",
    "minWaitTimeEstimate": 60,
    "maxWaitTimeEstimate": 120
  },
  "fast": {
    "suggestedMaxPriorityFeePerGas": "1.0",
    "suggestedMaxFeePerGas": "6.0",
    "minWaitTimeEstimate": 15,
    "maxWaitTimeEstimate": 60
  },
  "superFast": {
    "suggestedMaxPriorityFeePerGas": "2.0",
    "suggestedMaxFeePerGas": "10.0",
    "minWaitTimeEstimate": 5,
    "maxWaitTimeEstimate": 15
  }
}

Gas prices should be provided as strings in Gwei. Wait time estimates are optional and should be in seconds.

rrelayer.yaml
name: first-rrelayer
description: "my first rrelayer"
api_config:
  port: 3000
  authentication_username: "${RRELAYER_AUTH_USERNAME}"
  authentication_password: "${RRELAYER_AUTH_PASSWORD}"
signing_provider:
  aws_kms:
    region: "eu-west-1"
networks:
- name: "sepolia_ethereum"
  chain_id: 11155111
  provider_urls:
  - "https://sepolia.gateway.tenderly.co"
  block_explorer_url: "https://sepolia.etherscan.io"
  max_gas_price_multiplier: 4
  gas_bump_blocks_every:
    slow: 10
    medium: 5
    fast: 4
    super_fast: 2
  gas_provider: "CUSTOM"
gas_providers: 
  custom: 
    endpoint: "https://api.example.com/gas-estimates"
    supported_chains: [1, 11155111, 137] 
    auth_header: "${CUSTOM_GAS_API_AUTH_HEADER}"

Configuration Options

  • endpoint: The base URL of your gas estimation API. The relayer will append the chain ID to this URL (e.g., https://api.example.com/gas-estimates/1 for Ethereum mainnet)
  • supported_chains: Array of chain IDs that your custom gas provider supports
  • auth_header (optional): Authorization header value to include in requests to your API