Many people encounter the term RPC when manually adding a network RPC in wallets like MetaMask. However, RPC is an indispensable foundational technology for blockchain applications such as Dapps, Wallets, and CEXs. RPC stands for “Remote Procedure Call.” In Web2, RPC is a communication technique that allows one computer to call and execute a program on another. Through RPC, the caller only needs to pass the service name and parameters to communicate, a broad concept. In the blockchain context, RPC is the protocol that allows clients to interact with the blockchain. Users can query blockchain-related information (such as block height, block details, and node connections) and send transactions through the RPC interface.
Metamask Network Additions page (Source: Metamask)
It’s vital to understand the three primary roles of RPC:
RPC call graph (source: Google)
The detailed technical architecture is shown in the figure above. To explain to you more clearly, we take the process of the project manager completing the report as an example to explain the detailed invocation process:
To elucidate using a simple analogy, imagine you’re a project manager needing a complex report. You might not be technically adept, so you enlist a data analyst. You:
Given the decentralized and distributed nature of blockchains, data is stored across numerous nodes. Notably, to run a node and participate in block validation, computers need to meet specific hardware and software criteria. In networks like ETH and ADA, running nodes also demand staking a certain amount of tokens.
Not every node can use the RPC protocol. Typically, only computers running blockchain client software can act as RPC nodes. Most projects cannot bear the operational and maintenance costs of running nodes, given the immense time, manpower, and resources required. This gave rise to dedicated RPC nodes and service providers.
From the previous section, it’s evident that a vital function of RPC (Remote Procedure Call) is to establish a connection between terminal applications and the blockchain. Therefore, the primary use of RPC is, during the development process, to choose an appropriate RPC service provider to enable users to execute on-chain transactions and queries.
For the average Web3 user, the most direct use-case is to switch to an RPC gateway with lower latency during network congestion, thereby reducing their delay and speeding up transaction execution. In theory, RPC can be applied to any project that requires blockchain transactions or information queries.
The vast majority of blockchains offer free public RPCs for application testing. However, these come with rate limitations, leading to the emergence of private RPCs. A private RPC endpoint has a unique URL, and only its owner can use this URL to send transactions to the public memory pool, thus offering a direct connection to the node provider. The benefits of using private RPCs in practice include:
Regarding RPC usage in development, developers should refer to documentation. This article uses the RPC switch in wallets, like MetaMask, as an illustration: Go to settings, select the network, click on the network name you wish to change the RPC for, modify the RPC URL on the right, and save to finalize the change. Users should consider latency levels as switching to a high-latency RPC might slow transaction speeds.
MetaMask has an RPC change page (source: MetaMask web version).
When using it, it’s crucial to compare latency levels. If you switch to an RPC with higher latency, transaction speeds may slow down.
Due to the complexity of setting up and operating nodes, there has emerged a category of businesses that specialize in operating these nodes to provide services such as RPC/API to projects. Projects can send requests to these providers via the Internet. These providers run fully synchronized, always-updated nodes available 24/7, rather than the projects sending requests to their local nodes. Many providers offer more than just RPC services; they also offer various related services like APIs, SDKs, etc. For developers and individual users, when choosing a provider, it’s essential to consider factors like transaction speed, cost, customer service, and the range of tools they offer.
RPC service providers also provide the private RPCs mentioned earlier. Most RPC providers cater to multi-chain operations and often offer free trial and public versions. Below are some popular RPC service providers:
Flashbots is a research-driven company focusing on Miner Extractable Value (MEV), aiming to mitigate the negative externalities and risks that MEV poses to smart contract blockchains. Their RPC service, Flashbots Protect, consists of both RPC and API. Developers can easily embed it into their applications using the API. Ordinary users can add its RPC to their wallets, directing their transactions to Flashbots. This process involves sending transactions directly to miners instead of the public pool, preventing the “sandwich attack” prevalent in MEV. Currently, Flashbots is a leading entity in the industry for MEV research.
Note: A sandwich attack refers to the tactic of completing a trade just before a user’s transaction gets confirmed, causing the price to rise, and then selling at a premium after the user’s transaction completes to make a profit.
Infura is an IaaS (Infrastructure as a Service) product designed to make accessing Ethereum data easier for developers and users. Acting as a full Ethereum node, it offers an API interface that allows DApps to be swiftly connected to the Ethereum platform for interaction without running a local Ethereum node. Its clientele includes Metamask, Uniswap, Compound, and more.
Alchemy provides SDKs and APIs for building multi-chain Web3 DApps, and educates users on using these tools through community and university-like initiatives. Alchemy has supported over $100 billion in on-chain transaction value, has over 10 million end users, and has generated over $1.5 billion in royalties. Notable clients include Opensea, GMX, and AAVE.
Ankr offers various node services, including public and private nodes, supporting over 30 blockchains. Ankr also provides API interfaces based on RPC and WebSocket protocols, as well as several development tools and SDKs, such as Web3.js and Truffle, enabling developers to easily build and deploy blockchain applications. Their client base includes Binance, Sushiswap, Meta Apes, and more.
QuickNode provides API services to users directly through dedicated nodes. It supports various regions, multiple testnets, and archive nodes, offering developers enhanced blockchain access performance and greater stability. Features include an intuitive dashboard, analytics suite, and a remote procedure call writer, supporting over 20 chains. Clients include Nansen, Algofi, and Dapprader.
BlockPI is an RPC with a distributed network structure, a distributed multi-chain acceleration layer participating in the decentralized Web3 environment. In early 2023, it successfully upgraded its public RPC, offering a more stable and faster free RPC service. In theory, its architecture fundamentally addresses the congestion issue of RPC requests and boasts infinite scalability.
With the continuous maturation of blockchain technology and increasing adoption of Web3, RPC services, as one of the foundational services, hold a promising future. The demand from developers for RPC services is predictably going to rise. From an individual’s perspective, frequent traders who require faster transaction speeds could benefit greatly from selecting a lesser-used public RPC or investing in a private RPC, especially for activities like airdrops or NFT minting.