Base
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Base
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
TheRPC's Base API follows the JSON-RPC 2.0 specification, so it speaks the same protocol every Ethereum and OP Stack client already understands. The service is built around four characteristics: standard HTTP and WebSocket endpoints on base.therpc.io; simple API-key authentication via a Bearer header; a unified response format identical across every method; and cross-network compatibility, meaning the same request shape and the same API key work against Base (chain ID 8453) and every other network TheRPC serves — you only swap the host. Because Base is EVM-equivalent, tools like ethers.js, viem, web3.js, and web3.py connect without any Base-specific changes.
The HTTP endpoint is the best choice for single requests and straightforward integrations against Base: balance checks, one-off contract reads, transaction submission, and batched queries. Each call is a self-contained POST, which makes it easy to drop into serverless functions, cron jobs, and backend services. For copy-paste request examples, see the HTTP/Curl guide.
The WebSocket endpoint is ideal for subscriptions and real-time data on Base. With Base producing a fresh block roughly every 2 seconds, a persistent connection lets you stream new heads, logs, and pending transactions as they happen instead of polling — perfect for trading bots, indexers, and live dashboards watching Aerodrome or Uniswap activity. See the eth_subscribe reference for subscription examples.
Every call to the Base API uses the JSON-RPC 2.0 format. A request object carries four fields: jsonrpc, which is always the string "2.0"; method, the name of the call such as eth_blockNumber; params, an array of arguments (empty when none are needed); and id, a client-chosen identifier used to match the response back to its request, which matters when you batch or pipeline many calls.
Every response from the Base API shares a consistent structure. It echoes jsonrpc: "2.0" and the same id you sent, then carries exactly one of two outcomes: a result field on success, or an error object (with a numeric code and human-readable message) on failure. Checking which field is present is all your client needs to do to branch between handling data and handling an error.
All requests to the Base API must carry your TheRPC API key in the Authorization header using the Bearer scheme. The key both authenticates you and ties usage to your plan and quota. For how to generate, store, and rotate keys safely — plus per-language setup — see the full Authentication guide.
Base methods fall into two groups. Standard methods cover everyday work: eth_ for the core protocol (blocks, balances, transactions, contract calls), net_ for network status, and web3_ for utility helpers. Advanced methods serve deeper analysis: debug_ for step-by-step debugging, trace_ for full transaction tracing, and txpool_ for inspecting the pending pool. Each prefix on this page links through to the specific method docs, where you will find parameters, return shapes, and runnable examples for Base.
The Base API returns the five standard JSON-RPC error codes: -32700 for a parse error (malformed JSON), -32600 for an invalid request, -32601 when the method is not found, -32602 for invalid params, and -32603 for an internal error. Reading the code lets your client decide whether to fix the request, retry, or surface the failure. For detailed error-handling strategies and retry patterns, see the FAQ.