GetBlock
Returns the complete block data for a given slot number, including every transaction, reward, and piece of metadata the validator produced. This is the gRPC equivalent of the JSON-RPC getBlock method, delivering the same data with dramatically lower latency through the Yellowstone Geyser plugin.
Use this method when you need full block contents for indexing, analytics, or block-explorer functionality. For real-time block delivery without polling, consider using the Subscribe method with a Blocks filter instead.
Type: Unary (request/response)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slot | uint64 | Yes | The slot number of the block to retrieve |
commitment | CommitmentLevel | No | Commitment level: Processed (0), Confirmed (1), or Finalized (2). Default: Finalized |
Response
| Field | Type | Description |
|---|---|---|
blockhash | string | The blockhash of the returned block |
parent_slot | uint64 | The slot of the parent block |
parent_blockhash | string | The blockhash of the parent block |
transactions | TransactionInfo[] | Array of all transactions in the block, including signatures, messages, and execution metadata |
rewards | Reward[] | Validator and staking rewards distributed in this block |
block_time | int64 | Estimated Unix timestamp when the block was produced |
block_height | uint64 | The block height (not the same as slot) |
Code Examples
Node.js
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const packageDef = protoLoader.loadSync('geyser.proto', {
keepCase: true, longs: String, enums: String, defaults: true, oneofs: true
});
const proto = grpc.loadPackageDefinition(packageDef).geyser;
const client = new proto.Geyser('88.216.36.108:10001', grpc.credentials.createInsecure());
// Fetch block at a specific slot with Confirmed commitment
client.getBlock({ slot: 250000000, commitment: 1 }, (err, response) => {
if (err) { console.error('gRPC error:', err); return; }
console.log('Blockhash:', response.blockhash);
console.log('Parent slot:', response.parent_slot);
console.log('Transactions:', response.transactions.length);
console.log('Block time:', new Date(response.block_time * 1000).toISOString());
console.log('Block height:', response.block_height);
});Rust
use yellowstone_grpc_client::GeyserGrpcClient;
use yellowstone_grpc_proto::prelude::*;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut client = GeyserGrpcClient::build_from_uri("http://88.216.36.108:10001")
.connect()
.await?;
let response = client
.get_block(250_000_000, Some(CommitmentLevel::Confirmed as i32))
.await?;
let block = response.into_inner();
println!("Blockhash: {}", block.blockhash);
println!("Parent slot: {}", block.parent_slot);
println!("Transactions: {}", block.transactions.len());
println!("Block height: {}", block.block_height);
Ok(())
}Example Response
{
"blockhash": "7xkKzR2rL9JsVpHjWnBqoNjBEMpAv3RJRwbqTXmPYrjA",
"parent_slot": "249999999",
"parent_blockhash": "4Nd6LwMfvFbdFEiXQMfMqrj9cKjEMvkYPGcLaZGh4UbS",
"transactions": [
{
"signature": "5K4...",
"is_vote": false,
"meta": { "err": null, "fee": "5000", "compute_units_consumed": "150000" }
}
],
"rewards": [
{ "pubkey": "Vote111...", "lamports": "5000000", "reward_type": "Voting" }
],
"block_time": "1704067200",
"block_height": "230000000"
}