⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

Astar RPC Guide

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).

🌐 Cross-ecosystem reach

  • Native ASTR bridges via Chainlink CCIP and ERC-7802 routes, unlocking unified liquidity across Soneium, Optimism Superchain, and other L2s without wrapping friction (Astar x Chainlink CCIP integration).

🧑‍💻 Enterprise-ready infrastructure

Quick Start with Astar

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

🔗 RPC Endpoints

Astar Mainnet
Mainnet
Polkadot parachain 2006 secured by NPoS validators.
WSS
wss://api-astar.n.dwellir.com/YOUR_API_KEY
HTTPS
https://api-astar.n.dwellir.com/YOUR_API_KEY
✓ Archive Node✓ Trace API✓ Debug API✓ WebSocketUnit: ASTR (18 decimals)SS58 prefix 5

Quick Connect:

curl -X POST https://api-astar.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Get your API key

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

Installation & Setup

curl https://api-astar.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "chain_getHeader",
"params": []
}'

Sample response (2025-10-03 10:13 UTC):

{
"jsonrpc": "2.0",
"result": {
"number": "0x9fbc28",
"parentHash": "0x3f484429ad05365b32f643a9e825794961c1e6f92cde48a2c73935d7773dd5e1",
"stateRoot": "0x1b983c37356b175bcf38dc1afcc8e31fa893e561f605fcad473697a68ac92169",
"extrinsicsRoot": "0x783e75691edc604a3f13e1b5c558dd3ca5870ac07ce799c781713219a4a56224",
"digest": {
"logs": [
"0x066175726120159b7a1100000000",
"0x0452505352902bb51614ab3779fc4f4892aa8e21582a05a3162aef145209312f48c3b37fc7909618af06",
"0x0466726f6e88015cd52a32691b3d44a3cef762382d728668dbee8c4509c697efe25708d5e6ffd400",
"0x05617572610101809dd98345fce7c411d130f73a50b2e37d73efe027964dd63ce064275257cc1afb3192c7885ec1813c89350463bce9cd8b4f183b6e8cd779643ff4c476795e83"
]
}
},
"id": 1
}

</TabItem>
<TabItem value="polkadotjs" label="JavaScript (polkadot.js)">

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

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

const [chain, nodeName, nodeVersion, runtime] = await Promise.all([
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version(),
api.rpc.state.getRuntimeVersion()
]);

console.log(`Connected to ${chain.toString()} via ${nodeName} ${nodeVersion}`);
console.log(`specVersion=${runtime.specVersion.toString()}, transactionVersion=${runtime.transactionVersion}`);

const header = await api.rpc.chain.getHeader();
console.log(`Latest block #${header.number} (${header.hash.toHex()})`);

await api.disconnect();
}

main().catch(console.error);

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
  • Genesis hash recorded via chain_getBlockHash(0) on 2025-10-03.
  • Shiden (Kusama canary) and Shibuya (public testnet) provide staging environments for runtime upgrades before they reach mainnet (Astar network overview).

Available JSON-RPC Methods

Astar exposes the full Substrate RPC surface, plus Frontier EVM methods. Core namespaces documented in this section:

GroupPurposeKey Methods
system_*Node health, metadata, peer infosystem_health, system_version, system_chain
chain_*Blocks, headers, finality, subscriptionschain_getHeader, chain_getBlock, chain_subscribeFinalizedHeads
state_*Storage queries, metadata, runtime datastate_getStorage, state_getRuntimeVersion, state_getKeysPaged
author_*Extrinsic submission and queue inspectionauthor_submitExtrinsic, author_pendingExtrinsics
payment_*Fee estimation for Substrate extrinsicspayment_queryInfo, payment_queryFeeDetails
rpc_methodsEnumerate RPC namespaces exposed by the noderpc_methods

Frontier also enables Ethereum-compatible eth_*, net_*, and web3_* endpoints for EVM wallets.

Common Integration Patterns

Subscribe to new heads for live indexing

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

# 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

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.
1010: Invalid Transaction when using LedgerLedger app not migrated to Polkadot Generic or metadata outdatedUpgrade to the Polkadot Generic Ledger app and re-import metadata via the Astar Ledger guide.
Empty storage readsMissing SS58 prefix or mismatched account encodingEnsure addresses use prefix 5 and convert EVM H160 to native SS58 when hitting Substrate APIs (address reference).
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 fee model before broadcasting from CI/CD.

Migration Guide (Polkadot/Westend → Astar)

  • Update RPC URLs to https://api-astar.n.dwellir.com/YOUR_API_KEY (or WebSocket equivalent) and keep credentials in secrets stores (Dwellir network overview).
  • Convert addresses to SS58 prefix 5; regenerate Ledger derivations with the Polkadot Generic app to avoid 1010 errors (address reference, Ledger guide).
  • Refresh cached metadata after each runtime upgrade by monitoring Astar release notes and updating custom type bundles.
  • Recalculate fee buffers with payment_queryInfo because Astar uses runtime-specific weight tables.

Resources & Tools

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