Logo
New RPC users get 35% off their first monthView the offer
dRPC
dRPC6 min read

dRPC API: A Practical Guide to the dRPC RPC API

A practical guide to the dRPC API, covering how to obtain an endpoint, authenticate requests, and integrate dRPC into your blockchain applications.

TL;DR

The dRPC API provides HTTP and WebSocket access to multiple blockchain networks through a unified interface. This guide explains how to obtain an endpoint, authenticate requests, and use the API effectively in your applications.

What Is the dRPC API?

The dRPC API is a remote procedure call (RPC) service that lets developers interact with blockchain nodes without running their own infrastructure. It supports JSON-RPC over HTTP and WebSocket, along with additional features such as archive data access and multi-chain routing.

dRPC aims to simplify blockchain integration by offering a single API endpoint that can route requests to various networks. This is useful for applications that need to query multiple chains or require reliable access to node data.

  • JSON-RPC over HTTP and WebSocket
  • Support for multiple blockchain networks
  • Archive data and enhanced API methods
  • Authentication via API keys

Getting Started with the dRPC API

To use the dRPC API, you typically need to sign up for an account and generate an API key. The API key is used to authenticate your requests and track usage. dRPC provides documentation and a dashboard where you can manage your keys and monitor activity.

Once you have an API key, you can construct your endpoint URL. dRPC endpoints usually follow a pattern that includes the network identifier and your API key. For example, an HTTP endpoint for Ethereum mainnet might look like this:

  • Create an account on the dRPC platform
  • Generate an API key from the dashboard
  • Choose the network you want to connect to
  • Use the provided endpoint URL in your application
https://lb.drpc.org/ogrpc?network=ethereum&dkey=YOUR_API_KEY

Authentication and Endpoint Structure

dRPC uses API keys for authentication. The key is passed as a query parameter in the endpoint URL or included in the request headers, depending on the endpoint type. It is important to keep your API key secure and not expose it in client-side code.

The endpoint structure varies by network and protocol. For HTTP requests, you send POST requests with a JSON-RPC payload. For WebSocket connections, you establish a persistent connection to the WebSocket URL.

  • API key required for all requests
  • HTTP endpoints accept JSON-RPC POST requests
  • WebSocket endpoints support subscriptions
  • Keep API keys confidential
POST https://lb.drpc.org/ogrpc?network=ethereum&dkey=YOUR_API_KEY
Content-Type: application/json

{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}

Supported Networks and Methods

dRPC supports a wide range of blockchain networks, including Ethereum, Polygon, Binance Smart Chain, Arbitrum, Optimism, and many others. The available methods depend on the network and the type of node (full or archive).

Standard JSON-RPC methods such as eth_call, eth_getBalance, and eth_sendRawTransaction are supported. dRPC also offers enhanced methods for some networks, which may include trace APIs or debug APIs. It is advisable to check the dRPC documentation for the latest list of supported networks and methods.

  • Ethereum, Polygon, BSC, Arbitrum, Optimism, and more
  • Standard JSON-RPC methods
  • Archive data access on supported networks
  • Enhanced APIs like trace and debug (availability varies)

Practical Usage Tips

When integrating the dRPC API, consider implementing retry logic and error handling to manage temporary network issues. Use environment variables to store your API key securely. For high-volume applications, monitor your usage to avoid rate limits.

If you need real-time data, use WebSocket connections for subscriptions to new blocks or pending transactions. For simple queries, HTTP requests are sufficient and easier to implement.

  • Implement retries with exponential backoff
  • Store API keys in environment variables
  • Use WebSockets for real-time subscriptions
  • Monitor usage and rate limits

Common Questions About the dRPC API

Users often ask about pricing, reliability, and supported features. dRPC offers various plans, and details can be found on their website. The service provides status information and a Discord community for support.

For specific questions about the dRPC API, refer to the official documentation or reach out to their support channels. Always verify current features and limits directly with dRPC, as offerings may change.

  • Check dRPC website for pricing details
  • Join dRPC Discord for community support
  • Review official documentation for method support
  • Monitor dRPC status page for service updates

Never Worry about Infrastructure Again

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

Get Started