What is an RPC node?

What is an RPC node?

One of the core components of all decentralized applications is that they execute various kinds of user transactions over a blockchain.

To do this, dApps must always be able to communicate with the blockchain, verify the details of the transactions, and process them. But dApps aren’t meant to directly communicate with the blockchain. That means they cannot send requests, retrieve data, or verify and process transactions on their own.

To do that, they rely on a system called RPC nodes. If a dApp cannot connect with RPC nodes, it will be unable to process any user request.

But what exactly are RPC nodes? And why can’t dApps function without them?

In this blog, we will explain what RPC nodes are, how they work, and how you can easily use them with your dApp.

What is an RPC node?

A Remote Procedure Call node or RPC node is a system that bridges decentralized applications (dApps) with the blockchain. dApps use RPC nodes to request various information from a blockchain network or send transactions from its interface to the blockchain so that they can get processed.

So, for example, let’s say you’re using a decentralized exchange (DEX) and request to swap ETH for USDT. Although you’re requesting this transaction through the DEX interface open on your browser, the DEX must communicate with the blockchain for two things:

Check whether your wallet (based on the blockchain) has the amount of ETH you want to swap.

Send the transaction to the blockchain nodes for verification and execution.

To do this, the DEX uses an RPC node to tell you in real-time whether or not you have the required amount of ETH. If you do, and confirm the transaction, it again uses an RPC node to broadcast your request to the blockchain network.

That is a surface-level explanation of what RPC nodes are and why they matter for dApps. For a better understanding, let’s now dive deeper and understand how RPC nodes work.



How do RPC nodes work?

The best way to understand how RPC nodes work is to individually understand three concepts: RPCs, nodes, and RPC endpoints.

When you understand these two concepts well, it automatically becomes clear how RPC nodes work.

Here’s what the two terms mean on an individual level.

What is a Remote Procedure Call (RPC)?

Remote Procedure Call is a software communication protocol that allows one software program to call and request a service from another software based on a different computer.

It works on a client-server model, where the client is the software that sends a request or query and the server is the software based on a different machine that responds to that request. The action performed by the server is called a procedure or a subroutine.

Let’s suppose you use a weather app on your smartphone. When you request the weather update on any location, the app uses an RPC to a server that stores relevant updated weather information. The server then returns the information you requested.

What is a blockchain node?

A blockchain node is a computer that runs a blockchain software and maintains a copy of the blockchain’s transactions. It also relays, verifies, and executes transaction requests from users and smart contracts.

As a blockchain does not have a central server or computing environment, it relies on hundreds or even thousands of nodes to act as a distributed and decentralized server.

What is an RPC endpoint?

Everything on the web has an address and a door even. You can imagine an RPC endpoint as a network location or address where a client can send requests. The request knocks on the server’s door, where the server receives it and performs the required action.

Now, let’s bring all these back together in the context of blockchain-based dApps.

Putting it all back together

RPC nodes are blockchain nodes that have an RPC endpoint, enabling them to respond to requests from dApps.

When a dApp (the client) needs any information from a blockchain or wants to relay a new transaction, it uses an RPC to send a request to the RPC endpoint. The RPC node (the server) with the endpoint then receives that request and returns the desired information.

💡
Having a reliable RPC node that offers near-100% uptime and stays up-to-date is crucial for your dApp. Otherwise, your dApp transactions may fail or get stuck, resulting in a poor user experience.

The Ethereum ecosystem and many other blockchains use a standardized type of RPC protocol dubbed JSON-RPC.

For the sake of understanding, let’s take Ethereum’s example. To let dApps query any type of blockchain data, JSON-RPC on Ethereum relies on a wide range of methods such as:

  • eth_blockNumber: returns the number of the most recent block.
  • eth_getBalance: returns the balance of a specific account.
  • eth_sendTransaction: sends a new transaction to the network.
  • net_version: returns the current network ID.
  • eth_getTransactionReceipt: returns receipt of a transaction by transaction hash.
  • eth_estimateGas: returns an estimate of the gas needed for a transaction.

These are only a few of the many other methods dApps can use to interact with the Ethereum network. And each blockchain has its own custom set of methods while the underlying protocol remains the same.



Self-hosted RPC nodes vs. RPC node services

Every blockchain has a set of RPC endpoints that are available for public usage. However, these public RPC endpoints have limited bandwidth. That means, they can only offer a limited number of calls and are not meant to support the request volume that a dApp may send.

That’s why it becomes crucial to use a private RPC endpoint/node. And there are two ways you can go about this:

  1. Host your own RPC node
  2. Use an RPC node service.

While both of these will serve the same purpose, the difference is in terms of flexibility, ease, and a few other factors. To get a better understanding, check out the below comparison table:

Clearly, for simplicity, RPC node services are better and the go-to choice for most dApp developers.

However, if you want to go the extra mile, you can set up an alternative RPC node to function alongside the RPC node service. So, in case the RPC node service is ever down, your self-hosted node can manage the requests.



Frequently Asked Questions (FAQs)

What does RPC stand for?

RPC stands for Remote Procedure Call, which is a technique for a software program to query, retrieve, and respond to information by calling a different program on a different computer.

Is RPC the only way for dApps to communicate with a blockchain?

No, RPC is one type of communication protocol that nodes and dApps use for communication. WebSockets and custom APIs can also allow dApps to send requests and retrieve information from a blockchain. However, RPC is the most commonly used protocol.

Can a dApp operate its own RPC node?

Yes, blockchains are open systems and anyone can set up a node. That allows a dApp creator to compose a dedicated RPC node with an endpoint that only receives requests from one dApp. However, most dApps today prefer to use RPC node service to avoid the cost and hassle of setting up and maintaining a blockchain node.

Where can I get RPC node service?

thirdweb is the complete web3 development framework for you to deploy smart contracts and build dApps easily, for free — offering a range of SDKs and a highly reliable RPC node services with almost 100% uptime, for any EVM-compatible blockchain.

See all of thirdweb's RPC endpoints here:

Chainlist: RPCs, Block Explorers, Faucets
A list of EVM networks with RPCs, smart contracts, block explorers & faucets. Deploy smart contracts to all EVM chains with thirdweb.

RPC nodes: The backbone of decentralized applications

RPC nodes are a crucial part of keeping dApps online and processing user requests, especially when your app is built to manage a huge audience. A reliable RPC node ensures that your dApp can query as much information as its needs from the blockchain and your users never face delays in transactions.

So while operating your own RPC node is a good idea, using a service like thirdweb removes the hassle of maintaining it & allows you to focus on building great dApp experiences for your users.

We hope this blog post has helped you better understand what an RPC node is, how it works, and how you can get started with one to build your dApp with. If you have any questions, join 35,000+ other builders in our Discord community.

And if you want to use our free RPC endpoints to build your dApps, get started with thirdweb’s web3 development stack & SDKs — they’re free!