paint-brush
What is a Remote Procedure Call (RPC)?by@drpc
1,023 reads
1,023 reads

What is a Remote Procedure Call (RPC)?

by DRPCSeptember 11th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A Remote Procedure Call (RPC) is a communication protocol that enables a program to execute a subroutine or procedure on a remote system over a network. This essentially allows programmers to communicate over a distributed network of nodes. Developers use RPCs to send requests to a node, such as creating a new address or sending a transaction. The node processes the request, updates the blockchain network accordingly, and then returns the result to the developer.
featured image - What is a Remote Procedure Call (RPC)?
DRPC HackerNoon profile picture


A Remote Procedure Call (RPC) is a communication protocol that enables a program to execute a subroutine or procedure on a remote system over a network. This essentially allows programmers to communicate over a distributed network of nodes. The pioneering RPC procedure used on Ethereum is Javascript Object Notation (JSON) RPCs.


Developers use RPCs to send requests to a node, such as creating a new address or sending a transaction. The node processes the request, updates the blockchain network accordingly, and then returns the result to the developer via an RPC. This allows the developer to build a cryptocurrency wallet that can interact with the blockchain network and perform various functions, such as sending and receiving transactions. This is useful because it facilitates the process of actually communicating this information over the blockchain network with supporting infrastructure presenting this information in a user-friendly way.


Recently, we have seen that RPC layers can simplify the process of building applications. For instance, if a developer wants users to view their external wallet's crypto balance within a new DeFi liquidity farming site, they can build an API (Application Programming Interface) that communicates with the wallet to find out what the user holds. From the case studies and recent news, it can be seen that the RPC landscape is evolving.


Existing Challenges with Ethereum’s RPC Infrastructure

The reoccurring surge in memecoins on Ethereum over its lifecycle has led to network congestion, causing soaring transaction costs and a growing backlog of unconfirmed transactions​​.


This has highlighted the limitations of Ethereum’s RPC infrastructure in particular as these network issues indicate a wider problem with how RPC nodes are distributed within the ecosystem. Currently, Ethereum’s network of RPC providers is highly centralized, with most requests being fulfilled by several centralized providers.


Cryptocurrency exchanges often provide APIs that allow different software programs to communicate and exchange data with a blockchain or crypto exchange platform and allow traders to access trading data and execute trades programmatically. These APIs may use RPCs to communicate with the exchange's trading engine and execute orders on behalf of the user.


We have also more recently seen RPCs exploited to carry out DeFi exploits. By manipulating RPCs, attackers can trick oracles into inaccurately indexing prices which allows more liquidity to be drained from a smart contract than intended. This is what happened in the attack on tender.fi which suffered a $1.6m loss from such an exploit.


RPC interfaces can be used to allow a cryptocurrency wallet application to communicate with a full node running on the blockchain network. This allows the wallet to query the blockchain for information such as balances and transaction histories, as well as send transactions to the network for processing.


Robust RPC Structures

  • Interoperability: Despite the fact that each blockchain has its own special features and capabilities, the core set of methods is almost always the same. This greatly increases the portability of your applications between different blockchains. So, JSON RPC is a ’lingua franca’, or bridging infrastructure for web3.


    However, you can easily add some blockchain-specific methods or even modify existing ones by adding some additional parameters to them.


    Also, because the typical JSON RPC payload will be transmitted using an HTTP POST request body, there are no limitations on its size.


    There are a number of open-source clients that help you use JSON RPC as a client, such as web3.js. You only need to have the JSON RPC server URL.



  • Flexibility: By using different RPC services, developers can choose the best tool for the job. Different RPC services may have different strengths and weaknesses, and choosing the right one can help optimize performance, security, reliability and costs.


    A flexible RPC framework allows developers to interact with multiple blockchain networks through a single interface, enabling them to create more versatile applications and have transparent statistics about different methods usage, their cost and performance.



  • Tech stack diversity: On the Execution Layer, the Ethereum ecosystem is highly monopolized by Geth and Eregon clients, but there are also several others, like Nethermind, Besu, rETH. Robust infrastructure shouldn’t be mono-client and should work with at least 3-4 clients to ensure reliability on the Ethereum client software level.



  • Redundancy: By using multiple RPC services, developers can create redundant systems that can switch between different RPC providers if one fails or lagging. This can help ensure that the system remains operational even in the event of a failure.



Distributed and decentralized networks of RPC providers may create a more cost-effective and energy-efficient environment where data consumers don’t rely on one centralized entity but are supported by independent Web3 infrastructure players. In this structure, dApps can even host their own RPC endpoints, connect them to the RPC network, and reduce infrastructure costs significantly.



Centralized RPCs

Decentralized RPCs

Control

Centralized

Decentralized

Architecture

Client-server

Peer-to-peer

Scalability

Medium

High

Fault Tolerance

Limited

High

Trust Model

Trust vested in the central authority

Trust delegated amongst the network

Performance

Dependent on the central server

Dependent on network and latency

Data Security

Relies on central server security

Distributed security through cryptography and consensus




Author: Constantine Zaitcev, Chief Product Officer of DRPC

Constantine is the Chief Product Officer of DRPC, an Ethereum-based decentralized RPC network that enhances security, reliability, and cost-efficiency for Web3 projects of all sizes. Constantine has over 15 years of work experience, nine of which have been in the crypto industry, including being the former Head of Product at P2P.ORG and PMO at Ambisafe.co.