Logo

Polkadot Nodes: A Developer's Guide to Running and Connecting to the Network

Summary

This guide covers everything developers need to know about Polkadot nodes: node types, how to run your own node, how to connect via RPC endpoints, and how to choose between self-hosted and provider-hosted nodes. Whether you're building a dApp, wallet, or infrastructure tool, you'll learn the practical steps to interact with the Polkadot network reliably.

Polkadot Node Decision Checklist

Before you decide how to connect to Polkadot, consider these factors:

  • Do you need historical state access? If yes, use an archive node or an RPC provider with archive support.
  • What is your request volume? High-throughput dApps may benefit from dedicated nodes or a provider with scalable rate limits.
  • Do you need WebSocket support? Real-time applications require WebSocket endpoints.
  • What is your budget? Self-hosting involves server costs and maintenance; provider plans offer predictable pricing.
  • How important is uptime? Providers often have SLAs; self-hosted nodes require your own monitoring.
  • Do you need multi-region redundancy? Providers distribute nodes globally for low latency.

What Is a Polkadot Node?

A Polkadot node is a software client that connects to the Polkadot relay chain or a parachain. It maintains a copy of the blockchain state, validates transactions, and serves data to applications via JSON-RPC or WebSocket. Nodes are essential for developers who need direct, unfiltered access to the network.

Node Types

Node TypeData StoredUse Case
Full NodeLatest blocks (pruned history)General interaction, balance checks, transaction submission
Archive NodeFull history from genesisHistorical queries, analytics, block explorers
Validator NodeFull node + block productionStaking, consensus participation
Collator NodeParachain full nodeParachain block production
Light NodeBlock headers onlyMobile wallets, low-resource environments

How to Run Your Own Polkadot Node

Running a node gives you full control over your infrastructure. Here's a quick setup guide.

Prerequisites

  • A machine with at least 4 CPU cores, 8 GB RAM, and 200 GB SSD (full node) or 1 TB+ (archive node).
  • Rust installed (follow rustup.rs).
  • Build dependencies: build-essential, clang, cmake, etc.

Install and Run

# Clone the Polkadot repository
git clone https://github.com/paritytech/polkadot-sdk.git
cd polkadot-sdk

# Build the binary (this may take a while)
cargo build --release --features fast-runtime

# Run a full node
./target/release/polkadot --chain polkadot --pruning archive --name my-node

For archive nodes, use --pruning archive. For validator nodes, add --validator and configure session keys.

Docker Option

docker run -d --name polkadot-node \
  -v /data:/data \
  -p 30333:30333 \
  -p 9933:9933 \
  -p 9944:9944 \
  parity/polkadot:latest \
  --chain polkadot \
  --pruning archive \
  --name my-docker-node

RPC Configuration

By default, the node exposes RPC on 127.0.0.1:9933 (HTTP) and 127.0.0.1:9944 (WebSocket). For external access, use --rpc-external and --ws-external, but secure them with firewalls or TLS.

Connecting to a Polkadot Node via RPC

Once your node is running, you can interact with it using JSON-RPC.

Example: Get the Latest Block

curl -H "Content-Type: application/json" \
  -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock"}' \
  http://localhost:9933

Example: Get Account Balance

curl -H "Content-Type: application/json" \
  -d '{"id":1, "jsonrpc":"2.0", "method": "system_account", "params": ["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"]}' \
  http://localhost:9933

Using WebSocket (JavaScript)

const { ApiPromise, WsProvider } = require('@polkadot/api');

async function main() {
  const wsProvider = new WsProvider('ws://localhost:9944');
  const api = await ApiPromise.create({ provider: wsProvider });

  const chain = await api.rpc.system.chain();
  console.log(`Connected to ${chain}`);

  const lastHeader = await api.rpc.chain.getHeader();
  console.log(`Last block number: ${lastHeader.number}`);
}

main().catch(console.error);

Self-Hosted vs RPC Provider: Which Should You Choose?

CriterionWhat to checkWhy it matters
CostSelf-host: server + bandwidth. Provider: pay-as-you-go or subscription.Self-hosting can be cheaper at high volume but requires ops overhead.
MaintenanceSelf-host: you handle updates, backups, monitoring. Provider: managed.Reduces engineering time and risk of downtime.
ScalabilitySelf-host: vertical scaling limited. Provider: horizontal scaling built-in.Sudden traffic spikes can overwhelm a single node.
LatencySelf-host: depends on your server location. Provider: multi-region.Lower latency improves user experience.
ReliabilitySelf-host: single point of failure. Provider: redundant clusters.Higher uptime for production apps.
Historical DataSelf-host: archive node required. Provider: often includes archive access.Needed for analytics and historical queries.

Common Pitfalls and Troubleshooting

  • Node not syncing: Check network connectivity, disk space, and that you're on the correct chain (Polkadot vs Kusama).
  • RPC connection refused: Ensure the node is running and RPC ports are open. Use --rpc-cors all for development.
  • WebSocket disconnects: Some providers limit connection duration. Use keep-alive pings.
  • Rate limiting: Public endpoints have limits. For production, use a dedicated node or a provider with higher limits.
  • Out of memory: Archive nodes require significant RAM. Consider using a provider for archive queries.

Using an RPC Provider for Polkadot

If you prefer not to run your own node, RPC providers offer managed endpoints with high availability. OnFinality provides Polkadot RPC endpoints with archive, trace, and WebSocket support. You can get started with a free API key and scale as needed.

To connect to OnFinality's Polkadot endpoint:

curl -H "Content-Type: application/json" \
  -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock"}' \
  https://polkadot.api.onfinality.io/public

For production, sign up for an API key to get higher rate limits and dedicated node options. See RPC pricing and supported networks for details.

Key Takeaways

  • Polkadot nodes come in several types: full, archive, validator, collator, and light.
  • Running your own node gives full control but requires infrastructure management.
  • RPC providers offer convenience, scalability, and reliability for production dApps.
  • Always use authenticated endpoints for production to avoid rate limiting.
  • Evaluate your needs for historical data, throughput, and latency before choosing a setup.

Frequently Asked Questions

What is the difference between a full node and an archive node?

A full node stores only recent blocks (pruned history), while an archive node stores all blocks from genesis. Archive nodes are needed for historical queries but require more disk space.

Can I run a Polkadot node on a laptop?

Yes, for development or testing. For production, use a server with adequate resources.

How long does it take to sync a Polkadot node?

Syncing a full node can take several hours; an archive node may take days. Using a provider like OnFinality eliminates sync time.

Do I need to run a node to build on Polkadot?

No, you can use RPC providers to interact with the network. Running a node is optional but gives you more control.

What RPC methods are available on Polkadot?

Polkadot supports standard JSON-RPC methods like chain_getBlock, system_account, and state_getStorage, plus Substrate-specific methods. See the Polkadot RPC documentation for a full list.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started