Moonbase Alpha – Moonbeam Test Network
Moonbase Alpha RPC
With Dwellir, you get access to our global Moonbase Alpha network which always routes your API requests to the nearest available location, ensuring low latency and the fastest speeds.
Why Build on Moonbase Alpha?
Moonbase Alpha is Moonbeam’s public test network. It mirrors Moonbeam’s Ethereum-compatible Substrate runtime so you can validate end‑to‑end integrations safely before deploying to mainnet:
- EVM + Substrate: Test both Ethereum JSON‑RPC and Substrate RPC flows on one chain
- Fast iteration: Frequent upgrades track Moonbeam, enabling realistic pre‑prod rehearsals
- Tooling parity: Works with polkadot.js, subxt, py‑substrate‑interface, and EVM SDKs
Quick Start
Connect in seconds using Dwellir’s optimized endpoints.
🔗 RPC Endpoints
Quick Connect:
curl -X POST https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"chain_getBlock","params":[],"id":1}'
Sign up at the Dwellir Dashboard to replace YOUR_API_KEY
before sending requests.
Installation & Setup
- cURL (HTTP)
- JavaScript (polkadot.js)
- Rust (subxt)
- Python (py-substrate-interface)
curl https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "chain_getHeader",
"params": []
}'
# Sample (2025-10-09)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0xd52457",
"parentHash": "0x56f87850ee68308211e6044273bc47bf8948e7e03a17d55e65ed70908eb921ca",
"stateRoot": "0x013f4c9d16f934155515a7328528a7309151c8b1a693a4f6a44224a0ea2e1099",
"extrinsicsRoot": "0x2d88bb9bc669fc3ab81a306e849b5f09248689abe1c05f81f63a88ee17891f4d"
}
}
import { ApiPromise, WsProvider } from '@polkadot/api';
async function main() {
const provider = new WsProvider('wss://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
const [chain, nodeName, version, 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} ${version}`);
console.log(`specVersion=${runtime.specVersion.toString()}, txVersion=${runtime.transactionVersion.toString()}`);
// Subscribe to new block headers
const unsub = await api.rpc.chain.subscribeNewHeads((header) => {
console.log(`#${header.number.toString()} ${header.hash.toHex()}`);
});
// Unsubscribe later
setTimeout(async () => { await unsub(); await api.disconnect(); }, 10000);
}
main().catch(console.error);
use subxt::{config::substrate::SubstrateConfig, OnlineClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api = OnlineClient::<SubstrateConfig>::from_url(
"wss://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY"
).await?;
let head = api.rpc().finalized_head().await?;
let header = api.rpc().header(Some(head)).await?.expect("header");
println!("Finalized block #{:?} (hash {:?})", header.number, head);
Ok(())
}
from substrateinterface import SubstrateInterface
api = SubstrateInterface(
url="wss://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY",
ss58_format=1287,
type_registry_preset="substrate-node-template"
)
runtime = api.get_runtime_version()
print("specVersion", runtime['specVersion'], "transactionVersion", runtime['transactionVersion'])
# Example account query (replace with a valid Moonbase Alpha SS58 address)
# account = api.query('System', 'Account', params=['<YOUR_SS58_ADDRESS>'])
# print(account.value['data'])
Network Information
Relay Chain
Alphanet Relay Chain
Unit / Decimals
DEV / 18
SS58 Prefix
1287
Genesis Hash
0x91bc6e169807aaa54802737e1c504b2577d4fafedd5a02c10293b1cd60e39527
Runtime (2025-10-09)
specVersion 3900 · transactionVersion 3
Explorer
Substrate JSON‑RPC API Reference
Supported core method groups include system_*
, chain_*
, state_*
, author_*
, payment_*
, and rpc_methods
. Frontier EVM (eth_*
) and debug namespaces are available on Moonbase Alpha but are out of scope for this Substrate reference.
Available JSON-RPC Methods
System & Runtime
Identify the chain, runtime versions, and node health.
Chain Data & Finality
Inspect blocks, headers, and finality streams.
State Access & Storage
Query storage, metadata, and runtime entry points.
Authoring & Sessions
Submit extrinsics and manage session keys.
RPC Introspection
Discover supported RPC namespaces and versions.
Get your API key
Get your API key →Common Integration Patterns
- Prefer WebSocket for subscriptions (e.g.,
chain_subscribeNewHeads
). - Cache metadata and types between runs to avoid repeated
state_getMetadata
/state_getRuntimeVersion
calls. - For large storage scans, paginate keys with
state_getKeysPaged
. - Use
payment_queryInfo
to estimate fees beforeauthor_submitExtrinsic
.
Performance Best Practices
- Reconnect with exponential backoff on WS disconnects.
- Batch independent calls where possible.
- Scope
state_getStorage
queries to explicit keys; avoid full‑state traversals.
Troubleshooting
- Connection errors: verify API key, TLS, and use WS for subscriptions.
- Type errors: ensure metadata is fresh; update polkadot.js/subxt type bundles.
- SS58 issues: confirm prefix
1287
and address checksum. - Extrinsics failing: decode dispatch errors using runtime metadata.
Smoke Tests
system_health
→ expectisSyncing: false
and non‑zeropeers
.chain_getHeader
(latest) → block number increases over time.state_getRuntimeVersion
→ returnsspecVersion: 3900
,transactionVersion: 3
(as of 2025‑10‑09).
Migration Guide
From Polkadot/Westend to Moonbase Alpha:
- Update endpoints to
api-moonbase-alpha.n.dwellir.com
. - Switch SS58 to
1287
; unit symbol becomesDEV
with 18 decimals. - Re‑check fee modeling via
payment_queryInfo
. - Confirm method availability with
rpc_methods
(GRANDPA/BEEFY are not exposed here).
Resources & Tools
- Explorer: https://moonbase.moonscan.io
- Moonbeam Docs: https://docs.moonbeam.network/
- Substrate Developer Hub: https://docs.substrate.io/
- Polkadot.js Apps: https://polkadot.js.org/apps/