Getting Started with the RPC API
The Avalanche RPC API provides direct access to the Platform Chain (P-Chain) and Exchange Chain (X-Chain) through JSON-RPC 2.0 endpoints. This guide will help you make your first RPC calls to interact with Avalanche’s core chains.Prerequisites
- Basic understanding of JSON-RPC
- A tool for making HTTP requests (curl, Postman, or any programming language with HTTP support)
- Access to an Avalanche node endpoint
Making Your First RPC Call
All RPC calls follow the standard JSON-RPC 2.0 format. Here’s an example to get the current height of the P-Chain:Response Format
All responses follow the JSON-RPC 2.0 standard:Common Use Cases
The RPC API enables you to:- Query Validators: Get information about current validators and their stakes
- Monitor Staking: Track staking rewards and delegation details
- Manage Subnets: Create and manage custom blockchain networks
- Access Blocks: Retrieve block data by height or hash
- Track Transactions: Query transaction status and details
Next Steps
- Explore the platform methods for P-Chain operations
- Review validator endpoints for staking information