Bắt đầu với TheRPC
Tham khảo API
Ethereum API
Core API
Hướng dẫn
Ethereum/Tổng quan

API Overview

Architecture

TheRPC API follows JSON-RPC 2.0 specification and provides:

  • Standard HTTP and WebSocket endpoints
  • Authentication via API keys
  • Unified response formats
  • Cross-network compatibility

Communication Protocols

HTTP Endpoints

Best for single requests and simple integrations. See examples in our HTTP/Curl guide.

https://YOUR_API_ENDPOINT

WebSocket Endpoints

Ideal for subscriptions and real-time data. See eth_subscribe for subscription examples.

wss://YOUR_API_ENDPOINT

JSON-RPC Format

Request Structure

All API calls follow the JSON-RPC 2.0 format. See complete examples in our Basic Operations guide:

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

Required fields:

  • jsonrpc: Version identifier (always "2.0")
  • method: The RPC method to call (see Available Methods)
  • params: Array of parameters (can be empty)
  • id: Request identifier

Response Format

All responses follow a consistent structure:

{
	"jsonrpc": "2.0",
	"id": 1,
	"result": "0x..."
}

Or in case of error:

{
	"jsonrpc": "2.0",
	"id": 1,
	"error": {
		"code": -32600,
		"message": "Invalid Request"
	}
}

Authentication

All requests require an API key in the Authorization header. See our Authentication guide for detailed setup:

Authorization: Bearer YOUR_API_KEY

Method Categories

Standard Methods

Advanced Methods

Error Handling

Common error codes (see FAQ for detailed error handling strategies):

  • -32700: Parse error
  • -32600: Invalid request
  • -32601: Method not found
  • -32602: Invalid params
  • -32603: Internal error

Implementation Examples

For practical implementation examples, check our language-specific guides:

Rate Limits

For information about request limits and quotas, see our Rate Limits documentation.

See Also

Giúp chúng tôi trở nên tốt hơn!
Chia sẻ trang này và giúp chúng tôi tạo ra sản phẩm tốt hơn cho bạn.