Summary
Astar zkEVM is an Ethereum Layer 2 that brings the Astar ecosystem to zero-knowledge rollups. This article explains how to connect your dApp to Astar zkEVM using the correct RPC endpoint, chain ID, and configuration, and how to choose a reliable RPC provider for production.
Quick decision: Which Astar zkEVM RPC should you use?
If you are building on Astar zkEVM, your first decision is whether to use a public RPC endpoint, a shared managed endpoint, or a dedicated node. Public endpoints are fine for prototyping and light usage, but they often have rate limits and can become unreliable under load. For production dApps, you need a managed RPC service that offers high availability, scalability, and support.
OnFinality provides managed RPC endpoints for Astar zkEVM, along with dedicated node options for teams that need predictable performance and isolation. You can check the Astar network page for the latest endpoint details and availability. For pricing and plan options, see RPC pricing.
If you are just getting started, use the public endpoint for testing, but plan to move to a managed service before launch. If you are already in production, evaluate your current provider's reliability, rate limits, and support for WebSocket and archive data.
What is Astar zkEVM?
Astar zkEVM is a Layer 2 scaling solution built on Ethereum, using zero-knowledge rollups to increase throughput and reduce transaction costs. It is part of the Astar network ecosystem, which originally launched as a Polkadot parachain. Astar zkEVM is Ethereum Virtual Machine (EVM) compatible, meaning you can deploy your existing Solidity smart contracts and use Ethereum tooling like MetaMask, Hardhat, and ethers.js without major changes.
The key benefit of Astar zkEVM is that it combines the security of Ethereum with the scalability of zk-rollups, while staying fully compatible with the Ethereum developer experience. This makes it an attractive option for developers looking to expand their dApps to a new audience.
Chain settings at a glance
To connect to Astar zkEVM, you need the correct network configuration. The following table summarizes the essential settings:
| Setting | Value |
|---|---|
| Network Name | Astar zkEVM |
| RPC URL | (Use the endpoint from your provider, e.g., OnFinality) |
| Chain ID | 3776 |
| Currency Symbol | ETH |
| Block Explorer URL | https://astar-zkevm.explorer.startale.com/ |
Note: The chain ID and explorer URL are based on public information. Always verify the latest details from the official Astar documentation or your RPC provider.
How to configure your wallet and dApp
To connect to Astar zkEVM, you need to add the network to your wallet or configure your dApp's RPC settings. Here's an example using MetaMask:
- Open MetaMask and click the network dropdown.
- Click "Add Network" and fill in the details:
- Network Name: Astar zkEVM
- New RPC URL: (your RPC endpoint)
- Chain ID: 3776
- Currency Symbol: ETH
- Block Explorer URL: https://astar-zkevm.explorer.startale.com/
- Click Save.
For developers, you can configure your dApp using ethers.js or viem. Here's an example using ethers.js:
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://astar-zkevm-rpc.example.com");
const network = await provider.getNetwork();
console.log("Chain ID:", network.chainId); // Should be 3776
Replace the RPC URL with your actual endpoint. If you are using OnFinality, you can find your dedicated endpoint in the OnFinality dashboard.
Making your first JSON-RPC call
Once you have an endpoint, you can test it with a simple JSON-RPC request. Here's a curl example to get the latest block number:
curl -X POST https://astar-zkevm-rpc.example.com \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
You should receive a response like:
{"jsonrpc":"2.0","result":"0x123456","id":1}
The result is a hex-encoded block number. This confirms that your RPC endpoint is working.
Using WebSocket for real-time updates
Many dApps need real-time data, such as new blocks or transaction confirmations. For this, you can use WebSocket connections. Most RPC providers, including OnFinality, offer WebSocket endpoints. Here's an example using viem:
import { createPublicClient, webSocket } from 'viem';
const client = createPublicClient({
transport: webSocket('wss://astar-zkevm-rpc.example.com'),
});
const unwatch = client.watchBlocks({
onBlock: (block) => console.log('New block:', block.number),
});
WebSocket connections are more efficient for subscriptions and can reduce latency compared to polling.
Common pitfalls and troubleshooting
When working with Astar zkEVM RPC, you might encounter a few common issues:
- Incorrect chain ID: Make sure you use 3776. Using the wrong chain ID will cause transactions to be rejected.
- Rate limiting: Public endpoints often have rate limits. If you see 429 errors, consider upgrading to a managed service.
- WebSocket disconnects: If your WebSocket connection drops frequently, check your provider's stability and consider using a dedicated node.
- Transaction not found: If you can't find a transaction, ensure you are querying the correct block range and that your node is synced.
If you need help, OnFinality provides support for all its RPC services. You can also check the Astar documentation for network-specific details.
How to choose an RPC provider for Astar zkEVM
When selecting an RPC provider for Astar zkEVM, consider the following criteria:
| Criterion | What to check | Why it matters |
|---|---|---|
| Reliability | Uptime history, redundancy | Downtime breaks your dApp |
| Performance | Latency, throughput | Slow responses hurt user experience |
| Rate limits | Free tier limits, paid plans | Avoid unexpected throttling |
| WebSocket support | wss:// endpoint | Needed for real-time features |
| Archive data | Access to historical state | Required for some analytics and debugging |
| Dedicated options | Isolated nodes | For high-traffic or compliance needs |
OnFinality offers both shared and dedicated RPC nodes for Astar zkEVM. You can start with a free tier and scale as your project grows. For more guidance, read our how to choose an RPC provider article.
Production readiness checklist
Before launching your dApp on Astar zkEVM, make sure you:
- Use a managed RPC provider with a reliable uptime guarantee.
- Set up monitoring for your RPC endpoints.
- Implement fallback endpoints in case of provider issues.
- Test your dApp on a testnet if available.
- Understand the rate limits and plan for scaling.
OnFinality provides monitoring and analytics for your endpoints, helping you keep your dApp healthy.
Key Takeaways
- Astar zkEVM is an Ethereum-compatible Layer 2 with a chain ID of 3776.
- Use the correct RPC endpoint and chain ID to connect your dApp.
- Public endpoints are fine for testing, but production apps need a reliable managed RPC provider.
- Consider WebSocket support, archive data, and dedicated node options when choosing a provider.
- OnFinality offers managed RPC and dedicated nodes for Astar zkEVM, with pricing options to fit your needs.
Frequently Asked Questions
What is the Astar zkEVM RPC URL?
The public RPC URL is provided by the Astar team and can be found in their documentation. For a reliable managed endpoint, you can use OnFinality's service, which provides a dedicated URL for your project.
What chain ID does Astar zkEVM use?
Astar zkEVM uses chain ID 3776.
Is Astar zkEVM compatible with Ethereum tools?
Yes, Astar zkEVM is EVM-compatible, so you can use MetaMask, Hardhat, ethers.js, viem, and other Ethereum tools.
How do I get a dedicated Astar zkEVM RPC node?
You can get a dedicated node through OnFinality. Visit the dedicated node page for more information.
What are the rate limits for public Astar zkEVM RPC?
Public endpoints typically have rate limits, but the exact limits are not officially documented. For production, it's recommended to use a managed provider like OnFinality to avoid throttling.