Skip to content

Commit

Permalink
Adding Kadena RPC docs (#4)
Browse files Browse the repository at this point in the history
* Adding Kadena RPC docs
  • Loading branch information
Hactive808 committed Apr 16, 2024
1 parent 153ec6e commit 7c55244
Show file tree
Hide file tree
Showing 15 changed files with 911 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<div style=\"padding: 10px 20px; border-radius: 5px; background-color: #e6e2ff; margin: 0 0 30px 0;\">\n <h5>Archive Method</h5>\n <p>Only on the full archive nodes. Complex queries might take longer and incur additional cost</p>\n</div>"
"html": "<div style=\"padding: 10px 20px; border-radius: 5px; background-color: #e6e2ff; margin: 0 0 30px 0;\">\n <h5>Archive Method</h5>\n <p>Only on the full archive nodes. Complex queries might take longer and incur additional cost</p>\n</div>"
}
[/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.
Expand Down Expand Up @@ -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<Ethereum>({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
```
8 changes: 8 additions & 0 deletions v1.0/RPC Nodes/rpc-others/rpc-kadena.md
Original file line number Diff line number Diff line change
@@ -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)"
---
47 changes: 47 additions & 0 deletions v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-checknodehealth.md
Original file line number Diff line number Diff line change
@@ -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<Kadena>({ 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
```
Original file line number Diff line number Diff line change
@@ -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<Kadena>({ 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
```
Original file line number Diff line number Diff line change
@@ -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<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
```
68 changes: 68 additions & 0 deletions v1.0/RPC Nodes/rpc-others/rpc-kadena/rpc-kadena-getblock.md
Original file line number Diff line number Diff line change
@@ -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
```
Loading

0 comments on commit 7c55244

Please sign in to comment.