Logo
RPC Assistant

How to Connect to Moonbeam: RPC Endpoints, JSON-RPC Methods, and Provider Selection

Summary

Moonbeam is an Ethereum-compatible parachain on Polkadot. To interact with it, you need a JSON-RPC endpoint. This page covers public endpoints, supported JSON-RPC methods, and how to choose a production-grade RPC provider for Moonbeam, Moonriver, and Moonbase Alpha.

Moonbeam API Decision Checklist

Before you start building on Moonbeam, evaluate these factors to choose the right API approach:

CriterionWhat to checkWhy it matters
Network typeMoonbeam (Polkadot), Moonriver (Kusama), or Moonbase Alpha (testnet)Each has a separate endpoint and GLMR/MOVR/DEV token
Endpoint reliabilityUptime history, rate limits, and dedicated node optionsPublic endpoints may throttle; production apps need consistent availability
Archive dataDoes the provider support archive node requests?Required for historical state queries (e.g., eth_call on past blocks)
WebSocket supportWSS URL availableNeeded for real-time subscriptions (e.g., pending transactions)
JSON-RPC method coverageFull Ethereum API compatibility plus Moonbeam-specific methodsMost dApps require eth_, net_, web3_*, plus debug/trace
Pricing modelPay-as-you-go vs. flat subscription vs. dedicated nodeChoose based on your request volume and budget

Moonbeam Network Overview

Moonbeam is a fully Ethereum-compatible parachain on the Polkadot network. It allows developers to deploy existing Solidity smart contracts with minimal changes while benefiting from Polkadot's shared security and cross-chain interoperability. The network has three core environments:

  • Moonbeam (mainnet) – GLMR token, connected to Polkadot
  • Moonriver (canary net) – MOVR token, connected to Kusama
  • Moonbase Alpha (testnet) – DEV token, for development and testing

All three support the standard Ethereum JSON-RPC interface, making them compatible with MetaMask, Hardhat, Truffle, and other familiar developer tools.

Public vs. Production RPC Endpoints

Public Endpoints (Free, Limited)

The Moonbeam Foundation and other providers offer public endpoints for development and low-volume use. They are rate-limited and not recommended for production apps.

NetworkHTTPS URLWSS URLRate Limit
Moonbeamhttps://rpc.api.moonbeam.networkwss://wss.api.moonbeam.network25 req/s
Moonriverhttps://rpc.api.moonriver.moonbeam.networkwss://wss.api.moonriver.moonbeam.network25 req/s
Moonbase Alphahttps://rpc.api.moonbase.moonbeam.networkwss://wss.api.moonbase.moonbeam.network25 req/s

Production RPC Provider Options

For production dApps, you need a reliable RPC provider that offers higher rate limits, dedicated nodes, and archive data. OnFinality provides RPC endpoints for all Moonbeam networks with scalable infrastructure. You can also consider providers listed in the Moonbeam documentation.

When choosing a provider, look for:

  • Transparent pricing (e.g., free tier, pay-as-you-go, dedicated nodes)
  • Archive node support
  • WebSocket (WSS) availability
  • Multi-region failover and uptime guarantees (use cautious wording)
  • Developer-friendly dashboard and API keys

Essential JSON-RPC Methods on Moonbeam

Moonbeam supports the standard Ethereum JSON-RPC methods plus some additional APIs. Below are the most commonly used methods.

Core Ethereum Methods

// Example: Get the latest block number
curl -X POST https://moonbeam.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_blockNumber",
    "params":[],
    "id":1
  }'

Methods List

MethodDescriptionNotes
eth_blockNumberLatest block number
eth_getBalanceAccount balanceSupports block tag
eth_callExecute a read-only contract callSupports archive blocks
eth_estimateGasEstimate gas for a transaction
eth_gasPriceCurrent gas price
eth_getLogsFilter event logsUse address, topics, block range
eth_getTransactionReceiptGet receipt by hash
eth_sendRawTransactionSubmit a signed transaction
net_versionNetwork ID (1284 for Moonbeam)
web3_clientVersionClient version

Moonbeam-Specific & Debug/Trace

  • debug_traceTransaction: For debugging transaction execution (requires archive node)
  • trace_filter: Parity-style trace filtering
  • eth_subscribe (WSS): Real-time event subscriptions

Note: Some methods (like trace_*) require a provider that supports trace API. Check with your provider before relying on these features.

MetaMask

  1. Open MetaMask and click "Add Network" manually.
  2. Enter these details for Moonbeam:
    • Network Name: Moonbeam
    • RPC URL: https://moonbeam.api.onfinality.io/public
    • Chain ID: 1284
    • Currency Symbol: GLMR
    • Block Explorer URL: https://moonbeam.subscan.io

Hardhat

// hardhat.config.js
module.exports = {
  networks: {
    moonbeam: {
      url: "https://moonbeam.api.onfinality.io/public",
      chainId: 1284,
      accounts: ["<PRIVATE_KEY>"]
    }
  }
};

ethers.js

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider(
  "https://moonbeam.api.onfinality.io/public"
);

const blockNumber = await provider.getBlockNumber();
console.log("Current block:", blockNumber);

Common Pitfalls and Troubleshooting

  • Rate limiting: Public endpoints will throttle after a certain number of requests per second. Use a dedicated or shared private endpoint for production.
  • Archive data: Many providers offer only full nodes (latest state). If you need eth_call on historical blocks, ensure the provider supports archive mode.
  • WebSocket disconnects: For real-time dApps, monitor connection health and implement reconnection logic.
  • Chain ID mismatch: Moonbeam uses 1284, Moonriver uses 1285, Moonbase Alpha uses 1287. Double-check when configuring wallets.
  • Faucet: For Moonbase Alpha testnet DEV tokens, use the official faucet.

Choosing a Provider: What to Compare

Not all RPC providers are equal for Moonbeam. Use this checklist when evaluating:

  1. Rate limits: Match your expected request volume. Free plans are fine for testing; production needs higher limits.
  2. Geographic distribution: Global endpoints reduce latency for your users.
  3. Archive support: Essential for analytics, historical dApps, and some DeFi protocols.
  4. Trace API: Required for tools like Tenderly or custom debugging.
  5. Pricing transparency: No hidden fees, clear per-request or monthly pricing.
  6. Support: SLA and developer support availability.

OnFinality offers RPC services for Moonbeam with multiple tiers, archive support, and WebSocket endpoints. Check the Moonbeam network page for endpoint details.

Frequently Asked Questions

Q: What is the difference between Moonbeam and Moonriver? Moonbeam is the mainnet parachain on Polkadot (GLMR), while Moonriver is the canary network on Kusama (MOVR). Both share identical Ethereum compatibility but have different tokenomics and security models.

Q: Can I use Ethereum libraries (ethers.js, web3.js) on Moonbeam? Yes, Moonbeam is fully Ethereum-compatible. All standard Ethereum libraries work out of the box with a Moonbeam RPC endpoint.

Q: How do I get free DEV tokens for Moonbase Alpha? Use the official Moonbase Alpha faucet to receive DEV tokens daily.

Q: Does Moonbeam support EIP-1559? Yes, Moonbeam supports EIP-1559 fee market. Use eth_feeHistory and eth_maxPriorityFeePerGas methods.

Q: Where can I find the complete list of JSON-RPC methods? The Moonbeam API overview lists all supported methods. Additionally, you can use eth_subscribe for real-time events.

Key Takeaways

  • Moonbeam provides Ethereum-compatible JSON-RPC endpoints for mainnet, canary, and testnet.
  • Public endpoints are suitable for development but not production due to rate limits.
  • Choose a production RPC provider based on rate limits, archive support, WebSocket, and pricing.
  • Standard Ethereum tools (MetaMask, Hardhat, ethers.js) work seamlessly with Moonbeam.
  • For debugging and advanced use cases, ensure your provider supports trace and archive APIs.

Start building on Moonbeam today by connecting to a reliable RPC API from OnFinality or another provider that meets your requirements.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started