eth_getBlockByNumber - Tempo

Example code for the eth_getBlockByNumber JSON-RPC method. Complete guide on how to use eth_getBlockByNumber JSON-RPC in GetBlock Web3 documentation.

Returns information about a block by block number. Pass "latest", "earliest", "pending", "safe", or "finalized" as a block tag, or a hex-encoded block number. On Tempo, "finalized" reflects deterministic single-slot finality — there are no re-orgs, so finalized tracks very close to "latest".

Parameters

Parameter
Type
Required
Description

blockParameter

string

Yes

Block number in hex, or "latest", "earliest", "pending", "safe", "finalized"

fullTransactions

boolean

Yes

If true, returns full transaction objects; if false, only hashes

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": [
        "latest",
        false
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result.number

string

Block number (hex)

result.hash

string

Block hash (32 bytes hex)

result.parentHash

string

Hash of the parent block

result.timestamp

string

Unix timestamp of the block (hex)

result.gasUsed

string

Total gas used by transactions in this block (hex)

result.baseFeePerGas

string

Base fee per gas (hex). On Tempo this is denominated in TIP-20 fee units, not native ETH

result.transactions

array

Array of transaction hashes, or full transaction objects if fullTransactions=true

Use Cases

  • Block-by-block indexing of Tempo transactions

  • Building payment-focused explorers

  • Computing per-block statistics

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?