Skip to content
LogoLogo

getBlock

Returns information about a block at a block number, hash or tag.

Usage

import {  } from './client'
 
const  = await .getBlock() 
 
}

Returns

Block

Information about the block.

Parameters

blockHash (optional)

Information at a given block hash.

const  = await .getBlock({
  : '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d'
})

blockNumber (optional)

  • Type: bigint

Information at a given block number.

const  = await .getBlock({
  : 42069n
})

blockTag (optional)

  • Type: 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'
  • Default: 'latest'

Information at a given block tag.

const  = await .getBlock({
  : 'safe'
})

includeTransactions (optional)

  • Type: boolean

Whether or not to include transactions (as a structured array of Transaction objects).

const  = await .getBlock({
  : true
})

Example

Check out the usage of getBlock in the live Fetching Blocks Example below.

JSON-RPC Method