RapidNode Docs
Back to WebsiteX/Twitter
  • Welcome
    • What is RapidNode?
  • Solana RPC Nodes
    • RapidNode RPCs Overview
    • Dedicated Nodes
      • Getting Started with Dedicated Nodes
    • Dedicated Staked Connections
    • Common Error Codes
  • RPC
    • HTTP
      • getAccountInfo
      • getBalance
      • getBlock
      • getBlockCommitment
      • getBlockHeight
      • getBlockProduction
      • getBlockTime
      • getBlocks
    • Websocket
  • Data Streaming
    • gRPC
    • Webhooks
  • Solana APIs
    • Priority Fee API
    • Enhanced Transaction API
    • Token Metadata API
  • Guides
    • RPC Proxy — Protect Your Keys
    • Sending Transactions on Solana
  • Resources
    • RapidNode Blog
    • SDKs
    • Transaction Types
    • Status Page
Powered by GitBook
On this page
  • Info
  • Request Formatting
  • Example Request using cURL
  • Response Format
  • Batch Requests
  • Example Request with Commitment
  • Definitions
  1. RPC

HTTP

Solana nodes accept HTTP requests using the JSON-RPC 2.0 specification.

Info

  • For JavaScript applications, use the @solana/web3.js library as a convenient interface for the RPC methods to interact with a Solana node.

  • For a PubSub connection to a Solana node, use the WebSocket API.


Request Formatting

To make a JSON-RPC request, send an HTTP POST request with a Content-Type: application/json header. The JSON request data should contain the following fields:

Field
Type
Description

jsonrpc

string

Set to "2.0".

id

string | number

A unique identifier for the request, generated by the client. Can be a string, number, or null.

method

string

The name of the method to invoke.

params

array

A JSON array of ordered parameter values.

Example Request using cURL

curl https://mainnet.rapidnode-rpc.com/?api-key=<api-key> -s -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBalance",
    "params": [
      "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"
    ]
  }
'

Response Format

The response will be a JSON object with the following fields:

Field
Type
Description

jsonrpc

string

Matches the request specification.

id

number

Matches the request identifier.

result

array|number|object|string

Requested data or success confirmation.


Batch Requests

Requests can be sent in batches by sending an array of JSON-RPC request objects in a single POST request.


Example Request with Commitment

The commitment parameter should be included as the last element in the params array:

curl https://mainnet.rapidnode-rpc.com/?api-key=<api-key> -s -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBalance",
    "params": [
      "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
      {
        "commitment": "finalized"
      }
    ]
  }
'

Definitions

  • Hash: A SHA-256 hash of a chunk of data.

  • Pubkey: The public key of an Ed25519 key-pair.

  • Transaction: A list of Solana instructions signed by a client keypair to authorize those actions.

  • Signature: An Ed25519 signature of a transaction's payload data, including instructions. This can be used to identify transactions.

PreviousCommon Error CodesNextgetAccountInfo

Last updated 4 months ago