getBatchOfBlockPayload

Kadena RPC

Overview

The /chain/{chain}/payload/batch endpoint retrieves a batch of block payloads given a set of payload hashes. This allows for efficient bulk retrieval of block data, crucial for applications that need to process or verify multiple blocks at once.

Parameters

NameTypeRequiredDescription
apiVersionstringYesVersion of Kadena API "0.0"
nodeVersionenumYes"test-singleton" "development" "mainnet01" "testnet04"
chainstringYesThe specific chain ID from which to retrieve data.

Request Body

The request body should include an array of payload hashes for which payloads are to be retrieved:

{
  "payloadHashes": ["hash1", "hash2", ...]
}

Returns

A successful call to this endpoint returns an array of the requested block payloads. The payloads may be returned in any order.

FieldDescription
transactionsA list of transactions included in the block.
minerDataData about the miner who mined this block.
transactionsHashA hash of the transactions included in the block.
outputsHashA hash of the outputs from the transactions.
payloadHashThe hash of the payload itself, confirming the payload retrieved.

Request Example

curl --location --request POST 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/payload/batch' \
--header 'Content-Type: application/json' \
--data-raw '{
    "payloadHashes": ["RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM", "QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74"]
}'
// yarn add @tatumio/tatum

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

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

const payloadBatch = await tatum.kadena.getPayloadBatch({
  network: {
    apiVersion: "0.0",
    nodeVersion: "mainnet01",
    chain: "0", // Example chain ID
  },
  payloadHashes: ["your_payload_hash_here1", "your_payload_hash_here2"],
});

console.log(payloadBatch);

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