Docs

Astar RPC Guide

Production-ready JSON-RPC guide for Astar Network, covering endpoints, network specs, integration patterns, and troubleshooting for builders targeting Polkadot parachain 2006.

Astar RPC

With Dwellir, you get access to our global Astar network which always routes your API requests to the nearest available location, ensuring low latency and the fastest speeds.

Get your API key

Why Build on Astar?

Multichain smart-contract hub

  • Dual EVM + WASM runtimes let teams deploy Solidity and ink! contracts side by side while inheriting Polkadot relay-chain security (Astar build docs).
  • Build2Earn dApp staking shares block rewards with developers who attract stakers, turning usage into sustainable funding (Astar dApp staking guide).

Optimized for Polkadot 2.0

  • Astar adopted Agile Coretime so parachain capacity scales with demand instead of multi-year lease slots, reducing operating costs for long-lived apps (Polkadot Ecosystem update, Aug 13 2025).
  • Asynchronous Backing on mainnet brings ~6-second block production with larger block weight limits for latency-sensitive DeFi and gaming flows (Astar mainnet upgrade announcement).

‍ Enterprise-ready infrastructure

Quick Start with Astar

Connect to Astar, Shibuya testnet, or Shiden canary through Dwellir-managed endpoints.

Astar RPC Endpoints
HTTPS
WSS
curl -sS -X POST https://api-astar.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots> \  -H 'Content-Type: application/json' \  -d '{"jsonrpc":"2.0","method":"chain_getBlockHash","params":[0],"id":1}'
import { ApiPromise, WsProvider } from '@polkadot/api';const provider = new WsProvider('wss://api-astar.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>');const api = await ApiPromise.create({ provider });const hash = await api.rpc.chain.getBlockHash(0);console.log(hash.toHex());
from substrateinterface import SubstrateInterfacesubstrate = SubstrateInterface(url='wss://api-astar.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>')block_hash = substrate.get_block_hash(block_id=0)print(block_hash)
package mainimport (  "bytes"  "fmt"  "io"  "net/http")func main() {  url := "https://api-astar.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>"  payload := []byte(`{"jsonrpc":"2.0","id":1,"method":"chain_getBlockHash","params":[0]}`)  resp, err := http.Post(url, "application/json",    bytes.NewBuffer(payload))  if err != nil { panic(err) }  defer resp.Body.Close()  body, _ := io.ReadAll(resp.Body)  fmt.Println(string(body))}

Get your API key

Sign up with Dwellir or your preferred infrastructure partner to replace YOUR_API_KEY before sending requests.

Installation & Setup

Network Information

ParameterAstar MainnetShiden CanaryShibuya Testnet
Relay chainPolkadotKusamaTokyo (Astar-managed)
Parachain ID200620071000
Genesis hash0x9eb76c5184c4ab8679d2d5d819fdf90b9c001403e9e17da2e14b6d8aec4029c6
Runtime (2025-10-03)specVersion 1700, transactionVersion 3specVersion 1700specVersion 1700
Unit symbolASTRSDNSBY
Decimals181818
SS58 prefix555
Explorerastar.subscan.ioshiden.subscan.ioshibuya.subscan.io

Notes

ParameterValueDetails
Genesis Hash VerificationRecorded via chain_getBlockHash(0) on 2025-10-03
Canary & Testnet RoleShiden (Kusama canary) and Shibuya (public testnet) provide staging environments for runtime upgrades before they reach mainnetAstar network overview

API Reference

Astar exposes the full Substrate RPC surface for block data, storage, extrinsics, and fee estimation, with Frontier also enabling Ethereum-compatible eth_*, net_*, and web3_* endpoints for EVM tooling.

Common Integration Patterns

Subscribe to new heads for live indexing

TypeScript
import { ApiPromise, WsProvider } from '@polkadot/api';

const provider = new WsProvider('wss://api-astar.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });

api.rpc.chain.subscribeNewHeads((header) => {
  console.log(`Astar block #${header.number.toString()} => ${header.hash.toHex()}`);
});

Fetch native balances via raw storage key

Bash
# System.Account for 5-digit treasury account
curl https://api-astar.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "state_getStorage",
    "params": [
      "0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9e3a5c81a65b0e6ba8e72e48e58704482922ee694ea772dc63a575845fa57a0c5ea93dfdc2a93ec631d9e426962f1e311"
    ],
    "id": 42
  }'

Decode the SCALE-encoded result with polkadot.js or py-substrate-interface to access data.free, data.reserved, and staking locks.

Pre-flight fees before submitting extrinsics

TypeScript
import { ApiPromise, WsProvider } from '@polkadot/api';

const api = await ApiPromise.create({ provider: new WsProvider('wss://api-astar.n.dwellir.com/YOUR_API_KEY') });
const tx = api.tx.balances.transferKeepAlive(
  '5DAAnrj7VHTz5xy1mJQp7vR8J33ePZ8WqWnVfHfV9bPp7PPV',
  1_000_000_000_000
);
const info = await api.rpc.payment.queryInfo(tx.toHex());
console.log(info.toHuman());

Performance Best Practices

  • Prefer WebSocket connections for subscriptions and batched queries; fall back to HTTPS for stateless workloads.
  • Cache runtime metadata keyed by the latest specVersion to avoid re-fetching on every request.
  • Use state_getKeysPaged or state_getStoragePaged with bounded page sizes when crawling large maps such as staking ledgers.
  • Track upgrade announcements on the Astar forum and rehearse changes on Shiden before promoting them to mainnet.
  • Implement exponential backoff around author_submitExtrinsic; Frontier queues may temporarily reject payloads when Ethereum traffic spikes.

Troubleshooting

SymptomLikely CauseResolution
API key does not exist errorsMisconfigured Dwellir endpoint or expired keyRe-issue the key via the Dwellir dashboard and update environment variables.
WebSocket disconnects on idle workloadsProvider closes idle connectionsEnable heartbeat pings or reconnect logic every 30 seconds.

Smoke Tests

Run these checks before promoting to production:

  1. system_health: Expect isSyncing: false and peer count > 8.
  2. chain_getHeader: Confirm block numbers advance every ~6 seconds.
  3. state_getStorage(System.Account): Verify SCALE decoding of balances for a known treasury or team account.
  4. payment_queryInfo on a signed extrinsic: Validate the fee model before broadcasting from CI/CD.

Resources & Tools

Ready to deploy? Spin up a staging environment on Shibuya, soak test on Shiden, then cut over to Astar mainnet with confidence.