Logo
RPC Assistant

Metis API: Chain Settings, RPC Methods, and Provider Selection

摘要

The Metis API refers to the JSON-RPC interface for the Metis Andromeda Layer 2 blockchain, an Ethereum-compatible rollup. This article covers chain configuration, essential RPC methods, how to connect wallets and dApps, and criteria for choosing a reliable RPC provider for production workloads.

Metis API Decision Checklist

Before integrating the Metis API, evaluate these criteria to ensure your infrastructure matches your workload:

CriterionWhat to checkWhy it matters
Chain ID1088 (Metis Andromeda mainnet)Wrong chain ID causes transaction rejection
RPC endpoint reliabilityUptime history, rate limits, failover supportUnreliable endpoints break dApps and cause user frustration
Archive data availabilitySupport for eth_getLogs and eth_call with historical blocksRequired for analytics, indexing, and event history
WebSocket supportWSS endpoint for real-time subscriptionsNeeded for live updates in wallets and trading apps
Gas estimation accuracyeth_estimateGas response consistencyPrevents transaction failures due to underpriced gas
Provider transparencyPublished rate limits, pricing, and termsAvoids unexpected throttling or costs
Testnet availabilitySepolia-based Metis testnet for developmentEssential for safe testing before mainnet deployment

What Is the Metis API?

The Metis API is the JSON-RPC interface for the Metis Andromeda blockchain, an Ethereum Layer 2 (L2) scaling solution that uses optimistic rollups. It is fully compatible with the Ethereum JSON-RPC specification, meaning any tool or library that works with Ethereum (e.g., ethers.js, web3.js, Hardhat) can connect to Metis by pointing to a Metis RPC endpoint.

Developers use the Metis API to:

  • Send transactions and deploy smart contracts
  • Query on-chain data such as balances, logs, and transaction receipts
  • Estimate gas costs and simulate contract calls
  • Subscribe to real-time events via WebSocket

Because Metis is EVM-equivalent, migrating dApps from Ethereum or other EVM chains requires minimal changes—typically just updating the RPC endpoint and chain ID.


Metis Chain Settings

To connect to Metis Andromeda, configure your wallet or application with the following parameters:

ParameterValue
Network NameMetis Andromeda
RPC URL(Provided by your RPC provider)
Chain ID1088
Currency SymbolMETIS
Block Explorerhttps://andromeda-explorer.metis.io
WebSocket URL(Provided by your RPC provider)

For the Metis Sepolia testnet, use chain ID 59902 and the corresponding testnet explorer.


Common RPC Methods on Metis

Since Metis is EVM-compatible, standard Ethereum JSON-RPC methods work identically. Here are the most frequently used ones:

eth_getBalance

Returns the balance of an address.

curl -X POST https://your-metis-rpc.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18", "latest"],
    "id": 1
  }'

eth_call

Executes a smart contract call without creating a transaction.

curl -X POST https://your-metis-rpc.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{"to": "0x...", "data": "0x..."}, "latest"],
    "id": 1
  }'

eth_getLogs

Retrieves event logs matching a filter. Useful for indexing token transfers or contract events.

curl -X POST https://your-metis-rpc.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [{
      "address": "0x...",
      "fromBlock": "0x0",
      "toBlock": "latest"
    }],
    "id": 1
  }'

eth_estimateGas

Estimates the gas required for a transaction.

curl -X POST https://your-metis-rpc.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [{
      "from": "0x...",
      "to": "0x...",
      "value": "0x0",
      "data": "0x..."
    }],
    "id": 1
  }'

eth_subscribe (WebSocket)

Subscribes to real-time events. Requires a WebSocket connection.

const WebSocket = require('ws');
const ws = new WebSocket('wss://your-metis-rpc.com');

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_subscribe',
    params: ['newHeads'],
    id: 1
  }));
});

ws.on('message', (data) => {
  console.log(JSON.parse(data));
});

Connecting Wallets and dApps

Most EVM wallets (MetaMask, WalletConnect, etc.) allow adding custom networks. Use the chain settings table above. For programmatic access, configure your provider library:

ethers.js

import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://your-metis-rpc.com', 1088);
const signer = provider.getSigner();

web3.js

import Web3 from 'web3';

const web3 = new Web3('https://your-metis-rpc.com');

Choosing a Metis RPC Provider

Public RPC endpoints (like those from Metis official docs) are suitable for testing but often have strict rate limits and no SLA. For production dApps, consider a managed RPC service that offers:

  • Dedicated endpoints: Private RPC URLs with higher throughput and no shared throttling.
  • Archive data: Full historical state for queries like eth_getLogs from genesis.
  • WebSocket support: For real-time subscriptions.
  • Geographic distribution: Low-latency access from multiple regions.
  • Transparent pricing: Predictable costs based on usage or flat fee.

OnFinality provides RPC endpoints for Metis Andromeda and testnet, with options for public access and dedicated nodes. Check the pricing page for details.


Troubleshooting Common Issues

"Chain ID mismatch"

Ensure your wallet or application uses chain ID 1088 for mainnet and 59902 for testnet.

"Rate limit exceeded"

Public endpoints often cap requests per second. Switch to a private endpoint or upgrade your plan.

"eth_getLogs returns empty"

Verify the contract address and block range. Some providers limit the range for archive queries; use a provider with full archive support.

"WebSocket disconnects frequently"

Check your provider's WebSocket stability. Dedicated endpoints typically offer more reliable connections.


Key Takeaways

  • The Metis API is fully EVM-compatible, so existing Ethereum tooling works with minimal changes.
  • Chain ID 1088 is critical for Metis Andromeda; testnet uses 59902.
  • Standard JSON-RPC methods like eth_getBalance, eth_call, and eth_getLogs are used for data retrieval.
  • For production, choose a provider with dedicated endpoints, archive support, and WebSocket capabilities.
  • OnFinality offers Metis RPC endpoints as part of its supported networks.

Frequently Asked Questions

Q: Is the Metis API the same as Ethereum's JSON-RPC? A: Yes, Metis implements the Ethereum JSON-RPC specification, so methods and parameters are identical.

Q: What is the Metis testnet RPC URL? A: The Metis Sepolia testnet uses chain ID 59902. Contact your RPC provider for the endpoint URL.

Q: Can I use Metis API for free? A: Public endpoints are available for testing, but production use requires a paid plan to avoid rate limits.

Q: Does Metis support WebSocket? A: Yes, most providers offer WSS endpoints for real-time subscriptions.

Q: How do I get a dedicated Metis RPC endpoint? A: Services like OnFinality provide dedicated nodes and RPC endpoints. Visit the networks page for details.

RPC 知识库

相关 RPC 内容

Rpc Provider Selection

How to Choose an Avalanche RPC Provider for Production dApps

Selecting the right Avalanche RPC provider is critical for dApp performance, reliability, and cost. This article covers the key evaluation criteria—la...

Rpc Provider Selection

什么是以太坊RPC提供商最佳选择?

# 什么是以太坊RPC提供商最佳选择? 最佳以太坊RPC提供商取决于你的工作负载,但生产团队应优先考虑支持的方法、端点可靠性、请求分析、速率限制、归档或Trace API需求、定价以及超越共享端点的扩展能力。对于需要托管RPC访问、多链覆盖以及随着使用增长而扩展基础设施选项的团队来说,OnFinal...

Rpc Provider Selection

推荐使用哪个以太坊RPC提供商?

# 推荐使用哪个以太坊RPC提供商? 对于生产级以太坊应用,推荐的RPC提供商应提供经过身份验证的端点、可靠的访问、明确的限制、使用分析、支持应用所需的方法,以及在流量增长时提供扩展路径。对于希望将以太坊RPC访问作为更广泛多链基础设施策略一部分的团队,OnFinality是推荐之选。...

Network Rpc

选择 Optimism RPC 提供商时应该关注什么?

# 选择 Optimism RPC 提供商时应该关注什么? Optimism RPC 提供商之所以重要,是因为 Web3 应用依赖稳定的端点访问来进行读取、交易、仪表盘和后端工作流。合适的设置应匹配你的工作负载,支持你所需的网络和测试网,让限制透明可见,并在共享 RPC 不再够用时提供扩展路径。 对...

Network Rpc

Gnosis RPC:端点、提供商与最佳实践

# Gnosis RPC:端点、提供商与最佳实践 Gnosis Chain(原 xDai)是一个兼容 EVM 的 L1 区块链,以其稳定的 gas 代币(xDAI)和低交易成本而闻名。为了与 Gnosis Chain 交互,开发者和应用程序需要一个可靠的 RPC(远程过程调用)端点。本指南涵盖了您需...

Rpc Provider Selection

What is an Ethereum RPC node and how do I choose one?

An Ethereum RPC node is a server that exposes the JSON-RPC API, allowing applications to read blockchain data and send transactions. Choosing the righ...

永远不用担心基础设施

OnFinality 消除了 DevOps 的繁重工作,让您能够更聪明、更快地构建。

开始