> ## Documentation Index
> Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# getBlock on Solana

> getBlock returns identity and transaction information for a confirmed block on Solana, via GoldRush JSON-RPC.

> [card] 0.05 credits per call

`getBlock` on **Solana**: Returns identity and transaction information for a confirmed block.

## Endpoint

```
https://rpc.goldrushdata.com/v1/solana-mainnet
```

Authenticate with `Authorization: Bearer <GOLDRUSH_API_KEY>`. See [authentication](https://goldrush.dev/docs/goldrush-json-rpc/authentication.md).

## Parameters

| Name | Type | Required | Description | Example |
| - | - | - | - | - |
| `slot` | `u64` | yes | Slot number to fetch, as a `u64` integer. | `372877175` |
| `config` | `object` | no | `{commitment?, encoding?, transactionDetails?, maxSupportedTransactionVersion?, rewards?}`. `encoding` is one of `json`, `jsonParsed`, `base58`, `base64`. | `{"encoding":"jsonParsed","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}` |

## Returns

`object | null`: Block object with `blockhash`, `previousBlockhash`, `parentSlot`, `transactions`, `rewards`, `blockTime`, `blockHeight`; `null` if the block is not confirmed.

```json theme={null}
{"blockhash":"5 y...","parentSlot":372877174,"blockHeight":361234567,"blockTime":1718000000,"transactions":[]}
```

## Examples

```bash curl theme={null}
curl https://rpc.goldrushdata.com/v1/solana-mainnet \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBlock",
    "params": [372877175, {"encoding":"jsonParsed","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]
  }'
```

```typescript @solana/kit theme={null}
import {
  createDefaultRpcTransport,
  createSolanaRpcFromTransport,
} from "@solana/kit";

const transport = createDefaultRpcTransport({
  url: "https://rpc.goldrushdata.com/v1/solana-mainnet",
  headers: { Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}` },
});
const rpc = createSolanaRpcFromTransport(transport);

const result = await rpc.getBlock(372877175, {"encoding":"jsonParsed","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}).send();
console.log(result);
```

```python python theme={null}
import os
import requests

resp = requests.post(
    "https://rpc.goldrushdata.com/v1/solana-mainnet",
    headers={
        "Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={"jsonrpc": "2.0", "id": 1, "method": "getBlock", "params": [372877175, {"encoding":"jsonParsed","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]},
)
print(resp.json()["result"])
```

## Errors

| Code | Message |
| - | - |
| `-32004` | Block not available for the requested slot. |
| `-32007` | Slot was skipped, or missing due to ledger jump to recent snapshot. |

Plus standard JSON-RPC errors: `-32600` invalid request, `-32601` method not found, `-32602` invalid params.

## Related Blocks info methods on Solana

* [`getBlocks` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/getblocks)
* [`getBlocksWithLimit` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/getblockswithlimit)
* [`getBlockHeight` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/getblockheight)
* [`getBlockTime` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/getblocktime)
* [`getBlockProduction` on Solana](https://goldrush.dev/docs/api-reference/json-rpc/solana/getblockproduction)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.