Skip to contents

Retrieves block header and chunk info. Works perfectly with "final", numeric height, or block hash.

Usage

near_get_block(block_id = "final")

Arguments

block_id

One of:

  • "final" — latest finalized block

  • Integer — block height (e.g. 123456789)

  • Character — full block hash

Value

A tibble with block details including timestamp, author, gas price, etc.

Examples

near_set_endpoint("mainnet")
#>  NEAR RPC endpoint set to <https://rpc.mainnet.near.org>

# Latest finalized block
near_get_block("final")
#> # A tibble: 1 × 10
#>      height hash  prev_hash timestamp           author chunks_included gas_price
#>       <int> <chr> <chr>     <dttm>              <chr>            <int> <chr>    
#> 1 176807972 Fa4r… 8FhVxDXP… 2025-12-14 13:46:58 x.poo…               9 100000000
#> # ℹ 3 more variables: total_supply <chr>, latest_protocol_version <int>,
#> #   raw_response <list>

# By height
near_get_block(176259877)
#> Error in httr2::req_perform(.): HTTP 422 Unprocessable Entity.

# By hash (example)
near_get_block("CanDKa6nYDQ89iv5U7sE1YDFteBRkBG6qBJjiM5YwGtY")
#> # A tibble: 0 × 10
#> # ℹ 10 variables: height <int>, hash <chr>, prev_hash <chr>, timestamp <dttm>,
#> #   author <chr>, chunks_included <int>, gas_price <chr>, total_supply <chr>,
#> #   latest_protocol_version <int>, raw_response <list>