# Welcome

CoinVera lets you **stream real-time token prices on Solana** from all the top DEXs via a simple WebSocket API. With CoinVera you can:

* Subscribe to price updates for **any token**
* Monitor trades by **mint address** or **wallet**
* Retrieve on-demand price information at millisecond latency

> **Beta Notice**\
> CoinVera is currently in **BETA**. We’re continuously improving the platform, and your feedback is invaluable. Join our community, explore the docs, and let us know how we can make CoinVera even better!

Enjoy building,\
The CoinVera Team 🚀


# Quickstart

Sign up, grab your API key, pick a plan—and connect via WebSocket to stream live Solana token prices in minutes.

Follow these simple steps to start using CoinVera’s WebSocket API:

1. **Create your account**\
   Visit [coinvera.io](https://www.coinvera.io) and sign up for a free account.
2. **Generate an API key**
   * Log in and navigate to the **API Keys** section in your dashboard.
   * Click **Create New Key** and give it a descriptive name.
   * Copy your API key— you’ll need it for authentication.
3. **Choose a subscription plan**
   * Go to the **Plans** page.
   * Select the plan that best fits your requirements.
   * If you’re just testing, the **FREE** plan is a great way to get started.
   * You can always upgrade as your needs grow.
4. **Connect and start streaming**
   * Use your API key to authenticate your WebSocket connection.
   * Subscribe to price feeds, trade events, or wallet activity in real time.

You’re all set! 🚀


# API Endpoints


# SOL Endpoints

Discover CoinVera’s Solana API endpoints for real-time token prices across top DEXs—including PumpFun, Raydium, Meteora, and Moonshot—for low-latency market data.

## Solana Endpoints

Below is the complete list of REST endpoints you can use to fetch Solana token price data:

| Endpoint                            | Description                                                                                                                                          |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Auto-Detect (Increased Latency)** | <p><code><https://api.coinvera.io/api/v1/price></code><br>Automatically routes your request to the fastest available DEX. Ideal for general use.</p> |
| **PumpFun**                         | <p><code><https://api.coinvera.io/api/v1/pumpfun></code><br>Direct access to PumpFun price data.</p>                                                 |
| **Raydium (All Pools)**             | <p><code><https://api.coinvera.io/api/v1/raydium></code><br>Stream prices from every Raydium liquidity pool.</p>                                     |
| **Meteora (All Pools)**             | <p><code><https://api.coinvera.io/api/v1/meteora></code><br>Unified feed for all Meteora pools, with PumpFun support.</p>                            |
| **Moonshot**                        | <p><code><https://api.coinvera.io/api/v1/moonshot></code><br>Get real-time prices from Moonshot’s AMM pools.</p>                                     |

> **Note:** We’re always adding more endpoints—check back here for updates!


# Solana


# RPC


# getAccountInfo

Explore the full capabilities of getAccountInfo—including its key use cases, example code snippets, request parameters, response format, and expert tips for effective integration.

The `getAccountInfo` RPC method is a core utility for querying detailed information about any account on the Solana blockchain. By supplying a public key, this method returns comprehensive data about the associated account—such as its balance, ownership, executable status, and raw or parsed storage data.

***

#### 🔍 Common Use Cases

* **Check SOL Balance**\
  Retrieve the lamport balance (1 SOL = 1,000,000,000 lamports) for any public key.
* **Verify Account Initialization**\
  Determine if an account exists and has been initialized with lamports or data.
* **Inspect Program State**\
  Read data stored in program-owned accounts—vital for decoding on-chain program states.
* **Identify Account Ownership**\
  Determine which program owns the account to understand how its data should be interpreted.
* **Check Executability**\
  Discover whether an account contains a deployed program (i.e., if it’s executable).

***

#### 🛠 Parameters

* **`publicKey`** (*string, required*):\
  Base-58 encoded public key of the account to query.
* **`config`** (*object, optional*):\
  Optional configuration fields:
  * `commitment` (*string*):\
    Sets the desired commitment level:
    * `finalized` *(default)* – Highest confirmation level.
    * `confirmed` – Voted on by supermajority.
    * `processed` – Most recent block, possibly unconfirmed.
  * `encoding` (*string*):\
    Specifies the data encoding:
    * `base64` *(default)*
    * `base58` *(slower)*
    * `base64+zstd` *(for compressed data)*
    * `jsonParsed` *(for known account types like tokens or stakes)*
  * `dataSlice` (*object*):\
    Return a partial slice of the data (valid only for binary encodings):
    * `offset`: Starting byte offset.
    * `length`: Number of bytes to return.
  * `minContextSlot` (*number*):\
    Minimum slot that must be reached before evaluating the request.

***

#### 📦 Response Structure

If the account exists, the `result` object includes:

* **`context`** (*object*):
  * `slot`: The slot at which the data was retrieved.
  * `apiVersion`: (Optional) The version of the RPC API used.
* **`value`** (*object | null*):\
  If `null`, the account was not found. Otherwise:
  * `lamports` (*number*): Total SOL balance in lamports.
  * `owner` (*string*): Public key of the program that owns the account.
  * `data` (*array | object | string*): Account data content:
    * For `base64`, `base58`, or `base64+zstd`: `[encoded_string, encoding]`
    * For `jsonParsed`: Parsed JSON if applicable, otherwise defaults to base64 structure.
  * `executable` (*boolean*): `true` if the account contains a program.
  * `rentEpoch` (*number*): The next epoch at which rent will be collected.
  * `space` (*number*, optional): Total allocated byte size of the account’s data.

If the account is not found, the `value` will be `null`.

***

#### 💡 Example: Querying Account Info

Let’s retrieve information for the Serum V3 program ID on mainnet:

**Public Key:**\
`4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5`

**Sample Request (CoinVera RPC):**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getAccountInfo(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getAccountInfo',
        "params": [
            "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
            {
              "encoding": "jsonParsed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getAccountInfo(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_account_info(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getAccountInfo",
            "params": [
                "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
                {
                    "encoding": "jsonParsed"
                }
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_account_info(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": {
      "slot": 355178140,
      "apiVersion": "2.2.7"
    },
    "value": {
      "lamports": 196248541,
      "data": [
        "",
        "base64"
      ],
      "owner": "11111111111111111111111111111111",
      "executable": false,
      "rentEpoch": 18446744073709552000,
      "space": 0
    }
  }
}
```

#### 💡 Developer Tips (Using `getAccountInfo` with CoinVera)

* **Optimize with `getMultipleAccounts`**\
  For applications that require checking multiple accounts simultaneously, use the `getMultipleAccounts` method to batch requests. This significantly reduces network overhead and improves performance.
* **Deserialize Account Data Properly**\
  The `data` field returned by `getAccountInfo` is often in raw or encoded form. To interpret this correctly, you’ll need deserialization logic tailored to the owning program (e.g., use the SPL Token library for token accounts). Refer to CoinVera’s blog for practical techniques on deserializing Solana account data.
* **Watch for RPC Rate Limits**\
  CoinVera RPC endpoints may enforce rate limits. Avoid excessive polling or redundant queries to maintain reliability and avoid throttling when accessing many accounts.
* **Manage Costs Efficiently**\
  Although `getAccountInfo` is a lightweight RPC call, high-frequency polling can accumulate bandwidth and compute costs. Optimize polling frequency and request patterns to stay efficient.
* **Use `jsonParsed` with Caution**\
  The `jsonParsed` encoding is helpful for known account types like tokens and stakes, but it may not support all custom programs. Its structure can also evolve if a program changes. For mission-critical use cases, decode binary data directly using a fixed layout for maximum consistency.
* **Leverage `dataSlice` for Precision**\
  If your use case only requires part of the account’s data, use the `dataSlice` option to fetch only the needed bytes. This reduces payload size and accelerates queries—especially valuable when working at scale.


# getBalance

The getBalance RPC method provides a simple and efficient way to retrieve the native SOL balance of any account on the Solana blockchain. The balance is returned in lamports.

The `getBalance` RPC method provides a simple and efficient way to retrieve the **native SOL balance** of any account on the Solana blockchain. The balance is returned in **lamports**, where 1 SOL = 1,000,000,000 lamports. Unlike `getAccountInfo`, which returns detailed metadata, `getBalance` is ideal for lightweight balance checks.

***

#### 🎯 Primary Use Case

* **Quick SOL Balance Check**\
  Instantly determine how much SOL an account—such as a wallet or program-owned address—holds.

***

#### 🛠 Parameters

* **`publicKey`** (*string, required*):\
  The base-58 encoded public key of the account to query.
* **`config`** (*object, optional*):\
  Optional fields to control query behavior:
  * `commitment` (*string*):\
    Determines the commitment level for the request:
    * `finalized` *(default)* – Highest level of confirmation.
    * `confirmed` – Recent vote-confirmed block.
    * `processed` – Most recent block (possibly unconfirmed).
  * `minContextSlot` (*number*):\
    Minimum slot at which the query may be evaluated.

**Public Key:** `4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5`

**Sample Request (CoinVera RPC):**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBalance(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBalance',
        "params": [
            "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5"
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBalance(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_balance(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBalance",
            "params": [
                "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5"
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_balance(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": {
      "slot": 355180145,
      "apiVersion": "2.2.7"
    },
    "value": 196248541
  }
}
```

#### 🧠 Developer Tips (with CoinVera)

* **Use `getBalance` for Simplicity**\
  When you only need SOL balance, this method is significantly lighter than `getAccountInfo` and avoids unnecessary data transfer.
* **Account Existence Check**\
  If the account hasn't been initialized on-chain, `getBalance` returns `0`. This makes it a quick way to check if an account exists *for balance purposes only*.
* **Convert Lamports to SOL**\
  Don’t forget: divide the result by `LAMPORTS_PER_SOL` (1,000,000,000) to display balances in SOL.
* **Commitment Strategy**\
  Choose your commitment level based on the application:
  * `confirmed` – Best for UI and general info.
  * `finalized` – Best for financial or high-assurance operations.\
    See Solana’s commitment model for more on consistency vs. speed.
* **Scaling with `getMultipleAccounts`**\
  Need balances for multiple accounts? While `getBalance` only handles one at a time, using `getMultipleAccounts` and extracting lamport balances can be more efficient at scale.


# getBlock

Learn getBlock use cases, code examples, request parameters, response structure, and tips.          Ask ChatGPT

The `getBlock` RPC method allows you to retrieve detailed information about a confirmed block in the Solana ledger. This is essential for block explorers, transaction history analysis, and understanding the state of the chain at a specific point in time.

***

#### **Common Use Cases**

* **Inspecting Block Contents**\
  View all transactions included in a specific block.
* **Retrieving Block Hashes**\
  Get the blockhash for a given slot, its parent’s blockhash, and its parent slot.
* **Checking Block Height and Time**\
  Find out a block’s height (its sequence number) and its estimated production time.
* **Analyzing Transaction Details**\
  With appropriate parameters, retrieve full transaction data, including metadata like fees, status, pre/post balances, and inner instructions.
* **Fetching Rewards**\
  Optionally include reward information for the block.

***

#### **Parameters**

* **`slot`** (*number, required*):\
  The slot number of the block to query (u64).
* **`config`** (*object, optional*):\
  Configuration options include:
  * **`commitment`** (*string*):\
    Commitment level. `processed` is not supported. Defaults to `finalized`.
  * **`encoding`** (*string*):\
    How transaction data is returned. Defaults to `json` if `transactionDetails` is `full` or `accounts`, otherwise `base64`. Options:
    * `json` *(deprecated)*
    * `jsonParsed` *(recommended for parsed keys and Lookup Table support)*
    * `base58`
    * `base64`
    * `base64+zstd`
  * **`transactionDetails`** (*string*):\
    Level of transaction detail to return. Defaults to `full`.
    * `full`
    * `accounts`
    * `signatures`
    * `none`
  * **`rewards`** (*boolean*):\
    Include rewards array if `true`. Defaults to `false`.
  * **`maxSupportedTransactionVersion`** (*number*):\
    Maximum transaction version to return. Set to `0` to include versioned transactions using Address Lookup Tables.

***

#### **Response**

If the block is found and confirmed, the `result` will include:

* **`blockhash`** (*string*):\
  The base-58 encoded blockhash.
* **`previousBlockhash`** (*string*):\
  The base-58 encoded blockhash of the previous block.
* **`parentSlot`** (*number*):\
  The slot number of the parent block.
* **`transactions`** (*array*):\
  List of transactions included in the block. Each entry contains:
  * `meta`: Transaction metadata (e.g., fee, logs, balances).
  * `transaction`: The raw transaction data, including signatures and message content.
* **`rewards`** (*array*, optional):\
  Present if `rewards: true` was requested. Includes reward info (e.g., `pubkey`, `lamports`, `postBalance`, `rewardType`, and `commission`).
* **`blockTime`** (*number | null*):\
  Estimated Unix timestamp of block production.
* **`blockHeight`** (*number | null*):\
  Sequence number from genesis slot.

If the block is not found or unconfirmed, `result` will be `null`.

***

#### **Example: Fetching Block Information**

Here’s how to retrieve block info for a sample slot (e.g., `355184627`) on Devnet. Replace it with a current confirmed slot number for accurate results.\
Also, replace `X-API-KEY` with your actual **CoinVera** API key.

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlock(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlock',
        "params": [
            355184627, 
            {
              "encoding": "jsonParsed",
              "transactionDetails": "full",
              "rewards": true,
              "maxSupportedTransactionVersion": 0
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlock(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_block(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlock",
            "params": [
                355184627,
                {
                    "encoding": "jsonParsed",
                    "transactionDetails": "full",
                    "rewards": True,
                    "maxSupportedTransactionVersion": 0
                }
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_block(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "blockHeight": 428,
    "blockTime": null,
    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
    "parentSlot": 429,
    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
    "transactions": [
      {
        "meta": {
          "err": null,
          "fee": 5000,
          "innerInstructions": [],
          "logMessages": [],
          "postBalances": [499998932500, 26858640, 1, 1, 1],
          "postTokenBalances": [],
          "preBalances": [499998937500, 26858640, 1, 1, 1],
          "preTokenBalances": [],
          "rewards": null,
          "status": {
            "Ok": null
          }
        },
        "transaction": {
          "message": {
            "accountKeys": [
              "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
              "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
              "SysvarS1otHashes111111111111111111111111111",
              "SysvarC1ock11111111111111111111111111111111",
              "Vote111111111111111111111111111111111111111"
            ],
            "header": {
              "numReadonlySignedAccounts": 0,
              "numReadonlyUnsignedAccounts": 3,
              "numRequiredSignatures": 1
            },
            "instructions": [
              {
                "accounts": [1, 2, 3, 0],
                "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
                "programIdIndex": 4
              }
            ],
            "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
          },
          "signatures": [
            "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
          ]
        }
      }
    ]
  },
  "id": 1
}
```

**Developer Tips**

* **Slot vs. Block Height**\
  The `getBlock` method accepts a **slot number**, not a block height. While slots are generally sequential, some may be skipped by the validator leader. To get the actual block sequence number, refer to the `blockHeight` field in the response.
* **`maxSupportedTransactionVersion` Is Crucial**\
  To retrieve blocks containing **versioned transactions** (now standard and using **Address Lookup Tables**), you must specify:\
  `"maxSupportedTransactionVersion": 0`\
  Omitting this may lead to errors when querying modern blocks.
* **Choosing `transactionDetails` Level**:
  * `full`: For comprehensive analysis—returns the most complete data including metadata.
  * `signatures`: Best for listing only transaction signatures in a block.
  * `accounts`: A good middle ground—lists involved accounts without full instructions.
  * `none`: Use when you only need high-level block metadata like `blockhash` or `rewards`.
* **Use `jsonParsed` for Encoding**\
  When requesting transaction details, `jsonParsed` is the recommended format. It provides a structured, human-readable JSON output and supports address resolution from Lookup Tables. Avoid using `json` (deprecated), as it lacks modern feature support.
* **Block Unavailability Handling**\
  A `null` response can mean:
  * The slot was **skipped**.
  * The block hasn’t reached the **requested commitment level**.
  * The RPC node (e.g., **CoinVera**) has **pruned** the block due to ledger limits—common with older historical data.
* **Include Rewards When Needed**\
  To retrieve block reward distribution info (e.g., for validators and stakers), set:\
  `"rewards": true`\
  This increases response size but is essential for full reward visibility.


# getBlockCommitment

Learn getBlockCommitment use cases, code examples, request parameters, response structure, and tips.

The `getBlockCommitment` RPC method provides insights into the **commitment status** of a specific block in the Solana ledger. It helps developers evaluate how much stake has voted on a block, making it a valuable tool for gauging **block finality** and **cluster health**.

***

#### **Common Use Cases**

* **Assessing Block Finality**\
  Measure the level of consensus by analyzing how much stake (in lamports) has confirmed the block across different confirmation depths.
* **Evaluating Cluster Health**\
  Use the `totalStake` field to understand the total active stake in the cluster when the block was processed.
* **Implementing Custom Confirmation Logic**\
  Ideal for systems that require stricter guarantees than standard `processed`, `confirmed`, or `finalized` commitment levels.

***

#### **Parameters**

* **`slot`** (*number, required*):\
  The slot number (u64) of the block for which commitment info is requested.

***

#### **Response**

If the block is found, the response includes:

* **`commitment`** (*array of u64 integers | null*):\
  An array (typically 32 elements) representing stake (in lamports) that voted on the block and its descendants up to depth `i`.
  * `commitment[i]` shows how much stake has confirmed the block at depth `i`.
  * `null` means the data is unavailable—either the block is too old or skipped.
* **`totalStake`** (*number*):\
  The total amount of active stake (in lamports) at the time the block was processed. Use this to calculate vote ratios like `commitment[i] / totalStake`.

#### **Example: Fetching Block Commitment Information**

Here’s a sample request using a placeholder slot (`355194322`). Be sure to use a **recent, confirmed slot** from Devnet or Mainnet:

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlockCommitment(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlockCommitment',
        "params": [
            355194322 
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlockCommitment(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_block_commitment(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlockCommitment",
            "params": [
                355194322
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_block_commitment(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "commitment": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      399444769122427100
    ],
    "totalStake": 399588547164198100
  },
  "id": 1
}
```

#### **Developer Tips**

* **Understanding the Commitment Array**\
  The higher the values at deeper indices, the more finalized the block is.
  * Example: If `commitment[31] / totalStake >= 2/3`, the block has reached supermajority finality.
* **Handling `null` Commitments**\
  This often indicates:
  * The block is too old and has been pruned.
  * The block was skipped or never processed.
* **When to Use `getBlockCommitment`**\
  It’s primarily for **advanced consensus or analytics** tools. For general use, prefer commitment-aware methods like `getTransaction` or `getBlock`.
* **Pruning Awareness**\
  Be mindful that some **RPC providers like CoinVera** may prune commitment data after a certain period.
* **Deep Commitment Knowledge Required**\
  To interpret results correctly, understand Solana’s **commitment levels**. Refer to Solana’s documentation for a full breakdown.


# getBlockHeight

Learn getBlockHeight use cases, code examples, request parameters, response structure, and tips.

The `getBlockHeight` RPC method offers a quick way to query the current **block height** of a Solana node. Block height is defined as the total number of blocks processed since the genesis block (slot 0). This method is ideal for tracking the chain’s progression and aligning on-chain data with specific block intervals.

***

#### **Common Use Cases**

* **Monitoring Chain Progression**\
  Repeatedly call `getBlockHeight` to track how fast the blockchain is advancing.
* **Capturing a Snapshot of Chain Length**\
  Retrieve the current block height at a particular commitment level to reference the chain’s state at a specific point.
* **Cross-Referencing Data**\
  Use the block height as a timeline marker when correlating events, logs, or transactions across various tools and datasets.

***

#### **Parameters**

You can call `getBlockHeight` with or without a configuration object:

* **`config`** (*object, optional*):\
  Optional fields to refine the request:
  * **`commitment`** (*string*):\
    Defines the confirmation level of the block height being returned. Defaults to `finalized`.
    * `finalized` – Highest assurance of confirmation.
    * `confirmed` – Voted on by a supermajority of validators.
    * `processed` – Most recent block (may still change).
  * **`minContextSlot`** (*number*):\
    Ensures the response is from a slot greater than or equal to this value. Useful for consistency and timeline alignment.

If no parameters are passed, the request defaults to the `finalized` commitment.

***

#### **Response**

The JSON-RPC `result` field will return:

* **`blockHeight`** (*number*):\
  An unsigned integer representing the height of the latest confirmed block.

***

#### **Example: Fetching the Current Block Height**

Here’s how to request the current block height from the CoinVera Mainnet RPC:

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlockHeight(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlockHeight',
        "params": []
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlockHeight(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_block_height(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlockHeight",
            "params": []
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_block_height(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

If you don’t need any custom configuration, you can also call it with no parameters:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockHeight"
}

```

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 333387608,
  "id": 1
}
```

**Developer Tips**

* **Commitment Levels Matter**\
  The block height returned by `getBlockHeight` depends on the **commitment level** used:
  * `finalized` provides the most stable and reliable block height.
  * `processed` offers the most up-to-date value, but it may not be confirmed and could change.
* **Use `minContextSlot` for Consistency**\
  When tracking specific slots, setting `minContextSlot` ensures that the block height returned is based on a state at or after that slot—ideal for maintaining temporal consistency in your application logic.
* **Block Height ≠ Slot Number**\
  It's important to distinguish between **block height** and **slot number**:
  * A **slot** is a time window where a validator may produce a block.
  * **Skipped slots** occur when no block is produced.
  * **Block height** only increments when a block is actually produced.
* **Lightweight Chain Health Monitoring**\
  Although basic, `getBlockHeight` is a quick and effective method to track **chain progression** or include in **synchronization and health checks** for validators, dApps, or backend systems.


# getBlockProduction

Learn getBlockProduction use cases, code examples, request parameters, response structure, and tips.

The `getBlockProduction` RPC method provides detailed insights into **block production statistics** within a specific slot range or the current epoch. It is particularly useful for monitoring **validator performance**, analyzing **network participation**, and detecting **missed leader slots**.

***

#### **Common Use Cases**

* **Monitor Validator Performance**\
  Track how many leader slots were assigned and how many blocks a validator actually produced.
* **Analyze Epoch-Wide Participation**\
  View block production data across all validators within the current or a historical epoch.
* **Detect Missed Slots**\
  Identify whether a validator missed their assigned slots, helping measure uptime or reliability.
* **Assess Network Health**\
  Evaluate overall block production efficiency as part of broader network monitoring.

***

#### **Request Parameters**

You can call `getBlockProduction` with an optional configuration object:

* **`commitment`** (*string, optional*):\
  Determines the commitment level to use. Defaults to the node’s configured level.
* **`range`** (*object, optional*):\
  Specifies the slot range to examine.
  * `firstSlot` (*u64*, required if no `identity`): Start slot (inclusive).
  * `lastSlot` (*u64*, optional): End slot (inclusive). If omitted, data will be returned up to the current slot.
* **`identity`** (*string, optional*):\
  The base58-encoded public key of a validator. If specified, returns data only for that validator.\
  ⚠️ Either `identity` or `range.firstSlot` **must** be provided.

***

#### **Response Structure**

* **`context`** (*object*):
  * `slot`: The slot at which the query was evaluated.
* **`value`** (*object*):
  * `byIdentity`: An object mapping each validator’s identity (public key) to:
    * `leaderSlots`: Number of slots assigned.
    * `blocksProduced`: Number of blocks successfully produced.
  * `range`:
    * `firstSlot`: Start of the queried range.
    * `lastSlot`: End of the queried range.

#### **Examples**

**1. Get Block Production for Current Epoch (All Validators)**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockProduction"
}
```

2. **Get Block Production for a Specific Validator (Current Epoch)**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockProduction",
  "params": [
    {
      "identity": "YourValidatorPublicKeyHere"
    }
  ]
}
```

3. **Get Block Production for a Validator in a Slot Range**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockProduction",
  "params": [
    {
      "identity": "YourValidatorPublicKeyHere",
      "range": {
        "firstSlot": 355104000,
        "lastSlot": 355104010
      }
    }
  ]
}

```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlockProduction(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlockProduction',
        "params": [
            {
              "identity": "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr",
              "range": {
                "firstSlot": 355104000, // e.g., 355104000
                "lastSlot": 355104010    // e.g., 355104010
              }
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlockProduction(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_block_production(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlockProduction",
            "params": [
                {
                    "identity": "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr",
                    "range": {
                        "firstSlot": 355104000,  # e.g., 355104000
                        "lastSlot": 355104010    # e.g., 355104010
                    }
                }
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_block_production(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355197308
    },
    "value": {
      "byIdentity": {},
      "range": {
        "firstSlot": 355104000,
        "lastSlot": 355104010
      }
    }
  },
  "id": 1
}
```

This guide should give you a solid understanding of how to use the `getBlockProduction` RPC method to monitor and analyze validator and network block production on Solana.

#### **Developer Tips**

* **Epoch Boundaries Matter**\
  If querying by `identity` only, results are scoped to the current epoch up to the latest processed slot. For past epochs, use `range.firstSlot` and `range.lastSlot`.
* **Data Retention Depends on RPC Node**\
  Older slot ranges may not be available on all providers. CoinVera’s node infrastructure may retain more recent data.
* **Essential for Validator Monitoring**\
  This RPC is ideal for building dashboards that display block production stats, uptime, and slot efficiency metrics.
* **Enhance with `getLeaderSchedule`**\
  Pair with `getLeaderSchedule` to get a detailed view of when each validator was expected to produce blocks.
* **Large Data Sets Warning**\
  If querying without specifying an `identity`, and over a wide slot range, expect large responses. Limit the range or filter by identity for efficient processing.


# getBlocks

Learn getBlocks use cases, code examples, request parameters, response structure, and tips.

The `getBlocks` RPC method returns a list of **confirmed block slot numbers** between a specified `start_slot` and an optional `end_slot`. It’s useful when you need to know which blocks were confirmed within a certain range—without fetching full block contents.

***

#### ✅ Common Use Cases

* **Identify Confirmed Blocks in a Range**\
  Quickly fetch all block slots that were successfully confirmed between two slots.
* **Iterate Over Confirmed Slots**\
  Use the list of confirmed slots to loop through and fetch detailed block data later via `getBlock`.
* **Audit Block Presence**\
  Verify whether blocks exist across a specific slot range for basic validation or reporting.

***

#### 🛠 Request Parameters

`getBlocks` accepts the following parameters:

* **`start_slot`** (*u64, required*):\
  The first slot of the range (inclusive).
* **`end_slot`** (*u64, optional*):\
  The last slot of the range (inclusive).\
  If omitted, the method will return confirmed blocks up to the latest available slot.\
  ⚠️ The range between `start_slot` and `end_slot` must not exceed **500,000 slots**.
* **`commitment`** (*string, optional*):\
  Commitment level passed as a field in a config object. If omitted, the node's default is used. Typical values:
  * `processed`
  * `confirmed`
  * `finalized`

***

#### 📦 Response Structure

The `result` field will be an array of slot numbers (as unsigned 64-bit integers), each representing a **confirmed block**.

```json
[355104000, 355104001, 355104002, 355104003, 355104004]
```

This means blocks were confirmed at these slots—note that some slots may be skipped (e.g., 355104004).

#### 💡 Examples

**1. Get Confirmed Blocks in a Slot Range**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocks",
  "params": [355104000, 355104001]
}
```

2. **Get Blocks from Start Slot to Latest Confirmed Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocks",
  "params": [355104000]
}

```

3. **Get Blocks Using a Specific Commitment Level**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocks",
  "params": [355104000, 355104001, { "commitment": "confirmed" }]
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlocks(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlocks',
        "params": [
            355104000,
            355104001,
            { "commitment": "confirmed" }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlocks(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_blocks(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlocks",
            "params": [
                355104000,
                355104001,
                {"commitment": "confirmed"}
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_blocks(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    355104000,
    355104001
  ],
  "id": 1
}
```

#### 🧠 Developer Tips

* **Range Limit Enforcement**\
  The maximum allowed range is **500,000 slots**. Splitting larger ranges into chunks is required for historical scans.
* **Ledger Retention Differences**\
  Very old slot data may not be available on all RPC nodes. Empty arrays or errors might be returned for out-of-retention queries.
* **Consistency with Commitment**\
  Block confirmation status can vary depending on the `commitment` level and the specific RPC node queried—especially for recent slots.
* **Use as a Prefilter for `getBlock`**\
  `getBlocks` is often used to determine which blocks exist before making multiple calls to `getBlock` for deeper inspection.
* **Effective Pagination Strategy**\
  For scanning long history segments, implement pagination by dividing your range into multiple sub-ranges of 500,000 slots or fewer.


# getBlocksWithLimit

Learn getBlocksWithLimit use cases, code examples, request parameters, response structure, and tips.

The `getBlocksWithLimit` RPC method retrieves a list of **confirmed block slot numbers**, starting from a specified slot and returning up to a defined limit. It’s especially useful when you need a fixed number of confirmed blocks following a known slot, without fetching full block data.

***

#### ✅ Common Use Cases

* **Fetch a Fixed Number of Blocks**\
  Retrieve a specific number of confirmed block slots beginning at a particular start slot.
* **Paginated Block Scanning**\
  Process the blockchain in manageable chunks—ideal for block explorers or analytics pipelines.
* **Recent Block Monitoring**\
  Quickly get the most recent confirmed blocks following a known anchor slot.

***

#### 🛠 Request Parameters

`getBlocksWithLimit` accepts the following arguments:

* **`start_slot`** (*u64, required*):\
  The first slot to start the query (inclusive).
* **`limit`** (*u64, required*):\
  The maximum number of block slots to return.\
  ⚠️ The conceptual slot range (`start_slot` to `start_slot + limit - 1`) must **not exceed 500,000 slots**.
* **`commitment`** (*string, optional*):\
  Commitment level for block confirmation:
  * `finalized` *(default)*
  * `confirmed`
  * `processed`\
    If provided, this must be wrapped in a configuration object as the last parameter.

***

#### 📦 Response Structure

The `result` field contains an array of **confirmed block slot numbers**, up to the requested limit.

**Example:**

```json
[355104000, 355104001, 355104002, 355104003, 355104004]
```

If `start_slot` is `355104000`and `limit` is `5`, this array represents the confirmed blocks found in that range.

#### 💡 Examples

**1. Fetch 5 Confirmed Blocks from a Start Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocksWithLimit",
  "params": [355104000, 5]
}

```

2. **Fetch 3 Confirmed Blocks with a Specific Commitment Level**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocksWithLimit",
  "params": [355104000, 3, { "commitment": "confirmed" }]
}

```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlocksWithLimit(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlocksWithLimit',
        "params": [
            355104000,
            5,
            { "commitment": "confirmed" }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlocksWithLimit(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_blocks_with_limit(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlocksWithLimit",
            "params": [
                355104000,
                5,
                {"commitment": "confirmed"}
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_blocks_with_limit(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Respose**

```json
{
  "jsonrpc": "2.0",
  "result": [
    355104000,
    355104001,
    355104002,
    355104003,
    355104004
  ],
  "id": 1
}
```

#### 🧠 Developer Tips

* **Understand Range Constraints**\
  The **conceptual range scanned** is from `start_slot` to `start_slot + limit - 1`. This must be ≤ 500,000 slots, regardless of how many actual blocks are returned.
* **Ledger Retention Limits**\
  RPC nodes (like **CoinVera**) may not retain block info for very old slots. If `start_slot` is too far in the past, the method might return fewer blocks than expected—or none at all.
* **Block Confirmation Levels**\
  The blocks returned reflect those confirmed at the specified commitment level. Recently confirmed blocks may vary slightly across nodes and configurations.
* **Choosing the Right Method**\
  Use `getBlocksWithLimit` when you:
  * Know where to start
  * Want a **fixed number** of results\
    For scanning a known range, use `getBlocks` instead.


# getBlockTime

Learn getBlockTime use cases, code examples, request parameters, response structure, and tips.

The `getBlockTime` RPC method returns the **estimated Unix timestamp** for when a given block (identified by its **slot number**) was produced. The timestamp is expressed as seconds since the Unix epoch. This method is essential for aligning on-chain events with real-world time.

***

#### ✅ Common Use Cases

* **Timestamping On-Chain Events**\
  Determine the approximate real-world time a block was created to timestamp program executions, transactions, or events.
* **Analyze Block Intervals**\
  Calculate time differences between slots to examine validator behavior, slot scheduling, or block spacing.
* **Correlate Off-Chain Events**\
  Match external data (e.g. trades, system logs) with blockchain activity using slot-to-time mapping.

***

#### 🛠 Request Parameters

* **`slot`** (*u64, required*):\
  The slot number for which to retrieve the estimated production time.

***

#### 📦 Response Structure

The `result` field will return:

* **`timestamp`** (*i64*):\
  The block’s estimated Unix timestamp (in seconds).
* **`null`**:\
  Returned if the timestamp is unavailable—typically because:
  * The block is too old and the data has been pruned.
  * The slot was skipped and has no associated block or timestamp.

#### 💡 Example

**Get Estimated Production Time for a Specific Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockTime",
  "params": [355104000]
}

```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getBlockTime(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getBlockTime',
        "params": [
            355104000 
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getBlockTime(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import json
import asyncio
import aiohttp

async def get_block_time(rpc_url):
    try:
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlockTime",
            "params": [
                355104000
            ]
        }
        
        async with aiohttp.ClientSession() as session:
            async with session.post(
                rpc_url,
                headers={'Content-Type': 'application/json'},
                json=payload
            ) as response:
                data = await response.json()
                
                # Print the exact full response
                print('Full RPC Response:')
                print(json.dumps(data, indent=2))
                
                return data
                
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
async def main():
    RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
    await get_block_time(RPC_URL)

# Run the async function
if __name__ == "__main__":
    asyncio.run(main())
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 1753231651,
  "id": 1
}
```

📌 Replace `355104000` with a **recent, confirmed slot number** from your target cluster (e.g., Mainnet or Devnet).

#### 🧠 Developer Tips

* **Timestamp Availability May Vary**\
  Older or skipped slots may return `null`. This is due to pruning or the absence of block production.
* **Estimated, Not Exact**\
  The returned timestamp is **stake-weighted**, based on vote timestamps. It’s generally accurate but not cryptographically guaranteed.
* **Node Variability**\
  Timestamps may differ slightly between RPC providers depending on validator reports and ledger history. For recent blocks, confirmation delays may affect availability.


# getClusterNodes

Learn getClusterNodes use cases, code examples, request parameters, response structure, and tips.

The `getClusterNodes` RPC method returns a list of all known nodes currently participating in the Solana cluster, as seen from the perspective of the RPC node you’re querying. This is a valuable tool for **network discovery**, **cluster diagnostics**, and **understanding node connectivity**.

***

#### ✅ Common Use Cases

* **Network Topology Mapping**\
  Get a real-time view of the nodes active in the cluster, including their identity keys and network endpoints.
* **Discover RPC Endpoints**\
  Identify nodes that advertise public RPC interfaces, which may be used as alternative access points (availability and rate limits may vary).
* **Monitor Node Versions**\
  Observe software version distribution across cluster participants for insights into network upgrade progress or compatibility.

***

#### 🛠 Request Parameters

This method **does not accept any parameters**.

***

#### 📦 Response Structure

The `result` will be an **array of objects**, each representing a node and containing the following fields:

| Field          | Type             | Description                                                                 |
| -------------- | ---------------- | --------------------------------------------------------------------------- |
| `pubkey`       | *string*         | Base58-encoded public key (identity) of the node.                           |
| `gossip`       | *string \| null* | Gossip address used for cluster communication.                              |
| `tpu`          | *string \| null* | TPU (Transaction Processing Unit) address used for submitting transactions. |
| `rpc`          | *string \| null* | JSON-RPC endpoint address if advertised.                                    |
| `version`      | *string \| null* | Software version reported by the node.                                      |
| `featureSet`   | *u32 \| null*    | Identifier of the node’s current feature set.                               |
| `shredVersion` | *u16 \| null*    | Shred version used by the node (affects data encoding).                     |

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getClusterNodes(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getClusterNodes'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getClusterNodes(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_cluster_nodes(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getClusterNodes'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_cluster_nodes(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
    {
      "featureSet": 3073396398,
      "gossip": "5.199.165.12:8000",
      "pubkey": "GK1dUWJJhk62z7ZKQFuLq4xuNvKJoJW7GvijsdWQLxw6",
      "pubsub": null,
      "rpc": null,
      "serveRepair": "5.199.165.12:8012",
      "shredVersion": 50093,
      "tpu": "5.199.165.12:8003",
      "tpuForwards": "5.199.165.12:8004",
      "tpuForwardsQuic": "5.199.165.12:8010",
      "tpuQuic": "5.199.165.12:8009",
      "tpuVote": "5.199.165.12:8005",
      "tvu": "5.199.165.12:8001",
      "version": "2.2.19"
    },
    {
      "featureSet": 3073396398,
      "gossip": "185.209.178.131:8001",
      "pubkey": "EmhoLGAXDEguKMqAGxNzgy6LGXe5jvmD1az7whhDKnB7",
      "pubsub": null,
      "rpc": null,
      "serveRepair": "185.209.178.131:8013",
      "shredVersion": 50093,
      "tpu": "185.209.178.131:8004",
      "tpuForwards": "185.209.178.131:8005",
      "tpuForwardsQuic": "185.209.178.131:8011",
      "tpuQuic": "185.209.178.131:8010",
      "tpuVote": "185.209.178.131:8006",
      "tvu": "185.209.178.131:8002",
      "version": "2.2.20"
    }
```

#### 🧠 Developer Tips

* **Results Depend on Node Perspective**\
  The node list reflects what the **queried RPC node** sees. Different RPC providers (e.g., CoinVera) may have slightly different views of the cluster due to synchronization state or network partitions.
* **RPC Field Is Optional**\
  Not all nodes expose their RPC endpoint. Even if the `rpc` field is present, the endpoint may be **unavailable or restricted**.
* **Expect Dynamic Results**\
  The cluster is constantly changing—nodes join, leave, or restart frequently. Always treat this list as **real-time and transient**.
* **Large Output on Mainnet**\
  On Solana Mainnet Beta, the response can include hundreds or even thousands of nodes. Be prepared to paginate, filter, or cache results for performance.


# getEpochInfo

Learn getEpochInfo use cases, code examples, request parameters, response structure, and tips.

The `getEpochInfo` RPC method returns real-time information about the **current epoch** on the Solana network. It helps track **epoch progression**, **network state**, and can be used to determine how far the network has advanced into the current epoch and when the next epoch is expected to begin.

***

#### ✅ Common Use Cases

* **Monitor Epoch Progression**\
  Retrieve the current slot index within the epoch and total slots in the epoch to estimate time remaining.
* **Analyze Network State**\
  Access core metrics like epoch number, block height, and transactions processed to evaluate network activity.
* **Node Synchronization Checks**\
  Confirm whether a node is aligned with the network by comparing its epoch info against a trusted source.

***

#### 🛠 Request Parameters

`getEpochInfo` optionally accepts a configuration object:

* **`commitment`** (*string, optional*):\
  Defines the ledger confirmation level:
  * `finalized` *(default)* – Highest safety; may lag slightly.
  * `confirmed` – Recently voted on by supermajority.
  * `processed` – Fastest, but may be incomplete or rollback-prone.
* **`minContextSlot`** (*number, optional*):\
  Ensures the response is evaluated at or beyond a specific slot, useful for timeline-sensitive consistency.

***

#### 📦 Response Structure

The `result` field will return an object containing:

| Field              | Type          | Description                                                         |
| ------------------ | ------------- | ------------------------------------------------------------------- |
| `absoluteSlot`     | *u64*         | Current absolute slot number on the ledger.                         |
| `blockHeight`      | *u64*         | Current block height (number of blocks produced since genesis).     |
| `epoch`            | *u64*         | Current epoch number.                                               |
| `slotIndex`        | *u64*         | Current slot within the epoch.                                      |
| `slotsInEpoch`     | *u64*         | Total slots assigned to the current epoch.                          |
| `transactionCount` | *u64 \| null* | Total number of transactions processed in this epoch (may be null). |

***

#### 💡 Examples

**1. Fetch Epoch Info with Default Commitment**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochInfo"
}
```

2\. **Fetch Epoch Info Using `confirmed` Commitment**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochInfo",
  "params": [
    {
      "commitment": "confirmed"
    }
  ]
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getEpochInfo(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getEpochInfo'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getEpochInfo(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_epoch_info(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getEpochInfo'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_epoch_info(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "absoluteSlot": 355253587,
    "blockHeight": 333445451,
    "epoch": 822,
    "slotIndex": 149587,
    "slotsInEpoch": 432000,
    "transactionCount": 429927746973
  },
  "id": 1
}
```

#### 🧠 Developer Tips

* **Choosing Commitment Levels**\
  Use `finalized` for highest confidence. Use `processed` for low-latency monitoring. For balanced needs, `confirmed` is a good compromise.
* **Transaction Count Limitations**\
  `transactionCount` may be `null` if not tracked by the node or unavailable for the specified commitment level.
* **Dynamic Epoch Lengths**\
  `slotsInEpoch` can vary based on network configuration. Use `getEpochSchedule` to explore the full epoch schedule and slot structure.


# getEpochSchedule

Learn getEpochSchedule use cases, code examples, request parameters, response structure, and tips.

The `getEpochSchedule` RPC method returns information about the **epoch schedule configuration** from the cluster’s genesis settings. It outlines how epochs are structured, including slot counts and leader scheduling mechanics. This data is essential for aligning application logic with Solana’s timing model.

***

#### ✅ Common Use Cases

* **Predict Epoch Boundaries**\
  Determine the number of slots in an epoch to estimate how soon the current epoch will end and when the next will begin.
* **Understand Leader Schedule Offsets**\
  Retrieve the `leaderScheduleSlotOffset` to know how far in advance validator leader schedules are generated.
* **Analyze Network Initialization**\
  Identify whether the network used a **warmup phase**, and if so, when full-length epochs began (via `firstNormalEpoch` and `firstNormalSlot`).
* **Build Monitoring and Analytics Tools**\
  Use epoch timing details to visualize epoch transitions and validate synchronization behaviors across clusters.

***

#### 🛠 Request Parameters

This method **does not require any parameters**.

***

#### 📦 Response Structure

The response object contains the following fields:

| Field                      | Type   | Description                                                                |
| -------------------------- | ------ | -------------------------------------------------------------------------- |
| `slotsPerEpoch`            | *u64*  | Number of slots in a full epoch (post-warmup).                             |
| `leaderScheduleSlotOffset` | *u64*  | Number of slots before an epoch when its leader schedule is generated.     |
| `warmup`                   | *bool* | `true` if the cluster had shorter initial epochs that ramped up gradually. |
| `firstNormalEpoch`         | *u64*  | First epoch with full-length slots (`slotsPerEpoch`).                      |
| `firstNormalSlot`          | *u64*  | The slot at which `firstNormalEpoch` begins.                               |

***

#### 💡 Example: Get Epoch Schedule

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochSchedule"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getEpochSchedule(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getEpochSchedule'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getEpochSchedule(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_epoch_schedule(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getEpochSchedule'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_epoch_schedule(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "firstNormalEpoch": 0,
    "firstNormalSlot": 0,
    "leaderScheduleSlotOffset": 432000,
    "slotsPerEpoch": 432000,
    "warmup": false
  },
  "id": 1
}
```

#### 🧠 Developer Tips

* **Epoch Schedule Is Static**\
  This data comes from the **cluster’s genesis configuration** and typically does not change unless there’s a protocol upgrade or network reset.
* **Cluster-Specific Behavior**\
  Parameters like `slotsPerEpoch` and `warmup` vary between **Mainnet**, **Testnet**, and **Devnet**. Always query the correct environment.
* **Warmup Epoch Calculations**\
  If `warmup` is `true`, early epochs use exponentially increasing lengths:

  ```
  iniCopyEditslots = 2^N * MINIMUM_SLOTS_PER_EPOCH
  ```

  where `N` is the epoch index, starting from 0.\
  `MINIMUM_SLOTS_PER_EPOCH` is usually 32.
* **Use for Time Estimation**\
  Combine with `getEpochInfo` to estimate time remaining in the current epoch or project when epoch transitions will occur.


# getFeeForMessage

Learn getFeeForMessage use cases, code examples, request parameters, response structure, and tips.

The `getFeeForMessage` RPC method estimates the **base transaction fee** (in lamports) required to process a given **compiled transaction message**. This is especially helpful for displaying cost estimates to users or optimizing fee strategies before submitting transactions.

> **Version Note:** This method is available in `solana-core` v1.9 and above. For older versions, use `getFees`.

***

#### ✅ Common Use Cases

* **Estimate Transaction Fees**\
  Calculate the expected fee for a transaction *before* sending it to the network.
* **Optimize Transaction Costs**\
  Compare fees across different transaction structures or times to identify cost-efficient strategies.
* **Improve User Experience**\
  Show users a real-time fee estimate in your UI before they sign and submit a transaction.

***

#### 🛠 Request Parameters

`getFeeForMessage` takes the following parameters:

* **`message`** (*string, required*):\
  A **base64-encoded** serialized Solana transaction message. Must be a valid compiled message containing instructions, fee payer, and recent blockhash.
* **`config`** (*object, optional*):\
  Configuration object with:
  * `commitment` (*string*):\
    Commitment level (`processed`, `confirmed`, or `finalized`). Defaults to `finalized`.
  * `minContextSlot` (*number*):\
    The minimum slot at which the request is evaluated (for consistency in long-running processes).

***

#### 📦 Response Structure

The `result` field contains:

```json
{
  "context": {
    "slot": <u64>
  },
  "value": <u64 | null>
}
```

* **`context.slot`** – The slot used when evaluating the fee.
* **`value`** – Estimated fee in **lamports** (1 SOL = 1,000,000,000 lamports).\
  `null` if the fee could not be calculated (e.g., expired blockhash or invalid message).

#### 💡 Example: Estimate Fee for a Simple Transfer

> First, compile a transfer transaction and extract its message in base64 format, then call:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getFeeForMessage",
  "params": [
    "base64_encoded_transaction_message_here",
    {
      "commitment": "finalized"
    }
  ]
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getFeeForMessage(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getFeeForMessage',
        "params": [
            "MESSAGE_BASE64_ENCODED", // Replace with your actual base64 encoded message
            { "commitment": "processed" }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getFeeForMessage(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_fee_for_message(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getFeeForMessage',
                'params': [
                    'MESSAGE_BASE64_ENCODED',  # Replace with your actual base64 encoded message
                    {'commitment': 'processed'}
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_fee_for_message(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 5068 },
    "value": 5000
  },
  "id": 1
}
```

#### 🧠 Developer Tips

* **Message Construction**\
  Ensure your message is well-formed with:
  * Valid fee payer
  * Correct instructions
  * A **recent** blockhash (within \~2 minutes)
* **Expired Blockhash**\
  If the blockhash is too old, the fee may return as `null`. Always refresh the blockhash before compiling the message.
* **Base Fee Only**\
  This method returns **only the base network fee**. To estimate priority fees, use `getRecentPrioritizationFees`.
* **Lamports, Not SOL**\
  The value is returned in **lamports**. Divide by `1_000_000_000` to convert to SOL for display purposes.
* **Handling Null Responses**\
  A `null` fee indicates:
  * Invalid or expired blockhash
  * Malformed message
  * Inability to compute at current commitment level


# getFirstAvailableBlock

Learn getFirstAvailableBlock use cases, code examples, request parameters, response structure, and tips.

The `getFirstAvailableBlock` RPC method returns the **slot number of the oldest confirmed block** still retained in the ledger by the queried RPC node. This is helpful for understanding how much historical block data a node currently stores and where its ledger history begins.

***

#### ✅ Common Use Cases

* **Historical Data Access**\
  Identify the earliest slot from which you can query confirmed block or transaction data using methods like `getBlock`, `getTransaction`, or `getConfirmedSignaturesForAddress2`.
* **Evaluate Ledger Retention**\
  Understand the storage configuration and pruning behavior of a specific node—useful for analytics tools or explorers.
* **Cross-Node Comparison**\
  While not a direct measure of synchronization, comparing results from different nodes can indicate which ones retain deeper historical data.

***

#### 🛠 Request Parameters

This method **does not require any parameters**.

***

#### 📦 Response Structure

The `result` field returns a single value:

```json
{
  "jsonrpc": "2.0",
  "result": 12345678,
  "id": 1
}
```

**`result`** (*u64*):\
The **slot number** of the first available confirmed block on the node.

***

💡 **Example: Get First Available Block Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getFirstAvailableBlock"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getFirstAvailableBlock(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getFirstAvailableBlock'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getFirstAvailableBlock(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_first_available_block(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getFirstAvailableBlock'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_first_available_block(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}
```

#### 🧠 Developer Tips

* **Node-Specific Results**\
  Each RPC node has its own ledger retention policy. Some nodes (e.g., archival nodes) may retain millions of slots, while others prune older data more aggressively.
* **Continuously Increases**\
  The returned slot number will **increase over time** as older blocks are pruned to conserve disk space.
* **Confirmed Blocks Only**\
  This method returns the **first confirmed block** still available. It does not reflect processed or unconfirmed slots.
* **Use in Data Pipelines**\
  Ideal for setting the **lower bound** when scanning transaction histories or backfilling analytics data.


# getGenesisHash

Learn getGenesisHash use cases, code examples, request parameters, response structure, and tips.

The `getGenesisHash` RPC method returns the **genesis hash** of the Solana cluster to which the queried node is connected. This hash uniquely identifies the specific network—such as **Mainnet Beta**, **Devnet**, **Testnet**, or a **custom/private cluster**.

***

#### ✅ Common Use Cases

* **Verify Connected Network**\
  Ensure your application is interacting with the intended cluster (e.g., Devnet vs. Mainnet Beta) by comparing the genesis hash.
* **Client Configuration**\
  Use the genesis hash programmatically to conditionally configure tools, wallets, or front-end applications based on the connected cluster.
* **Prevent Cross-Cluster Caching Errors**\
  Incorporate the genesis hash into cache keys to avoid serving data from one network on another—important when working with multiple environments.

***

#### 🛠 Request Parameters

This method **does not accept any parameters**.

***

#### 📦 Response Structure

The response includes:

```json
{
  "jsonrpc": "2.0",
  "result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
  "id": 1
}
```

**`result`** (*string*):\
The **base-58 encoded genesis hash** of the connected cluster.

***

💡 **Example: Fetch the Genesis Hash**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getGenesisHash"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getGenesisHash(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getGenesisHash'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getGenesisHash(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_genesis_hash(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getGenesisHash'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_genesis_hash(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
  "id": 1
}
```

#### 🧠 Developer Tips

* **Unique Per Cluster**\
  Each Solana network has its own unique genesis hash. For example:
  * Mainnet Beta: `5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`
  * Devnet/Testnet: Different and distinct hashes
  * Private clusters: Will have custom genesis hashes
* **Immutable Identifier**\
  The genesis hash is set once at cluster initialization and never changes.
* **Recommended Safety Check**\
  For sensitive actions (e.g., sending real funds), applications should verify that the returned hash matches the expected cluster hash to avoid misrouting operations.


# getHealth

Learn getHealth use cases, code examples, request parameters, response structure, and tips.

The `getHealth` RPC method is used to check the **operational health** of a Solana RPC node. A node is considered "healthy" if it is **responsive** and **sufficiently synchronized** with the cluster—typically within a configurable slot lag known as `HEALTH_CHECK_SLOT_DISTANCE`.

This method is essential for **monitoring**, **load balancing**, and **infrastructure failover strategies**.

***

#### ⚙️ How It Works

The `getHealth` method is a standard JSON-RPC POST request. It queries the RPC node to determine whether it is healthy according to its local configuration and synchronization status with the cluster.

***

#### ✅ Common Use Cases

* **Node Health Monitoring**\
  Periodically check RPC node status to ensure it's up and not significantly behind the cluster tip.
* **Load Balancer Integration**\
  Route traffic only to nodes reporting healthy status in a pool of RPC endpoints.
* **Failover Systems**\
  Automatically switch to a backup node if the primary node becomes unhealthy or unreachable.
* **Quick Connectivity Debugging**\
  Use for basic diagnostics when a node appears to be lagging or unresponsive.

***

#### 🛠 Request Parameters

This method **does not accept any parameters**.

***

#### 📦 Response Structure

The response varies based on node status:

| Status         | Description                                                                    |
| -------------- | ------------------------------------------------------------------------------ |
| `"ok"`         | Node is healthy and in sync with the cluster.                                  |
| `"behind"`     | Node is lagging behind the cluster (not within `HEALTH_CHECK_SLOT_DISTANCE`).  |
| `"unknown"`    | Node cannot determine its health—often due to isolation or startup.            |
| *error object* | Node is unhealthy or unresponsive. Exact structure may vary between providers. |

**Example Healthy Response:**

```json
jsonCopyEdit{
  "jsonrpc": "2.0",
  "result": "ok",
  "id": 1
}
```

***

#### 💡 Example: Check Node Health Using cURL

```bash
curl -X POST https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getHealth"
  }'
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getHealth(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getHealth',
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getHealth(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_health(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getHealth'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_health(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "ok"
}
```

#### 🧠 Developer Tips

* **What Counts as “Healthy”**\
  A node is healthy if it is not behind the cluster tip by more than the configured `HEALTH_CHECK_SLOT_DISTANCE`. This setting varies by node configuration.
* **"Behind" or "Unknown" States**
  * `"behind"`: The node is online but lagging. It may still serve some traffic depending on tolerance.
  * `"unknown"`: The node cannot confirm its health—possibly isolated or still catching up.
* **Provider Behavior May Vary**\
  Different RPC providers (like CoinVera or others) may implement health checks with subtle differences. Always test with your provider.
* **Robust Error Handling Is Crucial**\
  Treat any non-`"ok"` response with appropriate fallback logic (e.g., retry, alert, failover).
* **Complement with `getSlot` or `getEpochInfo`**\
  For advanced monitoring, combine `getHealth` with other RPCs to track slot lag, block production, or sync status.


# getHighestSnapshotSlot

Learn getHighestSnapshotSlot use cases, code examples, request parameters, response structure, and tips.

The `getHighestSnapshotSlot` RPC method provides details about the **most recent ledger snapshots** stored by a Solana RPC node. It includes both the highest **full snapshot** and the latest **incremental snapshot** (if available), which are critical for fast node startup and ledger synchronization.

> **Version Note:** Available in `solana-core v1.9+`. For versions ≤ v1.8, use the deprecated `getSnapshotSlot` method.

***

#### ✅ Common Use Cases

* **Monitor Snapshot Generation**\
  Check how up-to-date a node is in generating snapshots used for bootstrapping and syncing.
* **Analyze Node Health**\
  Use snapshot information to understand whether the node is keeping pace with the cluster or falling behind.
* **Debug Syncing Issues**\
  Compare full and incremental snapshot slots to troubleshoot delayed snapshot generation or restoration problems.

***

#### 🛠 Request Parameters

This method **does not accept any parameters**.

***

#### 📦 Response Structure

The `result` field returns an object:

```json
{
  "full": 185000000,
  "incremental": 185050000
}
```

| Field         | Type          | Description                                                                                                                                                      |
| ------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `full`        | *u64*         | The highest slot at which a **full snapshot** is available.                                                                                                      |
| `incremental` | *u64 \| null* | The highest slot at which an **incremental snapshot** exists (based on the full snapshot). Can be `null` if incremental snapshotting is disabled or unavailable. |

If the node has no snapshots at all, the behavior may vary by provider (e.g., returning `null`, an empty object, or an error).

***

💡 **Example: Fetch Highest Snapshot Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getHighestSnapshotSlot"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getHighestSnapshotSlot(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getHighestSnapshotSlot'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getHighestSnapshotSlot(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_highest_snapshot_slot(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getHighestSnapshotSlot'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_highest_snapshot_slot(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "full": 353404518,
    "incremental": 353413622
  },
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Snapshot Data Is Node-Specific**\
  Snapshot availability depends on each node’s configuration. Archival or high-availability nodes may generate snapshots more frequently than lightweight ones.
* **Snapshot Progression**\
  Expect `full` and `incremental` snapshot slots to increase as the node progresses through epochs. If these values remain static, the node may not be generating new snapshots correctly.
* **Full vs. Incremental Snapshots**
  * **Full Snapshot**: Contains the complete state of the ledger at a given slot.
  * **Incremental Snapshot**: Captures state changes since the most recent full snapshot. Smaller and faster to create, but dependent on the base full snapshot.
* **Use in Automation and Alerting**\
  Monitor these values in scripts or infrastructure dashboards to ensure snapshot generation is healthy and up to date.
* **Version Compatibility**\
  Ensure your node or RPC provider supports Solana v1.9+ to use this method. Older nodes will not respond to this RPC call.


# getIdentity

Learn getIdentity use cases, code examples, request parameters, response structure, and tips.

The `getIdentity` RPC method returns the **public key (identity)** of the Solana RPC node you are connected to. Each node in the Solana network has a unique cryptographic keypair, and the public key serves as its **node identifier**.

***

#### ✅ Common Use Cases

* **Identify the RPC Node**\
  Retrieve the unique public key of the node serving your request—useful in distributed systems or when using multiple providers.
* **Cross-reference with Cluster Nodes**\
  Combine with `getClusterNodes` to match the identity to other metadata (e.g., gossip, TPU, version) from the full cluster view.
* **Logging and Debugging**\
  Track which RPC node handled a given request—ideal for diagnostics in multi-node environments.
* **Protocol-Level Verification (Advanced)**\
  Some advanced tooling may require node identity verification, though this is uncommon in general dApp workflows.

***

#### 🛠 Request Parameters

This method **does not take any parameters**.

***

#### 📦 Response Structure

The `result` field contains:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "identity": "8Lx6...xKMN"
  },
  "id": 1
}
```

| Field      | Type     | Description                                                  |
| ---------- | -------- | ------------------------------------------------------------ |
| `identity` | *string* | Base-58 encoded public key of the node you are connected to. |

***

#### 💡 Example: Get RPC Node Identity

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getIdentity"
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getIdentity(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getIdentity'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getIdentity(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_identity(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getIdentity'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_identity(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "identity": "56vSo3VUVsCqiKow9J2ZY7RWnHg5qrBDEbrvbd1VMzRa"
  },
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Node-Specific Identity**\
  The returned identity is **unique to the specific RPC node** queried. Connecting to another RPC server (even within the same cluster or provider) may return a different identity.
* **Not Related to Wallets**\
  This identity is **not a user wallet or validator address**—it strictly identifies the node process itself.
* **Key Stability**\
  A node’s identity is generally stable, but may change if the operator regenerates or replaces the node’s keypair.
* **Use for Traceability**\
  Consider including the node’s identity in debug logs or telemetry to trace request origins in distributed setups.


# getInflationGovernor

Learn getInflationGovernor use cases, code examples, request parameters, response structure, and tips.

The `getInflationGovernor` RPC method returns the **current inflation governance parameters** for the Solana cluster. These parameters define how new SOL is issued over time—shaping the network’s **tokenomics**, **staking incentives**, and **long-term monetary policy**.

***

#### ✅ Common Use Cases

* **Economic Modeling**\
  Analyze how SOL issuance is structured over time to forecast total supply growth, dilution, and monetary policy effects.
* **Staking Reward Calculations**\
  While `getInflationRate` gives the current annual rate, `getInflationGovernor` reveals the underlying **inflation trajectory**, which affects long-term staking returns.
* **Tokenomics Transparency**\
  Understand how inflation is tapered and what portion is allocated to the **Solana Foundation**, helping projects and investors assess sustainability and incentive structures.

***

#### 🛠 Request Parameters

This method accepts an **optional configuration object**:

* **`commitment`** (*string, optional*):\
  The commitment level for querying the ledger. Common values:
  * `finalized` *(default)*
  * `confirmed`
  * `processed`

***

#### 📦 Response Structure

The response includes an object with the following inflation parameters (all `f64` floating-point numbers):

| Field            | Type | Description                                                                          |
| ---------------- | ---- | ------------------------------------------------------------------------------------ |
| `initial`        | f64  | Initial annual inflation rate (e.g., `0.15` = 15%).                                  |
| `terminal`       | f64  | Long-term terminal inflation rate (e.g., `0.015` = 1.5%).                            |
| `taper`          | f64  | Year-over-year decrease rate for inflation (e.g., `0.15` = 15% reduction each year). |
| `foundation`     | f64  | Portion of inflation allocated to the Solana Foundation (e.g., `0.05` = 5%).         |
| `foundationTerm` | f64  | Duration in years over which the foundation allocation is distributed.               |

***

#### 💡 Example: Fetch Inflation Governance Parameters

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getInflationGovernor"
}
```

With optional commitment:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getInflationGovernor",
  "params": [
    { "commitment": "confirmed" }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getInflationGovernor(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getInflationGovernor',
        "params":[{"commitment":"confirmed"}]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getInflationGovernor(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_inflation_governor(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getInflationGovernor',
                'params': [{'commitment': 'confirmed'}]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_inflation_governor(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "foundation": 0,
    "foundationTerm": 0,
    "initial": 0.08,
    "taper": 0.15,
    "terminal": 0.015
  },
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Static but Upgradable**\
  These parameters are typically set at genesis or through network upgrades, and do not change frequently unless through formal governance.
* **Foundation Allocation**\
  The `foundation` and `foundationTerm` define a predefined, temporary allocation of inflationary SOL to the Solana Foundation—supporting ecosystem funding and operations during the early lifecycle of the network.
* **Understand Long-Term Staking Impacts**\
  These parameters control the **future trajectory** of staking rewards and inflation-driven issuance, making them critical inputs for long-term validator and delegator modeling.
* **Combine with `getInflationRate`**\
  Use in conjunction with `getInflationRate` to compare **current effective rates** vs. **governed targets**.


# getInflationRate

Learn getInflationRate use cases, code examples, request parameters, response structure, and tips.

The `getInflationRate` RPC method returns a **snapshot of inflation distribution** for the **current epoch**, including how new SOL issuance is allocated between validators and the Solana Foundation. It provides a real-time view into the **annualized inflation rate** applied to token rewards and economic modeling.

***

#### ✅ Common Use Cases

* **Estimate Staking Returns**\
  View the current **annualized inflation rate** allocated to validators—useful for estimating staking APRs.
* **Track Foundation Allocation**\
  Monitor the proportion of inflation being distributed to the **Solana Foundation** during the current epoch.
* **Analyze Current Economic Metrics**\
  Fetch up-to-date inflation data to evaluate Solana’s token issuance behavior in the active epoch.

***

#### 🛠 Request Parameters

This method **does not require any parameters**.

***

#### 📦 Response Structure

The `result` field returns an object:

```json
{
  "total": 0.065,
  "validator": 0.06,
  "foundation": 0.005,
  "epoch": 540
}
```

| Field        | Type  | Description                                                                     |
| ------------ | ----- | ------------------------------------------------------------------------------- |
| `total`      | *f64* | Total inflation rate for the current epoch (e.g., `0.065` = 6.5% annualized).   |
| `validator`  | *f64* | Portion of inflation allocated to validators (e.g., `0.06` = 6%).               |
| `foundation` | *f64* | Portion of inflation allocated to the Solana Foundation (e.g., `0.005` = 0.5%). |
| `epoch`      | *u64* | Epoch number to which the inflation rates apply.                                |

***

#### 💡 Example: Fetch Current Inflation Rates

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getInflationRate"
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getInflationRate(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getInflationRate'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getInflationRate(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_inflation_rate(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getInflationRate'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_inflation_rate(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "epoch": 822,
    "foundation": 0,
    "total": 0.04395241940186995,
    "validator": 0.04395241940186995
  },
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Epoch-Specific Data**\
  These values are **specific to the current epoch**. To understand future trends or configurations, use `getInflationGovernor`.
* **Annualized Rates**\
  Although values apply to the current epoch, they are expressed as **annualized percentages**, allowing for straightforward APR comparison.
* **Rates Evolve Over Time**\
  The inflation rate tapers gradually based on the long-term monetary policy. While `getInflationGovernor` outlines the trajectory, `getInflationRate` shows the effective rate **right now**.
* **Use in Wallets & Dashboards**\
  Integrate this endpoint to display real-time APR insights to delegators and validators.


# getInflationReward

Learn getInflationReward use cases, code examples, request parameters, response structure, and tips.

The `getInflationReward` RPC method enables querying **inflation rewards** (staking rewards) for one or more accounts for a specific epoch. These rewards are credited to **stake accounts**, and the method is crucial for tracking, auditing, or verifying staking-based earnings.

***

### ✅ Common Use Cases

* **🔍 Verify Staking Rewards**: Confirm that a stake account received rewards for a specific epoch.
* **📊 Track Reward History**: Retrieve rewards across multiple epochs to analyze trends or build a payout log.
* **🔐 Audit Validator Payouts**: While validators don’t receive rewards directly, this method allows validating rewards received by their associated vote/stake accounts.

***

### 🛠️ Request Parameters

The method accepts:

#### 1. `addresses` (array of strings) — **Required**

* A list of **base-58 encoded public keys**.
* These can be stake accounts, vote accounts, or other account types.
* Some providers (like Helius) support large batches (e.g., up to 1005 addresses for paid users).

#### 2. `config` (object) — *Optional*

Contains:

| Field            | Type    | Description                                                                           |
| ---------------- | ------- | ------------------------------------------------------------------------------------- |
| `commitment`     | string  | Commitment level (`processed`, `confirmed`, or `finalized`). Default: `finalized`.    |
| `epoch`          | integer | The epoch number to query. If omitted, defaults to the most recently completed epoch. |
| `minContextSlot` | integer | Ensures the query is evaluated at a slot at least this recent.                        |

***

### 📤 Example Request

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getInflationReward",
  "params": [
    ["AccountPublicKey1", "AccountPublicKey2"],
    {
      "epoch": 512,
      "commitment": "finalized"
    }
  ]
}
```

***

### 📥 Response Structure

Returns an **array of results**, in the same order as the `addresses` array. Each element is either:

* An object with reward info
* `null` if the account received no rewards or didn’t exist in the epoch

#### Reward Object Fields:

| Field           | Type | Description                                                  |
| --------------- | ---- | ------------------------------------------------------------ |
| `epoch`         | u64  | Epoch number for the reward                                  |
| `effectiveSlot` | u64  | Slot in which the reward was applied                         |
| `amount`        | u64  | Reward amount in **lamports**                                |
| `postBalance`   | u64  | Account balance after reward application                     |
| `commission`    | u8   | Validator’s commission percentage (*only for vote accounts*) |

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getInflationReward(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getInflationReward',
        "params": [
            [
              "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
              "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
            ],
            {
              "epoch": 822,
              "commitment": "finalized"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getInflationReward(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_inflation_reward(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getInflationReward',
                'params': [
                    [
                        '6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu',
                        'BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2'
                    ],
                    {
                        'epoch': 822,
                        'commitment': 'finalized'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_inflation_reward(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32004,
    "message": "Block not available for slot 355536000"
  },
  "id": 1
}
```

***

### 💡 Developer Tips

* **Epoch Timing**: Rewards are **calculated at the end** of an epoch and **credited at the start** of the next.
* **Effective Slot**: Indicates when the reward was actually applied.
* **Null Entries**: May mean:
  * The account didn't exist
  * No rewards were applicable (e.g., inactive or insufficient stake)
  * The reward was zero
* **Batch Requests**: Avoid overloading providers with large batches if you're not sure about their rate limits.
* **Use with getEpochInfo**: To dynamically determine the current or most recent epoch before querying.

***

### 📘 Summary

The `getInflationReward` RPC method is an essential tool for any staking dashboard, validator analytics tool, or protocol-level reward verification system. It gives granular visibility into how inflation rewards are distributed per epoch across stake accounts.


# getLargestAccounts

Explore the getLargestAccounts RPC method — including its use cases, code examples, request parameters, response structure, and developer tips.

The `getLargestAccounts` RPC method returns the top 20 accounts on the Solana network ranked by lamport balance. This data is often used for insights into wealth concentration, circulating supply dynamics, and network analytics. Keep in mind that results may be **cached by the RPC node for up to two hours**, so they may not always reflect real-time state.

***

#### ✅ Common Use Cases

* **Network Health Monitoring**: Gauge SOL concentration and decentralization by analyzing top account balances.
* **Economic & Wealth Distribution Analysis**: Understand how SOL is distributed across the network.
* **Identifying Whales**: Detect high-balance accounts that may influence token movement or governance.

***

#### 🛠 Request Parameters

This method optionally accepts a configuration object:

| Parameter    | Type                | Description                                                                                                                                                                                                       |
| ------------ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `commitment` | `string` (optional) | Commitment level to query (e.g., `processed`, `confirmed`, `finalized`). Defaults to the node’s setting.                                                                                                          |
| `filter`     | `string` (optional) | <p>Filters results by account type:<br>• <code>"circulating"</code> – Accounts contributing to circulating supply<br>• <code>"nonCirculating"</code> – Locked or reserved accounts<br>• Omit for all accounts</p> |

***

#### 📦 Response Structure

The response includes a `context` object and a `value` array of account entries:

```json
{
  "context": {
    "slot": 251998990
  },
  "value": [
    {
      "address": "4Nd1mQY...ABC123",
      "lamports": 1200000000000
    },
    ...
  ]
}
```

* `address` (string): Base-58 encoded public key.
* `lamports` (u64): Account balance in lamports (1 SOL = 1,000,000,000 lamports).

***

#### 📘 Examples

1. **Get the Largest Accounts Without Filters**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getLargestAccounts"
}
```

2. **Get Top 20 Circulating Supply Accounts**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getLargestAccounts",
  "params": [{ "filter": "circulating" }]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getLargestAccounts(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getLargestAccounts',
        "params": [{ "filter": "circulating" }]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getLargestAccounts(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_largest_accounts(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getLargestAccounts',
                'params': [{'filter': 'circulating'}]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_largest_accounts(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 54 },
    "value": [
      {
        "address": "99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ",
        "lamports": 999974
      },
      {
        "address": "uPwWLo16MVehpyWqsLkK3Ka8nLowWvAHbBChqv2FZeL",
        "lamports": 42
      }
    ]
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Caching Warning**: Results may be cached for up to 2 hours — use with awareness for time-sensitive operations.
* **Result Limit**: Only the top 20 accounts are returned. Use external analytics or archival nodes for broader analysis.
* **Filter Definitions May Vary**: The meaning of `"circulating"` and `"nonCirculating"` is node-specific and may differ slightly between providers.


# getLatestBlockhash

Explore the use cases, examples, parameters, response format, and best practices for the getLatestBlockhash RPC method.

The `getLatestBlockhash` RPC method is fundamental for transaction preparation and submission on the Solana network. It retrieves the most recently processed blockhash and the last block height at which that blockhash remains valid. Since every Solana transaction must reference a recent blockhash, this mechanism plays a crucial role in preventing replay attacks, especially on forked chains.

> 💡 **Note:** Available in `solana-core` v1.9 and newer. For older nodes (v1.8 or below), use `getRecentBlockhash`.

***

**🔍 Common Use Cases**

* **Transaction Construction:** Retrieve a fresh blockhash to include in new transactions before signing and submitting them.
* **Managing Transaction Expiry:** Use `lastValidBlockHeight` to determine how long a transaction will remain valid before expiring.
* **Manual Preflight Checks:** While `simulateTransaction` handles this automatically, developers may opt to manually fetch a blockhash for custom transaction preparation and simulation.

***

**🧾 Request Parameters**

This method optionally accepts a configuration object:

* `commitment` *(string, optional)*: The commitment level for the query. Common values include `confirmed` or `finalized` to ensure a stable blockhash.
* `minContextSlot` *(integer, optional)*: Ensures that the blockhash is retrieved from a ledger state that has processed at least this slot.

***

**📦 Response Structure**

The `result` object includes:

* `blockhash` *(string)*: A base-58 encoded string representing the latest blockhash.
* `lastValidBlockHeight` *(u64)*: The final block height where this blockhash remains valid.
* `context.slot` *(u64)*: The slot at which this data was retrieved.

***

**💡 Examples**

1. **Get the Latest Blockhash (Default Commitment)**\
   Fetches the most recent blockhash using the node’s default commitment level.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getLatestBlockhash"
}
```

1. **Get the Latest Blockhash with `confirmed` Commitment**\
   Explicitly requests a blockhash with `confirmed` commitment for more stability.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getLatestBlockhash",
    "params": [{ "commitment": "confirmed" }]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getLatestBlockhash(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getLatestBlockhash',
        "params": [{ "commitment": "confirmed" }]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getLatestBlockhash(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_latest_blockhash(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getLatestBlockhash',
                'params': [{'commitment': 'confirmed'}]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_latest_blockhash(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355365707
    },
    "value": {
      "blockhash": "GUyGdZk1ghy44vBXaqYkomjUqGnTZEgrPCvCkEETD3xB",
      "lastValidBlockHeight": 333557572
    }
  },
  "id": 1
}
```

***

**🛠 Developer Tips**

* **Blockhash Expiration:** A blockhash typically remains valid for \~2 minutes, though this can vary. Always re-fetch a blockhash if your transaction hasn't been submitted promptly.
* **Commitment Strategy:** Use `finalized` for critical, irreversible transactions. For responsiveness, `confirmed` provides a balance of speed and reliability.
* **Transaction Fees:** This method only returns the blockhash, not fees. Make sure you calculate and attach appropriate fees separately.
* **Retries:** If your transaction expires due to an outdated blockhash, re-sign it with a new one and submit again.

***

This guide walks you through effectively using the `getLatestBlockhash` method — an essential step in ensuring your Solana transactions are fresh, valid, and ready to land.


# getLeaderSchedule

Explore getLeaderSchedule: use cases, examples, parameters, responses, and expert tips.

The `getLeaderSchedule` RPC method retrieves the mapping of block production responsibilities to validators for a specific epoch. This data is vital for analyzing validator activity, predicting leader roles, and building advanced Solana network tooling.

***

**🔍 Common Use Cases**

* **Network Monitoring**: Examine how leadership is distributed among validators during an epoch.
* **Advanced Transaction Routing**: In low-latency applications, developers may attempt to align transactions with current or upcoming leaders.
* **Validator Uptime and Performance**: Cross-reference scheduled leadership slots with actual block production to evaluate validator reliability.
* **Epoch Role Analysis**: Understand the order and frequency with which each validator is assigned leadership duties.

***

**📥 Request Parameters**

You can pass up to two optional arguments:

* `slot` (u64, *optional*): The slot used to determine which epoch’s schedule to return. If omitted, the current epoch is used.
* `config` (object, *optional*):
  * `commitment` (*string*): Choose from `finalized`, `confirmed`, or `processed`. Defaults to the node’s commitment.
  * `identity` (*string*): Base-58 encoded validator public key. If provided, limits the result to only the specified validator’s slots.

***

**📤 Response Structure**

* **`null`**: Returned if the schedule is unavailable (e.g. querying a future epoch not yet calculated).
* **Object**: A mapping where:
  * **Key** = Validator public key (base-58)
  * **Value** = Array of slot indices (relative to the start of the epoch) during which that validator is the leader.

📌 *Example*:\
If an epoch begins at slot `1000`, and a validator’s array is `[0, 1, 5]`, that validator leads slots `1000`, `1001`, and `1005`.

***

**💡 Examples**

1. **Fetch the Full Leader Schedule for the Current Epoch**\
   Query with no parameters to get all validators and their assigned slots.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getLeaderSchedule"
}
```

1. **Fetch a Validator's Schedule for a Specific Epoch**\
   Provide a slot number (e.g., `200000`) and a validator identity to see only their assignments for that epoch.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getLeaderSchedule",
    "params": [
      200000,
      { "identity": "VALIDATOR_PUBKEY" }
    ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getLeaderSchedule(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getLeaderSchedule',
        "params": [
            null,
            {
              "commitment": "processed",
              "identity": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getLeaderSchedule(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_leader_schedule(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getLeaderSchedule',
                'params': [
                    None,
                    {
                        'commitment': 'processed',
                        'identity': 'dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_leader_schedule(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
      21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
      39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
      57, 58, 59, 60, 61, 62, 63
    ]
  },
  "id": 1
}
```

***

**🛠 Developer Tips**

* **Epoch Calculation**: Use `getEpochInfo` to determine the exact start and end slots for a given epoch.
* **Unavailable Data**: If requesting a future epoch, the method may return `null` until the leader schedule is computed.
* **Relative Indexing**: Slot numbers in the response are *relative* to the epoch’s start—not global slot numbers.
* **Large Payloads**: Without an `identity` filter, responses can be large, especially on Mainnet with many active validators.

***

This guide equips you to effectively use `getLeaderSchedule` to explore validator assignments and strengthen your interaction with the Solana cluster’s consensus mechanism.


# getMaxRetransmitSlot

Explore getMaxRetransmitSlot: Use Cases, Examples, Parameters, Response Format, and Pro Tips.

The `getMaxRetransmitSlot` RPC method returns the highest slot number observed by a Solana node during the **retransmit stage**—a critical phase in Solana’s Turbine protocol, which handles block data propagation and repair. This slot reflects how far the node has progressed in receiving shreds (block fragments) from peers and can offer insights into the node's synchronization with the cluster.

***

#### ✅ Common Use Cases

* **Node Synchronization Monitoring**: Use this value to determine how up-to-date a node is with block data being propagated across the cluster.
* **Advanced Network Analysis**: Combine this metric with others to evaluate block propagation health, especially in research or monitoring dashboards.
* **Diagnosing Node Connectivity**: A persistently low retransmit slot can suggest connectivity issues or peer communication failures for a given node.

***

#### 🛠️ Request Parameters

This method takes **no parameters**.

***

#### 📦 Response Structure

The response’s `result` field returns:

* `u64`: The highest slot number seen by the node in the retransmit stage.

***

#### 💡 Example

**Get the Maximum Retransmit Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getMaxRetransmitSlot"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getMaxRetransmitSlot(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getMaxRetransmitSlot'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getMaxRetransmitSlot(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_max_retransmit_slot(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getMaxRetransmitSlot'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_max_retransmit_slot(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 355367621,
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Node-Dependent View**: This slot reflects what *your queried node* sees. Different nodes may report different values due to propagation delays or local issues.
* **Not the Network’s Highest Slot**: For the most confirmed or finalized slot cluster-wide, use `getSlot` with appropriate commitment or `getBlockHeight`. `getMaxRetransmitSlot` only represents what this node has received via retransmit.
* **Continuously Updating**: This value should generally increase in real time. If it stagnates, investigate potential node connectivity or performance problems.

***

This guide equips you with the knowledge to leverage `getMaxRetransmitSlot` for assessing Solana node data propagation health and synchronization performance.


# getMaxShredInsertSlot

Explore getMaxShredInsertSlot: Use Cases, Code Examples, Parameters, Response Format, and Best Practices

The `getMaxShredInsertSlot` RPC method returns the highest slot number for which a Solana node has successfully received and inserted shreds—small pieces of block data propagated through the Turbine protocol. This metric reflects how up-to-date the node is with block ingestion and is an important indicator of node performance and synchronization.

***

#### 🔧 Common Use Cases

* **Node Sync Monitoring**\
  Assess how current a node is by comparing its `maxShredInsertSlot` to the cluster's latest slot. Significant lag may indicate synchronization issues.
* **Performance Tracking**\
  Continuously monitor this value to gauge a node’s processing efficiency and responsiveness to incoming shreds over time.
* **Debugging Ingestion Issues**\
  A stagnant or lagging slot value may reveal problems with a node’s ability to ingest block data, possibly due to poor network connectivity or CPU/memory bottlenecks.

***

#### 📝 Request Parameters

This method does **not** take any parameters.

***

#### 📦 Response Structure

The `result` field in the JSON-RPC response returns a single unsigned 64-bit integer:

* `u64`: The highest slot number for which the node has inserted shreds.

***

#### 💻 Example

**Fetch the Highest Shred Inserted Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getMaxShredInsertSlot"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getMaxShredInsertSlot(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getMaxShredInsertSlot'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getMaxShredInsertSlot(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_max_shred_insert_slot(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getMaxShredInsertSlot'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_max_shred_insert_slot(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 355368267,
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Node-Specific Metric:**\
  This value is local to the node you’re querying. Nodes may differ slightly based on latency and hardware performance.
* **Not a Finality Indicator:**\
  Unlike `getSlot` or `getBlockHeight`, this metric shows ingestion progress—not whether the block has been finalized. For finalized data, use `getSlot` with the `finalized` commitment.
* **Relation to `getMaxRetransmitSlot`:**\
  Typically, `maxShredInsertSlot` will be equal to or slightly lower than `maxRetransmitSlot`, as shreds must first be received (retransmit) before they can be inserted.
* **Continuously Increasing:**\
  The value should steadily increase as new slots are produced and processed. If it stalls, it could indicate issues worth investigating.

***

By using `getMaxShredInsertSlot`, developers and operators can gain precise insights into a node’s data ingestion progress—an essential factor in maintaining performance, uptime, and network reliability within the Solana ecosystem.


# getMinimumBalanceForRentExemption

Explore getMinimumBalanceForRentExemption: Use Cases, Parameters, Examples, and Best Practices

The `getMinimumBalanceForRentExemption` RPC method calculates the minimum number of lamports required for an account of a given data size to become rent-exempt on the Solana network. Rent exemption ensures that accounts retain their balance indefinitely, avoiding depletion due to storage rent charges. An account becomes rent-exempt when its balance equals at least two years' worth of rent.

***

**🧩 Common Use Cases**

* **Account Initialization**: When creating accounts (e.g., SPL Token accounts, PDAs, or custom data structures), use this method to allocate the appropriate lamport amount for rent exemption.
* **Dynamic Sizing**: For applications where account size changes over time, recalculate the minimum balance to maintain rent exemption as the data grows.
* **Deployment Cost Estimation**: Estimate SOL requirements for deploying programs or initializing accounts with various data sizes.
* **Wallet & SDK Integration**: Wallets and Solana SDKs often use this method to ensure rent-exempt balances when creating accounts.

***

**🔧 Request Parameters**

```json
{
  "dataLength": <usize>,      // Required. Size of the account data in bytes.
  "commitment": {             // Optional.
    "commitment": "finalized" // e.g., "processed", "confirmed", or "finalized"
  }
}
```

* **dataLength**: Number of bytes the account will store (e.g., 165 for a typical SPL Token account).
* **commitment**: Optional commitment level to define how finalized the queried state should be.

***

**📦 Response Structure**

```json
{
  "result": <u64>
}
```

* **result**: The minimum number of lamports required to make an account of the given `dataLength` rent-exempt.

***

**🧪 Examples**

1. **Standard SPL Token Account (165 bytes)**

   ```bash
   bashCopyEditgetMinimumBalanceForRentExemption(165)
   ```

   Returns the lamports needed to make a token account rent-exempt.
2. **Zero-Byte Account**

   ```bash
   bashCopyEditgetMinimumBalanceForRentExemption(0)
   ```

   Returns the smallest possible rent-exempt value—useful for bare minimum accounts.

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getMinimumBalanceForRentExemption(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getMinimumBalanceForRentExemption',
        "params": [
            0
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getMinimumBalanceForRentExemption(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_minimum_balance_for_rent_exemption(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getMinimumBalanceForRentExemption',
                'params': [0]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_minimum_balance_for_rent_exemption(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 890880,
  "id": 1
}
```

***

**💡 Developer Tips**

* **Rent Scales With Size**: Larger accounts require more lamports to remain rent-exempt.
* **Dynamic Network Rate**: Rent is a network-level parameter (lamports per byte-year) and may change via cluster governance. This method always reflects the current rate.
* **Units**: Returned value is in lamports. (1 SOL = 1,000,000,000 lamports.)
* **Avoid Garbage Collection**: Rent-exempt accounts are protected from being removed due to insufficient balance, preserving important data over time.

***

This method is essential for developers who want to ensure their Solana accounts are sustainable and secure from unintended deletion due to rent mechanics.


# getMultipleAccounts

Explore getMultipleAccounts: Use Cases, Examples, Parameters, Response Format, and Best Practices

The `getMultipleAccounts` RPC method lets you fetch data for up to 100 accounts in a single call—dramatically reducing network overhead compared to individual `getAccountInfo` requests. This batch approach improves responsiveness and scalability for applications that need to load or process many accounts at once.

***

#### ✅ Common Use Cases

* **Batch Account Loading**\
  Retrieve data for multiple known accounts (e.g., a user’s token accounts or on-chain configuration accounts) in one request.
* **Portfolio Trackers**\
  Simultaneously fetch balances and states for all token accounts owned by a user.
* **Marketplace & NFT UIs**\
  Load details of multiple NFT or marketplace item accounts in a single call.
* **dApp Performance Optimization**\
  Reduce RPC calls, speed up load times, and enhance user experience when handling large sets of accounts.

***

#### 🛠 Request Parameters

```json
{
  "pubkeys": ["<base58Pubkey1>", "<base58Pubkey2>", …],  // Required, max 100 keys
  "options": {                                          // Optional
    "commitment": "processed|confirmed|finalized",
    "encoding": "base64|base58|base64+zstd|jsonParsed",
    "dataSlice": { "offset": <number>, "length": <number> },
    "minContextSlot": <u64>
  }
}
```

* **pubkeys**\
  Array of base-58 encoded public keys (max 100).
* **options**
  * `commitment`: Query confirmation level.
  * `encoding`: How to return account data (`jsonParsed` for structured formats).
  * `dataSlice`: Fetch only a byte range (`offset` + `length`) for large accounts.
  * `minContextSlot`: Ensure the data is at least as recent as this slot.

***

#### 📦 Response Structure

```json
{
  "context": { "slot": <u64>, "apiVersion"?: "<string>" },
  "value": [
    null,  // if account not found or error
    {
      "lamports": <u64>,
      "owner": "<string>",
      "data": ["<encoded>", "<encoding>"] | { /* parsed JSON */ },
      "executable": <boolean>,
      "rentEpoch": <u64>,
      "space": <u64>
    },
    …
  ]
}
```

* **context.slot**: Slot at which data was retrieved.
* **value**: Array matching the order of `pubkeys`. Each element is either `null` or an account object.

***

#### 💡 Examples

1. **Basic Info for Two Accounts**

   ```json
   {
     "method": "getMultipleAccounts",
     "params": [
       [
         "GyWcZ398VPbAfMk6P1JQTPQv8Z57W2AFFuTfZa3NBe8M",
         "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5"
       ]
     ]
   }
   ```
2. **Parsed SPL Token Data**

   ```json
   {
     "method": "getMultipleAccounts",
     "params": [
       ["<tokenPubkey1>", "<tokenPubkey2>"],
       { "encoding": "jsonParsed", "commitment": "finalized" }
     ]
   }
   ```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getMultipleAccounts(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getMultipleAccounts',
        "params": [
            [
              "GyWcZ398VPbAfMk6P1JQTPQv8Z57W2AFFuTfZa3NBe8M",
              "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5"
            ]
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getMultipleAccounts(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_multiple_accounts(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getMultipleAccounts',
                'params': [
                    [
                        'GyWcZ398VPbAfMk6P1JQTPQv8Z57W2AFFuTfZa3NBe8M',
                        '4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5'
                    ]
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_multiple_accounts(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": {
      "slot": 355370044,
      "apiVersion": "2.2.7"
    },
    "value": [
      {
        "lamports": 289078906,
        "data": [
          "",
          "base64"
        ],
        "owner": "11111111111111111111111111111111",
        "executable": false,
        "rentEpoch": 18446744073709552000,
        "space": 0
      },
      {
        "lamports": 196360749,
        "data": [
          "",
          "base64"
        ],
        "owner": "11111111111111111111111111111111",
        "executable": false,
        "rentEpoch": 18446744073709552000,
        "space": 0
      }
    ]
  }
}
```

***

#### 🧠 Developer Tips

* **100-Account Limit**: You can request up to 100 accounts per call.
* **Partial Failures**: A single failure doesn’t abort the batch—check for `null` entries.
* **`jsonParsed` Convenience**: Saves manual deserialization for common programs (e.g., SPL Token).
* **Use `dataSlice`** for large accounts to minimize payload size and bandwidth.
* **Handle Nulls Gracefully**: Null indicates non-existent accounts or fetch errors—plan your UI/logic accordingly.

***

By batching account queries with `getMultipleAccounts`, your Solana application can achieve faster load times and more efficient RPC usage.

2/2Ask ChatGPT


# getProgramAccounts

Explore getProgramAccounts: Use Cases, Code Examples, Parameters, Response Format, and Expert Tips

The `getProgramAccounts` RPC method lets you fetch **all** on‐chain accounts owned by a given program—essential for any application that needs to discover or monitor program‑specific state. Since a program can own thousands of accounts, this method offers powerful filtering to narrow your results and optimize performance.

***

#### 🔍 Common Use Cases

* **Token Holders Discovery**\
  Find every SPL token account for a specific mint to list all token holders.
* **User‑Specific Data Retrieval**\
  Fetch all accounts created by a program for a user (e.g., a DeFi position, game state).
* **Custom Account Indexing**\
  Locate all instances of a bespoke account type defined by your program.
* **Program State Monitoring**\
  Track every account under a program to observe its overall activity and health.
* **Explorer & Analytics Tooling**\
  Aggregate and analyze program data for dashboards or block explorers.

***

#### 🛠 Request Parameters

```json
{
  "programId": "<base58ProgramPubkey>",  // Required
  "options": {                           // Optional
    "commitment": "processed|confirmed|finalized",
    "encoding": "base64|base58|base64+zstd|jsonParsed",
    "filters": [
      { "dataSize": <u64> },
      { "memcmp": { "offset": <usize>, "bytes": "<base58Bytes>" } }
      // up to 4 total filters
    ],
    "dataSlice": { "offset": <usize>, "length": <usize> },
    "withContext": true|false,
    "minContextSlot": <u64>
  }
}
```

* **programId**: Base‑58 public key of the on‑chain program (e.g., `"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"`).
* **commitment**: Desired confirmation level.
* **encoding**:
  * `base64` (default)
  * `base58`
  * `base64+zstd`
  * `jsonParsed` (highly recommended for supported programs)
* **filters** (max 4):
  * `dataSize`: Match accounts by byte length.
  * `memcmp`: Compare a slice of account data at `offset` with `bytes`.
* **dataSlice**: Return only a byte range—ideal for large accounts.
* **withContext**: Wrap results in an object with `context` (slot) and `value` (accounts) when `true`.
* **minContextSlot**: Ensure data is at least as recent as this slot.

***

#### 📦 Response Structure

Returns either a raw array or, if `withContext: true`, an RPC response object:

```json
[
  {
    "pubkey": "<accountPubkey>",
    "account": {
      "lamports": <u64>,
      "owner": "<programId>",
      "data": ["<encoded>", "<encoding>"] | { /* parsed JSON */ },
      "executable": true|false,
      "rentEpoch": <u64>,
      "space": <u64>  // data length in bytes
    }
  },
  …
]
```

* **pubkey**: Account’s base‑58 public key.
* **account**:
  * `lamports`: Balance in lamports.
  * `owner`: Program that owns this account.
  * `data`: Encoded or parsed account data.
  * `executable`: `true` if this account is a program.
  * `rentEpoch`: Next epoch when rent is due.
  * `space`: Byte length of the data.

***

#### 💡 Examples

1. **All USDC Token Accounts**\
   Filter by `dataSize: 165` and `memcmp` at offset `0` matching the USDC mint key.
2. **Accounts Owned by a Wallet**\
   Use `dataSize: 165` and `memcmp` at offset `32` to match the wallet’s public key.

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getProgramAccounts(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getProgramAccounts',
        "params": [
            "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
            {
              "commitment": "finalized",
              "filters": [
                { "dataSize": 17 },
                {
                  "memcmp": {
                    "offset": 4,
                    "bytes": "3Mc6vR"
                  }
                }
              ]
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getProgramAccounts(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_program_accounts(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getProgramAccounts',
                'params': [
                    '4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T',
                    {
                        'commitment': 'finalized',
                        'filters': [
                            {'dataSize': 17},
                            {
                                'memcmp': {
                                    'offset': 4,
                                    'bytes': '3Mc6vR'
                                }
                            }
                        ]
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_program_accounts(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY",
      "account": {
        "data": "2R9jLfiAQ9bgdcw6h8s44439",
        "executable": false,
        "lamports": 15298080,
        "owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
        "rentEpoch": 28,
        "space": 42
      }
    }
  ],
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Always Filter**: Without filters, queries can be extremely heavy and may time out.
* **No Pagination**: Large result sets aren’t paginated—design filters to keep results manageable.
* **Rate Limits**: Heavy usage can hit provider limits (e.g., CoinVera).
* **Know Your Layout**: Effective `memcmp` filters require precise knowledge of account byte structure.
* **Prefer `jsonParsed`**: For SPL Token, Stake, and other common programs, `jsonParsed` saves manual decoding.

***

By mastering `getProgramAccounts` and its filters, you’ll efficiently query and manipulate program‑owned accounts at scale on Solana.


# getRecentPerformanceSamples

Explore getRecentPerformanceSamples: Use Cases, Code Examples, Parameters, Response Format, and Pro Tips

The `getRecentPerformanceSamples` RPC method delivers a time‑series snapshot of Solana’s network performance, sampling roughly every 60 seconds. Each sample records the number of transactions processed and slots produced during that interval—critical metrics for assessing throughput and network health.

***

**Key Use Cases**

* **Network Health Monitoring**\
  Track transaction rates and slot production over time to detect congestion or slowdowns.
* **Performance Analysis**\
  Examine historical samples to identify trends, peak load periods, and capacity limits.
* **Dashboarding & Alerts**\
  Display TPS (transactions per second) and slots‑per‑minute on monitoring dashboards or trigger alerts when performance dips.
* **Capacity Planning**\
  Use sampled data to forecast resource needs for application scaling and infrastructure provisioning.

***

**Request Parameters**

* `limit` *(optional, usize)*:\
  Number of most recent samples to return (max 720, \~12 hours of data). Omitting `limit` returns the provider’s default sample count.

***

**Response Structure**

An array of performance sample objects in **reverse chronological** order:

| Field                    | Type | Description                                          |
| ------------------------ | ---- | ---------------------------------------------------- |
| `slot`                   | u64  | Slot at which this sample was recorded               |
| `numTransactions`        | u64  | Total transactions (including votes) in the period   |
| `numSlots`               | u64  | Slots produced during the sample interval            |
| `samplePeriodSecs`       | u16  | Actual duration of the sample (usually \~60 seconds) |
| `numNonVoteTransactions` | u64  | Transactions excluding consensus votes               |

***

#### Get the Last 5 Performance Samples <a href="#id-1-get-the-last-5-performance-samples" id="id-1-get-the-last-5-performance-samples"></a>

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getRecentPerformanceSamples",
    "params": [5]
}
```

#### Get Default Number of Performance Samples <a href="#id-2-get-default-number-of-performance-samples" id="id-2-get-default-number-of-performance-samples"></a>

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getRecentPerformanceSamples"
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getRecentPerformanceSamples(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getRecentPerformanceSamples'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getRecentPerformanceSamples(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_recent_performance_samples(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getRecentPerformanceSamples'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_recent_performance_samples(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "slot": 348125,
      "numTransactions": 126,
      "numSlots": 126,
      "samplePeriodSecs": 60,
      "numNonVoteTransactions": 1
    },
    {
      "slot": 347999,
      "numTransactions": 126,
      "numSlots": 126,
      "samplePeriodSecs": 60,
      "numNonVoteTransactions": 1
    }
  ],
  "id": 1
}
```

***

**Developer Tips**

* **Interval Variance**: Samples aim for \~60‑second intervals; check `samplePeriodSecs` to see the exact duration.
* **Data Retention**: Up to 720 samples (\~12 hours). For longer-term analysis, combine with external logging.
* **Vote vs. User Activity**: Use `numNonVoteTransactions` to focus on user‑driven load apart from voting traffic.
* **Node Differences**: Slight variations may occur between RPC nodes based on synchronization and local timing.


# getRecentPrioritizationFees

Explore getRecentPrioritizationFees: Use Cases, Code Examples, Parameters, Response Format, and Pro Tips

The `getRecentPrioritizationFees` RPC method surfaces fee data from the last \~150 blocks, showing the extra “priority” fee paid (in micro‑lamports per compute unit) by transactions that gained early inclusion. By analyzing recent fee levels, you can choose competitive priority fees to improve your transaction’s chances of rapid processing during congestion.

***

#### ✅ Common Use Cases

* **Dynamic Fee Estimation**\
  Determine a target priority fee by observing what fees succeeded in recent blocks.
* **Network Congestion Analysis**\
  Gauge current load by tracking the distribution of paid prioritization fees.
* **Wallet Fee Suggestions**\
  Power wallet UIs to recommend realistic priority fees based on live network conditions.
* **Time‑Sensitive Operations**\
  For arbitrage bots or auction sniping, set an optimal fee to beat competing transactions.

***

#### 🛠 Request Parameters

```json
{
  "lockedWritableAccounts": [
    "<base58Pubkey1>",
    "<base58Pubkey2>",
    …
  ] // Optional, max 128 entries
}
```

* **lockedWritableAccounts**\
  If provided, returns fees from transactions that locked **all** specified accounts.\
  Omit or pass `[]` to get a global view of recent prioritization fees.

***

#### 📦 Response Structure

An array of objects (most recent first), each with:

```json
[
  { "slot": 12345678, "prioritizationFee": 5000 },
  { "slot": 12345677, "prioritizationFee": 0    },
  …
]
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getRecentPrioritizationFees(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getRecentPrioritizationFees',
        "params": [[
            "Vote111111111111111111111111111111111111111", 
            "Stake11111111111111111111111111111111111111"
          ]]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getRecentPrioritizationFees(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_recent_prioritization_fees(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getRecentPrioritizationFees',
                'params': [[
                    'Vote111111111111111111111111111111111111111',
                    'Stake11111111111111111111111111111111111111'
                ]]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_recent_prioritization_fees(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "prioritizationFee": 0,
      "slot": 355373923
    },
    {
      "prioritizationFee": 0,
      "slot": 355374059
    },
    {
      "prioritizationFee": 0,
      "slot": 355374071
    },
    {
      "prioritizationFee": 0,
      "slot": 355374072
    }
  ],
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Units Matter**\
  Fees are in **micro‑lamports** (0.000 001 lamports) per compute unit (CU). Multiply by your CU usage to get total priority fee.
* **Short Cache Window**\
  Most nodes cache this data for \~150 blocks (\~1–2 minutes). Use it for very recent fee trends only.
* **Zero Fees ≠ No Demand**\
  A `prioritizationFee` of `0` can simply mean no matching transactions paid extra fees, not that the network was free.
* **Statistical Selection**\
  Rather than picking the single highest fee, consider the median or 75th percentile of non‑zero fees to avoid overpaying.
* **Combine with Compute Budget**\
  Ensure you set both `ComputeBudgetProgram.setComputeUnitLimit` and `.setComputeUnitPrice` to apply your chosen priority fee effectively.

***

By leveraging `getRecentPrioritizationFees`, you can fine‑tune transaction fees to current network conditions and enhance your transaction confirmation success.


# getSignaturesForAddress

Explore getSignaturesForAddress: Use Cases, Code Examples, Request Parameters, Response Structure, and Expert Tips

The `getSignaturesForAddress` RPC method retrieves a list of confirmed transaction signatures involving a specific account, ordered newest first. It’s the primary way to fetch an account’s transaction history on Solana.

***

#### ✅ Common Use Cases

* **Wallet History**\
  Display recent transactions for a user’s wallet. For richer parsing, consider CoinVera’s Enhanced Transactions API.
* **Activity Auditing**\
  Review all transactions tied to a particular smart contract or account.
* **Targeted Lookup**\
  Locate a specific transaction when you only know the involved address.
* **Local Indexing**\
  Build a custom transaction index for faster queries and analytics.

***

#### 🛠 Request Parameters

```json
{
  "address": "<base58AccountPubkey>",  // Required
  "options": {                         // Optional
    "limit": <number>,         // 1–1000 (default 1000)
    "before": "<signature>",   // Fetch signatures before this one
    "until": "<signature>",    // Stop when this signature is reached (exclusive)
    "commitment": "processed|confirmed|finalized",
    "minContextSlot": <u64>
  }
}
```

* **address**: Base‑58 public key of the target account.
* **limit**: Max signatures to return (default and max: 1000).
* **before / until**: Paginate by signature.
* **commitment**: Confirmation level (defaults to the node’s setting).
* **minContextSlot**: Minimum slot the node must have processed to serve this request.

***

#### 📦 Response Structure

Returns an array of objects—each representing one signature:

| Field                | Type           | Description                                            |
| -------------------- | -------------- | ------------------------------------------------------ |
| `signature`          | string         | Base‑58 transaction signature                          |
| `slot`               | u64            | Slot in which the transaction was processed            |
| `err`                | object \| null | Error details if the transaction failed                |
| `memo`               | string \| null | Memo attached to the transaction, if any               |
| `blockTime`          | i64 \| null    | Unix timestamp of the block (seconds since epoch)      |
| `confirmationStatus` | string \| null | “processed”, “confirmed”, or “finalized” (may be null) |

***

#### 💡 Examples

1. **Fetch the Latest Signatures**\
   Retrieve up to 1,000 newest signatures for an address.
2. **Limit the Number of Signatures**\
   Request a specific count (e.g., 100) by setting `limit: 100`.
3. **Paginate Through History**\
   Use `before` with the last signature of the previous batch to page backwards.

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSignaturesForAddress(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSignaturesForAddress',
        "params": [
            "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
            {
              "limit": 5 
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSignaturesForAddress(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_signatures_for_address(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSignaturesForAddress',
                'params': [
                    '4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5',
                    {
                        'limit': 5
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_signatures_for_address(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "blockTime": 1753337914,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "4boe3PE7Z2JvVuJb71MCNHZMRSGpcgMVFtiWADzGNTQkM6aa6b9xZg21Rs4xckLiDfFHfQNcPimMD7AmWkqS8KWC",
      "slot": 355371621
    },
    {
      "blockTime": 1753337729,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "3ec22yxtoMsSZKgEG7yGmLpVqkwQL4mqo4uBJbXJbx3VHAot6zhxLoH9K34hpD5SaeTGc3x4ufFMuA2r8mDJ84eP",
      "slot": 355371148
    },
    {
      "blockTime": 1753336615,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "4sjZcFBuamq26nSEiQeezaHwNzr1zPfaYf4iJXbZ7FHcEJ7jxLkFWp6UMhab3fyq98EQyoym6j8dEHnZR1u5XgU2",
      "slot": 355368317
    },
    {
      "blockTime": 1753336550,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "3ogjKgB5thqU7ENNUTaxnVHnG8eufW4cm8Jx42bofiHGWHamjMMiEm3RdTSThq38mwtcuqDChg6FTaX84TkiZ1aS",
      "slot": 355368149
    },
    {
      "blockTime": 1753335989,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "2iHnTgv2cJvr3EMdFaEoYcjQrtUL9kq7LmBPENKb4YA4ZgA3ZGDvEnmNu6sdnuW6kmQM9Rbc3fsQYhWg6cXGCYqe",
      "slot": 355366716
    }
  ],
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Pagination Is Essential**\
  To walk an active account’s full history, repeat calls using `before` and adjust `limit`.
* **Watch Rate Limits**\
  Large or frequent history queries can hit RPC provider limits.
* **Ordering Guaranteed**\
  Results always flow from newest to oldest.
* **Use `until` to Stop Early**\
  If you only need transactions up to a known signature, specify `until` to halt the scan.
* **Context Slot Doesn’t Filter**\
  `minContextSlot` sets the node’s ledger state threshold, not a transaction filter.
* **Full Details via `getTransaction`**\
  This method returns only signatures and metadata; retrieve full transaction info by feeding each signature into `getTransaction`.

***

By leveraging `getSignaturesForAddress` with its pagination and filtering options, you can efficiently access and manage any Solana account’s transaction history.


# getSignatureStatuses

Learn about getSignatureStatuses—its use cases, code examples, request parameters, response structure, and practical tips.

The `getSignatureStatuses` RPC method in **CoinVera** allows you to retrieve the processing and confirmation status of one or more transaction signatures. It's a powerful tool to determine whether transactions have been **processed**, **confirmed**, or **finalized** on the Solana network.

By default, this method queries the **recent status cache** on the RPC node. To retrieve status for older transactions, set `searchTransactionHistory` to `true`.

***

#### ✅ Common Use Cases

* **Confirming Transaction Finality**\
  Verify if a transaction has reached a desired confirmation level, such as `confirmed` or `finalized`.
* **Batch Status Lookup**\
  Check the status of up to 256 transactions in a single request—useful after batch sends.
* **UI Updates Based on Status**\
  Display real-time transaction progress in your frontend.
* **Error Checking**\
  Identify failed transactions and inspect error details.

***

#### 🧾 Request Parameters

* `signatures` (array of string) – **Required**\
  An array of base-58 encoded transaction signatures. Up to **256** per call.
* `options` (object) – *Optional*
  * `searchTransactionHistory` (boolean):\
    If `true`, the node will search its full transaction history.\
    If `false` (default), only the recent cache is used.

***

#### 📦 Response Structure

```json
{
  "result": {
    "context": {
      "slot": 12345678
    },
    "value": [
      {
        "slot": 12345678,
        "confirmations": 2,
        "err": null,
        "status": { "Ok": null },
        "confirmationStatus": "confirmed"
      },
      null
    ]
  }
}
```

* **`context.slot`** – Slot when the request was processed.
* **`value[]`** – Array matching the order of requested signatures:
  * If found:
    * `slot`: Slot where the transaction was processed.
    * `confirmations`: Number of blocks confirmed since then. `null` means finalized.
    * `err`: `null` if successful, or error details.
    * `status`: Execution status.
    * `confirmationStatus`: One of `processed`, `confirmed`, `finalized`, or `null`.
  * If not found:
    * `null`: Signature not found (e.g., not in cache and no history search).

***

#### 🧪 Examples

**1. Get Status for Recent Transactions**

Query recent transactions without enabling historical search.

**2. Get Status with `searchTransactionHistory: true`**

Use this when querying older transactions or when unsure if they're still in cache.

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSignatureStatuses(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSignatureStatuses',
        "params": [
            [
              "4boe3PE7Z2JvVuJb71MCNHZMRSGpcgMVFtiWADzGNTQkM6aa6b9xZg21Rs4xckLiDfFHfQNcPimMD7AmWkqS8KWC"
            ],
            {
              "searchTransactionHistory": true
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSignatureStatuses(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_signature_statuses(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSignatureStatuses',
                'params': [
                    [
                        '4boe3PE7Z2JvVuJb71MCNHZMRSGpcgMVFtiWADzGNTQkM6aa6b9xZg21Rs4xckLiDfFHfQNcPimMD7AmWkqS8KWC'
                    ],
                    {
                        'searchTransactionHistory': True
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_signature_statuses(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355395272
    },
    "value": [
      {
        "confirmationStatus": "finalized",
        "confirmations": null,
        "err": null,
        "slot": 355371621,
        "status": {
          "Ok": null
        }
      }
    ]
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Enable `searchTransactionHistory`** for older or uncertain transactions.
* **Limit of 256 Signatures** per request—batch intelligently.
* A **`null` entry in the value array** means:
  * Not found in cache.
  * Not in node history.
  * Transaction was never confirmed.
* **`confirmations: null`** usually indicates the transaction is finalized.
* Use the **`err`** and **`status`** fields to handle transaction failures gracefully.

***

**CoinVera’s `getSignatureStatuses`** is a lightweight yet essential tool for monitoring transaction lifecycles, especially in high-throughput environments. For reliability, always set&#x20;


# getSlot

Learn about getSlot—its use cases, code examples, request parameters, response structure, and helpful tips.

The `getSlot` RPC method in **CoinVera** returns the current slot number that the node believes has reached a specified commitment level. This is a core method used to understand the **current progression** of the Solana blockchain as perceived by an RPC node.

***

#### ✅ Common Use Cases

* **Getting Current Network Progress**\
  Identify the most recent slot processed or confirmed by the node.
* **Node Synchronization Check**\
  Compare slot values between nodes to assess sync status.
* **Timestamping Operations**\
  Use slot values as temporal markers for blockchain events or data.
* **Input for Other RPC Calls**\
  Supply a current or specific slot as input to other RPC methods.

***

#### 🧾 Request Parameters

This method accepts an **optional configuration object**:

* `options` (object, optional):
  * `commitment` (string, optional):\
    Determines the commitment level to query.\
    Options:
    * `processed`: Latest slot the node knows of. Not confirmed—may be skipped.
    * `confirmed`: Slot voted on by a supermajority.
    * `finalized`: Slot confirmed and **cannot be rolled back**.
    * *If omitted, defaults to the node’s default commitment (usually `finalized`).*
  * `minContextSlot` (number, optional):\
    The minimum acceptable slot. If the node is behind this slot, it may return an error or a lower value. Useful for ensuring queries operate on recent enough state.

***

#### 📦 Response Structure

The `result` is a **single unsigned 64-bit integer (`u64`)**:

```json
{
  "result": 221446599
}
```

This value represents the slot number corresponding to the specified commitment level.

***

#### 🧪 Examples

**1. Get Current Slot (Default Commitment)**

Fetches the slot using the node’s default setting, usually `finalized`.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlot"
}
```

**2. Get Slot with Specific Commitment**

Retrieve the latest slot at the `confirmed` commitment level.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlot",
    "params": [
      {
        "commitment": "confirmed"
      }
    ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSlot(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSlot',
        "params": [
            {
              "commitment": "confirmed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSlot(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_slot(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSlot',
                'params': [
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_slot(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 355395938
}
```

***

#### 💡 Developer Tips

* **Commitment Level Affects Finality**\
  Use `finalized` for the highest confidence. `processed` gives the most up-to-date slot but may not be stable.
* **Different Nodes, Different Slots**\
  Slot numbers can vary slightly between nodes, depending on network delays and processing state.
* **Use `minContextSlot` in Advanced Scenarios**\
  This helps ensure the node is evaluating your request against a recent enough slot. Especially useful in consistency-sensitive operations.

***

The `getSlot` method is simple but powerful—essential for understanding Solana's real-time state and building reliable, time-sensitive blockchain applications with **CoinVera**.


# getSlotLeader

Learn about getSlotLeader—its use cases, code examples, request parameters, response structure, and practical tips.

The `getSlotLeader` RPC method in **CoinVera** returns the **public key** of the validator currently designated as the **block producer** for the current slot. This determination is made according to the node’s view at a specified **commitment level**.

***

#### ✅ Common Use Cases

* **Identifying the Current Block Producer**\
  Determine which validator is currently responsible for producing blocks.
* **Network Monitoring**\
  Track how slot leadership rotates among validators.
* **Debugging Transaction Issues**\
  In advanced setups, it may be useful to identify the leader—especially when submitting transactions directly to leader nodes.

***

#### 🧾 Request Parameters

`getSlotLeader` accepts an **optional configuration object**:

* `options` (object, optional):
  * `commitment` (string):\
    One of `finalized`, `confirmed`, or `processed`.\
    Defaults to the node’s standard (usually `finalized`).
  * `minContextSlot` (number):\
    Minimum slot the request must be evaluated at. Ensures the node is sufficiently up to date before responding.

***

#### 📦 Response Structure

Returns a single **base-58 encoded public key** string representing the current slot leader.

```json
{
  "result": "5Y6g8zWcR9GVoHqGnBbPmgzUdu1tHuCVDRKLv7fP5Xed"
}
```

***

#### 🧪 Examples

**1. Get Current Slot Leader (Default Commitment)**

Fetches the current leader using the node's default commitment (usually `finalized`).

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlotLeader"
}
```

**2. Get Slot Leader with `confirmed` Commitment**

Fetches the leader for the most recently confirmed slot.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlotLeader",
    "params": [
      {
        "commitment": "confirmed"
      }
    ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSlotLeader(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSlotLeader',
        "params": [
            {
              "commitment": "confirmed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSlotLeader(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_slot_leader(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSlotLeader',
                'params': [
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_slot_leader(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": "bkpk9KVsDRfrArzzmkJ9mPEvbXfQxczzQYR3QMGiR8Z",
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Leaders Rotate Rapidly**\
  Slot leaders change roughly every **4 slots**, making the returned value a momentary snapshot.
* **Commitment Level Impacts Accuracy**
  * `processed`: Most recent view, may be unstable.
  * `confirmed` or `finalized`: Safer, more consistent results.
* **Understand Leader Scheduling**\
  The rotation is based on a **leader schedule**, calculated at the start of each **epoch**. For future or historical slots, use `getLeaderSchedule`.
* **Node Perspective Matters**\
  Each RPC node operates based on its own network view. Results may vary slightly across nodes due to latency or forks.

***

The `getSlotLeader` method provides a fast and simple way to identify the current validator responsible for producing blocks. For a broader perspective of validator rotation, use the more detailed `getLeaderSchedule` RPC method.


# getSlotLeaders

Learn about getSlotLeaders—including its use cases, code examples, request parameters, response structure, and helpful tips.

The `getSlotLeaders` RPC method in **CoinVera** allows you to retrieve a list of **validator public keys** scheduled to produce blocks for a specific range of slots. This method is helpful when analyzing or predicting short-term leader activity on the Solana network.

***

#### ✅ Common Use Cases

* **Predicting Near-Term Block Producers**\
  Identify which validators are expected to lead block production in upcoming slots.
* **Analyzing Leader Distribution**\
  Examine how leadership is distributed across a segment of an epoch.
* **Network Monitoring & Analysis**\
  Tools that track validator activity or block propagation can use this method to understand validator participation in upcoming slots.

***

#### 🧾 Request Parameters

* `startSlot` (`u64`) – **Required**\
  The first slot (inclusive) from which to begin fetching leader assignments.
* `limit` (`u64`) – **Required**\
  The number of **consecutive slot leaders** to return (must be between **1 and 5,000**).

***

#### 📦 Response Structure

Returns an array of base-58 encoded public keys, one for each slot in the requested range, in order.

```json
{
  "result": [
    "5Y6g8zWcR9GVoHqGnBbPmgzUdu1tHuCVDRKLv7fP5Xed",
    "2ABgfX2pRzAGhLkYwPYTeJNXREtxNUb1mC17hCwF41hD",
    ...
  ]
}
```

Each public key corresponds to the validator scheduled to produce a block for that slot.

***

#### 🧪 Example

**Get Slot Leaders for a Specific Range**

Fetches leaders for the next 5 slots starting at a specified slot number.

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSlotLeaders",
    "params": [
      180000000, 
      5          
    ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSlotLeaders(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSlotLeaders',
        "params": [
            355104000, 
            5          
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSlotLeaders(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_slot_leaders(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSlotLeaders',
                'params': [
                    355104000,
                    5
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_slot_leaders(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "vu1sGn2f1Xim6voHNLt4nLn38zNkYdLasU7hEr1TC2D",
    "simpRo1FrQYGa1moicfgnPDp6KyE38d4gYrZzhjXYJb"
  ],
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Limit Parameter**\
  You can retrieve up to **5,000** slot leaders in one request, which allows insight into a sizable segment of the leader schedule within an epoch.
* **Epoch Boundaries**\
  The schedule is fixed per epoch. If your requested range crosses into a new epoch, only slots from the current epoch (where `startSlot` resides) will be returned—up to the `limit` or the end of the schedule, depending on node configuration.
* **Supports Future Slot Lookups**\
  You can query upcoming (future) slots. The RPC node uses the current leader schedule to project future leaders.
* **High Accuracy**\
  Since the leader schedule is deterministic and set at the beginning of an epoch, returned values are reliable unless major network events occur.
* **Difference from `getLeaderSchedule`**
  * `getSlotLeaders`: Returns a flat, ordered list of leader public keys for a specific slot range.
  * `getLeaderSchedule`: Returns the full epoch schedule, mapping each validator to all slots they're scheduled to lead.

***

Use `getSlotLeaders` when you need a concise, sequential list of upcoming block producers for a well-defined slot range—ideal for validator analysis, staking dashboards, or block propagation modeling.


# getStakeMinimumDelegation

Learn getStakeMinimumDelegation use cases, code examples, request parameters, response structure, and tips.

The `getStakeMinimumDelegation` RPC method in **CoinVera** returns the **minimum amount of SOL** required to create or maintain a **delegated stake account**. This minimum is defined by the network and may change over time based on network parameters or updates.

***

#### ✅ Common Use Cases

* **Creating Stake Accounts**\
  Ensure users or applications allocate at least the minimum required SOL before attempting to delegate stake.
* **Staking UI Validation**\
  Display appropriate warnings or disable staking options if the user's balance is below the threshold.
* **Programmatic Checks**\
  Prevent transaction failures by validating stake amounts before submitting stake instructions.

***

#### 🧾 Request Parameters

This method takes **no parameters**.

```json
{}
```

***

#### 📦 Response Structure

Returns a single number representing the minimum required stake in **lamports** (1 SOL = 1,000,000,000 lamports):

```json
{
  "result": 10000000
}
```

In this example, the minimum stake required is **0.01 SOL**.

***

#### 🧪 Example

**Get Current Minimum Stake Amount**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getStakeMinimumDelegation"
}

// Response
{
  "jsonrpc": "2.0",
  "result": 10000000,
  "id": 1
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getStakeMinimumDelegation(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getStakeMinimumDelegation',
        "params": [
            {
              "commitment": "confirmed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getStakeMinimumDelegation(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_stake_minimum_delegation(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getStakeMinimumDelegation',
                'params': [
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_stake_minimum_delegation(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355399228
    },
    "value": 1
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Always Use This Before Delegating**\
  Especially if users are staking small amounts—this avoids failed transactions due to insufficient delegation.
* **Lamports, Not SOL**\
  Remember that the response is in lamports. Convert to SOL for display (e.g., divide by 1e9).
* **Minimum May Change**\
  The network may update this threshold over time. Always retrieve it dynamically instead of hardcoding a value.
* **Useful for Cold Wallet Staking Interfaces**\
  Ensures users don’t lock SOL into undelegatable stake accounts, which would otherwise need to be withdrawn and re-staked.

***

The `getStakeMinimumDelegation` method is a straightforward but essential RPC call for any staking-enabled interface or automation built on **CoinVera**.


# getSupply

Learn getSupply use cases, code examples, request parameters, response structure, and tips.

The `getSupply` RPC method in **CoinVera** returns detailed information about the current total and circulating supply of **SOL** on the Solana network. This includes both the **total minted supply** and the **amount not held in any reserve or inactive accounts**, giving insight into the actively circulating supply.

***

#### ✅ Common Use Cases

* **Displaying SOL Supply Metrics**\
  Show total and circulating SOL on dashboards, explorers, or analytics platforms.
* **Tokenomics Tracking**\
  Monitor supply growth and how much SOL is locked or inactive.
* **Validator or Stake Program Integration**\
  Understand the context of staking and issuance when building financial tooling.

***

#### 🧾 Request Parameters

Optional configuration object:

* `commitment` (string, optional):\
  The state commitment to query against—options are `processed`, `confirmed`, or `finalized`.
* `minContextSlot` (number, optional):\
  Ensures the node is caught up to at least a certain slot before responding.

***

#### 📦 Response Structure

The `result` object includes supply and context information:

```json
{
  "context": {
    "slot": 221446650
  },
  "value": {
    "total": 573264567999876000,
    "circulating": 487366912349870000,
    "nonCirculating": 85897655650006000,
    "nonCirculatingAccounts": [
      "11111111111111111111111111111111",
      "Stake11111111111111111111111111111111111111"
    ]
  }
}
```

* **total**: Total supply of SOL in lamports (1 SOL = 1e9 lamports).
* **circulating**: Estimated actively circulating SOL.
* **nonCirculating**: Amount of SOL held in non-circulating accounts.
* **nonCirculatingAccounts**: List of account addresses excluded from circulation.

***

#### 🧪 Example

**Get Current SOL Supply (Default Commitment)**

**Request:**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getSupply"
}
```

**Response:**

```json
{
  "result": {
    "context": { "slot": 221446650 },
    "value": {
      "total": 573264567999876000,
      "circulating": 487366912349870000,
      "nonCirculating": 85897655650006000,
      "nonCirculatingAccounts": [ ... ]
    }
  }
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSupply(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSupply',
       "params": [
        {
            "excludeNonCirculatingAccountsList": true}
        ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSupply(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_supply(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSupply',
                'params': [
                    {
                        'excludeNonCirculatingAccountsList': True
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_supply(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.3.0",
      "slot": 355400253
    },
    "value": {
      "circulating": 538167181851082240,
      "nonCirculating": 67728473743944220,
      "nonCirculatingAccounts": [],
      "total": 605895655595026400
    }
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Use Circulating Supply for Market Metrics**\
  Circulating supply is often more relevant than total supply for calculating real market cap.
* **Expect Large Numbers**\
  All supply-related values are returned in lamports, not SOL—divide by 1e9 for readability.
* **Non-Circulating Accounts Are Transparent**\
  You can track which accounts are excluded from circulating calculations.
* **Add Commitment for Consistency**\
  Specify `finalized` if you require a confirmed view across validators.

***

The `getSupply` method is essential for any application needing accurate supply metrics or network economic insights, all delivered with speed and transparency through **CoinVera**.


# getTokenAccountBalance

Learn getTokenAccountBalance use cases, code examples, request parameters, response structure, and tips.

The `getTokenAccountBalance` RPC method in **CoinVera** returns the **token balance** of a specified SPL token account. It provides detailed information including raw amount, decimals, and user-friendly display formats.

***

#### ✅ Common Use Cases

* **Display Token Balances in UI**\
  Show a user’s token balance for wallets and dApps.
* **Validate Token Holdings**\
  Confirm whether a wallet has a sufficient token balance before proceeding with transfers, swaps, or burns.
* **Bot/Automation Scripts**\
  Use in scripts to make decisions based on token balances (e.g., execute only if balance > threshold).

***

#### 🧾 Request Parameters

* `account` (string, required):\
  The base-58 encoded address of the SPL token account to query.
* `commitment` (string, optional):\
  Optional. Specifies the state commitment level—`processed`, `confirmed`, or `finalized`.

***

#### 📦 Response Structure

Returns a balance object under the `value` key:

```json
{
  "context": {
    "slot": 221446650
  },
  "value": {
    "amount": "1500000",
    "decimals": 6,
    "uiAmount": 1.5,
    "uiAmountString": "1.5"
  }
}
```

* **amount**: Raw token amount as a string (e.g. "1500000" for 1.5 tokens with 6 decimals).
* **decimals**: Number of decimal places defined by the token mint.
* **uiAmount**: The token amount as a number (floating point).
* **uiAmountString**: The token amount as a formatted string.

***

#### 🧪 Example

**Query Balance of a Token Account**

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountBalance",
  "params": [
    "6z7jRJ3Wy8x1NUts7vmu5yQ9xNGZ63v2wKzLtnSKNfJg"
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTokenAccountBalance(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTokenAccountBalance',
        "params": [
            "G4W4MYAETYHYUnARsydMzcyrY5gLfse3pXrg2rR2wang",
            {
              "commitment": "confirmed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTokenAccountBalance(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_token_account_balance(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTokenAccountBalance',
                'params': [
                    'G4W4MYAETYHYUnARsydMzcyrY5gLfse3pXrg2rR2wang',
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_token_account_balance(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Response Example**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355401009
    },
    "value": {
      "amount": "1",
      "decimals": 6,
      "uiAmount": 0.000001,
      "uiAmountString": "0.000001"
    }
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Only Works on Token Accounts**\
  This method only accepts **token account addresses**, not general wallet addresses. Use `getTokenAccountsByOwner` first if needed.
* **Lamports ≠ Token Amounts**\
  Unlike SOL balances, token balances vary in decimal precision—always respect the `decimals` value.
* **String for Precision**\
  Use `uiAmountString` in UIs to avoid rounding errors, especially for large or small balances.
* **Commitment Matters**\
  Add `commitment: "finalized"` if you need the most reliable confirmed result.

***

The `getTokenAccountBalance` method is essential for tracking SPL token balances in real-time, especially in dApps, wallets, and trading bots built on **CoinVera**.


# getTokenAccountsByDelegate

Learn getTokenAccountsByDelegate use cases, code examples, request parameters, response structure, and tips.

The `getTokenAccountsByDelegate` RPC method in **CoinVera** returns all SPL token accounts where the specified public key is set as the **delegate**. Delegated accounts allow another wallet to act on behalf of the token owner, typically for transfers or burns within an approved allowance.

***

#### ✅ Common Use Cases

* **View All Delegated Token Accounts**\
  Retrieve every token account where a delegate (e.g., escrow or vault program) is authorized.
* **Monitor Allowances**\
  Track accounts where a program or external user has been granted limited spending authority.
* **Build Programmatic Access Control**\
  Use in systems that rely on delegated authority for token movement or staking operations.

***

#### 🧾 Request Parameters

```json
[
  delegateAddress: string,         // Required: base-58 public key of the delegate
  options?: {
    commitment?: string,           // Optional: "processed", "confirmed", or "finalized"
    encoding?: string,             // Optional: "jsonParsed", "json", "base64" (default: "jsonParsed")
    dataSlice?: { offset: number, length: number } // Optional: for partial account data
  }
]
```

* **delegateAddress**: Public key of the delegate to search against.
* **commitment**: Optional commitment level.
* **encoding**: Format of account data (typically `jsonParsed` for human-readable).
* **dataSlice**: If you want only part of the account data.

***

#### 📦 Response Structure

Returns a list of token accounts where the delegate matches the input address.

```json
{
  "context": { "slot": 221446650 },
  "value": [
    {
      "pubkey": "TokenAccountPubkeyHere",
      "account": {
        "data": {
          "parsed": {
            "info": {
              "delegate": "DelegatePublicKey",
              "delegatedAmount": {
                "amount": "1000000",
                "decimals": 6
              },
              ...
            }
          }
        },
        "lamports": 2039280,
        ...
      }
    }
  ]
}
```

***

#### 🧪 Example

**Get All Token Accounts Delegated to a Specific Wallet**

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountsByDelegate",
  "params": [
    "9vZh4cYytHe7rJPVbUWziGmLZQUKvVSoL7L1uQhe9kBA",
    { "encoding": "jsonParsed" }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTokenAccountsByDelegate(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTokenAccountsByDelegate',
        "params": [
            "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
            {
              "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
            },
            {
              "commitment": "finalized",
              "encoding": "jsonParsed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTokenAccountsByDelegate(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_token_accounts_by_delegate(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTokenAccountsByDelegate',
                'params': [
                    '4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T',
                    {
                        'programId': 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
                    },
                    {
                        'commitment': 'finalized',
                        'encoding': 'jsonParsed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_token_accounts_by_delegate(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 1114 },
    "value": [
      {
        "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp",
        "account": {
          "data": {
            "program": "spl-token",
            "parsed": {
              "info": {
                "tokenAmount": {
                  "amount": "1",
                  "decimals": 1,
                  "uiAmount": 0.1,
                  "uiAmountString": "0.1"
                },
                "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
                "delegatedAmount": {
                  "amount": "1",
                  "decimals": 1,
                  "uiAmount": 0.1,
                  "uiAmountString": "0.1"
                },
                "state": "initialized",
                "isNative": false,
                "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E",
                "owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD"
              },
              "type": "account"
            },
            "space": 165
          },
          "executable": false,
          "lamports": 1726080,
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "rentEpoch": 4,
          "space": 165
        }
      }
    ]
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Use `jsonParsed` for Easy Parsing**\
  You'll get structured info like mint, owner, delegate, and balance without decoding manually.
* **Delegated Amounts Are Limited**\
  The `delegatedAmount` field shows how much the delegate is allowed to transfer.
* **Matches Token Accounts, Not Wallets**\
  The method returns token accounts, which are tied to specific SPL tokens, not SOL.
* **Use with Caution in Critical Systems**\
  If you're automating logic based on delegated authority, ensure up-to-date commitment levels (e.g., `finalized`).

***

The `getTokenAccountsByDelegate` method is essential for inspecting delegated token authority, enabling permissioned workflows and token allowances across Solana-powered apps using **CoinVera**.


# getTokenAccountsByOwner

Learn getTokenAccountsByOwner use cases, code examples, request parameters, response structure, and tips.

The `getTokenAccountsByOwner` RPC method in **CoinVera** is used to retrieve all SPL token accounts owned by a specific wallet address (public key). This is a core method for wallets, explorers, and applications that need to **display token balances** or **interact with a user’s token accounts**.

You must filter the request using either a **specific token mint** or a **programId** (such as the SPL Token Program or Token-2022 Program).

***

#### ✅ Common Use Cases

* **Displaying User Portfolio**\
  Retrieve all token accounts owned by a wallet to display the user’s full token holdings.
* **Token Transfer Logic**\
  Identify the token account associated with a specific mint before sending or receiving tokens.
* **Ownership Verification**\
  Check whether a wallet owns a token account for a particular token.
* **Indexing Known Holders**\
  Though less efficient than global indexing, this can be used to find token accounts across known users.

***

#### 🧾 Request Parameters

```ts
[
  ownerPubkey: string,       // Required – The public key of the wallet.
  filter: {
    mint?: string,           // Optional – Specific token mint to filter by.
    programId?: string       // Optional – Token program ID to filter accounts (e.g. SPL or Token-2022).
  },
  options?: {
    commitment?: string,     // Optional – Commitment level (processed, confirmed, finalized).
    encoding?: string,       // Optional – Data encoding ("jsonParsed" recommended).
    dataSlice?: { offset: number, length: number }, // Optional – Only used for binary encodings.
    minContextSlot?: number  // Optional – Minimum context slot.
  }
]
```

**💡 Filter Requirement:**

You **must provide either** a `mint` or a `programId`. Without one, the query is invalid.

**Common program IDs**:

* SPL Token Program: `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`
* Token-2022 Program: `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`

***

#### 📦 Response Structure

```json
{
  "context": { "slot": 221446650 },
  "value": [
    {
      "pubkey": "TokenAccountPubkeyHere",
      "account": {
        "lamports": 2039280,
        "owner": "TokenProgramAddress",
        "data": {
          "program": "spl-token",
          "parsed": {
            "info": {
              "mint": "MintAddress",
              "owner": "WalletAddress",
              "tokenAmount": {
                "amount": "1500000",
                "decimals": 6,
                "uiAmount": 1.5,
                "uiAmountString": "1.5"
              },
              "state": "initialized",
              "isNative": false,
              "delegate": "OptionalDelegate",
              "delegatedAmount": {
                "amount": "500000"
              }
            },
            "type": "account"
          }
        },
        "executable": false,
        "rentEpoch": 375
      }
    }
  ]
}
```

***

#### 🧪 Examples

**Get All Token Accounts for a Wallet (SPL Token Program)**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountsByOwner",
  "params": [
    "YourWalletPublicKeyHere",
    { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" },
    { "encoding": "jsonParsed" }
  ]
}
```

**Filter by Specific Mint**

```json
{
  "params": [
    "YourWalletPublicKeyHere",
    { "mint": "MintAddressHere" },
    { "encoding": "jsonParsed" }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTokenAccountsByOwner(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTokenAccountsByOwner',
        "params": [
            "58FqLVkDz8Zkg5fRAinwrAnu6a2dK1TJkDg8NG6pRimE",
            { "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" },
            { "encoding": "jsonParsed", "commitment": "confirmed" }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTokenAccountsByOwner(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_token_accounts_by_owner(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTokenAccountsByOwner',
                'params': [
                    '58FqLVkDz8Zkg5fRAinwrAnu6a2dK1TJkDg8NG6pRimE',
                    {'mint': 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'},
                    {'encoding': 'jsonParsed', 'commitment': 'confirmed'}
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_token_accounts_by_owner(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": {
      "slot": 355408021,
      "apiVersion": "2.2.7"
    },
    "value": [
      {
        "pubkey": "G4W4MYAETYHYUnARsydMzcyrY5gLfse3pXrg2rR2wang",
        "account": {
          "lamports": 2039280,
          "data": {
            "program": "spl-token",
            "parsed": {
              "info": {
                "isNative": false,
                "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
                "owner": "58FqLVkDz8Zkg5fRAinwrAnu6a2dK1TJkDg8NG6pRimE",
                "state": "initialized",
                "tokenAmount": {
                  "amount": "1",
                  "decimals": 6,
                  "uiAmount": 0.000001,
                  "uiAmountString": "0.000001"
                }
              },
              "type": "account"
            },
            "space": 165
          },
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "executable": false,
          "rentEpoch": 18446744073709552000,
          "space": 165
        }
      }
    ]
  }
}
```

***

#### 💡 Developer Tips

* **Mandatory Filter**\
  Either `mint` or `programId` must be provided—you cannot retrieve all token accounts unfiltered.
* **Associated Token Accounts (ATAs)**\
  Results include standard ATAs as well as manually created or legacy token accounts.
* **Use `jsonParsed`**\
  Highly recommended for easier access to account fields like balance, owner, and mint.
* **Performance Consideration**\
  If filtering only by `programId`, results may be large. Consider batching wallet lookups if working with multiple addresses.
* **Token Extensions**\
  For Token-2022 tokens (e.g., with transfer fees, interest-bearing extensions), make sure you use the correct program ID:\
  `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`.

***

The `getTokenAccountsByOwner` method is essential for any wallet or token-aware Solana app powered by **CoinVera**. It offers a clear view into a user’s on-chain token holdings, including advanced support for both standard and extended SPL tokens.


# getTokenLargestAccounts

Learn getTokenLargestAccounts use cases, code examples, request parameters, response structure, and tips.

The `getTokenLargestAccounts` RPC method in **CoinVera** returns the top 20 largest SPL token accounts for a given token mint. It’s primarily used to analyze **token distribution**, identify **major holders**, and power **top-holder dashboards**.

***

#### ✅ Common Use Cases

* **Token Distribution Analysis**\
  Understand how a token’s supply is distributed across wallets.
* **Identifying Whales**\
  Spot addresses holding large portions of a token supply.
* **Market Research & Risk Assessment**\
  Measure decentralization or the potential influence of top holders.
* **Explorer & Dashboard Integration**\
  Display the top token holders in user interfaces.

***

#### 🧾 Request Parameters

```ts
[
  mintAddress: string,         // Required – base-58 address of the SPL token mint
  options?: {
    commitment?: string        // Optional – "processed", "confirmed", or "finalized"
  }
]
```

* **mintAddress**: The SPL token mint for which to retrieve largest token accounts.
* **commitment**: Optional commitment level to specify the network state snapshot.

***

#### 📦 Response Structure

The result is an array of up to 20 token account objects:

```json
{
  "context": {
    "slot": 221446650
  },
  "value": [
    {
      "address": "AccountPubkeyHere",
      "amount": "500000000000",
      "decimals": 6,
      "uiAmount": 500000.0,
      "uiAmountString": "500000"
    },
    ...
  ]
}
```

Each entry includes:

* **address**: Base-58 public key of the token account.
* **amount**: Raw token balance (as a string).
* **decimals**: Token mint’s decimal precision.
* **uiAmount**: Balance as a float (optional, may be deprecated).
* **uiAmountString**: Balance as a string (preferred for display).

***

#### 🧪 Example

**Fetch Top 20 Largest Accounts for a Token**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenLargestAccounts",
  "params": [
    "So11111111111111111111111111111111111111112"
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTokenLargestAccounts(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTokenLargestAccounts',
        "params": [
            "f68ejXhHX8M71pdnutQf8BMthpT4jJuhT7kHkdZpump",
            { "commitment": "confirmed" }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTokenLargestAccounts(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_token_largest_accounts(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTokenLargestAccounts',
                'params': [
                    'f68ejXhHX8M71pdnutQf8BMthpT4jJuhT7kHkdZpump',
                    {'commitment': 'confirmed'}
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_token_largest_accounts(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": {
      "slot": 355408555,
      "apiVersion": "2.2.7"
    },
    "value": [
      {
        "address": "DdDiTstikLPchipWjSQ9ZgJdE2wq99W2qjdGcJtSqJXc",
        "uiAmount": 999822991.855856,
        "decimals": 6,
        "amount": "999822991855856",
        "uiAmountString": "999822991.855856"
      },
      {
        "address": "AUSZfegoc2ZhkcMpU9PMcWpg7jLid1Vgp2yfxeEhXs23",
        "uiAmount": 177007.043244,
        "decimals": 6,
        "amount": "177007043244",
        "uiAmountString": "177007.043244"
      },
      {
        "address": "Fo8hU9VAMgQEXjJ3JxfJyrTh4PXkpqMW5eXxv3vPYZ2S",
        "uiAmount": 0.304141,
        "decimals": 6,
        "amount": "304141",
        "uiAmountString": "0.304141"
      },
      {
        "address": "HeTAA5GzNpa8Z1UFpk9sqZurHPJ6gpZuPCfoJHfcAfMG",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      },
      {
        "address": "B8TeUywdwHNGb6p9voiWcJSMYQ2eQB7ZszzLqhoNksbK",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      },
      {
        "address": "9XBsFrMwjMnXJE1sKM1waRtuULApmazNWFfZfPgWm9Qz",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      },
      {
        "address": "6qoLLeaYXr6x6bP2VbGPB9Y5kNmQ6MY2p7L6yiFUXhBJ",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      }
    ]
  }
}
```

***

#### 💡 Developer Tips

* **Fixed Result Size**\
  Always returns up to **20 largest accounts**—no support for pagination.
* **Token-Specific Query**\
  Only shows holders for the mint you provide. Use a valid SPL token mint.
* **`uiAmountString` Is Recommended**\
  It’s safer and more consistent for displaying token balances than `uiAmount`.
* **Avoid Excessive Polling**\
  While efficient, repeated queries in short intervals may add unnecessary load.
* **Commitment Level Matters**\
  Use `finalized` for the most stable snapshot of top token holders.

***

The `getTokenLargestAccounts` method is a simple yet powerful way to understand SPL token distribution and visualize key holders within the Solana ecosystem. It's ideal for dashboards, analytics tools, and smart contract tooling built on **CoinVera**.


# getTokenSupply

Learn getTokenSupply use cases, code examples, request parameters, response structure, and tips.

The `getTokenSupply` RPC method in **CoinVera** retrieves the **total supply** of a specific SPL token mint. This method is essential for understanding the **overall quantity** of tokens created and is especially useful for token dashboards, explorers, and tokenomics tracking.

***

#### ✅ Common Use Cases

* **Displaying Token Information**\
  Show the total token supply in wallets, token explorers, or DeFi dashboards.
* **Tokenomics Analysis**\
  Understand how many tokens exist and how that relates to market cap or distribution.
* **Supply Verification**\
  Validate supply directly from the on-chain mint account for auditing or compliance.
* **Monitoring Supply Changes**\
  Detect increases or decreases in supply for mintable tokens (e.g., stablecoins or utility tokens with active minting authority).

***

#### 🧾 Request Parameters

```ts
[
  mintAddress: string,        // Required – Base-58 token mint address
  options?: {
    commitment?: string       // Optional – "processed", "confirmed", or "finalized"
  }
]
```

* **mintAddress**: The public key of the SPL token mint.
* **commitment** (optional): The network state to query against. Defaults to the node's standard (typically `finalized`).

***

#### 📦 Response Structure

The `value` field contains detailed supply information:

```json
{
  "context": { "slot": 221446650 },
  "value": {
    "amount": "500000000000",
    "decimals": 6,
    "uiAmount": 500000.0,
    "uiAmountString": "500000"
  }
}
```

* **amount**: Total supply in raw units (not adjusted for decimals).
* **decimals**: Number of decimal places defined for this token.
* **uiAmount**: Total supply as a float (may be null or imprecise).
* **uiAmountString**: Total supply as a string (accurate and display-friendly).

***

#### 🧪 Example

**Query the Supply of a Specific Token Mint**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenSupply",
  "params": [
    "TokenMintAddressHere"
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTokenSupply(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTokenSupply',
        "params": [
            "f68ejXhHX8M71pdnutQf8BMthpT4jJuhT7kHkdZpump",
            { "commitment": "confirmed" }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTokenSupply(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_token_supply(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTokenSupply',
                'params': [
                    'f68ejXhHX8M71pdnutQf8BMthpT4jJuhT7kHkdZpump',
                    {'commitment': 'confirmed'}
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_token_supply(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355409363
    },
    "value": {
      "amount": "999999999203241",
      "decimals": 6,
      "uiAmount": 999999999.203241,
      "uiAmountString": "999999999.203241"
    }
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Decimals Matter**\
  Always use the `decimals` field to properly convert `amount` into a human-readable value.
* **Immutable by Default**\
  Most SPL tokens have a fixed supply unless governed by a mint authority. Track `getMint` to see if further minting is possible.
* **Prefer `uiAmountString` for Display**\
  For accurate and consistent formatting, use `uiAmountString` instead of `uiAmount`.
* **Data Source Is Direct**\
  This method reads data directly from the mint account—not from token accounts—ensuring reliable totals.
* **Burns Don’t Change Mint Supply**\
  Burning typically occurs at the token account level and does not reduce the mint’s recorded total unless explicitly programmed.

***

The `getTokenSupply` method is a vital part of working with SPL tokens, enabling reliable supply visibility for audits, analytics, and user interfaces built on **CoinVera**.


# getTransaction

Learn getTransaction use cases, code examples, request parameters, response structure, and tips.

The `getTransaction` RPC method in **CoinVera** allows you to retrieve detailed information about a **confirmed transaction** using its signature. This includes metadata such as **slot**, **block time**, **fees**, **execution status**, **balance changes**, **logs**, and the full **transaction structure**.

***

#### ✅ Common Use Cases

* **Transaction Verification**\
  Confirm that a transaction was processed and check if it succeeded or failed.
* **Transaction History Display**\
  Show detailed transaction info in wallets or explorers.
* **Auditing and Analysis**\
  Analyze executed instructions, accounts touched, and fees paid.
* **Debugging Failed Transactions**\
  Inspect `logMessages` and `err` fields to identify why a transaction failed.
* **Data Indexing**\
  Extract structured transaction data for off-chain storage and querying.

***

#### 🧾 Request Parameters

```ts
[
  transactionSignature: string,  // Required – base-58 transaction signature
  options?: {
    commitment?: string,          // Optional – "finalized", "confirmed", etc.
    encoding?: string,            // Optional – Recommended: "jsonParsed"
    maxSupportedTransactionVersion?: number // Optional – Set to 0 to support legacy + versioned
  }
]
```

* **transactionSignature**: Required. The base-58 encoded transaction ID.
* **commitment**: Optional. Affects finality level (`finalized` recommended for accuracy).
* **encoding**: Optional. Use `"jsonParsed"` for human-readable output; `"json"`, `"base58"`, and `"base64"` are also supported.
* **maxSupportedTransactionVersion**: Optional but **strongly recommended**.\
  Set to `0` to support both **legacy** and **versioned** transactions.

***

#### 📦 Response Structure

Returns `null` if the transaction is not found or hasn’t reached the specified commitment. Otherwise, it returns an object with:

* **slot**: Slot number where the transaction was confirmed.
* **blockTime**: Estimated UNIX timestamp (nullable).
* **meta**: Metadata about execution:
  * `err`: Error info if the transaction failed, or `null` on success.
  * `fee`: Lamports paid.
  * `preBalances` / `postBalances`: Lamport balances of involved accounts.
  * `preTokenBalances` / `postTokenBalances`: SPL token balances (if any).
  * `innerInstructions`: CPI calls and their instructions.
  * `logMessages`: Logs emitted during execution.
  * `loadedAddresses`: Accounts loaded via address lookup tables (for versioned txns).
  * `returnData`: Output returned by the transaction, if applicable.
  * `computeUnitsConsumed`: Compute units used (if available).
* **transaction**:
  * If `jsonParsed` or `json`: Includes `message`, `signatures`, etc.
  * If `base58` or `base64`: Raw encoded transaction.
* **version**: `"legacy"` or a number (e.g., `0` for versioned txns); `undefined` if not requested properly.

***

#### 🧪 Example

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTransaction",
  "params": [
    "5ZQsfqZxPv2h9YurUR9HkEG4grLZAhUNSJmeXrcTRAcKXvLvfbR2fBr3TQadAyQeP5GjZAZ4BLMTrDskmWRGuXMS",
    {
      "encoding": "jsonParsed",
      "commitment": "finalized",
      "maxSupportedTransactionVersion": 0
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTransaction(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTransaction',
        "params": [
            "3ec22yxtoMsSZKgEG7yGmLpVqkwQL4mqo4uBJbXJbx3VHAot6zhxLoH9K34hpD5SaeTGc3x4ufFMuA2r8mDJ84eP",
            {
              "encoding": "jsonParsed",
              "maxSupportedTransactionVersion": 0
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTransaction(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_transaction(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTransaction',
                'params': [
                    '3ec22yxtoMsSZKgEG7yGmLpVqkwQL4mqo4uBJbXJbx3VHAot6zhxLoH9K34hpD5SaeTGc3x4ufFMuA2r8mDJ84eP',
                    {
                        'encoding': 'jsonParsed',
                        'maxSupportedTransactionVersion': 0
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_transaction(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "blockTime": 1753337729,
    "meta": {
      "computeUnitsConsumed": 60796,
      "err": null,
      "fee": 5000,
      "innerInstructions": [
        {
          "index": 0,
          "instructions": [
            {
              "parsed": {
                "info": {
                  "extensionTypes": [
                    "immutableOwner"
                  ],
                  "mint": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v"
                },
                "type": "getAccountDataSize"
              },
              "program": "spl-token",
              "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
              "stackHeight": 2
            },
            {
              "parsed": {
                "info": {
                  "lamports": 2039280,
                  "newAccount": "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G",
                  "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
                  "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx",
                  "space": 165
                },
                "type": "createAccount"
              },
              "program": "system",
              "programId": "11111111111111111111111111111111",
              "stackHeight": 2
            },
            {
              "parsed": {
                "info": {
                  "account": "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G"
                },
                "type": "initializeImmutableOwner"
              },
              "program": "spl-token",
              "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
              "stackHeight": 2
            },
            {
              "parsed": {
                "info": {
                  "account": "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G",
                  "mint": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
                  "owner": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
                },
                "type": "initializeAccount3"
              },
              "program": "spl-token",
              "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
              "stackHeight": 2
            }
          ]
        },
        {
          "index": 1,
          "instructions": [
            {
              "parsed": {
                "info": {
                  "amount": "36680639863",
                  "authority": "791Ln3Yp48TMaLLVLPtVq37BmHKs6VRd49f3pr5fXDui",
                  "destination": "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G",
                  "source": "Bq5y1StGDmqMEpdHkQnD5FTTKzJx2iFxntHseWsm4XQR"
                },
                "type": "transfer"
              },
              "program": "spl-token",
              "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
              "stackHeight": 2
            },
            {
              "parsed": {
                "info": {
                  "destination": "bo5XZZDESRJ9d4qRpFtkuhnLwmaPCCAKRxU7Vy7Wa2E",
                  "lamports": 1008,
                  "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
                },
                "type": "transfer"
              },
              "program": "system",
              "programId": "11111111111111111111111111111111",
              "stackHeight": 2
            },
            {
              "parsed": {
                "info": {
                  "destination": "791Ln3Yp48TMaLLVLPtVq37BmHKs6VRd49f3pr5fXDui",
                  "lamports": 2015097,
                  "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
                },
                "type": "transfer"
              },
              "program": "system",
              "programId": "11111111111111111111111111111111",
              "stackHeight": 2
            },
            {
              "parsed": {
                "info": {
                  "destination": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM",
                  "lamports": 19144,
                  "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
                },
                "type": "transfer"
              },
              "program": "system",
              "programId": "11111111111111111111111111111111",
              "stackHeight": 2
            },
            {
              "accounts": [
                "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"
              ],
              "data": "2zjR1PvPvgqdhPdZLxuWCL7t5hN1BQERy9ZVqfANVwkEugCDgFwkVZ7cC3rNSqgFjGu3o3LKtt65Djz2Jmz4EPaSB6aV7pPvFZUsQCvXfahbzon2PAzuWEwugRz2v9aQo8YM449qLHH4q1PioCdDCELW5DMxeS4nXWTeTSLFffcfc4HYz9wnLxohJYu5KFZiJSaK1piDvKKwCUL5skkRNwtPeoxEvvQpq5p22gho759vZ5zn8A3xCrDu6HU7pnbX8rp1YbzGXcospKR48i4hb3GXcS7CniXtkXUksYtUdu3VRNDUaHJ3q87Hd218ecf",
              "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
              "stackHeight": 2
            }
          ]
        }
      ],
      "logMessages": [
        "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
        "Program log: CreateIdempotent",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
        "Program log: Instruction: GetAccountDataSize",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 399097 compute units",
        "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
        "Program 11111111111111111111111111111111 invoke [2]",
        "Program 11111111111111111111111111111111 success",
        "Program log: Initialize the associated token account",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
        "Program log: Instruction: InitializeImmutableOwner",
        "Program log: Please upgrade to SPL Token 2022 for immutable owner support",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 392511 compute units",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
        "Program log: Instruction: InitializeAccount3",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4188 of 388630 compute units",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
        "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 21841 of 406000 compute units",
        "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
        "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]",
        "Program log: Instruction: Buy",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
        "Program log: Instruction: Transfer",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 364503 compute units",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
        "Program 11111111111111111111111111111111 invoke [2]",
        "Program 11111111111111111111111111111111 success",
        "Program 11111111111111111111111111111111 invoke [2]",
        "Program 11111111111111111111111111111111 success",
        "Program 11111111111111111111111111111111 invoke [2]",
        "Program 11111111111111111111111111111111 success",
        "Program data: vdt/007mYe5rABX35G2eArLr2jFX83hsUZaK2H05GChD2o6TLd/fyXm/HgAAAAAAdyVWiggAAAABixvJSd/FYxLOp+t4sccgNpaW1EonqKlFHM6tZXe6kCeBz4FoAAAAAMolSacJAAAAMtLAk2CuAgDKeSWrAgAAADJi/Qu/7QEArRHmpPwpRKT6glG++BVCbhv7KMa2ZGZ3YHxq2fVmpkZfAAAAAAAAAMhKAAAAAAAAWo6aHeIn3JO5nGpE7od1jBMPEPjqekCW+X5LO0nZq6YFAAAAAAAAAPADAAAAAAAA",
        "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]",
        "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2009 of 348349 compute units",
        "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",
        "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 38655 of 384159 compute units",
        "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",
        "Program 11111111111111111111111111111111 invoke [1]",
        "Program 11111111111111111111111111111111 success",
        "Program 11111111111111111111111111111111 invoke [1]",
        "Program 11111111111111111111111111111111 success"
      ],
      "postBalances": [
        6302360,
        2039280,
        4522329612,
        54208476714230,
        11463229419,
        2039280,
        143934559,
        196366793,
        1525925,
        736050881,
        1461600,
        1,
        374025595,
        380770805,
        147104475
      ],
      "postTokenBalances": [
        {
          "accountIndex": 1,
          "mint": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
          "owner": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "36680639863",
            "decimals": 6,
            "uiAmount": 36680.639863,
            "uiAmountString": "36680.639863"
          }
        },
        {
          "accountIndex": 5,
          "mint": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
          "owner": "791Ln3Yp48TMaLLVLPtVq37BmHKs6VRd49f3pr5fXDui",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "711679772402226",
            "decimals": 6,
            "uiAmount": 711679772.402226,
            "uiAmountString": "711679772.402226"
          }
        }
      ],
      "preBalances": [
        10887933,
        0,
        4522329612,
        54208476695086,
        11461214322,
        2039280,
        143933551,
        196360749,
        1025925,
        736050881,
        1461600,
        1,
        374025595,
        380770805,
        147104475
      ],
      "preTokenBalances": [
        {
          "accountIndex": 5,
          "mint": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
          "owner": "791Ln3Yp48TMaLLVLPtVq37BmHKs6VRd49f3pr5fXDui",
          "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "uiTokenAmount": {
            "amount": "711716453042089",
            "decimals": 6,
            "uiAmount": 711716453.042089,
            "uiAmountString": "711716453.042089"
          }
        }
      ],
      "rewards": [],
      "status": {
        "Ok": null
      }
    },
    "slot": 355371148,
    "transaction": {
      "message": {
        "accountKeys": [
          {
            "pubkey": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx",
            "signer": true,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "791Ln3Yp48TMaLLVLPtVq37BmHKs6VRd49f3pr5fXDui",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "Bq5y1StGDmqMEpdHkQnD5FTTKzJx2iFxntHseWsm4XQR",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "bo5XZZDESRJ9d4qRpFtkuhnLwmaPCCAKRxU7Vy7Wa2E",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
            "signer": false,
            "source": "transaction",
            "writable": true
          },
          {
            "pubkey": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "11111111111111111111111111111111",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf",
            "signer": false,
            "source": "transaction",
            "writable": false
          },
          {
            "pubkey": "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1",
            "signer": false,
            "source": "transaction",
            "writable": false
          }
        ],
        "addressTableLookups": [],
        "instructions": [
          {
            "parsed": {
              "info": {
                "account": "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G",
                "mint": "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
                "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx",
                "systemProgram": "11111111111111111111111111111111",
                "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
                "wallet": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
              },
              "type": "createIdempotent"
            },
            "program": "spl-associated-token-account",
            "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
            "stackHeight": null
          },
          {
            "accounts": [
              "4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf",
              "CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM",
              "8CghaJVr4fGoA4A8ag2uosDKKxwV1sGbtx8yFY9rvs3v",
              "791Ln3Yp48TMaLLVLPtVq37BmHKs6VRd49f3pr5fXDui",
              "Bq5y1StGDmqMEpdHkQnD5FTTKzJx2iFxntHseWsm4XQR",
              "iupJ2Lnr2ivuMp3uEFVjrVpPipBoaAT5X7fXny1Fd1G",
              "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx",
              "11111111111111111111111111111111",
              "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
              "bo5XZZDESRJ9d4qRpFtkuhnLwmaPCCAKRxU7Vy7Wa2E",
              "Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1",
              "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
            ],
            "data": "AJTQ2h9DXrBsrVNrKZuHZGyjtstmparyM",
            "programId": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
            "stackHeight": null
          },
          {
            "parsed": {
              "info": {
                "destination": "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
                "lamports": 6044,
                "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
              },
              "type": "transfer"
            },
            "program": "system",
            "programId": "11111111111111111111111111111111",
            "stackHeight": null
          },
          {
            "parsed": {
              "info": {
                "destination": "HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe",
                "lamports": 500000,
                "source": "AN2FAtXX4AyZE3mF6uYaVHpuznzgBdKrZCShftkHoUsx"
              },
              "type": "transfer"
            },
            "program": "system",
            "programId": "11111111111111111111111111111111",
            "stackHeight": null
          }
        ],
        "recentBlockhash": "AB3hE6oQuHFsNWbVSM75MxMTMcDwqF3cwBDr4DiQNAf"
      },
      "signatures": [
        "3ec22yxtoMsSZKgEG7yGmLpVqkwQL4mqo4uBJbXJbx3VHAot6zhxLoH9K34hpD5SaeTGc3x4ufFMuA2r8mDJ84eP"
      ]
    },
    "version": 0
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Always Set `maxSupportedTransactionVersion: 0`**\
  To handle both legacy and versioned transactions reliably.
* **Use `jsonParsed` When Possible**\
  Easier to inspect instructions, accounts, and tokens—especially for wallet or dApp UIs.
* **Expect Large Payloads**\
  Complex transactions with many instructions/logs can return very large JSON objects.
* **Check for `null` Values**\
  The method will return `null` for:
  * Incorrect or unknown signatures
  * Unconfirmed transactions (depending on commitment)
  * Incompatible transaction versions (if not configured)
* **Parsing Limitations**\
  If a custom program is not recognized, `jsonParsed` may fallback to base64 format for that instruction.
* **Provider Differences**\
  While the RPC spec is consistent, **CoinVera** may offer enhanced transaction decoding or additional metadata compared to other providers.

***

The `getTransaction` method is critical for building detailed transaction explorers, debugging tools, and analytics platforms on Solana. By using `jsonParsed` and `maxSupportedTransactionVersion: 0`, you can ensure broad compatibility and full visibility into on-chain activity through **CoinVera**.


# getTransactionCount

Learn getTransactionCount use cases, code examples, request parameters, response structure, and tips.

The `getTransactionCount` RPC method in **CoinVera** returns the **total number of transactions** that have been processed by the Solana ledger since genesis. This provides a high-level view of network throughput and long-term activity.

***

#### ✅ Common Use Cases

* **Network Statistics**\
  Display the cumulative transaction count as an indicator of network usage and health.
* **Growth Tracking**\
  Monitor how transaction volume grows over time to assess adoption trends.
* **Blockchain Dashboards**\
  Provide a simple, intuitive metric showing the size and history of on-chain activity.

***

#### 🧾 Request Parameters

```ts
[
  options?: {
    commitment?: string,       // Optional – "processed", "confirmed", or "finalized"
    minContextSlot?: number    // Optional – Only respond if node is caught up to this slot
  }
]
```

* **commitment** *(optional)*:\
  The level of confirmation the node should use.
  * `processed`: Fastest, but not rollback-safe.
  * `confirmed`: Voted on by the network.
  * `finalized`: Safest, fully confirmed.
* **minContextSlot** *(optional)*:\
  Ensures that the returned result is evaluated at or after a minimum slot.

***

#### 📦 Response Structure

Returns a single integer value representing the total transaction count:

```json
{
  "context": {
    "slot": 221446650
  },
  "value": 1874219342
}
```

* **value**: The number of transactions processed since network genesis.

***

#### 🧪 Example

**Get Total Transaction Count (Finalized)**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTransactionCount",
  "params": [
    {
      "commitment": "finalized"
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getTransactionCount(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getTransactionCount',
        "params": [
            {
              "commitment": "confirmed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getTransactionCount(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_transaction_count(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTransactionCount',
                'params': [
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_transaction_count(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 430177731688,
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Ledger-Wide Metric**\
  This count reflects **all** transactions since the beginning of the network—not tied to any specific wallet or block.
* **Monotonically Increasing**\
  The value will only increase over time—never decrease.
* **Commitment Level Impacts Count**\
  `processed` will show the most recent value, while `finalized` reflects a safer, confirmed count.
* **Not TPS**\
  This number does **not** represent Transactions Per Second (TPS) directly. To estimate TPS, measure the delta between two values over time.

***

The `getTransactionCount` method is ideal for tracking long-term usage trends, building visualizations, or reporting total activity on Solana—all with reliable data from **CoinVera**.


# getVersion

Learn getVersion use cases, code examples, request parameters, response structure, and tips.

The `getVersion` RPC method in **CoinVera** returns the **software version** of the Solana node responding to the request. This includes the `solana-core` version string and a `feature-set` identifier, making it a valuable tool for diagnostics, compatibility checks, and monitoring.

***

#### ✅ Common Use Cases

* **Node Version Verification**\
  Confirm the version of the CoinVera RPC node you’re communicating with—for feature support or SDK compatibility.
* **Network Monitoring**\
  Periodically query node versions across the network (use `getClusterNodes` for broader insight).
* **Troubleshooting and Debugging**\
  Determine if issues may be version-specific by identifying the exact software build of the node.

***

#### 🧾 Request Parameters

This method **does not take any parameters**.

```ts
[]
```

***

#### 📦 Response Structure

```json
{
  "solana-core": "1.17.9",
  "feature-set": 123456789
}
```

* **solana-core**: The version string of the Solana software running on the node.
* **feature-set**: An internal identifier corresponding to the set of features enabled in this version.

***

#### 🧪 Example

**Get Current Node Version**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getVersion"
}
```

**Response**:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "solana-core": "1.17.9",
    "feature-set": 123456789
  },
  "id": 1
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getVersion(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getVersion'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getVersion(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_version(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getVersion'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_version(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "feature-set": 3073396398,
    "solana-core": "2.2.16"
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Simple and Fast**\
  This is one of the quickest RPC calls—ideal for lightweight health checks or CLI tools.
* **Version Is Node-Specific**\
  The version returned reflects the specific CoinVera RPC node you're querying. During network upgrades, other nodes may be running different versions.
* **Use Feature Set for Compatibility**\
  While version strings are useful, the `feature-set` number can be important for programmatic checks or runtime gating of features.

***

The `getVersion` method is a simple yet effective way to verify Solana software versions and ensure you're interacting with a compatible and up-to-date CoinVera node.


# getVoteAccounts

Learn getVoteAccounts use cases, code examples, request parameters, response structure, and tips.

The `getVoteAccounts` RPC method in **CoinVera** returns detailed information about **all validator vote accounts** currently known to the network. It separates **active (current)** validators from **delinquent** ones and provides insights into their identity, stake, commission, voting performance, and more.

***

#### ✅ Common Use Cases

* **Validator Monitoring**\
  Track validator voting status, commission rates, and recent activity.
* **Staking Dashboards**\
  Display available validators for delegators, including performance metrics and stake data.
* **Network Health Analysis**\
  Assess decentralization and performance by examining stake distribution and active participation.
* **Identifying Delinquent Validators**\
  Detect validators that have fallen behind or are not actively voting in consensus.

***

#### 🧾 Request Parameters

```ts
[
  options?: {
    commitment?: string,                 // Optional – "processed", "confirmed", or "finalized"
    votePubkey?: string,                 // Optional – Filter by a specific validator vote account
    keepUnstakedDelinquents?: boolean,   // Optional – Include unstaked delinquent validators
    delinquentSlotDistance?: number      // Optional – Slots behind tip to consider as delinquent
  }
]
```

* **commitment** *(optional)*:\
  The desired commitment level for the returned data. Defaults to the node’s configuration.
* **votePubkey** *(optional)*:\
  Filter results to a specific vote account (base-58 public key).
* **keepUnstakedDelinquents** *(optional)*:\
  Include delinquent validators with **zero** active stake. Defaults to `false`.
* **delinquentSlotDistance** *(optional)*:\
  Specify how many slots a validator must fall behind the ledger tip to be marked delinquent.

***

#### 📦 Response Structure

The response contains two arrays:

**`current`: List of active vote accounts**

**`delinquent`: List of delinquent vote accounts**

Each object includes:

```json
{
  "votePubkey": "VoteAccountAddress",
  "nodePubkey": "ValidatorIdentityPubkey",
  "activatedStake": 543210000000,
  "epochVoteAccount": true,
  "commission": 8,
  "lastVote": 221446590,
  "rootSlot": 221446500,
  "epochCredits": [
    [378, 144, 20094],
    [379, 150, 20244]
  ]
}
```

**Key fields:**

* **votePubkey**: Public key of the vote account.
* **nodePubkey**: Validator’s identity (node) key.
* **activatedStake**: Currently active delegated stake in lamports.
* **commission**: Validator fee charged (percentage from 0–100).
* **lastVote**: Last slot this validator voted on.
* **rootSlot**: Last fully confirmed slot recognized by this validator.
* **epochVoteAccount**: `true` if active this epoch.
* **epochCredits**: List of `[epoch, earned_credits, previous_total]`.

***

#### 🧪 Example

**Fetch All Validator Vote Accounts**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getVoteAccounts",
  "params": [
    {
      "commitment": "finalized",
      "keepUnstakedDelinquents": true
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getVoteAccounts(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getVoteAccounts',
        "params": [
            {
              "commitment": "confirmed",
              "keepUnstakedDelinquents": true
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getVoteAccounts(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_vote_accounts(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getVoteAccounts',
                'params': [
                    {
                        'commitment': 'confirmed',
                        'keepUnstakedDelinquents': True
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_vote_accounts(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "current": [
      {
        "activatedStake": 38263229364446900,
        "commission": 95,
        "epochCredits": [
          [902, 1383125544, 1376213656],
          [903, 1390037304, 1383125544],
          [904, 1396949288, 1390037304],
          [905, 1403861272, 1396949288],
          [906, 1406766600, 1403861272]
        ],
        "epochVoteAccount": true,
        "lastVote": 391573587,
        "nodePubkey": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV",
        "rootSlot": 391573556,
        "votePubkey": "i7NyKBMJCA9bLM2nsGyAGCKHECuR2L5eh4GqFciuwNT"
      }
    ],
    "delinquent": []
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Large Data Size**\
  Expect large responses on Mainnet Beta. Use pagination or lazy loading in UIs.
* **Delinquency Is Node-Relative**\
  The `delinquentSlotDistance` setting and local node state determine who appears delinquent—results may differ across nodes.
* **Stake Activation Delays**\
  Stake transitions take several epochs. `activatedStake` only includes stake that is currently active.
* **Use `epochCredits` to Measure Voting Performance**\
  High credit gains indicate reliable voting behavior.

***

The `getVoteAccounts` method is a foundational tool for validator monitoring, staking interfaces, and network observability in Solana applications powered by **CoinVera**.


# isBlockhashValid

Learn isBlockhashValid use cases, code examples, request parameters, response structure, and tips.

The `isBlockhashValid` RPC method in **CoinVera** checks whether a given **blockhash** is still considered **valid** by the Solana network. Since blockhashes expire after approximately **150 slots (\~1–2 minutes)**, this method helps ensure that a transaction referencing an older blockhash won't be rejected.

> 🛈 **Version Note**: This method is available in **Solana v1.9+**. For older nodes (v1.8 or earlier), use `getFeeCalculatorForBlockhash` to implicitly verify blockhash validity.

***

#### ✅ Common Use Cases

* **Transaction Resubmission**\
  Before retrying a failed transaction, check if the original blockhash is still valid.
* **Delayed Signing/Submission**\
  If a transaction is prepared but submitted later, validate the blockhash to avoid errors.
* **Optimistic Transaction Scheduling**\
  Ensure a held blockhash is still valid before attempting to send a transaction.

***

#### 🧾 Request Parameters

```ts
[
  blockhash: string,             // Required – base-58 encoded blockhash string
  options?: {
    commitment?: string,         // Optional – "processed", "confirmed", or "finalized"
    minContextSlot?: number      // Optional – ensure node response is from a recent enough slot
  }
]
```

* **blockhash** *(required)*:\
  The blockhash to validate.
* **commitment** *(optional)*:\
  Query the blockhash validity based on a specific network confirmation level.
* **minContextSlot** *(optional)*:\
  Ensures the response is based on a slot at least this recent—useful to prevent stale data.

***

#### 📦 Response Structure

```json
{
  "context": {
    "slot": 221446650
  },
  "value": true
}
```

* **value**: Boolean result — `true` if the blockhash is valid, `false` if it has expired.
* **context.slot**: The slot at which this response was evaluated.

***

#### 🧪 Example

**Check if a Blockhash is Valid**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "isBlockhashValid",
  "params": [
    "3bXZjQUZw3PyWHVb7fG7Yf6pDD6MiZf9j8nAy4DDWjXu",
    {
      "commitment": "finalized"
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function isBlockhashValid(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'isBlockhashValid',
        "params": [
            "GS2XJrxSKuDa8BLgvGjVTHpsijDkNs53BsJAZLXwgZx1",
            {
              "commitment": "confirmed",
              "minContextSlot": 355397937
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

isBlockhashValid(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def is_blockhash_valid(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'isBlockhashValid',
                'params': [
                    'GS2XJrxSKuDa8BLgvGjVTHpsijDkNs53BsJAZLXwgZx1',
                    {
                        'commitment': 'confirmed',
                        'minContextSlot': 355397937
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
is_blockhash_valid(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.2.16",
      "slot": 355412699
    },
    "value": false
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Blockhash Expiry**\
  Blockhashes are valid for \~150 slots. If you’re unsure about age, fetch a fresh one using `getLatestBlockhash`.
* **Use `minContextSlot` for Accuracy**\
  This prevents a stale node from incorrectly reporting a blockhash as valid.
* **Legacy Support**\
  On nodes running Solana \<v1.9, use:

  ```ts
  getFeeCalculatorForBlockhash("<BLOCKHASH>")
  ```

  If it fails, the blockhash is no longer valid.
* **Validation ≠ Finality**\
  A valid blockhash doesn’t guarantee transaction success. Finality is achieved only once the transaction is confirmed at the desired commitment level.

***

The `isBlockhashValid` method is a critical tool in time-sensitive transaction flows, helping developers avoid expired-blockhash errors and ensure smoother interactions on the Solana blockchain using **CoinVera**.


# minimumLedgerSlot

Learn minimumLedgerSlot use cases, code examples, request parameters, response structure, and tips.

The `minimumLedgerSlot` RPC method in **CoinVera** returns the **oldest slot** for which the queried RPC node retains ledger data. This is especially useful for determining whether a node can serve **historical queries**, such as old transactions or block information.

***

#### ✅ Common Use Cases

* **Determine Historical Data Availability**\
  Before querying for old transaction or block data, check if the node retains the slot you're interested in.
* **Understand Node Pruning Behavior**\
  Identify how much historical data the node stores—important when working with non-archival nodes that prune older slots.
* **Coordinate Historical Data Indexing**\
  Use this to set bounds for data-fetching services or APIs that sync and process Solana history.

***

#### 🧾 Request Parameters

This method **does not take any parameters**.

```ts
[]
```

***

#### 📦 Response Structure

Returns a single numeric value representing the **lowest slot** retained by the node:

```json
{
  "jsonrpc": "2.0",
  "result": 108938444,
  "id": 1
}
```

* **result**: The earliest slot this node can potentially serve data from.

***

#### 🧪 Example

**Get the Oldest Available Slot from an RPC Node**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "minimumLedgerSlot"
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function minimumLedgerSlot(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'minimumLedgerSlot'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

minimumLedgerSlot(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def minimum_ledger_slot(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'minimumLedgerSlot'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
minimum_ledger_slot(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 355355858,
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Node-Specific Result**\
  Each RPC node may retain a different portion of the ledger, depending on its configuration and whether it's archival.
* **Value Increases Over Time**\
  The minimum ledger slot can **only increase** as older data is pruned. It never decreases.
* **Not a Guarantee of Continuity**\
  The presence of a minimum slot does **not** mean all slots after it are available—gaps may exist.
* **Use Archival Nodes for Full History**\
  If you need complete historical data from genesis, query an archival node, as standard RPC nodes may not store full ledger history.

***

The `minimumLedgerSlot` method provides a reliable way to verify a node’s historical data retention range, helping you decide whether it's suitable for deep history queries or whether you need to switch to a full archival provider like **CoinVera**.


# requestAirdrop

Learn requestAirdrop use cases, code examples, request parameters, response structure, and tips.

The `requestAirdrop` RPC method in **CoinVera** is used to request a small amount of **SOL (in lamports)** to a specified account on **test networks** like **Devnet** or **Testnet**. It acts as a faucet to provide developers with free SOL for testing and experimentation.

> ⚠️ **Important**: This method does **not work on Mainnet Beta**. It is restricted to test environments with faucet functionality.

***

#### ✅ Common Use Cases

* **Funding Test Wallets**\
  Acquire SOL for paying transaction fees and deploying programs on Devnet/Testnet.
* **Automated Testing Pipelines**\
  Ensure test accounts are pre-funded before running integration or e2e tests.
* **Developer Experimentation**\
  Quickly receive SOL to experiment with smart contracts or token transfers in a safe sandbox environment.

***

#### 🧾 Request Parameters

```ts
[
  pubkey: string,             // Required – Base-58 public key of the recipient
  lamports: number,           // Required – Amount to airdrop (1 SOL = 1_000_000_000 lamports)
  options?: {
    commitment?: string       // Optional – "processed", "confirmed", or "finalized"
  }
]
```

* **pubkey** *(required)*:\
  The address to receive the airdrop, base-58 encoded.
* **lamports** *(required)*:\
  Amount of SOL to request (in lamports).\
  Example: 1 SOL = `1000000000` lamports.
* **commitment** *(optional)*:\
  Commitment level to use when confirming the airdrop transaction.

***

#### 📦 Response Structure

```json
{
  "result": "3oZMg7M...AirdropTxSignature"
}
```

* **result**: A base-58 encoded transaction signature for the airdrop.\
  You can use this with `getSignatureStatuses` or `confirmTransaction` to confirm completion.

***

#### 🧪 Example

**Airdrop 1 SOL to a Devnet Account**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "requestAirdrop",
  "params": [
    "4H6B3d4xNoXyRzk9m1eM2PK2shTyzj2UTh8uUreVfEnz",
    1000000000,
    {
      "commitment": "confirmed"
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function requestAirdrop(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'requestAirdrop',
        "params": [
            "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
            500000000,
            {
              "commitment": "confirmed"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://devnet-rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

requestAirdrop(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def request_airdrop(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'requestAirdrop',
                'params': [
                    '4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5',
                    500000000,
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://devnet-rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
request_airdrop(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Testnet Only**\
  This method is only supported on **Devnet** or **Testnet**. It will **fail** if used on Mainnet.
* **Rate Limits & Quotas**\
  Faucet endpoints often restrict how often or how much you can airdrop. If you're testing frequently, space out your requests.
* **Confirmation Handling**\
  The method returns a transaction signature—but confirmation is **not guaranteed** immediately. Use:
  * `getSignatureStatuses`
  * `confirmTransaction` (from `@solana/web3.js`)
  * `getTransaction` for full details
* **Useful for Continuous Integration**\
  Include airdrop requests in test scripts to automate funding of ephemeral test accounts.

***

The `requestAirdrop` method is an essential developer tool when building and testing on Solana's Devnet or Testnet using **CoinVera**. It provides a frictionless way to acquire SOL for experimentation, testing, and rapid prototyping.


# sendTransaction

Learn sendTransaction use cases, code examples, request parameters, response structure, and tips.

The `sendTransaction` RPC method in **CoinVera** submits a **signed transaction** to the Solana network for processing. This is the primary method used to send payments, execute instructions, interact with smart contracts, and perform any on-chain action.

Once sent, the transaction is forwarded to the leader node for inclusion in a block. The method returns a **transaction signature** that can be used to monitor confirmation status.

***

#### ✅ Common Use Cases

* **SOL Transfers**\
  Sending SOL from one wallet to another.
* **SPL Token Transfers**\
  Sending tokens between token accounts.
* **Smart Contract Calls**\
  Invoking on-chain programs with custom instructions.
* **Batch or Multi-instruction Transactions**\
  Grouping multiple actions (e.g., transfer + memo) into one atomic transaction.
* **DeFi & DEX Integrations**\
  Submitting transactions to liquidity pools, AMMs, lending protocols, and other dApps.

***

#### 🧾 Request Parameters

```ts
[
  encodedTransaction: string,      // Required – base64-encoded signed transaction
  options?: {
    encoding?: string,             // Optional – "base58" or "base64" (default: "base64")
    preflightCommitment?: string,  // Optional – pre-submission simulation ("processed", "confirmed", "finalized")
    skipPreflight?: boolean,       // Optional – skip simulation step (default: false)
    maxRetries?: number,           // Optional – retry count on leader forwarding failure
    minContextSlot?: number        // Optional – minimum slot for node context
  }
]
```

**Key Fields:**

* **encodedTransaction** (required):\
  The fully signed transaction in **base64** format.
* **encoding**:\
  Format of the encoded transaction (default is `"base64"`).
* **skipPreflight**:\
  If `true`, skips preflight simulation. Use with caution.
* **preflightCommitment**:\
  The level of commitment to simulate the transaction before sending. Recommended: `"confirmed"`.
* **maxRetries**:\
  How many times to retry sending if the leader node doesn’t respond.

***

#### 📦 Response Structure

Returns a base-58 encoded transaction signature if accepted:

```json
{
  "result": "5nqPU3r5evAMY3Q6E3gZHmRMAsi67k1nRxkk2eJyxJKZPFnQvEvMG4oKXKDLfhVzevY5LfkuNqYz2T3uCkvVQUrh"
}
```

* Use this signature with `getSignatureStatuses`, `getTransaction`, or `confirmTransaction` to track the transaction.

***

#### 🧪 Example

**Send a Signed Transaction (Base64-encoded)**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sendTransaction",
  "params": [
    "Base64EncodedSignedTransactionHere",
    {
      "preflightCommitment": "confirmed",
      "skipPreflight": false
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function sendTransaction(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'sendTransaction',
        "params": [

            "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT"
     
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

sendTransaction(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def send_transaction(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'sendTransaction',
                'params': [
                    '4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT'
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
send_transaction(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb",
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Preflight Simulation**\
  Enabled by default, it helps catch errors early—e.g., insufficient funds, missing signatures, or compute budget overruns.
* **Set `maxRetries` for Resilience**\
  Helps handle leader-forwarding issues or temporary network disruptions.
* **Confirm Transaction**\
  Use `confirmTransaction`, `getSignatureStatuses`, or `getTransaction` to verify that the transaction was finalized on-chain.
* **Use `base64` Encoding**\
  Always encode the transaction as base64 unless your RPC explicitly supports base58.
* **Handle Versioned Transactions**\
  When working with versioned transactions (e.g., v0), ensure all required address lookup tables are properly included and resolved before sending.

***

The `sendTransaction` method is the gateway to executing real actions on Solana. Whether you're transferring SOL, interacting with DeFi protocols, or calling custom programs, this method—backed by **CoinVera**—ensures reliable and performant transaction submission.


# simulateTransaction

Learn simulateTransaction use cases, code examples, request parameters, response structure, and tips.

The `simulateTransaction` RPC method in **CoinVera** simulates the execution of a signed transaction **without broadcasting it to the network**. This is commonly used for **debugging**, **testing**, and **preflight validation** before sending a real transaction. It helps catch errors like insufficient funds, failed program logic, or compute unit limits.

***

#### ✅ Common Use Cases

* **Preflight Testing**\
  Simulate a transaction to verify whether it will succeed before submitting it.
* **Debugging**\
  Inspect `logMessages`, `computeUnitsConsumed`, and `err` fields to debug failing transactions.
* **Estimate Compute Usage**\
  See how many compute units a transaction consumes before hitting the cap.
* **Program Development**\
  Quickly iterate on smart contracts without submitting on-chain transactions.
* **Validate Instruction Formatting**\
  Catch serialization or parameter errors before execution.

***

#### 🧾 Request Parameters

```ts
[
  encodedTransaction: string,        // Required – base64-encoded signed transaction
  config?: {
    sigVerify?: boolean,             // Optional – verify signatures (default: false)
    commitment?: string,             // Optional – "processed", "confirmed", "finalized"
    replaceRecentBlockhash?: boolean,// Optional – use latest blockhash instead of original
    accounts?: {
      encoding?: string,             // Optional – "base64" | "base64+zstd" | "jsonParsed"
      addresses: string[]            // Optional – accounts to fetch data for during simulation
    },
    minContextSlot?: number          // Optional – minimum slot for simulation context
  }
]
```

**Key Fields:**

* **encodedTransaction**:\
  A fully signed transaction encoded in base64.
* **sigVerify**:\
  Whether to verify the transaction's signatures during simulation.
* **replaceRecentBlockhash**:\
  If `true`, substitutes the blockhash with the latest one (useful for testing older transactions).
* **accounts**:\
  Optionally return selected account data after simulation for inspection.
* **commitment**:\
  Level of commitment to simulate against. Typically `"processed"`.

***

#### 📦 Response Structure

```json
{
  "context": {
    "slot": 221446650
  },
  "value": {
    "err": null,
    "logs": [
      "Program 11111111111111111111111111111111 invoke [1]",
      "Program returned success"
    ],
    "accounts": [],
    "unitsConsumed": 1420,
    "returnData": {
      "programId": "SomeProgramAddress",
      "data": ["encodedDataHere", "base64"]
    }
  }
}
```

**Key Fields in `value`:**

* **err**: `null` if successful, or error details (e.g. `InstructionError`).
* **logs**: An array of log messages emitted during simulation.
* **accounts**: Optional account state if requested.
* **unitsConsumed**: Compute units used during simulation.
* **returnData**: Output returned from the transaction, if applicable.

***

#### 🧪 Example

**Simulate a Base64-Encoded Transaction**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "simulateTransaction",
  "params": [
    "Base64EncodedSignedTransactionHere",
    {
      "sigVerify": true,
      "commitment": "processed"
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function simulateTransaction(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'simulateTransaction',
        "params": [
            "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEEjNmKiZGiOtSZ+g0//wH5kEQo3+UzictY+KlLV8hjXcs44M/Xnr+1SlZsqS6cFMQc46yj9PIsxqkycxJmXT+veJjIvefX4nhY9rY+B5qreeqTHu4mG6Xtxr5udn4MN8PnBt324e51j94YQl285GzN2rYa/E2DuQ0n/r35KNihi/zamQ6EeyeeVDvPVgUO2W3Lgt9hT+CfyqHvIa11egFPCgEDAwIBAAkDZAAAAAAAAAA=",
            {
              "commitment": "confirmed",
              "encoding": "base64",
              "replaceRecentBlockhash": true
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

simulateTransaction(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def simulate_transaction(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'simulateTransaction',
                'params': [
                    'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEEjNmKiZGiOtSZ+g0//wH5kEQo3+UzictY+KlLV8hjXcs44M/Xnr+1SlZsqS6cFMQc46yj9PIsxqkycxJmXT+veJjIvefX4nhY9rY+B5qreeqTHu4mG6Xtxr5udn4MN8PnBt324e51j94YQl285GzN2rYa/E2DuQ0n/r35KNihi/zamQ6EeyeeVDvPVgUO2W3Lgt9hT+CfyqHvIa11egFPCgEDAwIBAAkDZAAAAAAAAAA=',
                    {
                        'commitment': 'confirmed',
                        'encoding': 'base64',
                        'replaceRecentBlockhash': True
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
simulate_transaction(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "2.3.3",
      "slot": 393226680
    },
    "value": {
      "accounts": null,
      "err": null,
      "innerInstructions": null,
      "loadedAccountsDataSize": 413,
      "logs": [
        "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [1]",
        "Program log: Instruction: Transfer",
        "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1714 of 200000 compute units",
        "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success"
      ],
      "replacementBlockhash": {
        "blockhash": "6oFLsE7kmgJx9PjR4R63VRNtpAVJ648gCTr3nq5Hihit",
        "lastValidBlockHeight": 381186895
      },
      "returnData": null,
      "unitsConsumed": 1714
    }
  },
  "id": 1
}
```

***

#### 💡 Developer Tips

* **Efficient Debugging**\
  Use `simulateTransaction` with `"sigVerify": true` for a full dry-run, including signature validation.
* **Catch Instruction Errors**\
  Failed deserialization, invalid accounts, or custom program errors will surface in `err` or `logs`.
* **Track Compute Units**\
  Helps optimize transaction size and complexity before submission.
* **Avoid Mainnet Transaction Waste**\
  Prevent failed transactions (and SOL loss from fees) by simulating first—especially in production environments.
* **returnData Support**\
  If your program uses `sol_set_return_data`, use this method to capture and inspect its output.

***

The `simulateTransaction` method is a powerful utility for Solana developers using **CoinVera**, enabling safe, cost-free validation and debugging of transaction logic—before committing anything to the chain.


# Get Token Price

Integrate seamlessly with CoinVera’s REST endpoints by authenticating with your x-api-key, either as a query parameter or in the request header.

#### Authentication

1. **Query Parameter**\
   Append your API key to the URL:

   ```
   ?x-api-key=<YOUR_API_KEY>
   ```
2. **HTTP Header**\
   Include the header in your request:

   ```
   x-api-key: <YOUR_API_KEY>
   ```

***

#### Single-Token Price Requests

Replace `<TOKEN_MINT>` and `<YOUR_API_KEY>` with your token’s mint address and your CoinVera API key.

| Endpoint                      | URL Example                                                                            |
| ----------------------------- | -------------------------------------------------------------------------------------- |
| **Auto-Detect (Low-Latency)** | `GET https://api.coinvera.io/api/v1/price?ca=<TOKEN_MINT>&x-api-key=<YOUR_API_KEY>`    |
| **PumpFun**                   | `GET https://api.coinvera.io/api/v1/pumpfun?ca=<TOKEN_MINT>&x-api-key=<YOUR_API_KEY>`  |
| **Meteora**                   | `GET https://api.coinvera.io/api/v1/meteora?ca=<TOKEN_MINT>&x-api-key=<YOUR_API_KEY>`  |
| **Raydium (All Pools)**       | `GET https://api.coinvera.io/api/v1/raydium?ca=<TOKEN_MINT>&x-api-key=<YOUR_API_KEY>`  |
| **Moonshot**                  | `GET https://api.coinvera.io/api/v1/moonshot?ca=<TOKEN_MINT>&x-api-key=<YOUR_API_KEY>` |

**Using HTTP Headers**

```http
GET /api/v1/price?ca=<TOKEN_MINT> HTTP/1.1
Host: api.coinvera.io
x-api-key: <YOUR_API_KEY>
```

*(Swap `/price` for `/pumpfun`, `/raydium`, etc., as needed.)*

***

#### Multi-Token Price Requests

Fetch prices for multiple tokens in one call by passing a comma-separated list of mint addresses:

```http
GET https://api.coinvera.io/api/v1/price?ca=<MINT1>,<MINT2>,<MINT3>&x-api-key=<YOUR_API_KEY>
```

***

**Code Examples**

Fetch a single token’s price per request—see the code examples below.

{% tabs %}
{% tab title="NodeJs" %}

```javascript
const fetch = require('node-fetch');

const x_api_key = "<YOUR-API-KEY>"; // <-- Replace with your actual API key

const tokenAddresses = [
    "<MINT-ADDRESS>"
];

async function getPrice(ca) {
    try {
        const url = `https://api.coinvera.io/api/v1/price?ca=${ca}`;
        const result = await fetch(url, {
            headers: {
                "Content-Type": "application/json",
                "x-api-key": x_api_key,
            }
        });
        const data = await result.json();
        return { ca, ...data };
    } catch (err) {
        return { ca, error: err.message };
    }
}

async function getPricesForAllTokens() {
    const results = await Promise.all(tokenAddresses.map(getPrice));
    results.forEach(res => {
        if (res.error) {
            console.log(`Error for ${res.ca}: ${res.error}`);
        } else {
            console.log(`Token: ${res.ca}`);
            console.log(res);
            console.log('-------------------------');
        }
    });
}

getPricesForAllTokens();

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

x_api_key = "<YOUR-API-KEY>"  # Replace with your actual API key

token_addresses = [
    "<MINT-ADDRESS>"
]

def get_price(ca):
    url = f"https://api.coinvera.io/api/v1/price?ca={ca}"
    headers = {
        "Content-Type": "application/json",
        "x-api-key": x_api_key
    }
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()  # raises HTTPError for bad responses
        data = response.json()
        return {'ca': ca, **data}
    except requests.exceptions.RequestException as err:
        return {'ca': ca, 'error': str(err)}

def get_prices_for_all_tokens():
    results = [get_price(ca) for ca in token_addresses]
    for res in results:
        if 'error' in res:
            print(f"Error for {res['ca']}: {res['error']}")
        else:
            print(f"Token: {res['ca']}")
            print(res)
            print('-------------------------')

if __name__ == "__main__":
    get_prices_for_all_tokens()

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
    "sync"
)

const xAPIKey = "<YOUR-API-KEY>" // Replace with your actual API key

var tokenAddresses = []string{
    "<MINT-ADDRESS>",
}

type APIResponse struct {
    CA     string                 `json:"ca"`
    Data   map[string]interface{} `json:"data,omitempty"`
    Error  string                 `json:"error,omitempty"`
}

func getPrice(ca string) APIResponse {
    url := fmt.Sprintf("https://api.coinvera.io/api/v1/price?ca=%s", ca)

    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }

    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("x-api-key", xAPIKey)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }

    var data map[string]interface{}
    if err := json.Unmarshal(body, &data); err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }

    return APIResponse{CA: ca, Data: data}
}

func getPricesForAllTokens() {
    var wg sync.WaitGroup
    results := make(chan APIResponse, len(tokenAddresses))

    for _, ca := range tokenAddresses {
        wg.Add(1)
        go func(ca string) {
            defer wg.Done()
            results <- getPrice(ca)
        }(ca)
    }

    wg.Wait()
    close(results)

    for res := range results {
        if res.Error != "" {
            fmt.Printf("Error for %s: %s\n", res.CA, res.Error)
        } else {
            fmt.Printf("Token: %s\n", res.CA)
            fmt.Printf("%v\n", res.Data)
            fmt.Println("-------------------------")
        }
    }
}

func main() {
    getPricesForAllTokens()
}

```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  ca: '',
  dex: '',
  priceInSol: ,
  priceInUsd: ,
  marketCap: 
}
```

Fetch multiple tokens’ prices in a single request—example below.

{% tabs %}
{% tab title="NodeJs" %}

```javascript
const fetch = require('node-fetch');

const x_api_key = ""; // <-- Replace with your actual API key

const tokenAddresses = [
    "mint-1",
    "mint-2"
];

async function getPrice(ca) {
    try {
        const url = `https://api.coinvera.io/api/v1/price?ca=${ca}`;
        const result = await fetch(url, {
            headers: {
                "Content-Type": "application/json",
                "x-api-key": x_api_key,
            }
        });
        const data = await result.json();
        return { ca, ...data };
    } catch (err) {
        return { ca, error: err.message };
    }
}

async function getPricesForAllTokens() {
    const results = await Promise.all(tokenAddresses.map(getPrice));
    results.forEach(res => {
        if (res.error) {
            console.log(`Error for ${res.ca}: ${res.error}`);
        } else {
            console.log(`Token: ${res.ca}`);
            console.log(res);
            console.log('-------------------------');
        }
    });
}

getPricesForAllTokens();

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

x_api_key = "<YOUR-API-KEY>"  # Replace with your actual API key

token_addresses = [
    "<MINT-ADDRESS-1>",
    "<MINT-ADDRESS-2>"
]

def get_price(ca):
    url = f"https://api.coinvera.io/api/v1/price?ca={ca}"
    headers = {
        "Content-Type": "application/json",
        "x-api-key": x_api_key
    }
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()  # raises HTTPError for bad responses
        data = response.json()
        return {'ca': ca, **data}
    except requests.exceptions.RequestException as err:
        return {'ca': ca, 'error': str(err)}

def get_prices_for_all_tokens():
    results = [get_price(ca) for ca in token_addresses]
    for res in results:
        if 'error' in res:
            print(f"Error for {res['ca']}: {res['error']}")
        else:
            print(f"Token: {res['ca']}")
            print(res)
            print('-------------------------')

if __name__ == "__main__":
    get_prices_for_all_tokens()

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
    "sync"
)

const xAPIKey = "<YOUR-API-KEY>" // Replace with your actual API key

var tokenAddresses = []string{
    "<MINT-ADDRESS-1>",
    "<MINT-ADDRESS-2>"
}

type APIResponse struct {
    CA     string                 `json:"ca"`
    Data   map[string]interface{} `json:"data,omitempty"`
    Error  string                 `json:"error,omitempty"`
}

func getPrice(ca string) APIResponse {
    url := fmt.Sprintf("https://api.coinvera.io/api/v1/price?ca=%s", ca)

    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }

    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("x-api-key", xAPIKey)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }

    var data map[string]interface{}
    if err := json.Unmarshal(body, &data); err != nil {
        return APIResponse{CA: ca, Error: err.Error()}
    }

    return APIResponse{CA: ca, Data: data}
}

func getPricesForAllTokens() {
    var wg sync.WaitGroup
    results := make(chan APIResponse, len(tokenAddresses))

    for _, ca := range tokenAddresses {
        wg.Add(1)
        go func(ca string) {
            defer wg.Done()
            results <- getPrice(ca)
        }(ca)
    }

    wg.Wait()
    close(results)

    for res := range results {
        if res.Error != "" {
            fmt.Printf("Error for %s: %s\n", res.CA, res.Error)
        } else {
            fmt.Printf("Token: %s\n", res.CA)
            fmt.Printf("%v\n", res.Data)
            fmt.Println("-------------------------")
        }
    }
}

func main() {
    getPricesForAllTokens()
}

```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    ca: '',
    dex: '',
    priceInSol: ,
    priceInUsd: ,
    marketCap: ,
    success: true
  },
  {
    ca: '',
    dex: '',
    priceInSol: ,
    priceInUsd: ,
    marketCap: ,
    success: true
  }
]
```

> **Tip:** Experiment with different endpoints to find the lowest-latency feed for your use case. If you have questions, see our API Reference or reach out on our community channels.


# Get Price By Pool

Fetch precise, real-time Solana token prices from any liquidity pool by specifying the token mint and pool ID, all via a single CoinVera REST endpoint.

Retrieve the real-time price of a specific token from any supported DEX pool. This is ideal when you need precision pricing or want to target a particular liquidity pool for lowest latency.

**Endpoint**

```
GET https://api.coinvera.io/api/v1/price
```

**Authentication**\
Include your API key in the request header:

```
x-api-key: <YOUR_API_KEY>
```

**Query Parameters**

* `ca` (string, required) — The token’s mint address.
* `poolId` (string, required) — The identifier of the liquidity pool you want to query.

**Direct URL Example**

```
https://api.coinvera.io/api/v1/price?ca=<TOKEN_MINT>&poolId=<POOL_ID>&x-api-key=<YOUR_API_KEY>
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const axios = require('axios');

const x_api_key = "";

// Add your token addresses and pool IDs here
const tokens = [
    {
        ca: "",
        poolId: ""
    },
];

async function getPrice(ca, poolId) {
    try {
        const url = `https://api.coinvera.io/api/v1/price?x-api-key=${x_api_key}&ca=${ca}&poolId=${poolId}`;
        const response = await axios.get(url);
        return { ca, poolId, ...response.data };
    } catch (err) {
        return { ca, poolId, error: err.message };
    }
}

async function getPricesForAllTokens() {
    const results = await Promise.all(tokens.map(token => getPrice(token.ca, token.poolId)));
    results.forEach(res => {
        if (res.error) {
            console.log(`Error for CA: ${res.ca}, Pool: ${res.poolId}: ${res.error}`);
        } else {
            console.log(`Token: ${res.ca}, Pool: ${res.poolId}`);
            console.log(res);
            console.log('-------------------------');
        }
    });
}

getPricesForAllTokens();
```

{% endtab %}

{% tab title="Pythong" %}

```python
import requests
import asyncio
import aiohttp
import json

x_api_key = ""

# Add your token addresses and pool IDs here
tokens = [
    {
        "ca": "",
        "poolId": ""
    },
]

async def get_price(session, ca, pool_id):
    try:
        url = f"https://api.coinvera.io/api/v1/price?x-api-key={x_api_key}&ca={ca}&poolId={pool_id}"
        async with session.get(url) as response:
            data = await response.json()
            return {"ca": ca, "poolId": pool_id, **data}
    except Exception as err:
        return {"ca": ca, "poolId": pool_id, "error": str(err)}

async def get_prices_for_all_tokens():
    async with aiohttp.ClientSession() as session:
        tasks = [get_price(session, token["ca"], token["poolId"]) for token in tokens]
        results = await asyncio.gather(*tasks)
        
        for res in results:
            if "error" in res:
                print(f"Error for CA: {res['ca']}, Pool: {res['poolId']}: {res['error']}")
            else:
                print(f"Token: {res['ca']}, Pool: {res['poolId']}")
                print(json.dumps(res, indent=2))
                print("-------------------------")

# Run the async function
asyncio.run(get_prices_for_all_tokens())
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"sync"
)

const xAPIKey = ""

type Token struct {
	CA     string `json:"ca"`
	PoolID string `json:"poolId"`
}

type PriceResult struct {
	CA     string      `json:"ca"`
	PoolID string      `json:"poolId"`
	Data   interface{} `json:"data,omitempty"`
	Error  string      `json:"error,omitempty"`
}

var tokens = []Token{
	{
		CA:     "",
		PoolID: "",
	},
}

func getPrice(token Token, wg *sync.WaitGroup, results chan<- PriceResult) {
	defer wg.Done()

	url := fmt.Sprintf("https://api.coinvera.io/api/v1/price?x-api-key=%s&ca=%s&poolId=%s", 
		xAPIKey, token.CA, token.PoolID)

	resp, err := http.Get(url)
	if err != nil {
		results <- PriceResult{
			CA:     token.CA,
			PoolID: token.PoolID,
			Error:  err.Error(),
		}
		return
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		results <- PriceResult{
			CA:     token.CA,
			PoolID: token.PoolID,
			Error:  err.Error(),
		}
		return
	}

	var data interface{}
	if err := json.Unmarshal(body, &data); err != nil {
		results <- PriceResult{
			CA:     token.CA,
			PoolID: token.PoolID,
			Error:  err.Error(),
		}
		return
	}

	results <- PriceResult{
		CA:     token.CA,
		PoolID: token.PoolID,
		Data:   data,
	}
}

func getPricesForAllTokens() {
	var wg sync.WaitGroup
	results := make(chan PriceResult, len(tokens))

	for _, token := range tokens {
		wg.Add(1)
		go getPrice(token, &wg, results)
	}

	go func() {
		wg.Wait()
		close(results)
	}()

	for result := range results {
		if result.Error != "" {
			fmt.Printf("Error for CA: %s, Pool: %s: %s\n", result.CA, result.PoolID, result.Error)
		} else {
			fmt.Printf("Token: %s, Pool: %s\n", result.CA, result.PoolID)
			jsonData, _ := json.MarshalIndent(result.Data, "", "  ")
			fmt.Println(string(jsonData))
			fmt.Println("-------------------------")
		}
	}
}

func main() {
	getPricesForAllTokens()
}
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  ca: '53JxiSEdahWu8FXnkeUbpoS2o2wXumc8ThzviBX7pump',
  poolId: '24hgLhdNLgPmJeUNAQMHJEBdbuZRBknRuaP1trTiBkD4',
  dex: 'pumpfun amm',
  liquidity: '33810.474998006444',
  priceInSol: '0.0000006679153339642684',
  priceInUsd: '0.00010054593656529703'
}
```

***

> **Tip:** Omitting `poolId` will trigger auto-detection across all pools for that token. Specify `poolId` when you need data from one exact pool.


# Get Token Overview

Retrieve comprehensive details for any Solana token by its mint address, including on-chain metadata, holder distribution, and pricing.

### Base URL

```
https://api.coinvera.io/api/v1/overview
```

***

### Authentication

Every request must include a valid API key in the headers. Without it, the API will return a `401 Unauthorized` error.

* **Header name:** `x-api-key`
* **Format:**

  ```
  x-api-key: YOUR_API_KEY_HERE
  ```

***

### Request Method

```
GET /api/v1/overview
```

***

### Query Parameters

| Parameter | Type   | Required | Description                                                            |
| --------- | ------ | -------- | ---------------------------------------------------------------------- |
| `ca`      | string | Yes      | SPL token mint address on Solana (the contract address for the token). |

* Example mint:

  ```
  So11111111111111111111111111111111111111112
  ```

***

**Code Example**

```javascript
const axios = require('axios');

const x_api_key = ""; 

const tokenAddresses = [
    ""
];

async function getOverview(ca) {
    try {
        const url = `https://api.coinvera.io/api/v1/overview?ca=${ca}`;
        const response = await axios.get(url, {
            headers: {
                "Content-Type": "application/json",
                "x-api-key": x_api_key,
            }
        });
        return { ca, ...response.data };
    } catch (err) {
        return { ca, error: err.message };
    }
}

async function getOverviewForAllTokens() {
    const results = await Promise.all(tokenAddresses.map(getOverview));
    results.forEach(res => {
        if (res.error) {
            console.log(`Error for ${res.ca}: ${res.error}`);
        } else {
            console.log(`Token: ${res.ca}`);
            console.log(res);
            console.log('-------------------------');
        }
    });
}

getOverviewForAllTokens();
```

### Example Response

A successful `200 OK` response returns a JSON object similar to the following. Actual values will vary by token.

```json
{
  "ca": "3VCkk4EVWQjCP8usuVK9ArfSmViFAcNcTMPivFJPpump",
  "name": "Jesse Pinkman",
  "symbol": "Pinkman",
  "image": "https://ipfs.io/ipfs/bafkreicr3t3bcwqvdeyshtrlhgxsfj3qphotlx2nz6ybrnkq2juluql3bu",
  "description": null,
  "socials": {
    "twitter": "https://x.com/i/communities/1930604634453750232",
    "website": "https://x.com/i/communities/1930604634453750232"
  },
  "decimals": "6",
  "supply": "999999885",
  "mintAuthority": null,
  "freezeAuthority": null,
  "updateAuthority": "TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM",
  "creators": [
    {
      "address": "3Tx9rimPi7nwAyNqHB8U4JhdcaLdhpVLuN9uSENYWJoY",
      "verified": false,
      "share": "100"
    }
  ],
  "isToken2022": false,
  "top10HoldersBalance": "1422967.838701",
  "top10HoldersPercent": "0.14",
  "top20HoldersBalance": "1422976.395499",
  "top20HoldersPercent": "0.14",
  "dex": "PumpFun",
  "priceInSol": "0.000000028033304403000017",
  "priceInUsd": "0.000004247922989399055",
  "marketCap": "4247.922500887911"
}

```

### Response Field Descriptions

| Field                 | Type             | Description                                                                                                       |
| --------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------- |
| `ca`                  | string           | SPL token mint address (identical to the `ca` query parameter).                                                   |
| `name`                | string           | Token’s registered name (if available).                                                                           |
| `symbol`              | string           | SPL token symbol (e.g., “USDC,” “RAY,” “Pinkman”).                                                                |
| `image`               | string (URL)     | URL to a hosted image (often IPFS). May be `null` if none is registered.                                          |
| `description`         | string or null   | Optional text description of the token.                                                                           |
| **`socials`**         | object           | Contains optional social or official links.                                                                       |
| `twitter`             | string (URL)     | Link to the token’s Twitter/X community or handle.                                                                |
| `website`             | string (URL)     | Token’s official website or landing page URL.                                                                     |
| `decimals`            | string (integer) | Number of decimal places. For example, if `decimals = "6"`, then a raw supply of `"100000000"` equals 100 tokens. |
| `supply`              | string           | Total minted supply in the smallest unit (raw integer). Divide by 10^`decimals` to get human-readable amount.     |
| `mintAuthority`       | string or null   | Public key with permission to mint new tokens. Shows `null` if no mint authority exists.                          |
| `freezeAuthority`     | string or null   | Public key that can freeze token accounts. `null` if no freeze authority is set.                                  |
| `updateAuthority`     | string           | Public key that can update on-chain metadata (for tokens using Metaplex metadata).                                |
| **`creators`**        | array            | List of creator entries (for tokens using Metaplex).                                                              |
| `address`             | string           | Creator’s public key.                                                                                             |
| `verified`            | boolean          | Whether the creator has been verified by Metaplex.                                                                |
| `share`               | string (integer) | Percentage of royalties (0–100) assigned to this creator.                                                         |
| `isToken2022`         | boolean          | Indicates if the token uses the Token 2022 standard (`true` or `false`).                                          |
| `top10HoldersBalance` | string (decimal) | Combined balance of the top 10 holders, in human units (after dividing by 10^`decimals`).                         |
| `top10HoldersPercent` | string (decimal) | Percentage of total supply held by the top 10 addresses.                                                          |
| `top20HoldersBalance` | string (decimal) | Combined balance of the top 20 holders, in human units.                                                           |
| `top20HoldersPercent` | string (decimal) | Percentage of total supply held by the top 20 addresses.                                                          |
| `dex`                 | string           | Primary DEX or liquidity source used for pricing (e.g., “Raydium,” “Serum,” “PumpFun,” etc.).                     |
| `priceInSol`          | string (decimal) | Current token price denominated in SOL. Multiply by 10^9 to convert to lamports if needed (1 SOL = 10⁹ lamports). |
| `priceInUsd`          | string (decimal) | Current token price in USD.                                                                                       |
| `marketCap`           | string (decimal) | Market capitalization in USD (circulating supply in human units × `priceInUsd`).                                  |

> **Note:** Many numeric values are returned as strings to preserve precision. Parse them carefully (e.g., `parseFloat(priceInUsd)`) and convert supply fields by dividing by 10^`decimals` for a human-readable amount.

***

### Error Responses

In case of an error—such as a missing parameter, invalid API key, or server issue—the API returns a non‐`200` status code with this structure:

```json
{
  "status": "error",
  "error": {
    "code": 400,
    "message": "Invalid request: missing required parameter 'ca'"
  }
}
```


# Get Trending Tokens

Discover CoinVera’s Trend endpoint for real-time insights into the top trending Solana tokens—filterable by time window and result count.

Identify the hottest Solana tokens over a recent timeframe. Use the **Trend** endpoint to retrieve a ranked list of tokens sorted by activity, volume, or momentum.

**Endpoint**

```
GET https://api.coinvera.io/api/v1/trend
```

**Authentication**\
Include your API key in the request header:

```
x-api-key: <YOUR_API_KEY>
```

**Query Parameters**

| Parameter | Type   | Required | Description                                           |
| --------- | ------ | -------- | ----------------------------------------------------- |
| `hour`    | number | ✅        | Lookback window in hours (e.g. `1`, `6`, `24`).       |
| `limit`   | number | ✅        | Maximum number of tokens to return (e.g. `10`, `50`). |

**Direct URL Example**

```
https://api.coinvera.io/api/v1/trend?hour=6&limit=20
```

*…plus your `x-api-key` header.*

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const axios = require('axios');

const x_api_key = "";

// Configuration
const hour = 24;  // Change this to 1, 6, 12, or 24 hours
const limit = 10; // Number of results to return

async function getTrend(hour, limit) {
    try {
        const url = `https://api.coinvera.io/api/v1/trend?x-api-key=${x_api_key}&hour=${hour}&limit=${limit}`;
        const response = await axios.get(url);
        return { hour, limit, ...response.data };
    } catch (err) {
        return { hour, limit, error: err.message };
    }
}

async function fetchTrend() {
    const result = await getTrend(hour, limit);
    
    if (result.error) {
        console.log(`Error for ${result.hour}h trend (limit: ${result.limit}): ${result.error}`);
    } else {
        console.log(`Trend data for ${result.hour}h (limit: ${result.limit}):`);
        console.log(JSON.stringify(result, null, 2));
    }
}

fetchTrend();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

x_api_key = ""

# Configuration
hour = 24  # Change this to 1, 6, 12, or 24 hours
limit = 10  # Number of results to return

def get_trend(hour, limit):
    try:
        url = f"https://api.coinvera.io/api/v1/trend?x-api-key={x_api_key}&hour={hour}&limit={limit}"
        response = requests.get(url)
        response.raise_for_status()  # Raises an HTTPError for bad responses
        
        data = response.json()
        return {"hour": hour, "limit": limit, **data}
    except Exception as err:
        return {"hour": hour, "limit": limit, "error": str(err)}

def fetch_trend():
    result = get_trend(hour, limit)
    
    if "error" in result:
        print(f"Error for {result['hour']}h trend (limit: {result['limit']}): {result['error']}")
    else:
        print(f"Trend data for {result['hour']}h (limit: {result['limit']}):")
        print(json.dumps(result, indent=2))

# Run the function
fetch_trend()
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"strconv"
)

const xAPIKey = ""

// Configuration
const hour = 24 // Change this to 1, 6, 12, or 24 hours
const limit = 10 // Number of results to return

type TrendResult struct {
	Hour  int         `json:"hour"`
	Limit int         `json:"limit"`
	Data  interface{} `json:"data,omitempty"`
	Error string      `json:"error,omitempty"`
}

func getTrend(hour, limit int) TrendResult {
	url := fmt.Sprintf("https://api.coinvera.io/api/v1/trend?x-api-key=%s&hour=%d&limit=%d", 
		xAPIKey, hour, limit)

	resp, err := http.Get(url)
	if err != nil {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: err.Error(),
		}
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: err.Error(),
		}
	}

	// Check for HTTP errors
	if resp.StatusCode != http.StatusOK {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: fmt.Sprintf("HTTP %d: %s", resp.StatusCode, string(body)),
		}
	}

	var data interface{}
	if err := json.Unmarshal(body, &data); err != nil {
		return TrendResult{
			Hour:  hour,
			Limit: limit,
			Error: err.Error(),
		}
	}

	return TrendResult{
		Hour:  hour,
		Limit: limit,
		Data:  data,
	}
}

func fetchTrend() {
	result := getTrend(hour, limit)

	if result.Error != "" {
		fmt.Printf("Error for %dh trend (limit: %d): %s\n", result.Hour, result.Limit, result.Error)
	} else {
		fmt.Printf("Trend data for %dh (limit: %d):\n", result.Hour, result.Limit)
		jsonData, _ := json.MarshalIndent(result.Data, "", "  ")
		fmt.Println(string(jsonData))
	}
}

func main() {
	fetchTrend()
}
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "0": {
    "buy_volume_usd": 264171537.95575368,
    "latest_price": 0.0030217195692742236,
    "net_inflow_usd": 255050220.33141094,
    "sell_volume_usd": 9121317.624342749,
    "token_address": "8jVcgXXUReoiFCDzDMEhftCvA7HWqLX6rNmZ6AxLpump",
    "token_symbol": "stockcoin"
  },
  "1": {
    "buy_volume_usd": 182223999.0542052,
    "latest_price": 0.000013589051139642012,
    "net_inflow_usd": 180950650.5435902,
    "sell_volume_usd": 1273348.510615017,
    "token_address": "Hz7NdWK3aX5asNLywHDkQxgpXC38nTVDLPpaTGd7pump",
    "token_symbol": "$1 stock"
  },
  "2": {
    "buy_volume_usd": 123156467.66647036,
    "latest_price": 0.006432619799014278,
    "net_inflow_usd": 111710199.7289238,
    "sell_volume_usd": 11446267.937546562,
    "token_address": "55KrNjWHrkgxCzTLvcgaKYDxaopuxZK8vETi1CJNpump",
    "token_symbol": "invest"
  },
  "3": {
    "buy_volume_usd": 102657933.11458473,
    "latest_price": 0.00004347762674059343,
    "net_inflow_usd": 95527427.26541495,
    "sell_volume_usd": 7130505.849169775,
    "token_address": "9mfqn25C1nMVwn7YjxdJFvvTqichHFf8aR6vzNzPSodh",
    "token_symbol": "commodity"
  },
  "4": {
    "buy_volume_usd": 89250429.5964523,
    "latest_price": 0.00005535670512988365,
    "net_inflow_usd": 84827414.22617784,
    "sell_volume_usd": 4423015.370274453,
    "token_address": "HYJ9CKdVBwqYnZTEkEgWoyZJikWJ6icQKtaiNRgXpump",
    "token_symbol": "GAYMAN"
  },
  "5": {
    "buy_volume_usd": 63629733.73753922,
    "latest_price": 0.00013600745164074442,
    "net_inflow_usd": 61013882.9096696,
    "sell_volume_usd": 2615850.8278696146,
    "token_address": "8wvLsACsR3owhGzmLLHTgh2waW2vKNtVYWDs9cCopump",
    "token_symbol": "memestock"
  },
  "6": {
    "buy_volume_usd": 52124966.063705124,
    "latest_price": 0.00031610543953291745,
    "net_inflow_usd": 48378200.87247831,
    "sell_volume_usd": 3746765.1912268195,
    "token_address": "7CLBRXBp534WyZfgMDnR3E4VyedeHVPFQe3P1EHDpump",
    "token_symbol": "STONKS"
  },
  "7": {
    "buy_volume_usd": 43201371.32219729,
    "latest_price": 0.0021707478800632187,
    "net_inflow_usd": 37071648.85030203,
    "sell_volume_usd": 6129722.471895258,
    "token_address": "39zSVsSHFqNhARbVh6n8ZF78nCmhV3gSg8D39xhBNe73",
    "token_symbol": "AP"
  },
  "8": {
    "buy_volume_usd": 36782092.849714845,
    "latest_price": 0.000011710087778822374,
    "net_inflow_usd": 35871217.70677651,
    "sell_volume_usd": 910875.1429383396,
    "token_address": "4cjmXiM4Mg7F5Q5mXJF4Xn9y36wY9xLHK5nzcN4qpump",
    "token_symbol": "Microsoft"
  },
  "9": {
    "buy_volume_usd": 35514986.57322835,
    "latest_price": 0.000006468656907085074,
    "net_inflow_usd": 34865718.1163198,
    "sell_volume_usd": 649268.4569085517,
    "token_address": "5hYQrmP7yPZ6KMnmRbs2waU729abjx3yjuPH3npkpump",
    "token_symbol": "PEABODY"
  },
  "hour": 24,
  "limit": 10
}
```

***

> **Tip:** Try different `hour` windows to capture short-term spikes or longer-term trends, and adjust `limit` to tailor the size of your results list.


# WebSocket Integration

Real-time WebSocket feed for token price updates, trade activities, and more.

#### 🧭 Supported Methods

Currently, CoinVera WebSocket supports the following subscription methods:

* `subscribePrice`: Subscribe to real-time price updates for tokens
* `subscribeTrade`: Subscribe to live trade activity data
* `subscribeNewpair`: Subscribe to stream new tokens & pools live

***

#### 🌐 WebSocket Endpoint

```
wss://api.coinvera.io
```

***

#### 🛠️ Required Parameters

Each subscription request must include the following parameters:

| Parameter | Type     | Description                                                                 |
| --------- | -------- | --------------------------------------------------------------------------- |
| `apiKey`  | `string` | Your CoinVera API key                                                       |
| `method`  | `string` | One of: `subscribePrice`, `subscribeTrade`                                  |
| `tokens`  | `array`  | One or more token addresses or wallet addresses (based on your plan limits) |

***

#### 💻 Code Example

```javascript
const WebSocket = require('ws');

const apiKey = ''; // Your CoinVera API Key
if (!apiKey) {
  console.error('Missing API key');
  process.exit(1);
}

// WebSocket endpoint
const WS_URL = 'wss://api.coinvera.io'; // Normal usage

// Create WebSocket client
const ws = new WebSocket(WS_URL);

let pingInterval;

// Subscribe to trade updates once the connection is open
ws.on('open', () => {
  console.log('WebSocket connection opened. Subscribing to trades...');

  const payload = {
    apiKey,
    method: 'subscribeTrade',
    tokens: [''], // Comment or remove for methods: subscribeNewpair
  };

  ws.send(JSON.stringify(payload));
  console.log('Subscribe request sent:', payload);

  // Start sending PING to keep connection alive every 10 seconds
  pingInterval = setInterval(() => {
    if (ws.readyState === WebSocket.OPEN) {
      ws.ping();
    }
  }, 10000);
});

// Handle incoming messages
ws.on('message', (data) => {
  try {
    const message = JSON.parse(data);
    console.log('Received:', message);
  } catch (err) {
    console.error('Error parsing message:', err);
  }
});

// Handle errors
ws.on('error', (err) => {
  console.error('WebSocket error:', err);
});

// Handle connection close
ws.on('close', (code, reason) => {
  console.log(`WebSocket closed: ${code} - ${reason}`);
  if (pingInterval) clearInterval(pingInterval);
});

```

***

#### 📤 Sample Response: `subscribePrice`

```javascript
{
  ca: '3VCkk4EVWQjCP8usuVK9ArfSmViFAcNcTMPivFJPpump',
  dex: 'PumpFun',
  priceInSol: '0.000000028020233436191693',
  priceInUsd: '0.000004195937910602868'
}
```

***

#### 📤 Sample Response: `subscribeTrade`

```javascript
{
  signature: '5MZFwRDa6Q9ErRetB8RvaUjepNM9RodDG1ZSfMLunSq36NcB38FhR5mBsQFvmTWjzkG8xztMnKmFXVy3eQS6fyv3',
  signer: '58FqLVkDz8Zkg5fRAinwrAnu6a2dK1TJkDg8NG6pRimE',
  dexs: [ 'Pump.fun' ],
  ca: '3VCkk4EVWQjCP8usuVK9ArfSmViFAcNcTMPivFJPpump',
  trade: 'buy',
  priceInSol: 2.801561469095688e-8,
  solAmount: -0.004950495,
  tokenAmount: 176704.85029899998,
  TokenDelta: [
    {
      mint: '3VCkk4EVWQjCP8usuVK9ArfSmViFAcNcTMPivFJPpump',
      amount: 176704.85029899998
    }
  ]
}
```

#### 📤 Sample Response: `subscribeNewpair`

```json
{
  dex: 'Meteora DlmmV2',
  signature: '5ZX2iDtPMvsGGt6uLHF2ZivcqoyPgGxHLqe1tkRADSwGHc6L5Df6vUNuetP137V6shqRY6qTrNQdfmDWsMqycjEp',
  creator: '7Loze72RNfp2t2PUtw43ajtCNeyvzeVWLpmWm8v8Ss5m',
  pool: 'kp8a7jXmCG3QNx3WssGpJGpGpaVCkFimj7ocMsB1H3Z',
  token0: 'y7DdeCMbukNQShsGbybQmsxgVANi4nhCy7m4WZSLuCb',
  token1: 'So11111111111111111111111111111111111111112'
}
```

***

#### 🔁 Connection Keep-Alive

To maintain your WebSocket session, periodically send `ping` messages to avoid disconnection.


# Referral Program

GitBook integrations allow you to connect your GitBook spaces to some of your favorite platforms and services. You can install integrations into your GitBook page from the *Integrations* menu in the top left.

<figure><img src="https://gitbookio.github.io/onboarding-template-images/integrations-hero.png" alt=""><figcaption></figcaption></figure>

### Types of integrations

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Analytics</strong></td><td>Track analytics from your docs</td><td><a href="https://www.gitbook.com/integrations#analytics">https://www.gitbook.com/integrations#analytics</a></td><td></td><td></td></tr><tr><td><strong>Support</strong></td><td>Add support widgets to your docs</td><td><a href="https://www.gitbook.com/integrations#support">https://www.gitbook.com/integrations#support</a></td><td></td><td></td></tr><tr><td><strong>Interactive</strong></td><td>Add extra functionality to your docs</td><td><a href="https://www.gitbook.com/integrations#interactive">https://www.gitbook.com/integrations#interactive</a></td><td></td><td></td></tr><tr><td><strong>Visitor Authentication</strong></td><td>Protect your docs and require sign-in</td><td><a href="https://www.gitbook.com/integrations#visitor-authentication">https://www.gitbook.com/integrations#visitor-authentication</a></td><td></td><td></td></tr></tbody></table>


