Previous Module
Wallet Connect Demo

📡 RPC Calls: Talk to Blockchain Nodes

Learn how every Web3 app communicates with Ethereum

📡 What are RPC Calls?

RPC (Remote Procedure Call) is how applications communicate with blockchain nodes. Think of it as an API for blockchains—you send a request in JSON format, the node processes it, and returns data. Every wallet, dApp, and block explorer uses RPC calls. When you check your ETH balance in MetaMask, it calls eth_getBalance. When you send a transaction, it calls eth_sendRawTransaction. RPC is the foundation of Web3 development.

🔑 JSON-RPC Protocol Structure

📤
Request Format
  • jsonrpc: Protocol version ("2.0")
  • method: Function name (e.g., "eth_call")
  • params: Array of arguments
  • id: Request identifier (any number)
📥
Response Format
  • jsonrpc: Protocol version ("2.0")
  • id: Matches request id
  • result: Success data (hex-encoded)
  • error: Error object (if failed)

🎮 Interactive: RPC Method Explorer

Select an RPC method to see its request format, response structure, and description. This demonstrates how applications communicate with blockchain nodes.

📤 Request
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": [
    "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "latest"
  ],
  "id": 1
}
📥 Response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1bc16d674ec80000"
}

Decoded: 2 ETH
💡 What This Does

Returns the balance of the account at a given address. Result is in wei (smallest ETH unit).

🌐 RPC Providers

Applications don't run their own nodes—they connect to RPC providers (node infrastructure services). These providers expose HTTP/WebSocket endpoints you can call.

Public RPC

Free endpoints (Infura, Alchemy free tier). Rate-limited (10-100 req/sec). Good for development/testing. Example: https://mainnet.infura.io/v3/YOUR_KEY

Premium RPC

Paid plans (Infura Growth, Alchemy Scale). Higher limits (1,000-10,000 req/sec), better reliability. Required for production dApps. ~$50-500/month.

Self-Hosted Node

Run your own Geth/Erigon node. No limits, full control, maximum decentralization. Requires server (~$200/month), DevOps expertise, 2+ TB storage.

💡 Key Insight

RPC is the invisible layer that makes Web3 work. Every blockchain interaction—checking balances, reading contracts, sending transactions, querying events—uses RPC calls under the hood. Libraries like ethers.js and web3.js abstract RPC complexity, but understanding the underlying JSON-RPC protocol is crucial for debugging, optimizing performance, and building robust dApps. Good developers know RPC. Great developers master it.

Wallet Connect Demo