From 7c55244b620e02e0582e51043d45a864cb0d4cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Zem=C3=A1nek?= <121304956+Hactive808@users.noreply.github.com> Date: Tue, 16 Apr 2024 08:11:40 +0200 Subject: [PATCH] Adding Kadena RPC docs (#4) * Adding Kadena RPC docs --- .../rpc-ethereum-debug_traceblockbyhash.md | 28 +++---- v1.0/RPC Nodes/rpc-others/rpc-kadena.md | 8 ++ .../rpc-kadena/rpc-kadena-checknodehealth.md | 47 +++++++++++ ...-kadena-getbatchblockpayloadwithoutputs.md | 79 ++++++++++++++++++ .../rpc-kadena-getbatchofblockpayload.md | 78 ++++++++++++++++++ .../rpc-kadena/rpc-kadena-getblock.md | 68 ++++++++++++++++ .../rpc-kadena/rpc-kadena-getblockbranches.md | 80 +++++++++++++++++++ .../rpc-kadena-getblockhashbranches.md | 79 ++++++++++++++++++ .../rpc-kadena/rpc-kadena-getblockhashes.md | 70 ++++++++++++++++ .../rpc-kadena-getblockheaderbyhash.md | 58 ++++++++++++++ .../rpc-kadena/rpc-kadena-getblockheaders.md | 70 ++++++++++++++++ .../rpc-kadena-getblockpayloadwithoutputs.md | 67 ++++++++++++++++ .../rpc-kadena/rpc-kadena-getcurrentcut.md | 67 ++++++++++++++++ .../rpc-kadena/rpc-kadena-getinfo.md | 60 ++++++++++++++ .../rpc-kadena/rpc-kadena-getpayloadbyhash.md | 66 +++++++++++++++ 15 files changed, 911 insertions(+), 14 deletions(-) create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-checknodehealth.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchblockpayloadwithoutputs.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchofblockpayload.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblock.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockbranches.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashbranches.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashes.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaderbyhash.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaders.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockpayloadwithoutputs.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getcurrentcut.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getinfo.md create mode 100644 v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getpayloadbyhash.md diff --git a/v1.0/RPC Nodes/rpc-evm/rpc-ethereum/rpc-ethereum-debug_traceblockbyhash.md b/v1.0/RPC Nodes/rpc-evm/rpc-ethereum/rpc-ethereum-debug_traceblockbyhash.md index de2fa6fe..7a332175 100644 --- a/v1.0/RPC Nodes/rpc-evm/rpc-ethereum/rpc-ethereum-debug_traceblockbyhash.md +++ b/v1.0/RPC Nodes/rpc-evm/rpc-ethereum/rpc-ethereum-debug_traceblockbyhash.md @@ -3,21 +3,20 @@ title: "debug_traceBlockByHash" slug: "rpc-ethereum-debug_traceblockbyhash" excerpt: "Ethereum RPC" hidden: false -metadata: +metadata: image: [] keywords: "Ethereum, rpc" robots: "index" createdAt: "Mon Mar 18 2024 13:51:30 GMT+0000 (Coordinated Universal Time)" updatedAt: "Sat Apr 06 2024 13:09:02 GMT+0000 (Coordinated Universal Time)" --- + [block:html] { - "html": "
\n
Archive Method
\n

Only on the full archive nodes. Complex queries might take longer and incur additional cost

\n
" +"html": "
\n
Archive Method
\n

Only on the full archive nodes. Complex queries might take longer and incur additional cost

\n
" } [/block] - - ## Overview `debug_traceBlockByHash`method allows developers to trace the execution of transactions within a block specified by its hash. This method is particularly useful for debugging purposes, as it provides detailed information about the execution of each transaction within the block, including the type of call, the addresses involved, the value transferred, the gas used, the input data, the output data, and any sub-calls made during the transaction. @@ -91,23 +90,24 @@ curl --location 'https://api.tatum.io/v3/blockchain/node/ethereum-mainnet/' \ "jsonrpc": "2.0" }' ``` + ```javascript JS SDK // yarn add @tatumio/tatum -import { TatumSDK, Ethereum, Network } from '@tatumio/tatum' +import { TatumSDK, Ethereum, Network } from "@tatumio/tatum"; -const tatum = await TatumSDK.init({network: Network.ETHEREUM}) +const tatum = (await TatumSDK.init) < Ethereum > { network: Network.ETHEREUM }; const result = await tatum.rpc.debugTraceBlockByHash( -'0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82', -{ - tracer: 'callTracer', - tracerConfig: { + "0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82", + { + tracer: "callTracer", + tracerConfig: { onlyTopCall: true, - timeout: '5s', + timeout: "5s", + }, } -} -) +); -await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs ``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena.md new file mode 100644 index 00000000..3c500b18 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena.md @@ -0,0 +1,8 @@ +--- +title: "Kadena" +slug: "rpc-kadena" +excerpt: "Kadena RPC" +hidden: false +createdAt: "Wed Mar 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Mar 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-checknodehealth.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-checknodehealth.md new file mode 100644 index 00000000..27fc19b9 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-checknodehealth.md @@ -0,0 +1,47 @@ +--- +title: "kda_checkNodeHealth" +slug: "rpc-kadena-checknodehealth" +excerpt: "Kadena RPC" +hidden: false +metadata: + image: [] + keywords: "kadena, node, health-check" + robots: "index" +createdAt: "Wed Apr 11 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Apr 11 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/health-check` endpoint is utilized to confirm the operational status of a Kadena chainweb-node, ensuring it is active, running, and able to respond to API requests. To evaluate the consensus state or the blockchain's current cut, it is advisable to use the `/cut` endpoint. This health check plays a vital role in the maintenance and reliability of blockchain applications by verifying the node's readiness. + +## Parameters + +The `/health-check` endpoint does not require any parameters, simplifying the process for developers to quickly ascertain the health of a Kadena node. + +## Returns + +A successful call to the `/health-check` endpoint yields a plain text response that indicates the node's health status: + +- **200 OK**: "Health check OK." - This response signifies that the node is healthy and functional. + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/health-check' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const healthStatus = await tatum.kadena.checkNodeHealth(); + +console.log(healthStatus); // Expected output: "Health check OK." + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchblockpayloadwithoutputs.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchblockpayloadwithoutputs.md new file mode 100644 index 00000000..3bfd1af7 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchblockpayloadwithoutputs.md @@ -0,0 +1,79 @@ +--- +title: "getBatchBlockPayloadWithOutputs" +slug: "rpc-kadena-getbatchblockpayloadwithoutputs" +excerpt: "Kadena Get Batch of Block Payloads with Outputs" +hidden: false +metadata: + description: "Retrieve a batch of block payloads with outputs for specified payload hashes in the Kadena blockchain." + image: [] + keywords: "Kadena, block payload, batch, outputs, getPayloadOutputsBatch" + robots: "index" +createdAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/payload/outputs/batch` endpoint retrieves a batch of block payloads along with their outputs, given a set of payload hashes. This method enables efficient bulk data retrieval, particularly useful for applications requiring detailed information across multiple blocks. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------ | -------- | ------------------------------------------------------------------------------- | +| apiVersion | string | Yes | Version of Kadena API, e.g., "0.0" | +| nodeVersion | enum | Yes | Node version, one of: "test-singleton", "development", "mainnet01", "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve data. | + +## Request Body + +You should include an array of payload hashes for which payloads with outputs are to be retrieved: + +```json +{ + "payloadHashes": ["hash1", "hash2", ...] +} +``` + +## Returns + +A successful call to this endpoint returns an array of the requested block payloads with outputs. The results may be returned in any order. + +| Field | Description | +| ---------------- | ------------------------------------------------------------------ | +| transactions | An array of transactions included in each payload. | +| outputs | Detailed outputs of each transaction. | +| minerData | Data about the miner who mined each block. | +| transactionsHash | A hash of the transactions included in each payload. | +| outputsHash | A hash of the outputs from the transactions in each payload. | +| payloadHash | The hash of each payload itself, confirming the payload retrieved. | + +## Request Example + +```curl +curl --location --request POST 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key})/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/payload/outputs/batch' \ +--header 'Content-Type: application/json' \ +--data-raw '{ +"payloadHashes": ["hash1", "hash2"] +}' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const payloadOutputsBatch = await tatum.kadena.getPayloadOutputsBatch({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + payloadHashes: ["hash1", "hash2"], +}); + +console.log(payloadOutputsBatch); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchofblockpayload.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchofblockpayload.md new file mode 100644 index 00000000..e03f2e63 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getbatchofblockpayload.md @@ -0,0 +1,78 @@ +--- +title: "getBatchOfBlockPayload" +slug: "rpc-kadena-getbatchofblockpayload" +excerpt: "Kadena Get Payload Batch" +hidden: false +metadata: + description: "Retrieve a batch of block payloads by hash in the Kadena blockchain." + image: [] + keywords: "Kadena, block payload, getPayloadBatch" + robots: "index" +createdAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## 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 + +| Name | Type | Required | Description | +| ----------- | ------ | -------- | ------------------------------------------------------ | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The 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: + +```json +{ + "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. + +| Field | Description | +| ---------------- | ----------------------------------------------------------------- | +| transactions | A list of transactions included in the block. | +| minerData | Data about the miner who mined this block. | +| transactionsHash | A hash of the transactions included in the block. | +| outputsHash | A hash of the outputs from the transactions. | +| payloadHash | The hash of the payload itself, confirming the payload retrieved. | + +## Request Example + +```curl +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"] +}' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ 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 +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblock.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblock.md new file mode 100644 index 00000000..cf6b0ef2 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblock.md @@ -0,0 +1,68 @@ +--- +title: "kda_getBlock" +slug: "rpc-kadena-getblock" +excerpt: "Kadena RPC" +hidden: false +metadata: + image: [] + keywords: "kadena, get block, block" + robots: "index" +createdAt: "Wed Apr 11 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Apr 11 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## 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 + +| Name | Type | Required | Description | +| ----------- | ------- | -------- | ------------------------------------------------------ | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve blocks. | +| limit | integer | No | The maximum number of blocks to return. | +| next | string | No | A cursor for pagination to fetch subsequent blocks. | +| minheight | integer | No | The minimum block height to include in the results. | +| maxheight | integer | No | The maximum block height to include in the results. | + +## Returns + +| Name | Description | +| ----- | ------------------------------------------------------------------------------------------------------ | +| next | The cursor for the next page of blocks. | +| items | An array of blocks, each including details such as the block header, transactions, and their outcomes. | +| limit | The maximum number of blocks returned in this response. | + +## Request Example + +```curl +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' +``` + +```javascript +// 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 +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockbranches.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockbranches.md new file mode 100644 index 00000000..54fba034 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockbranches.md @@ -0,0 +1,80 @@ +--- +title: "getBlockBranches" +slug: "rpc-kadena-getblockbranches" +excerpt: "Kadena Get Block Branches" +hidden: false +metadata: + description: "Retrieve blocks from branches in the Kadena blockchain." + image: [] + keywords: "Kadena, block branches, getBlockBranches" + robots: "index" +createdAt: "Fri Apr 12 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Fri Apr 12 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/block/branch` endpoint retrieves a page of blocks from branches of the blockchain in descending order. This includes blocks that are ancestors of the block in the set of upper bounds and are not ancestors of any block in the set of lower bounds. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------- | -------- | ----------------------------------------------------------- | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID for which to retrieve block branches. | +| limit | integer | No | The maximum number of blocks to return. | +| next | string | No | A cursor for pagination to fetch subsequent blocks. | +| minheight | integer | No | The minimum block height to include in the results. | +| maxheight | integer | No | The maximum block height to include in the results. | + +## Request Body + +| Field | Type | Description | +| ----- | ----- | -------------------------------------------------------------------------------------------------------------------------- | +| lower | array | Blocks are not returned if they are predecessors of any block with a hash from this array. | +| upper | array | Returned blocks are predecessors of a block with a hash from this array. This includes blocks with hashes from this array. | + +## Returns + +A successful call to this endpoint returns a JSON object containing the following fields: + +| Field | Description | +| ----- | -------------------------------------------------------------------------- | +| next | The cursor for the next page of block branches. | +| items | An array of JSON encoded blocks, detailing the branches in the blockchain. | +| limit | The maximum number of blocks returned in this response. | + +## Request Example + +```curl +curl --location --request POST 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/block/branch?limit={limit}&next={next}&minheight={minheight}&maxheight={maxheight}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ +"lower": ["RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM"], +"upper": ["QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74"], +}' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const blockBranches = await tatum.kadena.getBlockBranches({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + lower: ["RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM"], + upper: ["QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74"], + limit: 2, +}); + +console.log(blockBranches); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashbranches.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashbranches.md new file mode 100644 index 00000000..44e9d02a --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashbranches.md @@ -0,0 +1,79 @@ +--- +title: "getBlockHashBranches" +slug: "rpc-kadena-getblockhashbranches" +excerpt: "Kadena RPC" +hidden: false +metadata: + description: "Retrieve block hash branches in Kadena blockchain." + image: [] + keywords: "Kadena, blockhash, getBlockHashBranches" + robots: "index" +createdAt: "Wed Apr 11 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Apr 11 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/hash/branch` endpoint retrieves a page of block hashes from branches of the blockchain in **descending** order. This method returns only blocks that are ancestors of some block in the set of upper bounds and are not ancestors of any block in the set of lower bounds. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------- | -------- | ---------------------------------------------------------------- | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID for which to retrieve block hash branches. | +| limit | integer | No | The maximum number of block hashes to return. | +| next | string | No | A cursor for pagination to fetch subsequent block hashes. | +| minheight | integer | No | The minimum block height to include in the results. | +| maxheight | integer | No | The maximum block height to include in the results. | + +## Request Body + +| Field | Type | Description | +| ----- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| lower | array | An array of block hashes. No block hashes are returned that are predecessors of any block with a hash from this array. | +| upper | array | An array of block hashes. Returned block hashes are predecessors of a block with a hash from this array, including blocks with hashes from this array. | + +## Returns + +A successful call to the `/chain/{chain}/hash/branch` endpoint returns a JSON object containing the following fields: + +| Field | Description | +| ----- | ------------------------------------------------------------------- | +| next | The cursor for the next page of block hashes. | +| items | An array of block hashes, detailing the branches in the blockchain. | +| limit | The maximum number of block hashes returned in this response. | + +## Request Example + +```curl +curl --location --request POST 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/hash/branch?limit={limit}&next={next}&minheight={minheight}&maxheight={maxheight}' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "lower": ["RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM"], + "upper": ["QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74"], +}' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const blockHashBranches = await tatum.kadena.getBlockHashBranches({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + lower: ["RClyuyZAacwvPpmLXKbTwrIRXWeUSjiNhJVP2esH8KM"], + upper: ["QxGCAz5AY1Y41nh1yWtgqhKhZ9pPiPRagFdIKNqBH74"], +}); + +console.log(blockHashBranches); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashes.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashes.md new file mode 100644 index 00000000..b6ee0f44 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockhashes.md @@ -0,0 +1,70 @@ +--- +title: "getBlockHashes" +slug: "rpc-kadena-getblockhashes" +excerpt: "Kadena RPC" +hidden: false +metadata: + description: "Kadena RPC" + image: [] + keywords: "kadena, blockhash, get block hashes" + robots: "index" +createdAt: "Wed Mar 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Mar 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/hash` endpoint retrieves a collection of block hashes from a specified Kadena chain in ascending order that satisfies various query parameters. This includes all block hashes within the chain database, even those of orphaned blocks. It is crucial for developers needing to track block creation or verify chain integrity. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------- | -------- | ---------------------------------------------------------- | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve block hashes. | +| limit | integer | No | The maximum number of block hashes to return. | +| next | string | No | A cursor for pagination to fetch subsequent block hashes. | +| minheight | integer | No | The minimum block height to include in the results. | +| maxheight | integer | No | The maximum block height to include in the results. | + +## Returns + +A successful call to the `/chain/{chain}/hash` endpoint returns a JSON object containing the following fields: + +| Field | Description | +| ----- | -------------------------------------------------------------- | +| next | The cursor for the next page of block hashes. | +| items | An array of block hashes, including hashes of orphaned blocks. | +| limit | The maximum number of block hashes returned in this response. | + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/hash?limit={limit}&next={next}&minheight={minheight}&maxheight={maxheight}' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const blockHashes = await tatum.kadena.getBlockHashes({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + limit: 2, + next: "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + minheight: 1000000, + maxheight: 1000001, +}); + +console.log(blockHashes); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaderbyhash.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaderbyhash.md new file mode 100644 index 00000000..18d3f271 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaderbyhash.md @@ -0,0 +1,58 @@ +--- +title: "getBlockHeaderByHash" +slug: "rpc-kadena-getblockheaderbyhash" +excerpt: "Kadena Get Block Header by Hash" +hidden: false +metadata: + description: "Retrieve a block header by hash in Kadena blockchain." + image: [] + keywords: "Kadena, blockheader, hash" + robots: "index" +createdAt: "Tue Apr 12 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 12 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/header/{blockHash}` endpoint allows querying a block header by its hash. This is useful for developers looking to verify blocks or inspect block attributes without the need for the entire block's data. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------ | -------- | -------------------------------------------------------- | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve the header. | +| blockHash | string | Yes | The hash of the block whose header is being requested. | + +## Returns + +A successful call to this endpoint returns the requested block header. The header can be returned in various formats, including JSON, base64 encoded, or binary. + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/header/{blockHash}' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const blockHeader = await tatum.kadena.getBlockHeaderByHash({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + blockHash: "your_block_hash_here", +}); + +console.log(blockHeader); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaders.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaders.md new file mode 100644 index 00000000..3ac44ea4 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockheaders.md @@ -0,0 +1,70 @@ +--- +title: "getBlockHeaders" +slug: "rpc-kadena-getblockheaders" +excerpt: "Kadena Get Block Headers" +hidden: false +metadata: + description: "Retrieve a collection of block headers from the Kadena blockchain." + image: [] + keywords: "Kadena, block headers, getBlockHeaders" + robots: "index" +createdAt: "Tue Apr 12 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 12 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/header` endpoint retrieves a page of block headers in ascending order that satisfies various query parameters. This includes headers of all blocks within the chain database, including those of orphaned blocks. The service is essential for developers needing detailed insights into the blockchain's history and state without needing full block data. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------- | -------- | ------------------------------------------------------ | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve headers. | +| limit | integer | No | The maximum number of headers to return. | +| next | string | No | A cursor for pagination to fetch subsequent headers. | +| minheight | integer | No | The minimum block height to include in the results. | +| maxheight | integer | No | The maximum block height to include in the results. | + +## Returns + +A successful call to this endpoint returns a JSON object containing the following fields: + +| Field | Description | +| ----- | ------------------------------------------------------------------------------------------------ | +| next | The cursor for the next page of block headers. | +| items | An array of base64 encoded or JSON formatted block headers, depending on the requested encoding. | +| limit | The maximum number of block headers returned in this response. | + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chain/{chain}/header?limit={limit}&next={next}&minheight={minheight}&maxheight={maxheight}' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const headers = await tatum.kadena.getBlockHeaders({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + limit: 2, + next: "inclusive:o1S4NNFhKWg8T1HEkmDvsTH9Ut9l3_qHRpp00yRKZIk", + minheight: 1000000, + maxheight: 1000001, +}); + +console.log(headers); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockpayloadwithoutputs.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockpayloadwithoutputs.md new file mode 100644 index 00000000..edd3fdf4 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblockpayloadwithoutputs.md @@ -0,0 +1,67 @@ +--- +title: "getPayloadWithOutputs" +slug: "rpc-kadena-getpayloadwithoutputs" +excerpt: "Kadena Get Block Payload with Outputs" +hidden: false +metadata: + description: "Retrieve the block payload with outputs for a given payload hash in the Kadena blockchain." + image: [] + keywords: "Kadena, block payload, outputs, getPayloadWithOutputs" + robots: "index" +createdAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/payload/{payloadHash}/outputs` endpoint retrieves the payload data along with transaction outputs for a specified payload hash. This detailed view is beneficial for users needing comprehensive transactional data for specific blocks. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------ | -------- | ------------------------------------------------------ | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve data. | +| payloadHash | string | Yes | The hash of the payload to retrieve. | + +## Returns + +A successful call to this endpoint returns the payload with transaction outputs for the specified block payload hash, which includes: + +| Field | Description | +| ---------------- | ----------------------------------------------------------------------- | +| transactions | An array of transactions included in the block, with their output data. | +| minerData | Data about the miner who mined this block. | +| transactionsHash | A hash of the transactions included in the block. | +| outputsHash | A hash of the outputs from the transactions. | +| payloadHash | The hash of the payload itself, confirming the payload retrieved. | +| coinbase | Coinbase transaction details, if applicable. | + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/payload/{payloadHash}/outputs' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const payloadOutputs = await tatum.kadena.getPayloadWithOutputs({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + payloadHash: "your_payload_hash_here", +}); + +console.log(payloadOutputs); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getcurrentcut.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getcurrentcut.md new file mode 100644 index 00000000..6f527347 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getcurrentcut.md @@ -0,0 +1,67 @@ +--- +title: "getCurrentCut" +excerpt: "Kadena RPC" +excerpt: "Kadena RPC" +hidden: false +metadata: + description: "Kadena RPC" + image: [] + keywords: "kadena, rpc" + robots: "index" +createdAt: "Wed Apr 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Apr 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/cut` endpoint in Kadena represents a distributed state of a chainweb. It references one block header for each chain, ensuring those blocks are pairwise concurrent. In Kadena, two blocks from different chains are considered concurrent if one is a direct dependency of the other or if they don't depend on each other at all. This method is crucial for: + +- **State Monitoring**: Allows for the monitoring of the Kadena chainweb's state, facilitating the identification of the blockchain's health and activity. +- **Synchronization**: Essential for applications that require up-to-date synchronization with the Kadena chainweb's state. +- **Data Integrity**: Ensures that transactions and other blockchain interactions are based on the current and accurate state of the chainweb. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------ | -------- | ------------------------------------------------------ | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| maxHeight | number | No | Maximum cut height of the returned cut | + +## Returns + +A successful request to the `/cut` endpoint returns the current cut of the Kadena chainweb, including the following information: + +| Field | Description | +| -------- | -------------------------------------------------------------------------------------------- | +| origin | The origin of the cut. | +| height | The height of the cut, indicating the latest state. | +| weight | The weight of the cut. | +| hashes | An object containing the height and hash of the latest block for each chain in the chainweb. | +| id | The ID of the cut. | +| instance | The instance of the Kadena network (e.g., mainnet01). | + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/cut' \ +--header 'Content-Type: application/json' \ +``` + +```typescript JS SDK +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const currentCut = await tatum.rpc.putCutNetworkPeerInfo({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + }, + maxHeight: +}); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getinfo.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getinfo.md new file mode 100644 index 00000000..081056bc --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getinfo.md @@ -0,0 +1,60 @@ +--- +title: "getinfo" +slug: "rpc-kadena-getinfo" +excerpt: "Kadena RPC" +hidden: false +metadata: + description: "Kadena RPC" + image: [] + keywords: "kadena, node, info" + robots: "index" +createdAt: "Wed Apr 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Wed Apr 10 2024 10:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/info` endpoint provides general information about a Kadena node and the chainweb version it is running. This endpoint is crucial for understanding the configuration and status of the node, including: + +- The number of chains supported by the node. +- The API version of the node. +- The list of chains the node is part of. +- The node's version and its chainweb instance. +- The node's graph history, detailing the connectivity and relationships between different chains at various points in time. + +This information is valuable for developers interacting with the Kadena blockchain, as it offers insights into the node's capabilities and network topology. + +## Parameters + +The `/info` method does not require any parameters, making it straightforward to retrieve the node's information. + +## Returns + +A successful call to the `/info` endpoint returns a JSON object containing the following fields: + +| Field | Description | +| ------------------ | -------------------------------------------------------------------------------------------------- | +| nodeNumberOfChains | The number of chains the node participates in. | +| nodeApiVersion | The version of the node's API. | +| nodeChains | An array listing the chains the node is part of. | +| nodeVersion | The version of the Kadena node. | +| nodeGraphHistory | A detailed account of the node's graph history, showing the connectivity between chains over time. | + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/info' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const nodeInfo = await tatum.kadena.getNodeInfo(); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getpayloadbyhash.md b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getpayloadbyhash.md new file mode 100644 index 00000000..6c6d40ae --- /dev/null +++ b/v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getpayloadbyhash.md @@ -0,0 +1,66 @@ +--- +title: "getPayloadByHash" +slug: "rpc-kadena-getpayloadbyhash" +excerpt: "Kadena Get Payload by Hash" +hidden: false +metadata: + description: "Retrieve payload data for a specific block in the Kadena blockchain by payload hash." + image: [] + keywords: "Kadena, block payload, getPayloadByHash" + robots: "index" +createdAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +updatedAt: "Tue Apr 11 2024 00:00:00 GMT+0000 (Coordinated Universal Time)" +--- + +## Overview + +The `/chain/{chain}/payload/{payloadHash}` endpoint retrieves the payload data of a block for the given payload hash. This is crucial for accessing detailed information about specific transactions and operations within a block without retrieving the entire block data. + +## Parameters + +| Name | Type | Required | Description | +| ----------- | ------ | -------- | ------------------------------------------------------ | +| apiVersion | string | Yes | Version of Kadena API "0.0" | +| nodeVersion | enum | Yes | "test-singleton" "development" "mainnet01" "testnet04" | +| chain | string | Yes | The specific chain ID from which to retrieve data. | +| payloadHash | string | Yes | The hash of the payload to retrieve. | + +## Returns + +A successful call to this endpoint returns the payload data of the specified block, which includes: + +| Field | Description | +| ---------------- | ----------------------------------------------------------------- | +| transactions | A list of transactions included in the block. | +| minerData | Data about the miner who mined this block. | +| transactionsHash | A hash of the transactions included in the block. | +| outputsHash | A hash of the outputs from the transactions. | +| payloadHash | The hash of the payload itself, confirming the payload retrieved. | + +## Request Example + +```curl +curl --location 'https://api.tatum.io/v3/blockchain/node/kadena-mainnet/{api_key}/chainweb/{apiVersion}/{nodeVersion}/chain/{chain}/payload/{payloadHash}' \ +--header 'Content-Type: application/json' +``` + +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Kadena, Network } from "@tatumio/tatum"; + +const tatum = await TatumSDK.init({ network: Network.KADENA_MAINNET }); + +const payload = await tatum.kadena.getPayloadByHash({ + network: { + apiVersion: "0.0", + nodeVersion: "mainnet01", + chain: "0", // Example chain ID + }, + payloadHash: "your_payload_hash_here", +}); + +console.log(payload); + +await tatum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +```