From fffd6afb7951770b86496df7aba6eaea4de2a4bf Mon Sep 17 00:00:00 2001 From: "martin.zemanek" Date: Fri, 19 Apr 2024 09:35:07 +0200 Subject: [PATCH] Adding Rostrum RPC docs --- v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum.md | 12 ++ .../rostrum/blockchainAddressGetBalance.md | 71 +++++++++++ .../rostrum/blockchainAddressGetHistory.md | 77 ++++++++++++ .../rostrum/blockchainAddressGetMempool.md | 77 ++++++++++++ .../rostrum/blockchainAddressListUnspent.md | 85 +++++++++++++ .../rpc-bch/rostrum/blockchainBlockGet.md | 65 ++++++++++ .../rpc-bch/rostrum/blockchainBlockHeader.md | 73 +++++++++++ .../rpc-bch/rostrum/blockchainBlockHeaders.md | 82 ++++++++++++ .../rpc-bch/rostrum/blockchainEstimateFee.md | 64 ++++++++++ .../rostrum/blockchainHeadersSubscribe.md | 73 +++++++++++ .../rpc-bch/rostrum/blockchainHeadersTip.md | 61 +++++++++ .../rpc-bch/rostrum/blockchainRelayFee.md | 62 ++++++++++ .../rostrum/blockchainTransactionBroadcast.md | 70 +++++++++++ .../rostrum/blockchainTransactionGet.md | 117 ++++++++++++++++++ .../rpc-utxo/rpc-bch/rostrum/serverBanner.md | 60 +++++++++ .../rpc-utxo/rpc-bch/rostrum/serverVersion.md | 76 ++++++++++++ 16 files changed, 1125 insertions(+) create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetBalance.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetHistory.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetMempool.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressListUnspent.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockGet.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeader.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeaders.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainEstimateFee.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersSubscribe.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersTip.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainRelayFee.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionBroadcast.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionGet.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverBanner.md create mode 100644 v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverVersion.md diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum.md new file mode 100644 index 00000000..d69f5c5e --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum.md @@ -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. \ No newline at end of file diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetBalance.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetBalance.md new file mode 100644 index 00000000..e1be38ee --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetBalance.md @@ -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({ 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 +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetHistory.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetHistory.md new file mode 100644 index 00000000..9fcdfed7 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetHistory.md @@ -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({ 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 +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetMempool.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetMempool.md new file mode 100644 index 00000000..5adcccf3 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressGetMempool.md @@ -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({ 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 +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressListUnspent.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressListUnspent.md new file mode 100644 index 00000000..8e9cf5d9 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainAddressListUnspent.md @@ -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({ 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 +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockGet.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockGet.md new file mode 100644 index 00000000..e14f606e --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockGet.md @@ -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({ 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 +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeader.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeader.md new file mode 100644 index 00000000..bec25eaf --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeader.md @@ -0,0 +1,73 @@ +--- +title: "blockchainBlockHeader" +slug: "blockchainBlockHeader" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, block header, 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.header` method retrieves the block header at a specified height within the Bitcoin Cash blockchain via Rostrum Electrum. Optionally, it can also provide a merkle proof of the header's inclusion in the blockchain up to a specified checkpoint height (`cp_height`). + +## Parameters + +| Name | Type | Required | Description | +| --------- | ------- | -------- | ----------------------------------------------------------------- | +| height | integer | Yes | The height of the block. | +| cp_height | integer | No | Checkpoint height for the merkle proof, defaults to 0 (disabled). | + +## Returns + +Depending on the value of `cp_height`, the method returns either the raw block header as a hexadecimal string or a dictionary providing a merkle proof: + +| Field | Description | +| ------- | ----------------------------------------------------------------------------------- | +| branch | An array of hashes in the merkle branch leading up to the checkpoint root. | +| header | The raw block header as a hexadecimal string. | +| root | The merkle root of all blockchain headers up to and including `cp_height`. | + +## Example Result + +If `cp_height` is 0: + +```json +{ + "header": "00000020a....61723" +} + +## 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.header", + "params": [5, 0], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const headerInfo = await tatum.rpc.getBlockHeader({ + height: 5, + cp_height: 0 +}); + +console.log(headerInfo); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeaders.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeaders.md new file mode 100644 index 00000000..78ed8a88 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainBlockHeaders.md @@ -0,0 +1,82 @@ +--- +title: "blockchainBlockHeaders" +slug: "blockchainBlockHeaders" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, block headers, 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.headers` method retrieves a contiguous sequence of block headers from the main chain, starting at a specified height. This function is crucial for applications that need to verify block headers without downloading full block data. + +## Parameters + +| Name | Type | Required | Description | +| ------------ | ------- | -------- | ------------------------------------------------------------------ | +| start_height | integer | Yes | The height of the first header in the range to retrieve. | +| count | integer | Yes | The number of headers to retrieve. | +| cp_height | integer | No | Optional checkpoint height for header verification. | + +## Returns + +The response includes a sequence of block headers and, optionally, proof of their inclusion in the blockchain: + +| Field | Description | +| ------- | ----------------------------------------------------------------------------------------- | +| count | The number of headers returned, which can be less than requested if the end of the chain is reached. | +| hex | A single string containing the binary headers concatenated together as hexadecimal. | +| max | The maximum number of headers the server will return in a single request. | +| root | (Optional) The merkle root of all blockchain headers up to cp_height, if cp_height is non-zero. | +| branch | (Optional) The merkle branch linking the last returned header to the root. | + +## Example Result + +Depending on the `cp_height` value, the response might include a simple list of headers or it could provide a merkle proof of inclusion up to the specified checkpoint height: + +Without `cp_height` or `cp_height` is 0: + +```json +{ + "count": 2, + "hex": "010...299", + "max": 2016 +} + + +## 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.headers", + "params": [1000, 10, 0], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const headersInfo = await tatum.rpc.getBlockHeaders({ + startHeight: 1000, + count: 10, + cpHeight: 0 +}); + +console.log(headersInfo); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainEstimateFee.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainEstimateFee.md new file mode 100644 index 00000000..5917c640 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainEstimateFee.md @@ -0,0 +1,64 @@ +--- +title: "blockchainEstimateFee" +slug: "blockchainEstimateFee" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, estimate fee, transaction fee, 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.estimatefee` method provides an estimation of the transaction fee per kilobyte needed for a transaction to be included in a block within a specified number of blocks. This is useful for applications that need to dynamically calculate transaction fees based on current network conditions. + +## Parameters + +| Name | Type | Required | Description | +| ------- | ------- | -------- | ---------------------------------------------------------------- | +| number | integer | Yes | The number of blocks within which the transaction should confirm. | + +## Returns + +The method returns the estimated fee in coin units per kilobyte. If the server cannot estimate the fee due to insufficient data, it returns -1. + +| Field | Description | +| ------- | -------------------------------------------------------------------------------- | +| fee | The estimated transaction fee per kilobyte or -1 if an estimate cannot be made. | + +## Example Result + +```json +0.00101079 +``` + +## 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.estimatefee", + "params": [2], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const feeEstimate = await tatum.rpc.estimateFee(2); + +console.log('Estimated Fee:', feeEstimate); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done +``` \ No newline at end of file diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersSubscribe.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersSubscribe.md new file mode 100644 index 00000000..4835934a --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersSubscribe.md @@ -0,0 +1,73 @@ +--- +title: "blockchainHeadersSubscribe" +slug: "blockchainHeadersSubscribe" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, block headers, subscribe, 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.headers.subscribe` method allows clients to subscribe to new block headers as they are discovered on the network. This subscription is essential for applications that need real-time updates on blockchain changes without polling the server for the latest block. + +## Subscription + +Upon subscribing, the client immediately receives the current blockchain tip's header. Following this initial response, the client will receive updates whenever new blocks are found. + +## Returns + +The response and subsequent updates provide the header in a dictionary format: + +| Field | Description | +| ------- | ------------------------------------------- | +| hex | The block header as a hexadecimal string. | +| height | The height of the block header. | + +## Example Result + +```json +{ + "height": 520481, + "hex": "00000020890208a0ae3a3892aa047c5468725846577cfcd9b512b50000000000000000005dc2b02f2d297a9064ee103036c14d678f9afc7e3d9409cf53fd58b82e938e8ecbeca05a2d2103188ce804c4" +} +``` + +## 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.headers.subscribe", + "params": [], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const subscribeHeaders = await tatum.rpc.subscribeBlockHeaders(); + +subscribeHeaders.on('data', header => { + console.log('New Block Header:', header); +}); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done +``` + +## Note + +- **Chain Reorganisations:** Clients should handle potential blockchain reorganizations where the new chain tip may not directly extend the previous one. Clients must be prepared to identify the common ancestor and request any missing headers to maintain a consistent view of the chain state. +- **Multiple Subscriptions:** If a client attempts multiple subscriptions, only the first one is active; additional requests do not result in multiple sets of notifications. diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersTip.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersTip.md new file mode 100644 index 00000000..9e506774 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainHeadersTip.md @@ -0,0 +1,61 @@ +--- +title: "blockchainHeadersTip" +slug: "blockchainHeadersTip" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, latest block header, 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.headers.tip` method retrieves the latest block header, known as the tip of the blockchain, for the Bitcoin Cash network via Rostrum Electrum. This method provides a snapshot of the most recent block header without subscribing to continuous header updates. + +## Returns + +The method returns a dictionary with the latest block header information: + +| Field | Description | +| ------ | --------------------------------------------------- | +| hex | The block header as a hexadecimal string. | +| height | The height of the block, represented as an integer. | + +## Example Result + +```json +{ + "hex": "0000...8ce804c4", + "height": 520481 +} + +## 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.headers.tip", + "params": [], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const tipHeader = await tatum.rpc.getHeadersTip(); + +console.log(tipHeader); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainRelayFee.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainRelayFee.md new file mode 100644 index 00000000..7363a1c6 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainRelayFee.md @@ -0,0 +1,62 @@ +--- +title: "blockchainRelayFee" +slug: "blockchainRelayFee" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, relay fee, transaction fee, 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.relayfee` method queries the minimum transaction fee required for a low-priority transaction to be accepted into the daemon's memory pool. This fee is crucial for users who need to minimize transaction costs while ensuring their transaction is processed. + +## Returns + +The method returns the minimum relay fee required in whole coin units (e.g., BTC, not satoshis for Bitcoin) as a floating-point number. + +| Field | Description | +| ----- | ------------------------------------- | +| fee | The minimum relay fee in coin units. | + +### Example Results + +```json +1e-05 +``` + +```json +0.0 +``` + +## 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.relayfee", + "params": [], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const relayFee = await tatum.rpc.getRelayFee(); + +console.log('Relay Fee:', relayFee); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done +``` \ No newline at end of file diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionBroadcast.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionBroadcast.md new file mode 100644 index 00000000..847fc89f --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionBroadcast.md @@ -0,0 +1,70 @@ +--- +title: "blockchainTransactionBroadcast" +slug: "blockchainTransactionBroadcast" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, transaction broadcast, 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.transaction.broadcast` method allows clients to broadcast a raw transaction to the network. This function is essential for applications that need to send transactions directly. + +## Parameters + +| Name | Type | Required | Description | +| ------- | ------ | -------- | ------------------------------------------ | +| raw_tx | string | Yes | The raw transaction as a hexadecimal string. | + +## Returns + +The method returns the transaction hash if the transaction is successfully broadcast to the network. In case of an error, the method returns a JSON RPC error in newer protocol versions or an error message directly in the result for protocol version 1.0. + +| Field | Description | +| ------- | -------------------------------------------------------------------------------- | +| txid | The transaction hash as a hexadecimal string, or an error message (protocol v1.0). | + +## Example Result + +```json +"a76242fce5753b4212f903ff33ac6fe66f2780f34bdb4b33b175a7815a11a98e" +``` + +Protocol version 1.0 error example: + +```json +"258: txn-mempool-conflict" +``` + +## 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.transaction.broadcast", + "params": ["0100000001abcdef..."], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const transactionHash = await tatum.rpc.broadcastTransaction("0100000001abcdef..."); + +console.log('Transaction Hash:', transactionHash); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done +``` \ No newline at end of file diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionGet.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionGet.md new file mode 100644 index 00000000..e5ce9bf4 --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/blockchainTransactionGet.md @@ -0,0 +1,117 @@ +--- +title: "blockchainTransactionGet" +slug: "blockchainTransactionGet" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash and Nexa" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, Nexa, transaction, 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.transaction.get` method retrieves a raw transaction from Bitcoin Cash or Nexa blockchains using the transaction hash. It can return a simple hexadecimal string or a detailed, decoded transaction object. + +## Parameters + +| Name | Type | Required | Description | +| -------- | ------- | -------- | -------------------------------------------------- | +| tx_hash | string | Yes | The transaction hash as a hexadecimal string. | +| verbose | boolean | No | Specifies whether to return a decoded transaction. | + +## Returns + +If `verbose` is false, the raw transaction is returned as a hexadecimal string. If `verbose` is true, a detailed dictionary of the transaction is returned. + +| Field | Description | +| ------------- | -------------------------------------------------------- | +| hex | The raw transaction as a hexadecimal string. | +| txid | The transaction ID. | +| size | The transaction size in bytes. | +| version | The version number of the transaction format. | +| locktime | The transaction's lock time. | +| vin | An array of transaction inputs. | +| vout | An array of transaction outputs. | +| blockhash | The block hash containing this transaction (if confirmed).| +| confirmations | The number of confirmations of the block containing this transaction. | +| time | Transaction timestamp from the block. | +| blocktime | Block timestamp as seen by the network. | +| fee | Transaction fee (if available). | + +### Example Result for Verbose = false + +```json +"0100000001abcdef..." +``` + +### Example Result for Verbose = true + +```json +{ + "hex": "0100000001abcdef...", + "txid": "exampletxid", + "size": 225, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "sometxid", + "vout": 0, + "scriptSig": { + "asm": "asm code", + "hex": "hex code" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "n": 0, + "scriptPubKey": { + "asm": "asm code", + "hex": "hex code", + "addresses": [ + "bitcoincash:address" + ] + } + } + ], + "blockhash": "someblockhash", + "confirmations": 10, + "time": 1510000000, + "blocktime": 1510000000, + "fee": "0.00001" +} +``` + +## 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.transaction.get", + "params": ["exampletxid", true], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const transaction = await tatum.rpc.getTransaction("exampletxid", true); + +console.log('Transaction Details:', transaction); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs when done +``` \ No newline at end of file diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverBanner.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverBanner.md new file mode 100644 index 00000000..e17b49ce --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverBanner.md @@ -0,0 +1,60 @@ +--- +title: "serverBanner" +slug: "serverBanner" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, server banner, 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 `server.banner` method retrieves the server's banner message. This is typically used to display server-specific messages or announcements to users. + +## Parameters + +No parameters are required for this method. + +## Returns + +Upon a successful request, the server responds with its current banner message. The response's `result` field contains a string with the banner message. + +## Example Result + +```json +{ + "banner": "Welcome to Rostrum Electrum Server! Stay up to date with the latest Bitcoin Cash news at our site." +} +``` + +## 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": "server.banner", + "params": [], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + +const serverBanner = await tatum.rpc.getServerBanner(); + +console.log(serverBanner); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs +``` diff --git a/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverVersion.md b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverVersion.md new file mode 100644 index 00000000..e5312d6e --- /dev/null +++ b/v1.0/RPC Nodes/rpc-utxo/rpc-bch/rostrum/serverVersion.md @@ -0,0 +1,76 @@ +--- +title: "serverVersion" +slug: "serverVersion" +category: "6620f7e31ea673003624a8cc" +excerpt: "Rostrum Electrum for Bitcoin Cash" +hidden: false +metadata: + image: [] + keywords: "Bitcoin Cash, server version, 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 `server.version` method allows a client to identify itself to the server and negotiate the protocol version. It is important that only the first `server.version` message is accepted by the server after connection establishment. + +## Parameters + +| Name | Type | Required | Description | +| ----------------- | ------ | -------- | --------------------------------------------------------------------------- | +| client_name | string | Yes | A string identifying the connecting client software. | +| protocol_version | mixed | Yes | An array [protocol_min, protocol_max] or a single string for equal values. | + +## Returns + +Upon a successful request, the server responds with the negotiated protocol version and server information. The response's `result` field contains an array with two elements: + +| Field | Description | +| ----------- | ----------------------------------------------------- | +| Server Name | The name and version of the Rostrum server. | +| Protocol | The negotiated protocol version between client and server. | + +## Example response + +```json +{ + "result": [ + "Rostrum 10.0.0", + "1.4" + ] +} +``` +## 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": "server.version", + "params": ["TatumClient", "1.4"], + "id": 1, + "jsonrpc": "2.0" +}' +``` +```typescript +// yarn add @tatumio/tatum + +import { TatumSDK, Rostrum, Network } from "@tatumio/tatum"; + +const rostrum = await TatumSDK.init({ network: Network.ROSTRUM_MAINNET }); + + +const serverVersion = await tatum.rpc.getServerVersion({ + client_name: "TatumClient", + protocol_version: "1.4" +}); + +console.log(serverVersion); + +await rostrum.destroy(); // Destroy Tatum SDK - needed for stopping background jobs + +``` +