Blocks API
Get Blocks

Get Blocks

Overview

The Get Blocks endpoint obtains data for multiple blocks by specifying their range, which should be defined either by block_number_start and block_number_end, timestamp_start and timestamp_end, or block_hash. When querying via block_hash, pass it as a path parameter.

Usage

In this example, we receive data for the last 10,000 blocks on Ethereum Mainnet.

import * as Parsiq from '@parsiq/parsiq.js';
 
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
 
const blocks = client.blocks.getByBlockRange(-10000, 'latest');
 
for await (const block of blocks) {
    console.log(block);
}

Output:

{
  hash: '0x67d2cc2cf7811c0e709d98cf5d84b5be0ab0eeefeb2680f8b5388fccfb50e974',
  parent_hash: '0xbb3c9df37b5c83200b5e5a9e9237147ca011985e9e80d6b41c5e47d636595786',
  number: 18372585,
  timestamp: 1697575823,
  header: {
    nonce: 0,
    gas_used: 15006326,
    mix_hash: '0x4f1e7823297ddc6e5a7291f326d453a536b168245fb2c8b39fe5a562a71ff3fe',
    gas_limit: 29970705,
    burnt_fees: '192534599088679304',
    difficulty: 0,
    extra_data: '0x6265617665726275696c642e6f7267',
    logs_bloom: '0x31b561ab41c13a13523071c9ac577033c455c85b0cd3405042bb3424ad7219168006d1b9c17801ba6a495b2ba542774a4631a1749e842ec21439e72c912b74cc8ac4ea58006c8aebda0e446e5d60b9618ef9b690c0442cf0454b7ca080b2d1795b5924c05e0f82448193708559c27c7d3e02a93c18ba7e890754569e77c9a9ce010583f0680788b9014424d508ac1b2266c02499e95624c9ec30216c76111e119ba88d050b6fbe7aba2be7cf9d52471ec762a68020799246e97e14aa943a5e30e1d9ad870746c5010217ba73f3de60cd71697270468d2498213d602b54d13826d9fa3698485c299f849e97f5ab012d68482df0a07b0a71ce1e8990950ac95cff',
    state_root: '0x625f2fb976b92df32cf535e5c95fe6f809ec5366073ec45e2d63fe06fb70df31',
    sha3_uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
    receipts_root: '0xfcc861b112514a0338a331f16f93d0e4976e98035865d17bf45721bff53d81c1',
    base_fee_per_gas: '12830229004',
    total_difficulty: '58750003716598360000000',
    transactions_root: '0xaab0748d0a17df672565a848e107588d0a2f164a5339e59d25270f8245316909'
  },
  ghost: true
}

Parameters

Path params
chainId
string
REQUIRED
version
string
REQUIRED
Query params
block_number_start
string
number
REQUIRED
block_number_end
string
number
REQUIRED
offset
string
limit
number
estimate_cu
boolean