> For the complete documentation index, see [llms.txt](https://docs.coinvera.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinvera.io/integration/solana/rpc/getslot.md).

# getSlot

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**.
