Skip to content

Commit

Permalink
Merge pull request #6 from tatumio/rostrum
Browse files Browse the repository at this point in the history
Adding Rostrum RPC docs
  • Loading branch information
Hactive808 authored Apr 19, 2024
2 parents ad09d46 + fffd6af commit d88b2ae
Show file tree
Hide file tree
Showing 16 changed files with 1,125 additions and 0 deletions.
12 changes: 12 additions & 0 deletions v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Rostrum"
slug: "rostrum"
category: "6620f7e31ea673003624a8cc"
excerpt: ""
hidden: false
createdAt: "Wed Mar 06 2024 10:39:28 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Sat Apr 06 2024 12:59:44 GMT+0000 (Coordinated Universal Time)"
---
# Bitcoin Cash Rostrum RPC Documentation

Welcome to the Bitcoin Cash Rostrum RPC documentation. This guide provides detailed information about the Remote Procedure Call (RPC) interfaces available for interacting with the Bitcoin Cash blockchain through the Rostrum Electrum server. Here, developers can find method specifications, example requests, and responses designed to facilitate the integration and development of applications utilizing Bitcoin Cash blockchain features.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: "blockchainAddressGetBalance"
slug: "BlockchainAddressGetBalance"
category: "6620f7e31ea673003624a8cc"
excerpt: "Rostrum Electrum for Bitcoin Cash"
hidden: false
metadata:
image: []
keywords: "Bitcoin Cash, get balance, address balance, Electrum"
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 `blockchain.address.get_balance` method retrieves the confirmed and unconfirmed balances of a Bitcoin Cash address. This method provides crucial data for wallet applications and services that require up-to-date balance information.

## Parameters

| Name | Type | Required | Description |
| ------- | ------ | -------- | ------------------------------------------------------------- |
| address | string | Yes | The Bitcoin Cash address in Cash Address or legacy format. |
| filter | string | No | Determines which UTXOs are included in the balance calculation. Options are `include_tokens`, `tokens_only`, `exclude_token`. Default is `include_tokens`. |

## Returns

The response includes both confirmed and unconfirmed balances:

| Field | Description |
| ---------------- | -------------------------------------------------------------- |
| confirmed | The confirmed balance of the address in satoshis. |
| unconfirmed | The unconfirmed balance of the address in satoshis. |

## Example Result

```json
{
"confirmed": 450000000,
"unconfirmed": 50000000
}

## Request Example

```json cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/rostrum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "blockchain.address.get_balance",
"params": ["bchtest:qp3hnqdkvqxfzvcj7xqm8sb4cs4mq856vsk5nx9h2w", "include_tokens"],
"id": 1,
"jsonrpc": "2.0"
}'
```
```typescript
// yarn add @tatumio/tatum

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

const rostrum = await TatumSDK.init<RostrumElectrum>({ network: Network.BITCOIN_CASH_MAINNET });

const balance = await tatum.rpc.getAddressBalance({
address: "bchtest:qp3hnqdkvqxfzvcj7xqm8sb4cs4mq856vsk5nx9h2w",
filter: "include_tokens"
});

console.log(balance);

await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "blockchainAddressGetHistory"
slug: "blockchainAddressGetHistory"
category: "6620f7e31ea673003624a8cc"
excerpt: "Rostrum Electrum for Bitcoin Cash"
hidden: false
metadata:
image: []
keywords: "Bitcoin Cash, Nexa, address history, Electrum"
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 `blockchain.address.get_history` method retrieves the confirmed and unconfirmed transaction history of a Bitcoin Cash or Nexa address. This functionality is crucial for tracking transactions associated with specific addresses, providing a comprehensive view of an address's activity.

## Parameters

| Name | Type | Required | Description |
| -------- | ------ | -------- | -------------------------------------------------------------------------- |
| address | string | Yes | The Bitcoin Cash or Nexa address in Cash Address format or legacy format. |
| filter | string | No | Determines which UTXOs are included. Valid options: 'include_tokens', 'tokens_only', 'exclude_token'. |

## Returns

The method returns an array of transaction histories, including both confirmed and unconfirmed transactions relevant to the specified address.

| Field | Description |
| ----------- | ------------------------------------------------------------------------ |
| transactions| A list of transactions associated with the address, detailed by their inclusion status and transaction details. |

## Example Result

```json
{
"transactions": [
{
"tx_hash": "b6f6998abc08195f5b..."
},
{
"tx_hash": "a2c8579bfcc32e..."
}
]
}
```

## Request Example

```curl /cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/rostrum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "blockchain.address.get_history",
"params": ["qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a", "include_tokens"],
"id": 1,
"jsonrpc": "2.0"
}'
```
```typescript
// yarn add @tatumio/tatum

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

const rostrum = await TatumSDK.init<Rostrum>({ network: Network.ROSTRUM_MAINNET });

const addressHistory = await tatum.rpc.getAddressHistory({
address: "qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a",
filter: "include_tokens"
});

console.log('Address History:', addressHistory);

await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "blockchainAddressGetMempool"
slug: "blockchainAddressGetMempool"
category: "6620f7e31ea673003624a8cc"
excerpt: "Rostrum Electrum for Bitcoin Cash"
hidden: false
metadata:
image: []
keywords: "Bitcoin Cash, Nexa, mempool, unconfirmed transactions, Electrum"
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 `blockchain.address.get_mempool` method retrieves the unconfirmed transactions associated with a Bitcoin Cash or Nexa address. This allows users to view pending transactions that have not yet been included in a block, providing insights into upcoming transactions.

## Parameters

| Name | Type | Required | Description |
| -------- | ------ | -------- | -------------------------------------------------------------------------- |
| address | string | Yes | The Bitcoin Cash or Nexa address in Cash Address format or legacy format. |
| filter | string | No | Specifies which UTXOs are included. Options: 'include_tokens', 'tokens_only', 'exclude_token'. |

## Returns

The method returns an array of unconfirmed transactions for the specified address.

| Field | Description |
| ----------------- | ------------------------------------------------------------------------ |
| unconfirmed_txs | List of unconfirmed transactions with details such as transaction hash, inputs, and outputs. |

## Example Result

```json
{
"unconfirmed_txs": [
{
"tx_hash": "b6f6998abc08195f5b..."
},
{
"tx_hash": "a2c8579bfcc32e..."
}
]
}
```

## Request Example

```curl /cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/rostrum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "blockchain.address.get_mempool",
"params": ["qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a", "include_tokens"],
"id": 1,
"jsonrpc": "2.0"
}'
```
```typescript
// yarn add @tatumio/tatum

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

const rostrum = await TatumSDK.init<Rostrum>({ network: Network.ROSTRUM_MAINNET });

const mempoolTransactions = await tatum.rpc.getMempoolTransactions({
address: "qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a",
filter: "include_tokens"
});

console.log('Mempool Transactions:', mempoolTransactions);

await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: "blockchainAddressListUnspent"
slug: "blockchainAddressListUnspent"
category: "6620f7e31ea673003624a8cc"
excerpt: "Rostrum Electrum for Bitcoin Cash"
hidden: false
metadata:
image: []
keywords: "Bitcoin Cash, Nexa, list unspent, UTXOs, Electrum"
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 `blockchain.address.listunspent` method retrieves a detailed list of unspent transaction outputs (UTXOs) for a specified Bitcoin Cash or Nexa address. This method is crucial for applications that require knowledge of available UTXOs for constructing new transactions.

## Parameters

| Name | Type | Required | Description |
| -------- | ------ | -------- | -------------------------------------------------------------------------- |
| address | string | Yes | The Bitcoin Cash or Nexa address in Cash Address format or legacy format. |
| filter | string | No | Specifies which UTXOs are included. Options: 'include_tokens', 'tokens_only', 'exclude_token'. |

## Returns

The method returns a sorted array of UTXOs for the address specified.

| Field | Description |
| ----------------- | ------------------------------------------------------------------------ |
| utxos | An ordered list of UTXOs including details like txid, vout, script, amount, and confirmations. |

## Example Result

```json
{
"utxos": [
{
"txid": "b6f6998abc08195f5b...",
"vout": 0,
"script": "76a914...",
"amount": 0.015,
"confirmations": 10
},
{
"txid": "a2c8579bfcc32e...",
"vout": 1,
"script": "76a914...",
"amount": 0.033,
"confirmations": 5
}
]
}
```

## Request Example

```curl /cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/rostrum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "blockchain.address.listunspent",
"params": ["qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a", "include_tokens"],
"id": 1,
"jsonrpc": "2.0"
}'
```
```typescript
// yarn add @tatumio/tatum

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

const rostrum = await TatumSDK.init<Rostrum>({ network: Network.ROSTRUM_MAINNET });

const utxos = await tatum.rpc.listUnspent({
address: "qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a",
filter: "include_tokens"
});

console.log('List of UTXOs:', utxos);

await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done
```
65 changes: 65 additions & 0 deletions v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockGet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "blockchainBlockGet"
slug: "BlockchainBlockGet"
category: "6620f7e31ea673003624a8cc"
excerpt: "Rostrum Electrum for Bitcoin Cash"
hidden: false
metadata:
image: []
keywords: "Bitcoin Cash, get block, full block, Electrum"
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 `blockchain.block.get` method allows retrieving a full block based on its hash or height within the Bitcoin Cash blockchain via Rostrum Electrum. This is particularly useful for obtaining detailed block information, including transactions within the block.

## Parameters

| Name | Type | Required | Description |
| -------------- | --------------- | -------- | ------------------------------------------------ |
| height_or_hash | string or integer | Yes | The block hash (hex string) or block height (integer). |

## Returns

This method returns the raw block data as a hexadecimal string:

| Field | Description |
| -------- | -------------------------------------------------- |
| blockHex | The full block data encoded as a hexadecimal string. |

## Example Result

```json
{
"blockHex": "0100...abcd"
}

## Request Example

```json cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/rostrum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "blockchain.block.get",
"params": ["00000000000000000176c6f9e3b8c23a5f9a07ae2b0f6cc6cc2d1b16869f97a3"],
"id": 1,
"jsonrpc": "2.0"
}'
```
```typescript
// yarn add @tatumio/tatum

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

const rostrum = await TatumSDK.init<Rostrum>({ network: Network.ROSTRUM_MAINNET });

const blockData = await tatum.rpc.getBlock("00000000000000000176c6f9e3b8c23a5f9a07ae2b0f6cc6cc2d1b16869f97a3");

console.log(blockData);

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

0 comments on commit d88b2ae

Please sign in to comment.