getBlock

Kadena RPC

Overview

The /chain/{chain}/block endpoint allows for retrieving a collection of blocks from a specified Kadena chain in ascending order that satisfies various query parameters. This comprehensive retrieval includes all blocks within the chain database, encompassing even orphaned blocks. This functionality is pivotal for developers requiring detailed insights into the chain's history and state for debugging and analytical purposes.

Parameters

NameTypeRequiredDescription
apiVersionstringYesVersion of Kadena API "0.0"
nodeVersionenumYes"test-singleton" "development" "mainnet01" "testnet04"
chainstringYesThe specific chain ID from which to retrieve blocks.
limitnumberNoThe maximum number of blocks to return.
nextstringNoA cursor for pagination to fetch subsequent blocks.
minheightnumberNoThe minimum block height to include in the results.
maxheightnumberNoThe maximum block height to include in the results.

Returns

NameDescription
nextThe cursor for the next page of blocks.
itemsAn array of blocks, each including details such as the block header, transactions, and their outcomes.
limitThe maximum number of blocks returned in this response.

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/block?limit={limit}&next={next}&minheight={minheight}&maxheight={maxheight}' \
--header 'Content-Type: application/json'
// yarn add @tatumio/tatum

import { TatumSDK, Kadena, Network } from "@tatumio/tatum";

const tatum =
  (await TatumSDK.init) < Kadena > { network: Network.KADENA_MAINNET };

const blocks = await tatum.kadena.getBlock({
  network: {
    apiVersion: "0.0",
    nodeVersion: "mainnet01",
    chain: "0", // Example chain ID
  },
  limit: 2,
  next: "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk",
  minheight: 1000000,
  maxheight: 1000001,
});

console.log(blocks);

await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs