# Solana RPC Working Principles

Solana RPC (Remote Procedure Call) serves as a critical interface for applications to interact with the Solana blockchain. Based on the JSON-RPC 2.0 protocol, it allows developers to access blockchain data and submit new transactions via RPC nodes. The working principles are as follows:

## **Basic Architecture**

Solana RPC provides standardized API interfaces with primary functions including:

* **Data Query**:
  * `getBlock` to fetch block information.
  * `getBalance` to retrieve account balances.
* **Transaction Submission**:
  * `sendTransaction` to send signed transactions.
* **Event Subscription**:
  * WebSocket for real-time on-chain activity monitoring (e.g., account changes, log updates).

## **Node Types and Roles**

The Solana network includes two node types:

1. **Validator Nodes**: Participate in consensus and maintain blockchain state, typically not exposing RPC interfaces directly.
2. **RPC Nodes**: Designed for external requests, divided into:
   * **Public RPC**: Free to use but rate-limited (e.g., Solana official endpoint `api.mainnet-beta.solana.com`).
   * **Dedicated RPC**: Provided by service providers, supporting high concurrency and low latency at a cost.

## **Request Processing Flow**

1. **Request Submission**: Developers send requests to RPC nodes via APIs.
2. **Validation**: Nodes verify request legitimacy.
3. **Data Query**: Nodes retrieve local data (blocks, transactions, accounts, etc.).
4. **Response**: Results are returned to developers in JSON format:
   * Successful requests yield corresponding data.
   * Failed requests return error codes.
