Summary
Astar is a Polkadot parachain that offers EVM and Wasm smart contract support. This page lists public and provider-hosted Astar RPC endpoints, chain configuration details, and guidance for choosing an RPC provider for production dApps.
Astar RPC Decision Checklist
Before selecting an Astar RPC endpoint for your project, consider these factors:
| Criterion | What to check | Why it matters |
|---|---|---|
| Public vs. private | Rate limits, reliability, and uptime guarantees | Public endpoints may throttle requests; private endpoints offer dedicated capacity for production apps |
| EVM vs. Substrate | Does the endpoint support EVM JSON-RPC methods? | Astar has both EVM and native Substrate layers; ensure your provider supports the methods you need |
| WebSocket support | Availability of wss:// endpoints | Required for real-time event listening and subscriptions |
| Archive data | Does the node store historical state? | Needed for dApps that query past balances or events |
| Geographic latency | Proximity of node to your users or backend | Lower latency improves transaction submission speed and user experience |
| Provider reputation | Track record, support, and network coverage | A reliable provider reduces downtime and maintenance overhead |
Astar Network Overview
Astar Network is a Polkadot parachain that supports both EVM and WebAssembly (Wasm) smart contracts. It serves as a hub for cross-chain dApps, connecting the Polkadot ecosystem with Ethereum and other major blockchains. Developers building on Astar can use standard Ethereum tooling (MetaMask, Hardhat, ethers.js) alongside Substrate-native tools.
Astar Chain Configuration
To connect to Astar, you need the following chain details:
- Chain ID: 592 (0x250)
- Currency: ASTR
- Block Explorer: https://astar.subscan.io or https://blockscout.com/astar
- Network Name: Astar Mainnet
- RPC URL: See endpoints below
Public Astar RPC Endpoints
Public endpoints are free to use but come with rate limits and no uptime guarantees. They are suitable for testing, light dApp usage, and development. Here are some commonly available public endpoints:
| Provider | HTTPS URL | WebSocket URL |
|---|---|---|
| Astar Team | https://evm.astar.network | wss://rpc.astar.network |
| OnFinality | https://astar.api.onfinality.io/public | wss://astar.api.onfinality.io/public-ws |
| Dwellir | https://astar-rpc.n.dwellir.com | wss://astar-rpc.n.dwellir.com |
| BlastAPI | https://astar.public.blastapi.io | wss://astar.public.blastapi.io |
| 1RPC | https://1rpc.io/astr | – |
| RadiumBlock | https://astar.public.curie.radiumblock.co/http | wss://astar.public.curie.radiumblock.co/ws |
| Alchemy | https://astar-mainnet.g.alchemy.com/v2/demo | – |
Note: Public endpoints are rate-limited. For production workloads, consider a dedicated node or a managed RPC service.
Using Astar RPC with Ethereum Libraries
Since Astar is EVM-compatible, you can use standard Ethereum libraries to interact with it. Below is an example using ethers.js:
const { ethers } = require("ethers");
// Connect to Astar via a public endpoint
const provider = new ethers.providers.JsonRpcProvider("https://astar.api.onfinality.io/public");
// Get the latest block number
provider.getBlockNumber().then((blockNumber) => {
console.log("Current block number:", blockNumber);
});
// Get ASTR balance of an address
const address = "0x...";
provider.getBalance(address).then((balance) => {
console.log("Balance:", ethers.utils.formatEther(balance), "ASTR");
});
When to Move Beyond Public Endpoints
Public endpoints are convenient for prototyping, but they have limitations:
- Rate limiting: Too many requests can result in 429 errors.
- No SLA: Uptime and performance are not guaranteed.
- Shared resources: Other users' traffic can affect your latency.
- Limited methods: Some advanced RPC methods (e.g.,
trace_*,debug_*) may not be available.
For production dApps, you need a reliable RPC provider that offers:
- Dedicated nodes with guaranteed throughput.
- Archive nodes for historical data queries.
- WebSocket support for real-time subscriptions.
- Global infrastructure to minimize latency.
Choosing an Astar RPC Provider
When evaluating RPC providers for Astar, consider the following:
- Network coverage: Does the provider have nodes in multiple regions?
- Pricing model: Pay-as-you-go vs. subscription; free tier availability.
- Supported methods: Ensure the provider supports the JSON-RPC methods your dApp needs (e.g.,
eth_call,eth_getLogs,eth_subscribe). - Archive data: If your dApp requires historical state, confirm archive node support.
- WebSocket: Essential for event-driven applications.
- Documentation and support: Clear API docs and responsive support channels.
OnFinality offers dedicated and shared Astar RPC endpoints with competitive pricing. You can find more details on the Astar network page and RPC pricing page.
Common Pitfalls and Troubleshooting
- Incorrect Chain ID: Always use chain ID 592 for Astar mainnet. Using the wrong chain ID will cause transaction failures.
- Rate limit exceeded: If you receive HTTP 429 errors, reduce request frequency or upgrade to a private endpoint.
- WebSocket disconnections: Ensure your client handles reconnection logic gracefully.
- Method not found: Some public endpoints disable certain RPC methods. Check the provider's documentation.
Key Takeaways
- Astar is an EVM-compatible Polkadot parachain with chain ID 592.
- Public RPC endpoints are available for testing and light use, but they have rate limits and no SLA.
- For production dApps, choose a managed RPC provider that offers dedicated nodes, archive data, and WebSocket support.
- Evaluate providers based on latency, reliability, pricing, and supported methods.
- OnFinality provides Astar RPC endpoints as part of its multi-chain infrastructure. Visit the supported networks page for more information.
Frequently Asked Questions
Q: What is the Astar chain ID? A: The Astar mainnet chain ID is 592 (0x250).
Q: Can I use MetaMask with Astar? A: Yes, MetaMask supports Astar. Add a custom network with the RPC URL and chain ID 592.
Q: Are there testnet endpoints for Astar? A: Yes, Astar has a testnet called Shibuya. Endpoints are available from the Astar team and other providers.
Q: How do I get an ASTR balance via RPC?
A: Use the eth_getBalance method with the address and block parameter. The balance is returned in Wei.
Q: What is the difference between public and private RPC endpoints? A: Public endpoints are free but rate-limited and shared. Private endpoints offer dedicated capacity, higher rate limits, and SLAs.
Q: Does OnFinality support Astar? A: Yes, OnFinality provides public and private Astar RPC endpoints. See the Astar network page for details.