# Welcome

Welcome to TAAL Docs!!

You can use these docs to learn more about TAAL’s core products, explore guides, and check our API references.

***You can get access to*** [***TAAL PLATFORM***](https://platform.taal.com/) ***and get*** <img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FXAFVIVO2J7OgLnU2d6U0%2Fimage.png?alt=media&amp;token=9e165dcf-796e-46e9-bf5d-0f8b08dff602" alt="" data-size="line">***.***

## **What is TAAL?**

TAAL delivers value-added blockchain services, providing professional-grade, highly scalable blockchain infrastructure, and transactional solutions to support builders and businesses building on the BitcoinSV protocol.

## **TAAL Services**

### Transaction Processing

As a Transaction processor (or miner) TAAL validates clients transactions and time stamps them by sequencing and encoding them into blocks, which are then published and added to the BSV blockchain.

TAAL API is an easy to integrate, open communication channel to the blockchain. By connecting an application to this endpoint data, in the form of transactions, can be processed, instantly verified, and once settled this data can be viewed anytime. Creating great value to applications that require real time blockchain data at scale, now and into the future.&#x20;

### Digital Asset Tokenization with the 1Sat Ordinals protocol

1SatOrdinals in an implementation of Ordinals running on the BSV blockchain. The tokens represent individual satoshis (the smallest unit of Bitcoin) that are "inscribed" with specific data, such as images or text. 1Sat Ordinals on BSV are fast, inexpensive, and fully scriptable via native Bitcoin Script.

{% content-ref url="/pages/yVYDNz3FO6mrbJNNwhec" %}
[1Sat Ordinals tokens API](/core-products/1sat-ordinals-tokens-api)
{% endcontent-ref %}

### Other benefits

* The ability to have low-cost transactions (less than a penny), which make a difference when issuers are dropping millions of NFTs, for example. This attribute means more margin for the issuers on primary and secondary markets.
* Interoperability with ecosystem wallets and other blockchain platforms.
* Transparency allows the token to be tracked throughout its lifecycle, which makes a difference in a regulatory environment.
* No network congestion — as the tokens are issued at the network level on a blockchain that scales unbounded.

You can license this technology from TAAL, download the SDK, and start building their next game-changing NFT or digital asset platform today!

{% hint style="info" %}
[Whitepaper](https://www.taal.com/wp-content/uploads/2022/01/STAS_White-Paper_20211214_1.0_Finalweb4.pdf)
{% endhint %}

{% hint style="info" %}
[TAAL Website](https://www.taal.com/)
{% endhint %}

{% hint style="info" %}
[Blog Post](https://www.taal.com/blog/)
{% endhint %}


# Get an API Key

The following are the steps to get an API key from TAAL:

1. Enter the URL <https://platform.taal.com/> in your browser
2. Register or login on to **TAAL PLATFORM**.
3. Your mainnet and testnet API keys will be displayed.


# WhatsOnChain

**WhatsOnChain API docs have moved!** [**https://docs.whatsonchain.com/**](https://docs.whatsonchain.com/)


# Health

## Get API Status <a href="#get-api-status" id="get-api-status"></a>

A simple endpoint to show that the API server is up and running.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/woc
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl "https://api.whatsonchain.com/v1/bsv/main/woc"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl "https://api.whatsonchain.com/v1/btc/main/woc"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```
Whats On Chain
```

{% endtab %}

{% tab title="BTC" %}

```
Whats On Chain
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |


# Chain Info

## Get Blockchain Info <a href="#get-blockchain-info" id="get-blockchain-info"></a>

This endpoint retrieves information about the state of the specified chain for the selected network.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/chain/info
```

{% endcode %}

#### Example Request

{% tabs fullWidth="false" %}
{% tab title="BSV" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/chain/info"
```

{% endcode %}
{% endtab %}

{% tab title="BTC" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/chain/info"
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "chain": "main",
    "blocks": 905064,
    "headers": 905064,
    "bestblockhash": "0000000000000000112ea3732c0417a2cee0130e9217dbba1b0ff078c92c904e",
    "difficulty": 51223782275.04099,
    "mediantime": 1752242156,
    "verificationprogress": 0.9999990488341951,
    "pruned": false,
    "chainwork": "00000000000000000000000000000000000000000167559704876ce49d636d35"
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "chain": "main",
    "blocks": 904937,
    "headers": 904937,
    "bestblockhash": "000000000000000000005c486692de6f8726bd9223bf4a2f80babedff0d44a91",
    "difficulty": 116958512019762.1,
    "mediantime": 1752160121,
    "verificationprogress": 0.9999988962482643,
    "pruned": false,
    "chainwork": "0000000000000000000000000000000000000000d12c110e37cfdb5d73cdd4ec",
    "size_on_disk": 763791035344
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Circulating Supply <a href="#get-circulating-supply" id="get-circulating-supply"></a>

This endpoint retrieves the circulating supply of the specified blockchain.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/circulatingsupply
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/circulatingsupply"
```

{% endcode %}
{% endtab %}

{% tab title="BTC" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/circulatingsupply"
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```
19890434.375
```

{% endtab %}

{% tab title="BTC" %}

```
19890428.125
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                          |
| --------- | ------------------------------------ |
| chain     | Desired blockchain: `bsv` or `btc`.  |
| network   | Selected network: `main`  or `test`. |

## Get Chain Tips <a href="#get-chain-tips" id="get-chain-tips"></a>

This endpoint retrieves information about all known tips in the block tree.

The possible values for status:

1. `invalid`: This branch contains at least one invalid block.
2. `headers-only`: Not all blocks for this branch are available, but the headers are valid.
3. `valid-headers`: All blocks are available for this branch, but they were never fully validated.
4. `valid-fork`: This branch is not part of the active chain, but is fully validated.
5. `active`: This is the tip of the active main chain, which is certainly valid.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/chain/tips
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/chain/tips"
```

{% endcode %}
{% endtab %}

{% tab title="BTC" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/chain/tips"
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "height": 905064,
    "hash": "0000000000000000112ea3732c0417a2cee0130e9217dbba1b0ff078c92c904e",
    "branchlen": 0,
    "status": "active"
}, {
    "height": 905048,
    "hash": "0000000000000000089a618e0f8b8fa5dcc8a201211d09aea1434a1e03c357cf",
    "branchlen": 1,
    "status": "valid-headers"
},
 ...
]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "height": 905086,
    "hash": "0000000000000000000061958ebfa47a17b104af4cf77cd0f23141748397d505",
    "branchlen": 0,
    "status": "active"
}, {
    "height": 904623,
    "hash": "00000000000000000002274bf6db24519f56a7d6b4841f216cb82e7dc345b499",
    "branchlen": 1,
    "status": "valid-fork"
},
...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Peer Info <a href="#get-blockchain-info" id="get-blockchain-info"></a>

This endpoint retrieves information about peers connected to the node.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/peer/info
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/peer/info"
```

{% endcode %}
{% endtab %}

{% tab title="BTC" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/peer/info"
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "id": 14,
    "addr": "78.110.160.26:56514",
    "addrlocal": "135.181.137.155:8333",
    "services": "0000000000000021",
    "relaytxes": true,
    "lastsend": 1752244985,
    "lastrecv": 1752244982,
    "bytessent": 9198799,
    "bytesrecv": 1112300,
    "conntime": 1752211964,
    "timeoffset": -58,
    "pingtime": 0.042279,
    "minping": 0.039421,
    "version": 70016,
    "subver": "/Bitcoin SV:1.0.16/",
    "inbound": true,
    "addnode": false,
    "startingheight": 905015,
    "txninvsize": 0,
    "banscore": 0,
    "synced_headers": 905064,
    "synced_blocks": 905064,
    "whitelisted": false,
    "bytessent_per_msg": {
        "addr": 27507,
        "blocktxn": 0,
        "cmpctblock": 0,
        "feefilter": 0,
        "getaddr": 0,
        "getdata": 0,
        "getheaders": 1053,
        "headers": 954,
        "inv": 3158821,
        "notfound": 0,
        "ping": 8832,
        "pong": 8832,
        "reject": 0,
        "sendcmpct": 33,
        "sendheaders": 24,
        "tx": 5992415,
        "verack": 24,
        "version": 146
    },
    "bytesrecv_per_msg": {
        "addr": 55,
        "blocktxn": 0,
        "cmpctblock": 0,
        "feefilter": 0,
        "getaddr": 24,
        "getdata": 109395,
        "getheaders": 1053,
        "headers": 4801,
        "inv": 978214,
        "notfound": 0,
        "ping": 8832,
        "pong": 8832,
        "reject": 694,
        "sendcmpct": 33,
        "sendheaders": 24,
        "tx": 0,
        "verack": 24,
        "version": 147
    }
},
...
]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "id": 19,
    "addr": "192.53.168.227:14985",
    "addrlocal": "65.108.123.176:44132",
    "services": "0000000000000c09",
    "relaytxes": false,
    "lastsend": 1752244946,
    "lastrecv": 1752244946,
    "bytessent": 3247905,
    "bytesrecv": 2058824,
    "conntime": 1749118420,
    "timeoffset": 0,
    "pingtime": 0.319371,
    "version": 70016,
    "subver": "/Satoshi:28.1.0/",
    "inbound": false,
    "startingheight": 899889,
    "banscore": 0,
    "feefilter": 0,
    "syncnode": false,
    "v2_connection": false
}, {
    "id": 26,
    "addr": "176.9.38.204:8333",
    "addrlocal": "65.108.123.176:58004",
    "services": "000000000000040d",
    "relaytxes": true,
    "lastsend": 1752245027,
    "lastrecv": 1752245028,
    "bytessent": 1042075735,
    "bytesrecv": 520385665,
    "conntime": 1749119628,
    "timeoffset": -1,
    "pingtime": 4.409384,
    "version": 70015,
    "subver": "/Satoshi:0.18.1/",
    "inbound": false,
    "startingheight": 899889,
    "banscore": 0,
    "feefilter": 0,
    "syncnode": false,
    "v2_connection": false
},
...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |


# Block

## Get by Hash

This endpoint retrieves the block details of a given hash.

{% hint style="info" %}
(BSV-only) For a block with up to 1000 transactions, all transaction ids are returned in response to this call.

* If a block has more than 1000 transactions, only the top 100 transaction ids are returned.
* To get the remaining ids see the [Get Block Pages](#get-block-pages) section.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/block/hash/<hash>
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/hash/000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb"
```

{% endcode %}
{% endtab %}

{% tab title="BTC" %}
{% code overflow="wrap" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/hash/00000000000000000002145230780fd4fd371945f9365664d98a2631358d3f8c"
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
    "confirmations": 330021,
    "size": 14421,
    "height": 575045,
    "version": 536928256,
    "versionHex": "2000e000",
    "merkleroot": "4ebcba09addd720991d03473f39dce4b9a72cc164e505cd446687a54df9b1585",
    "txcount": 5,
    "nTx": 0,
    "num_tx": 5,
    "tx": ["bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a", "c7e8317b48e72644e2b83c87c54f61bcda82326392f969a097fb801aed69b500", "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f", "65cb37947ccb7c5b7cc4ac36a200613bfc39a7f7c6c0314a23dbcc5b3908b5b8", "0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10"],
    "time": 1553416668,
    "mediantime": 1553414858,
    "nonce": 87914848,
    "bits": "180997ee",
    "difficulty": 114608607557.4425,
    "chainwork": "000000000000000000000000000000000000000000ddf5d385546872bab7dc01",
    "previousblockhash": "00000000000000000988156c7075dc9147a5b62922f1310862e8b9000d46dd9b",
    "nextblockhash": "00000000000000000112b36a37c10235fa0c991f680bc5482ba9692e0ae697db",
    "coinbaseTx": {
        "txid": "bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a",
        "hash": "bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a",
        "version": 1,
        "size": 119,
        "locktime": 0,
        "vin": [{
            "coinbase": "0345c6082f626d67706f6f6c2e636f6d2f473173717918707a8aae4a936f101e0000",
            "txid": "",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "sequence": 4294967295
        }],
        "vout": [{
            "value": 12.50023822,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 85770ad0ee64a4f3ee4027e199c32f876e03a2d9 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a91485770ad0ee64a4f3ee4027e199c32f876e03a2d988ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": ["1DAhUiQxHzL1oAusoUDdUM89spXuAG1sqy"],
                "isTruncated": false
            }
        }],
        "blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
        "confirmations": 330021,
        "time": 1553416668,
        "blocktime": 1553416668,
        "blockheight": 575045
    },
    "totalFees": 0.0002382199999999557,
    "miner": "Bmgpool",
    "pages": null
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "tx": ["f89b6ba9d48b1adb98d8e8f37ac9611183826a9f361bac970c562f42a76fed15", ...]
    "miner": "AntPool",
    "hash": "00000000000000000002145230780fd4fd371945f9365664d98a2631358d3f8c",
    "confirmations": 578,
    "size": 1509584,
    "height": 904510,
    "version": 546201600,
    "versionHex": "208e6000",
    "merkleroot": "0736388ae96f0cfbea8995039e9ecea3ddcec17ab54d2e737267c3df4c7b4818",
    "txcount": 5072,
    "time": 1751923471,
    "mediantime": 1751920846,
    "nonce": 3906737240,
    "bits": "17026816",
    "difficulty": 116958512019762.1,
    "chainwork": "0000000000000000000000000000000000000000d07aa30757a4549b9da2c8c2",
    "previousblockhash": "000000000000000000015a6b45bf7b5f5ca04553206f980de6f11c62a3e9a3b4",
    "nextblockhash": "00000000000000000001df5557c00a211ad5613ff0e2402df124c58b4dd17729",
    "totalFees": 0.048824670000000125,
    "src": "bitcoin",
    "coinbaseTx": {
        "hex": "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff56033ecd0d194d696e656420627920416e74506f6f6c20b600c900259e479ffabe6d6d500729c2badb393c33ecb43df4d1b1cfb72500e1bbc007bd8d7e40686cde9913100000000000000000000bb837e9e80000000000ffffffff07220200000000000017a91442402a28dd61f2718a4b27ae72a4791d5bbdade78721ddea120000000017a9145249bdf2c131d43995cff42e8feee293f79297a8870000000000000000266a24aa21a9ed4b61cde4f19f3e7e56901daf86503053b3e5d555ca2a9f1931e831844a75facb00000000000000002f6a2d434f52450142fdeae88682a965939fee9b7b2bd5b99694ff644e3ecda72cb7961caa4b541b1e322bcfe0b5a0300000000000000000146a12455853415401000d130f0e0e0b041f1200130000000000000000296a277379733aae4701474853a120872f92d1cfed38b1b72411f262ba2488a79035706a3a761a761f0000000000000000002b6a2952534b424c4f434b3a42c1fa55569b4e42870d0389e18cbee1cb1aceb4328ab065760c511500764bc50120000000000000000000000000000000000000000000000000000000000000000000000000",
        "txid": "f89b6ba9d48b1adb98d8e8f37ac9611183826a9f361bac970c562f42a76fed15",
        "hash": "045aec8ab9081f3d39cbb2ba0a7a28ce93eb0accfe3b5308246844d01b4e6de0",
        "size": 471,
        "version": 1,
        "locktime": 0,
        "vout": [{
            "value": 0.00000546,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_HASH160 42402a28dd61f2718a4b27ae72a4791d5bbdade7 OP_EQUAL",
                "hex": "a91442402a28dd61f2718a4b27ae72a4791d5bbdade787",
                "reqSigs": 1,
                "type": "scripthash",
                "addresses": ["37jKPSmbEGwgfacCr2nayn1wTaqMAbA94Z"],
                "isTruncated": false
            },
            "scripthash": "6ae165e8ea6275a089d2222c7a8ac38585de11861c06c420352d464793a099d0"
        },
        ...
        ],
        "blockhash": "00000000000000000002145230780fd4fd371945f9365664d98a2631358d3f8c",
        "confirmations": 578,
        "time": 1751923471,
        "blocktime": 1751923471,
        "vincount": 1,
        "voutcount": 7,
        "voutvalue": 3.17382467,
        "vin": [{
            "n": 0,
            "coinbase": "033ecd0d194d696e656420627920416e74506f6f6c20b600c900259e479ffabe6d6d500729c2badb393c33ecb43df4d1b1cfb72500e1bbc007bd8d7e40686cde9913100000000000000000000bb837e9e80000000000",
            "sequence": 4294967295,
            "minerInfo": {
                "name": "AntPool",
                "link": "https://www.antpool.com/",
                "type": "tag"
            }
        }]
    }
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| hash      | Block hash.                         |

## Get by Height

This endpoint retrieves the block details of a given block height.

{% hint style="info" %}
(BSV-only) For a block with up to 1000 transactions, all transaction ids are returned in response to this call.

* If a block has more than 1000 transactions, only the top 100 transaction ids are returned.
* To get the remaining ids see the [Get Block Pages](#get-block-pages) section.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/block/height/<height>
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/height/575045"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/height/904510"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
    "confirmations": 330022,
    "size": 14421,
    "height": 575045,
    "version": 536928256,
    "versionHex": "2000e000",
    "merkleroot": "4ebcba09addd720991d03473f39dce4b9a72cc164e505cd446687a54df9b1585",
    "txcount": 5,
    "nTx": 0,
    "num_tx": 5,
    "tx": ["bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a", "c7e8317b48e72644e2b83c87c54f61bcda82326392f969a097fb801aed69b500", "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f", "65cb37947ccb7c5b7cc4ac36a200613bfc39a7f7c6c0314a23dbcc5b3908b5b8", "0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10"],
    "time": 1553416668,
    "mediantime": 1553414858,
    "nonce": 87914848,
    "bits": "180997ee",
    "difficulty": 114608607557.4425,
    "chainwork": "000000000000000000000000000000000000000000ddf5d385546872bab7dc01",
    "previousblockhash": "00000000000000000988156c7075dc9147a5b62922f1310862e8b9000d46dd9b",
    "nextblockhash": "00000000000000000112b36a37c10235fa0c991f680bc5482ba9692e0ae697db",
    "coinbaseTx": {
        "txid": "bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a",
        "hash": "bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a",
        "version": 1,
        "size": 119,
        "locktime": 0,
        "vin": [{
            "coinbase": "0345c6082f626d67706f6f6c2e636f6d2f473173717918707a8aae4a936f101e0000",
            "txid": "",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "sequence": 4294967295
        }],
        "vout": [{
            "value": 12.50023822,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 85770ad0ee64a4f3ee4027e199c32f876e03a2d9 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a91485770ad0ee64a4f3ee4027e199c32f876e03a2d988ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": ["1DAhUiQxHzL1oAusoUDdUM89spXuAG1sqy"],
                "isTruncated": false
            }
        }],
        "blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
        "confirmations": 330022,
        "time": 1553416668,
        "blocktime": 1553416668,
        "blockheight": 575045
    },
    "totalFees": 0.0002382199999999557,
    "miner": "Bmgpool",
    "pages": null
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "tx": ["f89b6ba9d48b1adb98d8e8f37ac9611183826a9f361bac970c562f42a76fed15", ...]
    "miner": "AntPool",
    "hash": "00000000000000000002145230780fd4fd371945f9365664d98a2631358d3f8c",
    "confirmations": 578,
    "size": 1509584,
    "height": 904510,
    "version": 546201600,
    "versionHex": "208e6000",
    "merkleroot": "0736388ae96f0cfbea8995039e9ecea3ddcec17ab54d2e737267c3df4c7b4818",
    "txcount": 5072,
    "time": 1751923471,
    "mediantime": 1751920846,
    "nonce": 3906737240,
    "bits": "17026816",
    "difficulty": 116958512019762.1,
    "chainwork": "0000000000000000000000000000000000000000d07aa30757a4549b9da2c8c2",
    "previousblockhash": "000000000000000000015a6b45bf7b5f5ca04553206f980de6f11c62a3e9a3b4",
    "nextblockhash": "00000000000000000001df5557c00a211ad5613ff0e2402df124c58b4dd17729",
    "totalFees": 0.048824670000000125,
    "src": "bitcoin",
    "coinbaseTx": {
        "hex": "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff56033ecd0d194d696e656420627920416e74506f6f6c20b600c900259e479ffabe6d6d500729c2badb393c33ecb43df4d1b1cfb72500e1bbc007bd8d7e40686cde9913100000000000000000000bb837e9e80000000000ffffffff07220200000000000017a91442402a28dd61f2718a4b27ae72a4791d5bbdade78721ddea120000000017a9145249bdf2c131d43995cff42e8feee293f79297a8870000000000000000266a24aa21a9ed4b61cde4f19f3e7e56901daf86503053b3e5d555ca2a9f1931e831844a75facb00000000000000002f6a2d434f52450142fdeae88682a965939fee9b7b2bd5b99694ff644e3ecda72cb7961caa4b541b1e322bcfe0b5a0300000000000000000146a12455853415401000d130f0e0e0b041f1200130000000000000000296a277379733aae4701474853a120872f92d1cfed38b1b72411f262ba2488a79035706a3a761a761f0000000000000000002b6a2952534b424c4f434b3a42c1fa55569b4e42870d0389e18cbee1cb1aceb4328ab065760c511500764bc50120000000000000000000000000000000000000000000000000000000000000000000000000",
        "txid": "f89b6ba9d48b1adb98d8e8f37ac9611183826a9f361bac970c562f42a76fed15",
        "hash": "045aec8ab9081f3d39cbb2ba0a7a28ce93eb0accfe3b5308246844d01b4e6de0",
        "size": 471,
        "version": 1,
        "locktime": 0,
        "vout": [{
            "value": 0.00000546,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_HASH160 42402a28dd61f2718a4b27ae72a4791d5bbdade7 OP_EQUAL",
                "hex": "a91442402a28dd61f2718a4b27ae72a4791d5bbdade787",
                "reqSigs": 1,
                "type": "scripthash",
                "addresses": ["37jKPSmbEGwgfacCr2nayn1wTaqMAbA94Z"],
                "isTruncated": false
            },
            "scripthash": "6ae165e8ea6275a089d2222c7a8ac38585de11861c06c420352d464793a099d0"
        },
        ...
        ],
        "blockhash": "00000000000000000002145230780fd4fd371945f9365664d98a2631358d3f8c",
        "confirmations": 578,
        "time": 1751923471,
        "blocktime": 1751923471,
        "vincount": 1,
        "voutcount": 7,
        "voutvalue": 3.17382467,
        "vin": [{
            "n": 0,
            "coinbase": "033ecd0d194d696e656420627920416e74506f6f6c20b600c900259e479ffabe6d6d500729c2badb393c33ecb43df4d1b1cfb72500e1bbc007bd8d7e40686cde9913100000000000000000000bb837e9e80000000000",
            "sequence": 4294967295,
            "minerInfo": {
                "name": "AntPool",
                "link": "https://www.antpool.com/",
                "type": "tag"
            }
        }]
    }
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| height    | Block hash.                         |

## Get Block Pages (BSV-only)

If a block has more than **1000** transactions, the page URLs will be provided in the `pages` element when getting a block by hash or height.

{% code title="Example pages element in "Get block by height/hash" response:" %}

```json
{
    "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
    ...
    "pages": {
        "uri": [
            "/block/hash/000000000000000000885a4d8e9912f085b42288adc58b3ee5830a7da9f4fef4/page/1",
            "/block/hash/000000000000000000885a4d8e9912f085b42288adc58b3ee5830a7da9f4fef4/page/2",
            ...
    ],
        "size": 50000
    }
```

{% endcode %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/block/hash/<hash>/page/<number>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/block/hash/000000000000000000885a4d8e9912f085b42288adc58b3ee5830a7da9f4fef4/page/1"
```

{% endcode %}

{% code title="Example Response" %}

```json
[
    "89b4e01ea1ab27edb6ea66899637b526faebeb42ca0302ff9ed916670f1330fe",
    "1097bfc9b1f586352a1ab29afd27c1f89e0a5d9790ea08a2b2a7d988ea6f2cfe",
    ....
]
```

{% endcode %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| hash      | Block hash.                         |
| number    | Page number.                        |

## Get Header by Hash or Height

This endpoint retrieves the block header details of a given hash or height.

Use *`?format=block-headers-client`* as a query parameter for the [block-headers-client](https://github.com/bitcoin-sv/block-headers-client) response format.

Possible values for the status when the block-headers-client format is requested:

1. `active`: Block is a part of the current active chain.
2. `orphaned`: Block is not a part of the current active chain.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/block/<hashOrHeight>/header
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb/header"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/00000000000000000000c1412566504aeb8921b82126172437d3dd04e8683b9a/header"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
    "confirmations": 330022,
    "size": 14421,
    "height": 575045,
    "version": 536928256,
    "versionHex": "2000e000",
    "merkleroot": "4ebcba09addd720991d03473f39dce4b9a72cc164e505cd446687a54df9b1585",
    "time": 1553416668,
    "mediantime": 1553414858,
    "nonce": 87914848,
    "bits": "180997ee",
    "difficulty": 114608607557.4425,
    "chainwork": "000000000000000000000000000000000000000000ddf5d385546872bab7dc01",
    "previousblockhash": "00000000000000000988156c7075dc9147a5b62922f1310862e8b9000d46dd9b",
    "nextblockhash": "00000000000000000112b36a37c10235fa0c991f680bc5482ba9692e0ae697db",
    "nTx": 0,
    "num_tx": 5
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "hash": "00000000000000000000c1412566504aeb8921b82126172437d3dd04e8683b9a",
    "previousblockhash": "000000000000000000020988865dd391816915731f44a2c50bd5f0a45e4ba44a",
    "nextblockhash": "0000000000000000000246cd1ee83a0f684c11046899b27a90befd83c85bc8d3",
    "height": 905073,
    "confirmations": 34,
    "time": 1752236138,
    "version": 537214976,
    "versionHex": "20054000",
    "merkleroot": "5581b409a5067197468e82e20599eef9678f81880fa3e902cc08b0c648693549",
    "bits": "17026816",
    "nonce": 3798315392,
    "difficulty": 116958512019762.1,
    "txcount": 2945,
    "nTx": 2945,
    "chainwork": "0000000000000000000000000000000000000000d164940637443d7138ea87dc",
    "mediantime": 1752234300
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| hash      | Block hash.                         |

## Get Headers

This endpoint retrieves the last 10 block headers.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/block/headers
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/headers"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/headers"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "hash": "000000000000000001c1f8612fde5c70ba17d52b76db6f5c1e6403613f67dc72",
    "confirmations": 1,
    "size": 8187014,
    "height": 905066,
    "version": 738197504,
    "versionHex": "2c000000",
    "merkleroot": "63b4bd4890b9c0866981608b4208877f72a37245be8bf03c70d990372b25a8d5",
    "time": 1752245194,
    "mediantime": 1752242975,
    "nonce": 3389927517,
    "bits": "181584ed",
    "difficulty": 51093569403.56039,
    "chainwork": "0000000000000000000000000000000000000000016755aed8ebac0032110051",
    "previousblockhash": "00000000000000000d4a64c6818ed5a694b0f02a674fab052f04c44f8ab82a0a",
    "nextblockhash": "",
    "nTx": 0,
    "num_tx": 1027
}, {
    "hash": "00000000000000000d4a64c6818ed5a694b0f02a674fab052f04c44f8ab82a0a",
    "confirmations": 2,
    "size": 3055109,
    "height": 905065,
    "version": 575381504,
    "versionHex": "224ba000",
    "merkleroot": "2e48066f4155602c02580087f6418cc9c215d50c5d5dd7675b74f5df7e82aa84",
    "time": 1752244987,
    "mediantime": 1752242284,
    "nonce": 526349350,
    "bits": "181573d9",
    "difficulty": 51252456251.77387,
    "chainwork": "0000000000000000000000000000000000000000016755a2f375c70ebdaa0ab3",
    "previousblockhash": "0000000000000000112ea3732c0417a2cee0130e9217dbba1b0ff078c92c904e",
    "nextblockhash": "000000000000000001c1f8612fde5c70ba17d52b76db6f5c1e6403613f67dc72",
    "nTx": 0,
    "num_tx": 3116
},
...
]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "hash": "00000000000000000002676232151539d2094d342e4ca69e42f90dcc010b5166",
    "previousblockhash": "0000000000000000000061958ebfa47a17b104af4cf77cd0f23141748397d505",
    "nextblockhash": "",
    "height": 905087,
    "confirmations": 1,
    "time": 1752245105,
    "version": 769130496,
    "versionHex": "2dd80000",
    "merkleroot": "b63f3f987192f8f067687b6548a1279d5ead90f08310280f085a067e02f119c8",
    "bits": "17026816",
    "nonce": 3104566716,
    "difficulty": 116958512019762.1,
    "txcount": 0,
    "nTx": 4505,
    "chainwork": "0000000000000000000000000000000000000000d16a654564630b4d9c4412c0",
    "mediantime": 1752240725
}, {
    "hash": "0000000000000000000061958ebfa47a17b104af4cf77cd0f23141748397d505",
    "previousblockhash": "000000000000000000023b837b327cf7baa43b41850501d6be7e3e48d0021f62",
    "nextblockhash": "00000000000000000002676232151539d2094d342e4ca69e42f90dcc010b5166",
    "height": 905086,
    "confirmations": 2,
    "time": 1752244939,
    "version": 536895488,
    "versionHex": "20006000",
    "merkleroot": "2c16c87bcfbca675178a5a72c011262863b998e562a6e4b8a1472465cca6258a",
    "bits": "17026816",
    "nonce": 3008593203,
    "difficulty": 116958512019762.1,
    "txcount": 0,
    "nTx": 3835,
    "chainwork": "0000000000000000000000000000000000000000d169fae57373212b952b6442",
    "mediantime": 1752239292
},
...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

<table><thead><tr><th width="224">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>Desired blockchain: <code>bsv</code> or <code>btc</code>.</td></tr><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr></tbody></table>

## Get Header Bytes File Links

This endpoint retrieves a list of block header binary file links and each file only contains 80-byte block headers. These contain 10,000 block headers per file up to height `760,000`.&#x20;

Then 2,000 blocks per file after height `760,001` . New files are automatically created after every 2,000 blocks and added to the list.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/block/headers/resources
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/headers/resources"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/headers/resources"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
   "files":[
      "https://api.whatsonchain.com/v1/bsv/main/block/headers/0_10000_headers.bin",
      "https://api.whatsonchain.com/v1/bsv/main/block/headers/100001_110000_headers.bin",
      "https://api.whatsonchain.com/v1/bsv/main/block/headers/110001_120000_headers.bin"
       ...
   ]
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "files": [
        "https://api.whatsonchain.com/v1/btc/main/block/headers/0_2000_headers.bin",
        "https://api.whatsonchain.com/v1/btc/main/block/headers/2001_4000_headers.bin",
        "https://api.whatsonchain.com/v1/btc/main/block/headers/4001_6000_headers.bin",
        ...
    ]
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

<table><thead><tr><th width="224">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>Desired blockchain: <code>bsv</code> or <code>btc</code>.</td></tr><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr></tbody></table>

## Get Latest Header Bytes

This endpoint retrieves the latest specified number of block headers (up to `100`) as a binary file. If "the `count` parameter is not provided, returns the latest header file, with up to 2000 block headers.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/main/block/headers/latest?count=<count>
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/headers/latest?count=10"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/headers/latest?count=10"
```

{% endtab %}
{% endtabs %}

**URL Parameters**

<table><thead><tr><th width="224">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>Desired blockchain: <code>bsv</code> or <code>btc</code>.</td></tr><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr><tr><td>count (optional)</td><td>Headers requested: between <code>1</code> (default) and <code>100</code>.</td></tr></tbody></table>


# Transaction

## Get by Transaction Hash

This endpoint retrieves the transaction details for a given transaction ID.

{% hint style="info" %}

* In the response body, if any output's hex size `vout[x].scriptPubKey.hex` exceeds `100KB`, then the data for `vout[x].scriptPubKey.hex` and `vout[x].scriptPubKey.asm` is truncated and a flag `vout[x].scriptPubKey.isTruncated` is set to `true`.
* For unconfirmed transactions, `blockhash` and `confirmations` info won't be returned, as it doesn't exist.
* A separate endpoint [Get Raw Transaction Output Data](#get-raw-transaction-output-data) can be used to fetch the full hex data, if required by the client application.
  {% endhint %}

#### HTTP Request

{% tabs %}
{% tab title="BSV" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/hash/<txid>
```

{% endtab %}

{% tab title="BTC" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/tx/<txid>
```

{% endtab %}
{% endtabs %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/btc/main/tx/b1ec43184ff57a3143e2ad5ed646916030324bf41fec7f41aaeba86125cea660"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "txid": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "hash": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "version": 1,
    "size": 113,
    "locktime": 0,
    "vin": [{
        "coinbase": "03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040",
        "txid": "",
        "vout": 0,
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 12.5000042,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 492558fb8ca71a3591316d095afc0f20ef7d42f7 OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": ["17fm4xevwDh3XRHv9UoqYrVgPMbwcGHsUs"],
            "isTruncated": false
        }
    }],
    "blockhash": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
    "confirmations": 329877,
    "time": 1553501874,
    "blocktime": 1553501874,
    "blockheight": 575191
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "blockhash": "00000000000000000000374e27879ca3f89d8b1e826b0e188f15219311e74757",
    "blockheight": 903404,
    "blocktime": 1751296277,
    "confirmations": 1685,
    "hash": "b4ac21e75385b24d5b892686800c25a32544d9959985e2bb205a36906d0b0d9c",
    "hex": "",
    "locktime": 0,
    "size": 392,
    "time": 1751296277,
    "txid": "b1ec43184ff57a3143e2ad5ed646916030324bf41fec7f41aaeba86125cea660",
    "version": 1,
    "vin": [{
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "sequence": 4294967295,
        "txid": "db328bd0fb33da33203a53f2f0d5c50b7bb179e0127721d780aee37f0edc28ba",
        "txinwitness": ["", "3044022061ba3963c95dbe0cc293d66c5683b231d50774284672404932e323c96b7fa0ca0220795b1cccf504d32c431090a8ff6c0232ced265b4dbfceb3ad9b39da33ee378c101", "3045022100e36cf32128c8c689de36cfb208514112aa2498678aa62643ccf5d2cbbe1cb5940220265e3620f2cf86d641522503fc679272ea2e37098e9540ec90d763b5101e898201", "522102c3743d41784a9b7fa7a12cfd1fd9e7f1f082025f6ce1678a039f8e3a8f272c01210370d354df8cebb3e683c5e4a2c112a79b7c9adb801240d71d4788d8bac253599521038955d013f9524ab7d5b862c7c1202f316322841c81297b1e354a54e5d66f536753ae"],
        "vout": 0
    }],
    "vout": [{
        "n": 0,
        "scriptPubKey": {
            "address": "bc1qc4vww3zys9mzkchmf5s57ejew7metj3n4m7tzycyzwt7mxpv5y8qh0fyg5",
            "asm": "0 c558e7444481762b62fb4d214f665977b795ca33aefcb113041397ed982ca10e",
            "hex": "0020c558e7444481762b62fb4d214f665977b795ca33aefcb113041397ed982ca10e",
            "isTruncated": false,
            "type": "witness_v0_scripthash"
        },
        "value": 0.75
    }, {
        "n": 1,
        "scriptPubKey": {
            "address": "bc1q7ka0q74ugkzvtaz9wd64klumrpavykg64qqlcewvaxcyfmm6xh7stvux9n",
            "asm": "0 f5baf07abc4584c5f44573755b7f9b187ac2591aa801fc65cce9b044ef7a35fd",
            "hex": "0020f5baf07abc4584c5f44573755b7f9b187ac2591aa801fc65cce9b044ef7a35fd",
            "isTruncated": false,
            "type": "witness_v0_scripthash"
        },
        "value": 0.7498965
    }],
    "vsize": 201,
    "weight": 803
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |

## Get by Transaction Index (BSV-only)

This endpoint retrieves the transaction details for a given block height and transaction index in that block. Works only for confirmed transactions.

{% hint style="info" %}

* In the response body, if any output's hex size `vout[x].scriptPubKey.hex` exceeds 100KB, then the data for `vout[x].scriptPubKey.hex` and `vout[x].scriptPubKey.asm` is truncated and a flag `vout[x].scriptPubKey.isTruncated` is set to `true`.
* A separate endpoint [Get Raw Transaction Output Data](#get-raw-transaction-output-data) can be used to fetch the full hex data, if required by the client application.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/main/block/height/<height>/txindex/<txindex>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/block/height/892006/txindex/32891"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "txid": "522804f8b0c19cb51bd3c7d14a64b472bb9797f292393f1abd9d32b9a2946495",
    "hash": "522804f8b0c19cb51bd3c7d14a64b472bb9797f292393f1abd9d32b9a2946495",
    "version": 1,
    "size": 410,
    "locktime": 0,
    "vin": [{
        "coinbase": "",
        "txid": "bc5c9aba8003aa0c0ccb64f077310bb945796f8b3aec6648672ddfa8eee1d7eb",
        "vout": 0,
        "scriptSig": {
            "asm": "3045022100fee85b93b63e313950a3c100fb022e8c9990a7104032e7f678a4e36f791c52bd022001c6c022c03db168848a49a95de126cebd5160d4ac4a78277e08795a613cfafe[ALL|FORKID] 0326c692c95e73175795109d2fc90e852e7d725aa25d3d1b783d8c924d3c2be872",
            "hex": "483045022100fee85b93b63e313950a3c100fb022e8c9990a7104032e7f678a4e36f791c52bd022001c6c022c03db168848a49a95de126cebd5160d4ac4a78277e08795a613cfafe41210326c692c95e73175795109d2fc90e852e7d725aa25d3d1b783d8c924d3c2be872"
        },
        "sequence": 4294967295
    }, {
        "coinbase": "",
        "txid": "652d1235d1266d7ccdad981ade1b0169a6d8fdd690d3bac1e17e366935613dd4",
        "vout": 2,
        "scriptSig": {
            "asm": "3045022100a71a7d18cd7c4d441a215a2bb2bfb00a87af17a9ae65a1434dac6c943a5d95ba02203329d2d667175d33f3f097975a5aa0309b43c58f470448a25ed22342616642b7[ALL|FORKID] 0326c692c95e73175795109d2fc90e852e7d725aa25d3d1b783d8c924d3c2be872",
            "hex": "483045022100a71a7d18cd7c4d441a215a2bb2bfb00a87af17a9ae65a1434dac6c943a5d95ba02203329d2d667175d33f3f097975a5aa0309b43c58f470448a25ed22342616642b741210326c692c95e73175795109d2fc90e852e7d725aa25d3d1b783d8c924d3c2be872"
        },
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 0,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_RETURN 6478732e617070 703a313539363436302c6d617267696e",
            "hex": "6a076478732e61707010703a313539363436302c6d617267696e",
            "type": "nulldata",
            "opReturn": {
                "type": "dxs",
                "action": "",
                "text": "",
                "parts": ["\u0007dxs.app\u0010p:1596460,margin"]
            },
            "isTruncated": false
        }
    }, 
    ...
    ],
    "blockhash": "00000000000000000c20becd473e985688ff2fcb2b234165acb11fbf1024c2bb",
    "confirmations": 13062,
    "time": 1744376748,
    "blocktime": 1744376748,
    "blockheight": 892006
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                       |
| --------- | ------------------------------------------------- |
| network   | Selected network: `main` or `test`.               |
| height    | Specified block height.                           |
| txindex   | Index of the transaction in the associated block. |

## Get Transaction Propagation Status (BSV-only)

This endpoint returns the propagation status for a given transaction. It queries a random set of peers on the network and returns the number of peers that have the transaction in question.

{% hint style="warning" %}
This is an expensive call, so it's recommended only for critical or high-value transactions that might require checking the network propagation status. It is rate-limited to 10 requests per 10 seconds.
{% endhint %}

{% hint style="info" %}
If the transaction has been found on zero peers, possible reasons may include:

* Propagation is still in progress;
* The transaction fee rate, or that of a preceding transaction, is relatively low, making it invisible to peers that are configured to accept only higher fee rates.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/hash/<txid>/propagation
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/hash/<txid>/propagation"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
  "queried_peers": 16,
  "found_on_peers": 16
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| txid      | Transaction ID.                         |

## Broadcast Transaction (BSV-only)

You can broadcast a transaction to the BSV network using this endpoint. Returns the `txid` in the response or an error message from the node, with header content-type: `text/plain`.

{% hint style="warning" %}
Keep in mind that this endpoint is meant for small-scale usage. For commercial or enterprise usage, please take a look at [ARC Endpoints](/core-products/transaction-processing/arc-endpoints), which are built for those types of use cases.
{% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/tx/raw
```

{% endcode %}

{% code title="Request Data" %}

```json
{
  "txhex": "<txhex>"
}
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/tx/raw" \
  --header "Content-Type: application/json" \
  --data "{\"txhex\": \"<txhex>\" }"
```

{% endcode %}

**URL Parameters**

<table><thead><tr><th width="408">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr></tbody></table>

#### Request Parameters

| Parameter | Description                  |
| --------- | ---------------------------- |
| txhex     | Raw transaction data in hex. |

## Bulk Transaction Details

You can fetch details for multiple transactions in a single request.

{% hint style="info" %}

* Max 20 transactions per request.
* For unconfirmed transactions, `blockhash` and `confirmations` info won't be returned, as it doesn't exist.
  {% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/txs
```

{% endcode %}

{% code title="Request Data" %}

```json
{
  "txids": [
    "<txid>",
    "<txid>",
    ...
  ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/txs" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa\",\"91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/txs" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692\",\"fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "txid": "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "hash": "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "version": 1,
    "size": 1044,
    "locktime": 0,
    "vin": [{
        "coinbase": "",
        "txid": "57a79dbc0be8225f4d9dc705a91096e60d3da8f3a7fdf009715dc28975a8dbb8",
        "vout": 0,
        "scriptSig": {
            "asm": "304402206b9956a6dd39d7f081f6a2d3731b2b7c875ec563743d7620ea55b37f3c2d1ffd02202594d52b6df818d100a3e721b0d245625cbe200e51a7a846fd37436607e08a0a[ALL|FORKID] 03998489e31affb06deaa6890deea42447ac9b4b31c5fc93d023525de9f850b281",
            "hex": "47304402206b9956a6dd39d7f081f6a2d3731b2b7c875ec563743d7620ea55b37f3c2d1ffd02202594d52b6df818d100a3e721b0d245625cbe200e51a7a846fd37436607e08a0a412103998489e31affb06deaa6890deea42447ac9b4b31c5fc93d023525de9f850b281"
        },
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 0,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_RETURN 6761746c696e6720626974636f696e626c6f636b732e6c697665",
            "hex": "6a1a6761746c696e6720626974636f696e626c6f636b732e6c697665",
            "type": "nulldata",
            "opReturn": {
                "type": "OP_RETURN",
                "action": "",
                "text": "",
                "parts": null
            },
            "isTruncated": false
        }
    }, {
        "value": 0.000013,
        "n": 1,
        "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 8432682cb8f5cbbb36913266fbe84176a999ac99 OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a9148432682cb8f5cbbb36913266fbe84176a999ac9988ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": ["1D3zaf652ajAPZVC1CrKgMQjesaPuLwcSW"],
            "isTruncated": false
        }
    }, 
    ...
    ],
    "blockhash": "000000000000000004b5ce6670f2ff27354a1e87d0a01bf61f3307f4ccd358b5",
    "confirmations": 292813,
    "time": 1575841517,
    "blocktime": 1575841517,
    "blockheight": 612251
}, {
    "txid": "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258",
    "hash": "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258",
    "version": 1,
    "size": 118,
    "locktime": 0,
    "vin": [{
        "coinbase": "033f6b092f636f696e6765656b2e636f6d2f7759319af9d4f815e3a2fae5e60000",
        "txid": "",
        "vout": 0,
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 12.5133703,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 8460e9a972a8600766a1b38fac4a2cfb8692d3ad OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a9148460e9a972a8600766a1b38fac4a2cfb8692d3ad88ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": ["1D4xHwLxA8E9vU87N1ELHtPEZdKeLhywY1"],
            "isTruncated": false
        }
    }],
    "blockhash": "000000000000000002e8d4b4c0385abd195709c82f16d9917f081b70000e8804",
    "confirmations": 287785,
    "time": 1578837295,
    "blocktime": 1578837295,
    "blockheight": 617279
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "hex": "0200000000010131d40c65e5f0f07877bcff0340ded1939eaddfa8f7d92bc5a40236f419dd3ffb0000000000ffffffff01c097200000000000225120b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b0c40f068f5edb0943c29b5f49e3c5eef68b78c966153dadf487f40d3e1e1b04c36a71869399b6686624687be5580999ba118943afd8057960c48b2be4d7285e542d8000040c4b2c078d0d0fe1fe021a8c61f2daa271ab3d284cdf9bc83ece339b3d14106f211920ea60301192bc52191057b1d4194919374d33c91df499f46eef9329b240940d7b8086ae46158a07813cbe71128a9e252f974bf37860da3548e3e4f68701cba66e612ba322c5463c7c4fd63706e2ba294f187062413f29c245cf4ba82d3826900402dcf196e9dd17e481832204e9fe92ebc5cfbea6bdeebce25c0c8ad498f0e446d277a043255264a9d37ff953c7042e870fce0e75d2c653f0a5b8f38ecba7a36da408c4370aceb32d646dd5a97f5e9453fc2f85bb35ad9ecab5095c4d4af884bee13500e91599bb48cf9e618672c1c21a18b1850f0657b2a321679b905814fad36a0405cbb16af8c59b93e03720ad3ee986272deaa14754cdc0fd942f50aa4d957492bd030bc1495a6467c99249ee2751aa1bdcba34e44dc30dfafc24d2f63aa5345a7402f3b81b2c78000ea7d392fa633562ae6176a4e54f2d01b0eb9bc123931fea9095eb9a4f5e499348993388a933c8fc03895037d0c9feaa20c283ae629242441f9fd5601206ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888ad2023b29f89b45f4af41588dcaf0ca572ada32872a88224f311373917f1b37d08d1ac204b15848e495a3a62283daaadb3f458a00859fe48e321f0121ebabbdd6698f9faba208242640732773249312c47ca7bdb50ca79f15f2ecc32b9c83ceebba44fb74df7ba20cbdd028cfe32c1c1f2d84bfec71e19f92df509bba7b8ad31ca6c1a134fe09204ba20d3c79b99ac4d265c2f97ac11e3232c07a598b020cf56c6f055472c893c0967aeba20d45c70d28f169e1f0c7f4a78e2bc73497afe585b70aa897955989068f3350aaaba20de13fc96ea6899acbdc5db3afaa683f62fe35b60ff6eb723dad28a11d2b12f8cba20e36200aaa8dce9453567bba108bdc51f7f1174b97a65e4dc4402fc5de779d41cba20f178fcce82f95c524b53b077e6180bd2d779a9057fdff4255a0af95af918cee0ba569c61c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0eb6368f76160dc48fa7ba02db7897da8588a3b03e8de3a794ec698efb416d192d4df5c507a68c5f7819b9082553904b3564ceb90f98062c66b8edf0d5fed502000000000",
    "txid": "a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692",
    "hash": "b53ab97747c688bb04e06bfd6a6adb7fb1868272d0d43bac9b2b2814fdadb3b7",
    "size": 998,
    "vsize": 320,
    "weight": 1280,
    "version": 2,
    "locktime": 0,
    "vin": [{
        "txid": "fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431",
        "vout": 0,
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "txinwitness": ["f068f5edb0943c29b5f49e3c5eef68b78c966153dadf487f40d3e1e1b04c36a71869399b6686624687be5580999ba118943afd8057960c48b2be4d7285e542d8", "", "", "c4b2c078d0d0fe1fe021a8c61f2daa271ab3d284cdf9bc83ece339b3d14106f211920ea60301192bc52191057b1d4194919374d33c91df499f46eef9329b2409", "d7b8086ae46158a07813cbe71128a9e252f974bf37860da3548e3e4f68701cba66e612ba322c5463c7c4fd63706e2ba294f187062413f29c245cf4ba82d38269", "", "2dcf196e9dd17e481832204e9fe92ebc5cfbea6bdeebce25c0c8ad498f0e446d277a043255264a9d37ff953c7042e870fce0e75d2c653f0a5b8f38ecba7a36da", "8c4370aceb32d646dd5a97f5e9453fc2f85bb35ad9ecab5095c4d4af884bee13500e91599bb48cf9e618672c1c21a18b1850f0657b2a321679b905814fad36a0", "5cbb16af8c59b93e03720ad3ee986272deaa14754cdc0fd942f50aa4d957492bd030bc1495a6467c99249ee2751aa1bdcba34e44dc30dfafc24d2f63aa5345a7", "2f3b81b2c78000ea7d392fa633562ae6176a4e54f2d01b0eb9bc123931fea9095eb9a4f5e499348993388a933c8fc03895037d0c9feaa20c283ae629242441f9", "206ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888ad2023b29f89b45f4af41588dcaf0ca572ada32872a88224f311373917f1b37d08d1ac204b15848e495a3a62283daaadb3f458a00859fe48e321f0121ebabbdd6698f9faba208242640732773249312c47ca7bdb50ca79f15f2ecc32b9c83ceebba44fb74df7ba20cbdd028cfe32c1c1f2d84bfec71e19f92df509bba7b8ad31ca6c1a134fe09204ba20d3c79b99ac4d265c2f97ac11e3232c07a598b020cf56c6f055472c893c0967aeba20d45c70d28f169e1f0c7f4a78e2bc73497afe585b70aa897955989068f3350aaaba20de13fc96ea6899acbdc5db3afaa683f62fe35b60ff6eb723dad28a11d2b12f8cba20e36200aaa8dce9453567bba108bdc51f7f1174b97a65e4dc4402fc5de779d41cba20f178fcce82f95c524b53b077e6180bd2d779a9057fdff4255a0af95af918cee0ba569c", "c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0eb6368f76160dc48fa7ba02db7897da8588a3b03e8de3a794ec698efb416d192d4df5c507a68c5f7819b9082553904b3564ceb90f98062c66b8edf0d5fed5020"],
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 0.02136,
        "n": 0,
        "scriptPubKey": {
            "asm": "1 b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b",
            "hex": "5120b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b",
            "type": "witness_v1_taproot",
            "address": "bc1phzxxd9hgcev7hauugf8l83zwhaszgtnqa576qsutezyrxg80kaastx36m5"
        }
    }],
    "blockhash": "00000000000000000000374e27879ca3f89d8b1e826b0e188f15219311e74757",
    "confirmations": 1682,
    "time": 1751296277,
    "blocktime": 1751296277,
    "blockheight": 903404
}, {
    "hex": "0200000000010103c7a1f891f8167482dc74a2ed2cdc49dd782f61397412f4bb4dc01656cb8e1e0100000000fdffffff03c091210000000000225120b2014bee6c11c512924151fd6d4cd28853b20cfee2307bee77927a85a8f584af0000000000000000496a4762626e31006ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888fa7496f63a857d894aa393767325bf6f84560e9141f4ec54496c50f546f48bfbfa0011bb00000000000022512014493f0bced6e38bee29e85a4b88a81d94080ccca6eb25ccb14c1f0fff7302ed0140bae1fbc0b131c5501292b138f6211ffb3b2f33d45d5685f7d30bd00d980fef908d3fe284eb9f219ae715d7f02429b0df2ba56f72ef1352cdd9f4ca22027cc00d35170d00",
    "txid": "fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431",
    "hash": "cb402b95df35b56b77ac6ab1ec8377e9fc68defc193865795d58da543fad2816",
    "size": 287,
    "vsize": 236,
    "weight": 944,
    "version": 2,
    "locktime": 857909,
    "vin": [{
        "txid": "1e8ecb5616c04dbbf4127439612f78dd49dc2ceda274dc827416f891f8a1c703",
        "vout": 1,
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "txinwitness": ["bae1fbc0b131c5501292b138f6211ffb3b2f33d45d5685f7d30bd00d980fef908d3fe284eb9f219ae715d7f02429b0df2ba56f72ef1352cdd9f4ca22027cc00d"],
        "sequence": 4294967293
    }],
    "vout": [{
        "value": 0.022,
        "n": 0,
        "scriptPubKey": {
            "asm": "1 b2014bee6c11c512924151fd6d4cd28853b20cfee2307bee77927a85a8f584af",
            "hex": "5120b2014bee6c11c512924151fd6d4cd28853b20cfee2307bee77927a85a8f584af",
            "type": "witness_v1_taproot",
            "address": "bc1pkgq5hmnvz8z39yjp287k6nxj3pfmyr87ugc8hmnhjfagt284sjhs7tqwlm"
        }
    }, {
        "value": 0,
        "n": 1,
        "scriptPubKey": {
            "asm": "OP_RETURN 62626e31006ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888fa7496f63a857d894aa393767325bf6f84560e9141f4ec54496c50f546f48bfbfa00  [OpRet:OP_RETURN/]",
            "hex": "6a4762626e31006ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888fa7496f63a857d894aa393767325bf6f84560e9141f4ec54496c50f546f48bfbfa00",
            "type": "nulldata"
        }
    }, {
        "value": 0.00047889,
        "n": 2,
        "scriptPubKey": {
            "asm": "1 14493f0bced6e38bee29e85a4b88a81d94080ccca6eb25ccb14c1f0fff7302ed",
            "hex": "512014493f0bced6e38bee29e85a4b88a81d94080ccca6eb25ccb14c1f0fff7302ed",
            "type": "witness_v1_taproot",
            "address": "bc1pz3yn7z7w6m3chm3fapdyhz9grk2qsrxv5m4jtn93fs0sllmnqtksyj7cws"
        }
    }],
    "blockhash": "00000000000000000002eedf93ec4596619f491a6ec08acdd7f8ce1b06b040a6",
    "confirmations": 47015,
    "time": 1724408915,
    "blocktime": 1724408915,
    "blockheight": 858071
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Bulk Transaction Status

You can get the status of multiple transactions in a single request.

{% hint style="info" %}
Max 20 transactions per request.
{% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/txs/status
```

{% endcode %}

{% code title="Request Data" %}

```json
{
  "txids": [
    "<txid>",
    "<txid>",
    ...
  ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/txs/status" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa\",\"91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/txs/status" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692\",\"fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "txid": "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "blockhash": "000000000000000004b5ce6670f2ff27354a1e87d0a01bf61f3307f4ccd358b5",
    "blockheight": 612251,
    "blocktime": 1575841517,
    "confirmations": 292814
}, {
    "txid": "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258",
    "blockhash": "000000000000000002e8d4b4c0385abd195709c82f16d9917f081b70000e8804",
    "blockheight": 617279,
    "blocktime": 1578837295,
    "confirmations": 287786
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "txid": "a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692",
    "blockhash": "00000000000000000000374e27879ca3f89d8b1e826b0e188f15219311e74757",
    "confirmations": 1682,
    "blocktime": 1751296277,
    "blockheight": 903404
}, {
    "txid": "fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431",
    "blockhash": "00000000000000000002eedf93ec4596619f491a6ec08acdd7f8ce1b06b040a6",
    "confirmations": 47015,
    "blocktime": 1724408915,
    "blockheight": 858071
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Decode Transaction

You can decode a raw transaction using this endpoint. Returns a `json` in response or an error message from the node.

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/tx/decode
```

{% endcode %}

{% code title="Request Data" %}

```json
{
  "txhex": "<txhex>"
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/tx/decode" \
  --header "Content-Type: application/json" \
  --data "{\"txhex\": \"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c03fc3b092f7376706f6f6c2e636f6d2f49a4a636f07dad7dc7c30100ffffffff01eb4aa54a0000000017a9141314c7eace4d4da3f65a1341197bb58038aa9dbc8700000000\" }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/tx/decode" \
  --header "Content-Type: application/json" \
  --data "{\"txhex\": \"0200000000010180634fc4699690d2ec63dbd971de4c25f372161f4f126d638f944a62b28a69140000000000fdffffff01bb2dc800000000001976a9142d24910fe541c612553cb35c960717c5790d3eb188ac02483045022100b6b47e0b0bb22cf6a7c11270d7040345ea8cd1631c3d26b3122ec451b58f383502201c05fcbb93504f7d3c4114702d4ef90b4afe037d45e0a43eef1df18b8316091a012103497a5b1c93f571654d4d1ac659151d21a1ffef9a76b842d3f7e0746ccd8ce9d300000000\" }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "txid": "c203094f5bacd5d5dcabb997adab1923b3ec9b91667ff230cac51504e34a382d",
    "hash": "c203094f5bacd5d5dcabb997adab1923b3ec9b91667ff230cac51504e34a382d",
    "version": 1,
    "size": 111,
    "locktime": 0,
    "vin": [{
        "coinbase": "03fc3b092f7376706f6f6c2e636f6d2f49a4a636f07dad7dc7c30100",
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 12.52346603,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_HASH160 1314c7eace4d4da3f65a1341197bb58038aa9dbc OP_EQUAL",
            "hex": "a9141314c7eace4d4da3f65a1341197bb58038aa9dbc87",
            "reqSigs": 1,
            "type": "scripthash",
            "addresses": ["33Ruf5AZhSPHSCGbYiuu3xG5V3HvoNFfby"]
        }
    }],
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c03fc3b092f7376706f6f6c2e636f6d2f49a4a636f07dad7dc7c30100ffffffff01eb4aa54a0000000017a9141314c7eace4d4da3f65a1341197bb58038aa9dbc8700000000"
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "hex": "0200000000010180634fc4699690d2ec63dbd971de4c25f372161f4f126d638f944a62b28a69140000000000fdffffff01bb2dc800000000001976a9142d24910fe541c612553cb35c960717c5790d3eb188ac02483045022100b6b47e0b0bb22cf6a7c11270d7040345ea8cd1631c3d26b3122ec451b58f383502201c05fcbb93504f7d3c4114702d4ef90b4afe037d45e0a43eef1df18b8316091a012103497a5b1c93f571654d4d1ac659151d21a1ffef9a76b842d3f7e0746ccd8ce9d300000000",
    "txid": "e8a31194a15b62b169277b692111c4bd13bbf13b2ddc416ef68336d2958ba37f",
    "hash": "b79fe6a9a4440d12444a9385d2f923e644c62106a3d8b357b973b228bd0ee944",
    "size": 195,
    "vsize": 113,
    "weight": 450,
    "version": 2,
    "locktime": 0,
    "vin": [{
        "txid": "14698ab2624a948f636d124f1f1672f3254cde71d9db63ecd2909669c44f6380",
        "vout": 0,
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "txinwitness": ["3045022100b6b47e0b0bb22cf6a7c11270d7040345ea8cd1631c3d26b3122ec451b58f383502201c05fcbb93504f7d3c4114702d4ef90b4afe037d45e0a43eef1df18b8316091a01", "03497a5b1c93f571654d4d1ac659151d21a1ffef9a76b842d3f7e0746ccd8ce9d3"],
        "sequence": 4294967293
    }],
    "vout": [{
        "value": 0.13118907,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 2d24910fe541c612553cb35c960717c5790d3eb1 OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a9142d24910fe541c612553cb35c960717c5790d3eb188ac",
            "type": "pubkeyhash",
            "address": "157hDL1H612TioxAUZUFXfsN43i7pWkqyP"
        }
    }]
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

**Request Parameters**

| Parameter | Description                  |
| --------- | ---------------------------- |
| txhex     | Raw transaction data in hex. |

## Get a Transaction as Binary

This endpoint returns the transaction as a binary file for a given `txid`.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/tx/<txid>/bin
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/bin"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/btc/main/tx/a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692/bin"
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |

## Get Raw Transaction Data

This endpoint returns the raw hex of a transaction for a given `txid`.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/tx/<txid>/hex
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/hex"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/btc/main/tx/a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692/hex"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040ffffffff01247e814a000000001976a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac00000000
```

{% endtab %}

{% tab title="BTC" %}

```
0200000000010131d40c65e5f0f07877bcff0340ded1939eaddfa8f7d92bc5a40236f419dd3ffb0000000000ffffffff01c097200000000000225120b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b0c40f068f5edb0943c29b5f49e3c5eef68b78c966153dadf487f40d3e1e1b04c36a71869399b6686624687be5580999ba118943afd8057960c48b2be4d7285e542d8000040c4b2c078d0d0fe1fe021a8c61f2daa271ab3d284cdf9bc83ece339b3d14106f211920ea60301192bc52191057b1d4194919374d33c91df499f46eef9329b240940d7b8086ae46158a07813cbe71128a9e252f974bf37860da3548e3e4f68701cba66e612ba322c5463c7c4fd63706e2ba294f187062413f29c245cf4ba82d3826900402dcf196e9dd17e481832204e9fe92ebc5cfbea6bdeebce25c0c8ad498f0e446d277a043255264a9d37ff953c7042e870fce0e75d2c653f0a5b8f38ecba7a36da408c4370aceb32d646dd5a97f5e9453fc2f85bb35ad9ecab5095c4d4af884bee13500e91599bb48cf9e618672c1c21a18b1850f0657b2a321679b905814fad36a0405cbb16af8c59b93e03720ad3ee986272deaa14754cdc0fd942f50aa4d957492bd030bc1495a6467c99249ee2751aa1bdcba34e44dc30dfafc24d2f63aa5345a7402f3b81b2c78000ea7d392fa633562ae6176a4e54f2d01b0eb9bc123931fea9095eb9a4f5e499348993388a933c8fc03895037d0c9feaa20c283ae629242441f9fd5601206ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888ad2023b29f89b45f4af41588dcaf0ca572ada32872a88224f311373917f1b37d08d1ac204b15848e495a3a62283daaadb3f458a00859fe48e321f0121ebabbdd6698f9faba208242640732773249312c47ca7bdb50ca79f15f2ecc32b9c83ceebba44fb74df7ba20cbdd028cfe32c1c1f2d84bfec71e19f92df509bba7b8ad31ca6c1a134fe09204ba20d3c79b99ac4d265c2f97ac11e3232c07a598b020cf56c6f055472c893c0967aeba20d45c70d28f169e1f0c7f4a78e2bc73497afe585b70aa897955989068f3350aaaba20de13fc96ea6899acbdc5db3afaa683f62fe35b60ff6eb723dad28a11d2b12f8cba20e36200aaa8dce9453567bba108bdc51f7f1174b97a65e4dc4402fc5de779d41cba20f178fcce82f95c524b53b077e6180bd2d779a9057fdff4255a0af95af918cee0ba569c61c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0eb6368f76160dc48fa7ba02db7897da8588a3b03e8de3a794ec698efb416d192d4df5c507a68c5f7819b9082553904b3564ceb90f98062c66b8edf0d5fed502000000000
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |

## Bulk Raw Transaction Data

You can get the raw data of multiple transactions in hex in a single request.

{% hint style="info" %}
Max 20 transactions per request.
{% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/txs/hex
```

{% endcode %}

{% code title="Request Data" %}

```json
{
  "txids": [
    "<txid>",
    "<txid>",
    ...
  ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/txs/hex" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa\",\"91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/txs/hex" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692\",\"fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "txid": "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "hex": "0100000001b8dba87589c25d7109f0fda7f3a83d0de69610a905c79d4d5f22e80bbc9da757000000006a47304402206b9956a6dd39d7f081f6a2d3731b2b7c875ec563743d7620ea55b37f3c2d1ffd02202594d52b6df818d100a3e721b0d245625cbe200e51a7a846fd37436607e08a0a412103998489e31affb06deaa6890deea42447ac9b4b31c5fc93d023525de9f850b281ffffffff1a00000000000000001c6a1a6761746c696e6720626974636f696e626c6f636b732e6c69766514050000000000001976a9148432682cb8f5cbbb36913266fbe84176a999ac9988ac14050000000000001976a914f6b68ada06df7323aca315ec54aa251e806c516888ac14050000000000001976a914d47ab37ea2bcffe4a7bf98086a65d489acdf2fd688ac14050000000000001976a914a20568923f3c65f91c0d7a3be3ca4f8b14c7d04888ac14050000000000001976a9140e80337d887c653d2bd7228281aa7ecf4bf2c9dc88ac14050000000000001976a9147bc3cebb1dc5ee6356931add1f5f1196fce7b53188ac14050000000000001976a914a8854465a2bbefeb1d47c5c79b8aef737d62f06f88ac14050000000000001976a9146c376c6d05ff152e1537667cfb52e628547f620a88ac14050000000000001976a9147c0bd6447ac246f100fec9392a396191a06fcae288ac14050000000000001976a9145221bd8f6901612cb1bf0618a39823229233474988ac14050000000000001976a91432c248707616cd030a3f346aec13c9d5ae8d99b088ac14050000000000001976a914c31eaefc851f6de4830f51d649e1731706159dc888ac14050000000000001976a9143d980ead104586cba895d944280f93ca8323b47588ac14050000000000001976a91473721ce4189c5b996819f81f8cce7366a1bb780488ac14050000000000001976a9141fd249a4cac1a2c95b95ad8ecbbe23129831232e88ac14050000000000001976a914ae4661a1c0f8192e79b5c304cadd39470077c8a488ac14050000000000001976a914e99c1003b189bfe7ababb7cbe2e39b8eb2317ccf88ac14050000000000001976a914e26673b87c7e644688b0a62f1e2cd5e7cc4db63c88ac14050000000000001976a9145cce10f43fa0458b2f8c3982a9349e7a67e6736588ac14050000000000001976a9144f062ff6e6921a8b6f43c79fc0e89f582a22225388ac14050000000000001976a9146dacfcede9e86678de202cb30d17bd1eb656cec388ac14050000000000001976a914fcdaf0d9fd36b2c1dbfa90e659a373290795230b88ac14050000000000001976a91482f1a346d023fd8e5eb976bba6df7e6a2095003288ac14050000000000001976a9142f82e5b519a351b646d23ceed7d43bd53213209488ac14050000000000001976a9143d0e5368bdadddca108a0fe44739919274c726c788ac00000000",
    "blockhash": "000000000000000004b5ce6670f2ff27354a1e87d0a01bf61f3307f4ccd358b5",
    "blockheight": 612251,
    "blocktime": 1575841517,
    "confirmations": 292817
}, {
    "txid": "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258",
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff21033f6b092f636f696e6765656b2e636f6d2f7759319af9d4f815e3a2fae5e60000ffffffff0146e3954a000000001976a9148460e9a972a8600766a1b38fac4a2cfb8692d3ad88ac00000000",
    "blockhash": "000000000000000002e8d4b4c0385abd195709c82f16d9917f081b70000e8804",
    "blockheight": 617279,
    "blocktime": 1578837295,
    "confirmations": 287789
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "hex": "0200000000010131d40c65e5f0f07877bcff0340ded1939eaddfa8f7d92bc5a40236f419dd3ffb0000000000ffffffff01c097200000000000225120b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b0c40f068f5edb0943c29b5f49e3c5eef68b78c966153dadf487f40d3e1e1b04c36a71869399b6686624687be5580999ba118943afd8057960c48b2be4d7285e542d8000040c4b2c078d0d0fe1fe021a8c61f2daa271ab3d284cdf9bc83ece339b3d14106f211920ea60301192bc52191057b1d4194919374d33c91df499f46eef9329b240940d7b8086ae46158a07813cbe71128a9e252f974bf37860da3548e3e4f68701cba66e612ba322c5463c7c4fd63706e2ba294f187062413f29c245cf4ba82d3826900402dcf196e9dd17e481832204e9fe92ebc5cfbea6bdeebce25c0c8ad498f0e446d277a043255264a9d37ff953c7042e870fce0e75d2c653f0a5b8f38ecba7a36da408c4370aceb32d646dd5a97f5e9453fc2f85bb35ad9ecab5095c4d4af884bee13500e91599bb48cf9e618672c1c21a18b1850f0657b2a321679b905814fad36a0405cbb16af8c59b93e03720ad3ee986272deaa14754cdc0fd942f50aa4d957492bd030bc1495a6467c99249ee2751aa1bdcba34e44dc30dfafc24d2f63aa5345a7402f3b81b2c78000ea7d392fa633562ae6176a4e54f2d01b0eb9bc123931fea9095eb9a4f5e499348993388a933c8fc03895037d0c9feaa20c283ae629242441f9fd5601206ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888ad2023b29f89b45f4af41588dcaf0ca572ada32872a88224f311373917f1b37d08d1ac204b15848e495a3a62283daaadb3f458a00859fe48e321f0121ebabbdd6698f9faba208242640732773249312c47ca7bdb50ca79f15f2ecc32b9c83ceebba44fb74df7ba20cbdd028cfe32c1c1f2d84bfec71e19f92df509bba7b8ad31ca6c1a134fe09204ba20d3c79b99ac4d265c2f97ac11e3232c07a598b020cf56c6f055472c893c0967aeba20d45c70d28f169e1f0c7f4a78e2bc73497afe585b70aa897955989068f3350aaaba20de13fc96ea6899acbdc5db3afaa683f62fe35b60ff6eb723dad28a11d2b12f8cba20e36200aaa8dce9453567bba108bdc51f7f1174b97a65e4dc4402fc5de779d41cba20f178fcce82f95c524b53b077e6180bd2d779a9057fdff4255a0af95af918cee0ba569c61c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0eb6368f76160dc48fa7ba02db7897da8588a3b03e8de3a794ec698efb416d192d4df5c507a68c5f7819b9082553904b3564ceb90f98062c66b8edf0d5fed502000000000",
    "txid": "a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692",
    "blockhash": "00000000000000000000374e27879ca3f89d8b1e826b0e188f15219311e74757",
    "confirmations": 1686,
    "blocktime": 1751296277,
    "blockheight": 903404
}, {
    "hex": "0200000000010103c7a1f891f8167482dc74a2ed2cdc49dd782f61397412f4bb4dc01656cb8e1e0100000000fdffffff03c091210000000000225120b2014bee6c11c512924151fd6d4cd28853b20cfee2307bee77927a85a8f584af0000000000000000496a4762626e31006ccd26790f111933387b94da501fdfbdc48f0852757f19060c6b3acc65cb2888fa7496f63a857d894aa393767325bf6f84560e9141f4ec54496c50f546f48bfbfa0011bb00000000000022512014493f0bced6e38bee29e85a4b88a81d94080ccca6eb25ccb14c1f0fff7302ed0140bae1fbc0b131c5501292b138f6211ffb3b2f33d45d5685f7d30bd00d980fef908d3fe284eb9f219ae715d7f02429b0df2ba56f72ef1352cdd9f4ca22027cc00d35170d00",
    "txid": "fb3fdd19f43602a4c52bd9f7a8dfad9e93d1de4003ffbc7778f0f0e5650cd431",
    "blockhash": "00000000000000000002eedf93ec4596619f491a6ec08acdd7f8ce1b06b040a6",
    "confirmations": 47019,
    "blocktime": 1724408915,
    "blockheight": 858071
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Raw Transaction Output Data

This endpoint returns raw hex of the transaction output for a given transaction ID and output index.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<txid>/out/<index>/hex
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/out/0/hex"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET  "https://api.whatsonchain.com/v1/btc/main/tx/a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692/out/0/hex"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```
76a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac
```

{% endtab %}

{% tab title="BTC" %}

```json
5120b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b
```

{% endtab %}
{% endtabs %}

**URL Parameters**

<table><thead><tr><th width="302">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>Desired blockchain: <code>bsv</code> or <code>btc</code>.</td></tr><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr><tr><td>txid</td><td>Transaction ID.</td></tr><tr><td>index</td><td>Output / Vout index.</td></tr></tbody></table>

## Bulk Raw Transaction Output Data

This endpoint returns raw hex of the transaction output for a list of up to 40 transaction IDs and up to 40 output indexes per transaction.

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/txs/vouts/hex
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "txids": [{
        "txid": "<txid>",
        "vouts": [<vout>,<vout>, ...]
    },{
        "txid": "<txid>",
        "vouts": [<vout>,<vout>, ...]
    },
    ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST 'https://api.whatsonchain.com/v1/bsv/main/txs/vouts/hex' \
--header 'Content-Type: application/json' \
--data-raw '{
    "txids": [
        {
            "txid": "e8022f0904e636a7f4c1e561ca0af794b354f6fb71bdfb57b5ac3528e3f40e2f",
            "vouts": [
                0,
                1
            ]
        }
    ]
}'
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST 'https://api.whatsonchain.com/v1/btc/main/txs/vouts/hex' \
--header 'Content-Type: application/json' \
--data-raw '{
    "txids": [
        {
            "txid": "a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692",
            "vouts": [
                0,
                1
            ]
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "txid": "e8022f0904e636a7f4c1e561ca0af794b354f6fb71bdfb57b5ac3528e3f40e2f",
    "vout": {
        "0": {
            "scriptPubKey": {
                "hex": "76a9146b7f6a5d5677d1f3635e589b2eacc75d08dc6c4588ac"
            }
        },
        "1": {
            "scriptPubKey": {
                "hex": "006a036478733575453364693965487a6e6b47666865696d6863636434673d3d2c6d392c74622c613738362e39332c6535363430302c7332382e333704746578740142"
            }
        }
    }
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "txid": "a3db6634bdcfd55c7448402b33ebde0e02ee84f27ba6420f1b8d1a6f413f0692",
    "vout": {
        "0": {
            "scriptPubKey": {
                "hex": "5120b88c6696e8c659ebf79c424ff3c44ebf60242e60ed3da0438bc8883320efb77b"
            }
        }
    }
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

<table><thead><tr><th width="302">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>Desired blockchain: <code>bsv</code> or <code>btc</code>.</td></tr><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr></tbody></table>

**Errors**

| Error                   | Description                   |
| ----------------------- | ----------------------------- |
| `unknown` for that txId | If a given txId is unknown.   |
| `(Ignored)`             | If a given output is unknown. |

## Get Merkle Proof in TSC (BSV-only)

This endpoint returns the Merkle root of the branch for a confirmed transaction, in the [TSC](https://tsc.bitcoinassociation.net/standards/merkle-proof-standardised-format/) format.&#x20;

{% hint style="info" %}

* Returns `null` for unconfirmed transactions.
* The old, non-TSC-format endpoint is no longer supported.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<txid>/proof/tsc
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/proof/tsc"
```

{% endcode %}

{% code title="Example Response" %}

```json
[{
    "index": 0,
    "txOrId": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "target": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
    "nodes": ["7e0ba1980522125f1f40d19a249ab3ae036001b991776813d25aebe08e8b8a50", "1e3a5a8946e0caf07006f6c4f76773d7e474d4f240a276844f866bd09820adb3"]
}]
```

{% endcode %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |


# Mempool

## Get Mempool Info

This endpoint retrieves various information about the node's mempool, for the selected network.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/mempool/info
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/mempool/info"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/mempool/info"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "size": 4204,
    "journalsize": 4194,
    "nonfinalsize": 0,
    "bytes": 4347584,
    "usage": 10844944,
    "usagedisk": 0,
    "usagecpfp": 84170,
    "nonfinalusage": 192,
    "maxmempool": 16000000000,
    "maxmempoolsizedisk": 0,
    "maxmempoolsizecpfp": 1600000000,
    "mempoolminfee": 0
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "loaded": true,
    "size": 12960,
    "bytes": 6856905,
    "usage": 33532464,
    "total_fee": 0.15068615,
    "maxmempool": 300000000,
    "mempoolminfee": 0.00001,
    "minrelaytxfee": 0.00001,
    "incrementalrelayfee": 0.00001,
    "unbroadcastcount": 0,
    "fullrbf": true
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Mempool Transactions

This endpoint retrieves a list of `txIds` from the node's mempool, for the selected network.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/mempool/raw
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/mempool/raw"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/mempool/raw"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[
    "6525b061b0fb2e288527cbe881edd8b36297e16b2f4c28e20d2c9a8a34f94f8a",
    "df8955d5c845ce34c964f4f6969a7e7b116a4840452c1aafd23da508f4696cc6",
    ...
]
```

{% endtab %}

{% tab title="BTC" %}

```json
[
    "d1cf0c36fc45d08ca21dc11329fb8047574adeda46f731ebbe09676e6746d3e6",
    "e3288a783791d61b34931899c4be4653a8d0b60b5e431cd4f9b0a6a4f723e471",
    ...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |


# (Un)Spent Transaction Outputs

These endpoints cover spent and unspent transaction outputs.

## Get Unspent UTXOs by Address

This endpoint retrieves a combined, ordered list of both confirmed and unconfirmed UTXOs for a given address.&#x20;

{% hint style="info" %}

* Returns up to 100k unconfirmed results in one request.
* Confirmed results are paginated if more than 1000 are available.
* The rest can be accessed using the provided `next-page` token.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/unspent/all
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1L2F8wYxTRagCZLnsm2engg8ngGECSeuE5/unspent/all"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/1AR9sWV7ZR2C2ohGSDDKXipCfZ3RLGynHM/unspent/all"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "1L2F8wYxTRagCZLnsm2engg8ngGECSeuE5",
    "script": "b3005d46af31c4b5675b73c17579b7bd366dfe10635b7b43ac111aea5226efb6",
    "result": [{
        "height": 861499,
        "tx_pos": 1,
        "tx_hash": "ab0f76f957662335f98ee430a665f924c28310ec5126c2aede56086f9233326f",
        "value": 154,
        "isSpentInMempoolTx": false,
        "status": "confirmed"
    }, {
        "height": 861925,
        "tx_pos": 99,
        "tx_hash": "54e27d08c371b67746fd3088b78eecb9acef91f497f7e776d11d605635b9dc20",
        "value": 1000,
        "isSpentInMempoolTx": false,
        "status": "confirmed"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "1AR9sWV7ZR2C2ohGSDDKXipCfZ3RLGynHM",
    "script": "7b93a4e57dfc0cfacc47f486caac7f446ae6b366f8b708260962e7ca7d39f4fb",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "891459059f872c18bd27e7cfc9a5f2a8567f6739d4535bd07281de22379dd193",
        "value": 505370,
        "isSpentInMempoolTx": false,
        "hex": "76a914674a8527a29f25613552267d0edfd181212becdc88ac",
        "status": "unconfirmed"
    },
    ...
    {
        "height": 881136,
        "tx_pos": 0,
        "tx_hash": "764da85a1e8a383d5a41e3bb7b7b9303bc99f92e258ed4bfbea3aefed4f617d7",
        "value": 600,
        "isSpentInMempoolTx": false,
        "status": "confirmed"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Get Unconfirmed UTXOs by Address

This endpoint retrieves an ordered list of unconfirmed UTXOs for a given address.

{% hint style="info" %}
Returns up to 100k results in one request.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/unconfirmed/unspent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/12drYTV2c9nZMrxep9ewpWPdLrV5bNcWF2/unconfirmed/unspent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/bc1qcvltc5pzeq7dt52x0q0yjhlzlmvufusd0vm27a/unconfirmed/unspent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "12drYTV2c9nZMrxep9ewpWPdLrV5bNcWF2",
    "script": "2d4ec8100056a819943df89efb3ac6a37a44bdf46a307dc390c31f6db31a092f",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "bdcfb99b692a3418f79471ca970a201149d19ba97d0ca5c0b89949bdb627a1c9",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91411f074cf02b2c8070c424384493cb5c8548ae20788ac"
    }, {
        "tx_pos": 0,
        "tx_hash": "575e01c3ef02809308c835308a643199e56c3eb80816a28c1db51f31968c413d",
        "value": 17000,
        "isSpentInMempoolTx": false,
        "hex": "76a91411f074cf02b2c8070c424384493cb5c8548ae20788ac"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "bc1qcvltc5pzeq7dt52x0q0yjhlzlmvufusd0vm27a",
    "script": "d429f1c1970baaa6e8e1367b1e8689aafaefed972c0351a2223ceba047f22fdd",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "a3c6d8dd8c7c777527e9e45803cf2e9efda9d09bcde7830368e1719b292938fd",
        "value": 1382600,
        "isSpentInMempoolTx": false,
        "hex": "0014c33ebc5022c83cd5d146781e495fe2fed9c4f20d"
    }],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Bulk Unconfirmed UTXOs by Address

This endpoint retrieves an ordered list of unconfirmed UTXOs for a given set of addresses

{% hint style="info" %}

* Max 20 addresses per request.
* Returns up to 100 items in one request.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/addresses/unconfirmed/unspent
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
    	"<address>",
    	"<address>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/unconfirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"12drYTV2c9nZMrxep9ewpWPdLrV5bNcWF2\",\"1uEVHTbkzhz6pFfMQEYoimE2bQZNbhRC8\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/unconfirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"bc1qcvltc5pzeq7dt52x0q0yjhlzlmvufusd0vm27a\",\"bc1qvqny32utwemf32rlvk0tghjn6h40wwtn7feq7p\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "12drYTV2c9nZMrxep9ewpWPdLrV5bNcWF2",
    "script": "2d4ec8100056a819943df89efb3ac6a37a44bdf46a307dc390c31f6db31a092f",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "bdcfb99b692a3418f79471ca970a201149d19ba97d0ca5c0b89949bdb627a1c9",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91411f074cf02b2c8070c424384493cb5c8548ae20788ac"
    }, {
        "tx_pos": 0,
        "tx_hash": "575e01c3ef02809308c835308a643199e56c3eb80816a28c1db51f31968c413d",
        "value": 17000,
        "isSpentInMempoolTx": false,
        "hex": "76a91411f074cf02b2c8070c424384493cb5c8548ae20788ac"
    },
    ...
    ],
    "error": ""
}, {
    "address": "1uEVHTbkzhz6pFfMQEYoimE2bQZNbhRC8",
    "script": "b1654010d45195751fd392c13819834726edc87d6508f94cff4e41f643db2e49",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "ee568800fe3c442fc458e2a1471ac0c697d1b6c31d4185e016a58700514c82cc",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91409e0e39164714f25254ac278fc939933b1fe21f888ac"
    }, {
        "tx_pos": 0,
        "tx_hash": "186e0bd354cc0ba6a00a70529b60940a553eef4e468d109c7c8614d04d260ee9",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91409e0e39164714f25254ac278fc939933b1fe21f888ac"
    },
    ...
    ],
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "bc1qcvltc5pzeq7dt52x0q0yjhlzlmvufusd0vm27a",
    "script": "d429f1c1970baaa6e8e1367b1e8689aafaefed972c0351a2223ceba047f22fdd",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "a3c6d8dd8c7c777527e9e45803cf2e9efda9d09bcde7830368e1719b292938fd",
        "value": 1382600,
        "isSpentInMempoolTx": false,
        "hex": "0014c33ebc5022c83cd5d146781e495fe2fed9c4f20d"
    }],
    "error": ""
}, {
    "address": "bc1qvqny32utwemf32rlvk0tghjn6h40wwtn7feq7p",
    "script": "d939bd1751111e7cd8fb0d2a6945941e947a4bdcb396acd5635df8292fc3a375",
    "result": [{
        "tx_pos": 1,
        "tx_hash": "a3c6d8dd8c7c777527e9e45803cf2e9efda9d09bcde7830368e1719b292938fd",
        "value": 2010800,
        "isSpentInMempoolTx": false,
        "hex": "0014602648ab8b767698a87f659eb45e53d5eaf73973"
    }],
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

## Get Confirmed UTXOs by Address

This endpoint retrieves an ordered list of confirmed UTXOs for a given address.

{% hint style="info" %}

* `isSpentInMempoolTx` flag enables filtering of spent unconfirmed transactions from this set.
* Pagination is available using the provided `next-page` token.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/address/<address>/confirmed/unspent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1Dbj1LUxTqtuZ1U52KZiZChLPHkTAMiD6h/confirmed/unspent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/1AR9sWV7ZR2C2ohGSDDKXipCfZ3RLGynHM/confirmed/unspent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "1Dbj1LUxTqtuZ1U52KZiZChLPHkTAMiD6h",
    "script": "0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832",
    "result": [{
        "height": 797518,
        "tx_pos": 0,
        "tx_hash": "6cc9631ef3dad77eb0141134167f20469d0b4e61405de57fe6a9ac71b943bb9f",
        "value": 181827,
        "isSpentInMempoolTx": false
    }],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "1AR9sWV7ZR2C2ohGSDDKXipCfZ3RLGynHM",
    "script": "7b93a4e57dfc0cfacc47f486caac7f446ae6b366f8b708260962e7ca7d39f4fb",
    "result": [{
        "height": 881136,
        "tx_pos": 0,
        "tx_hash": "764da85a1e8a383d5a41e3bb7b7b9303bc99f92e258ed4bfbea3aefed4f617d7",
        "value": 600,
        "isSpentInMempoolTx": false
    }, {
        "height": 886287,
        "tx_pos": 1,
        "tx_hash": "12b8cf9dfaed801d448b6a36d4fc534245560108cc0ae067a13073dab7238a12",
        "value": 601,
        "isSpentInMempoolTx": false
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

<table><thead><tr><th width="349">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>Desired blockchain: <code>bsv</code> or <code>btc</code>.</td></tr><tr><td>network</td><td>Selected network: <code>main</code> or <code>test</code>.</td></tr><tr><td>address</td><td>Address.</td></tr><tr><td>limit</td><td>Between <code>1</code> and <code>10000</code> (default).</td></tr><tr><td>token</td><td>Provided <code>next-page</code> token.</td></tr></tbody></table>

## Bulk Confirmed UTXOs by Address

This endpoint retrieves an ordered list of confirmed UTXOs for a given set of addresses

{% hint style="info" %}

* Max 20 addresses per request.
* Returns up to 20 items in one request.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/addresses/confirmed/unspent
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
    	"<address>",
    	"<address>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/confirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"16ZBEb7pp6mx5EAGrdeKivztd5eRJFuvYP\",\"1KGHhLTQaPr4LErrvbAuGE62yPpDoRwrob\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/confirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd\",\"382UwmXW5WgrS7kmG3XQLHV1ivVjTJzS94\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "16ZBEb7pp6mx5EAGrdeKivztd5eRJFuvYP",
    "result": [{
        "height": 657540,
        "tx_pos": 1,
        "tx_hash": "d75485c2329a533fd06b5f55a3f21644741c0258f2974d5d989e946a0bb4357f",
        "value": 25000000
    },{
        "height": 657542,
        "tx_pos": 1,
        "tx_hash": "55a656d50327ec3237fa6e821ab62294695cfd508d631dc9b04dc3a395cf0a37",
        "value": 25000000
    }],
    "error": ""
},{
    "address": "1KGHhLTQaPr4LErrvbAuGE62yPpDoRwrob",
    "result": [{
        "height": 658133,
        "tx_pos": 1,
        "tx_hash": "7ae43aac97396bc99616d8273c6cd9b57f017d6d49aca742fbc8c214fee49fa7",
        "value": 25000000
    },{
        "height": 658134,
        "tx_pos": 1,
        "tx_hash": "5b25a56bbb959f9cf4b3e48dbbe412bf5cc85e655d27f87c3bfb07aa6aa01518",
        "value": 25000000
    }],
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd",
    "script": "d9d46113eb0f3759c0dabf23b87b58a4c76a0633d13add20922cc5f6ede8ddd9",
    "result": [{
        "height": 891917,
        "tx_pos": 0,
        "tx_hash": "a367face4189b870b340ba391ef336e756305f65f2e060ae8486d100ab89f33a",
        "value": 546,
        "isSpentInMempoolTx": false
    }, {
        "height": 891978,
        "tx_pos": 0,
        "tx_hash": "608ffca4e1a21fc767f802e37f2c673db7b9ab6076cbbffa82bd090af56eebbf",
        "value": 546,
        "isSpentInMempoolTx": false
    },
    ...
    ],
    "nextPageToken": "000000002f0100004c000000010000004000000064396434363131336562306633373539633064616266323362383762353861346337366130363333643133616464323039323263633566366564653864646439016900000005000000010000000004000000000d9c0d040000000000043a40000000613336376661636534313839623837306233343062613339316566333336653735363330356636356632653036306165383438366431303061623839663333610400000000000000ebffffff8a448b12ab55abccc87bef8c6e82e38301000000390000000119000000140000000100000008000000b3eee3a4f216cea2010119000000140000000100000008000000b3eee3a4f216cea2010101000000164715117e017b366640b372f29546ae010000000000ffffffff000000000002",
    "error": ""
}, {
    "address": "382UwmXW5WgrS7kmG3XQLHV1ivVjTJzS94",
    "script": "f55f33505fe16e01f0e79fde7259d71191c901a6b40833d5297251ce64b5705b",
    "result": null,
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Unspent UTXOs by Script

This endpoint retrieves a combined, ordered list of both confirmed and unconfirmed UTXOs for a given script.

{% hint style="info" %}

* Returns up to 100k unconfirmed results in one request.
* Confirmed results are paginated if more than 1000 are available.
* The rest can be accessed using the provided `next-page` token.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/script/<scriptHash>/unspent/all
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/b3005d46af31c4b5675b73c17579b7bd366dfe10635b7b43ac111aea5226efb6/unspent/all"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/script/d429f1c1970baaa6e8e1367b1e8689aafaefed972c0351a2223ceba047f22fdd/unspent/all"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "script": "b3005d46af31c4b5675b73c17579b7bd366dfe10635b7b43ac111aea5226efb6",
    "result": [{
        "height": 861499,
        "tx_pos": 1,
        "tx_hash": "ab0f76f957662335f98ee430a665f924c28310ec5126c2aede56086f9233326f",
        "value": 154,
        "isSpentInMempoolTx": false,
        "status": "confirmed"
    }, {
        "height": 861925,
        "tx_pos": 99,
        "tx_hash": "54e27d08c371b67746fd3088b78eecb9acef91f497f7e776d11d605635b9dc20",
        "value": 1000,
        "isSpentInMempoolTx": false,
        "status": "confirmed"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "script": "d429f1c1970baaa6e8e1367b1e8689aafaefed972c0351a2223ceba047f22fdd",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "a3c6d8dd8c7c777527e9e45803cf2e9efda9d09bcde7830368e1719b292938fd",
        "value": 1382600,
        "isSpentInMempoolTx": false,
        "hex": "0014c33ebc5022c83cd5d146781e495fe2fed9c4f20d",
        "status": "unconfirmed"
    }, {
        "height": 904501,
        "tx_pos": 1,
        "tx_hash": "dc625944cd7fc5761c93b337063fff0ed2c127c79b092159a2ede4491e5961db",
        "value": 142777600,
        "isSpentInMempoolTx": false,
        "status": "confirmed"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter  | Description                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| network    | Selected network: `main` or `test`.                                                                                       |
| scriptHash | Script hash: `Sha256` hash of the binary bytes of the locking script (`ScriptPubKey`), expressed as a hexadecimal string. |

## Get Unconfirmed UTXOs by Script

This endpoint retrieves the ordered list of unconfirmed UTXOs for a given script.

{% hint style="info" %}
Returns up to 100k results in one request.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/script/<scriptHash>/unconfirmed/unspent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/b1654010d45195751fd392c13819834726edc87d6508f94cff4e41f643db2e49/unconfirmed/unspent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/script/0954dff09a1f76f413f53ff8f92f58f0b36b3abad8ef9dcd98ba55686ea9dad8/unconfirmed/unspent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "script": "b1654010d45195751fd392c13819834726edc87d6508f94cff4e41f643db2e49",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "ee568800fe3c442fc458e2a1471ac0c697d1b6c31d4185e016a58700514c82cc",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91409e0e39164714f25254ac278fc939933b1fe21f888ac"
    }, {
        "tx_pos": 0,
        "tx_hash": "186e0bd354cc0ba6a00a70529b60940a553eef4e468d109c7c8614d04d260ee9",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91409e0e39164714f25254ac278fc939933b1fe21f888ac"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "script": "0954dff09a1f76f413f53ff8f92f58f0b36b3abad8ef9dcd98ba55686ea9dad8",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "71e1ffb4b435000ad3fce89ed660a1f618787381e10b0b11426def778a9ab6de",
        "value": 47600669,
        "isSpentInMempoolTx": false,
        "hex": "a914424f29a8a84fa867814ff9ded43379c9dc9a681487"
    }, {
        "tx_pos": 0,
        "tx_hash": "bf7f0cb602bdecd290e8a93924e34f915d4e9c9e3b3cec35d0f5c26950066ba0",
        "value": 30202537,
        "isSpentInMempoolTx": false,
        "hex": "a914424f29a8a84fa867814ff9ded43379c9dc9a681487"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter  | Description                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| network    | Selected network: `main` or `test`.                                                                                       |
| scriptHash | Script hash: `Sha256` hash of the binary bytes of the locking script (`ScriptPubKey`), expressed as a hexadecimal string. |

## Bulk Unconfirmed UTXOs by Script

This endpoint retrieves an ordered list of unconfirmed UTXOs for a given set of script hashes.

{% hint style="info" %}

* Max 20 scripthashes per request.
* Returns up to 20 items in one request.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/scripts/unconfirmed/unspent
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "scripts": [
        "<script>",
        "<script>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/unconfirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [\"b1654010d45195751fd392c13819834726edc87d6508f94cff4e41f643db2e49\",\"2d4ec8100056a819943df89efb3ac6a37a44bdf46a307dc390c31f6db31a092f\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/scripts/unconfirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [\"0954dff09a1f76f413f53ff8f92f58f0b36b3abad8ef9dcd98ba55686ea9dad8\",\"721ab98a12c78293b02278d19c45bb99c83a5289907f2854e3271c1aaf93b0f3\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "script": "b1654010d45195751fd392c13819834726edc87d6508f94cff4e41f643db2e49",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "ee568800fe3c442fc458e2a1471ac0c697d1b6c31d4185e016a58700514c82cc",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91409e0e39164714f25254ac278fc939933b1fe21f888ac"
    }, {
        "tx_pos": 0,
        "tx_hash": "186e0bd354cc0ba6a00a70529b60940a553eef4e468d109c7c8614d04d260ee9",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91409e0e39164714f25254ac278fc939933b1fe21f888ac"
    },
    ...
    ],
    "error": ""
}, {
    "script": "2d4ec8100056a819943df89efb3ac6a37a44bdf46a307dc390c31f6db31a092f",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "bdcfb99b692a3418f79471ca970a201149d19ba97d0ca5c0b89949bdb627a1c9",
        "value": 85,
        "isSpentInMempoolTx": false,
        "hex": "76a91411f074cf02b2c8070c424384493cb5c8548ae20788ac"
    }, {
        "tx_pos": 0,
        "tx_hash": "575e01c3ef02809308c835308a643199e56c3eb80816a28c1db51f31968c413d",
        "value": 17000,
        "isSpentInMempoolTx": false,
        "hex": "76a91411f074cf02b2c8070c424384493cb5c8548ae20788ac"
    },
    ...
    ],
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "script": "0954dff09a1f76f413f53ff8f92f58f0b36b3abad8ef9dcd98ba55686ea9dad8",
    "result": [{
        "tx_pos": 0,
        "tx_hash": "64362c322487a25f9f7cab377ab27490256347db06d96da581cc10e9956119ca",
        "value": 5752365,
        "isSpentInMempoolTx": false,
        "hex": "a914424f29a8a84fa867814ff9ded43379c9dc9a681487"
    }, {
        "tx_pos": 1,
        "tx_hash": "a12d907e49794e6c47fefde137bac977065337b8989917bf998ce58892479fc6",
        "value": 46203,
        "isSpentInMempoolTx": false,
        "hex": "a914424f29a8a84fa867814ff9ded43379c9dc9a681487"
    },
    ...
    ],
    "error": ""
}, {
    "script": "721ab98a12c78293b02278d19c45bb99c83a5289907f2854e3271c1aaf93b0f3",
    "result": null,
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

## Get Confirmed UTXOs by Script

This endpoint retrieves the ordered list of confirmed UTXOs for a given script.

{% hint style="info" %}

* `isSpentInMempoolTx` flag enables filtering of spent unconfirmed transactions from this set.
* Pagination is available using the provided `next-page` token.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/script/<scriptHash>/confirmed/unspent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832/confirmed/unspent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/script/aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3/confirmed/unspent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "script": "0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832",
    "result": [{
        "height": 797518,
        "tx_pos": 0,
        "tx_hash": "6cc9631ef3dad77eb0141134167f20469d0b4e61405de57fe6a9ac71b943bb9f",
        "value": 181827,
        "isSpentInMempoolTx": false
    }],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "script": "aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3",
    "result": [{
        "height": 904231,
        "tx_pos": 1,
        "tx_hash": "97b654a463364bf0fa0035dcb315abcdcf6c39ab4e522b3488060ba7098f55f0",
        "value": 2388665,
        "isSpentInMempoolTx": false
    }, {
        "height": 904268,
        "tx_pos": 0,
        "tx_hash": "fe18d4743815e5c152824063d08040d1df9bde0fcbe964288c3035cc16f63f0e",
        "value": 6389114,
        "isSpentInMempoolTx": false
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter  | Description                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| chain      | Desired blockchain: `bsv` or `btc`.                                                                                       |
| network    | Selected network: `main` or `test`.                                                                                       |
| scriptHash | Script hash: `Sha256` hash of the binary bytes of the locking script (`ScriptPubKey`), expressed as a hexadecimal string. |
| limit      | Between `1` and `10000` (default).                                                                                        |
| token      | Provided `next-page` token.                                                                                               |

## Bulk Confirmed UTXOs by Script

This endpoint retrieves an ordered list of confirmed UTXOs for a given set of script hashes.

{% hint style="info" %}

* Max 20 script hashes per request.
* Returns up to 20 items in one request.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/scripts/confirmed/unspent
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "scripts": [
        "<script>",
        "<script>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/confirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [\"f814a7c3a40164aacc440871e8b7b14eb6a45f0ca7dcbeaea709edc83274c5e7\",\"995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/scripts/confirmed/unspent" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [\"aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3\",\"843bf6ea60946a9ff5cf1d526878177317b88dcba83db33a4036ae9ca9f1f0cf\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "script": "f814a7c3a40164aacc440871e8b7b14eb6a45f0ca7dcbeaea709edc83274c5e7",
    "result": [{
        "height": 620539,
        "tx_pos": 0,
        "tx_hash": "4ec3b63d764558303eda720e8e51f69bbcfe81376075657313fb587306f8a9b0",
        "value": 450000,
        "isSpentInMempoolTx": false
    }],
    "error": ""
}, {
    "script": "995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3",
    "result": [],
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "script": "aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3",
    "result": [{
        "height": 904231,
        "tx_pos": 1,
        "tx_hash": "97b654a463364bf0fa0035dcb315abcdcf6c39ab4e522b3488060ba7098f55f0",
        "value": 2388665,
        "isSpentInMempoolTx": false
    }, {
        "height": 904268,
        "tx_pos": 0,
        "tx_hash": "fe18d4743815e5c152824063d08040d1df9bde0fcbe964288c3035cc16f63f0e",
        "value": 6389114,
        "isSpentInMempoolTx": false
    }, 
    ...
    ],
    "error": ""
}, {
    "script": "843bf6ea60946a9ff5cf1d526878177317b88dcba83db33a4036ae9ca9f1f0cf",
    "result": [{
        "height": 891509,
        "tx_pos": 0,
        "tx_hash": "d38d3c310658daf5bfa5ab65e18509dd1f532de99c12d51373f39abf4c66feb3",
        "value": 1785,
        "isSpentInMempoolTx": false
    }],
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Unconfirmed Spent Tx Output

This endpoint retrieves where the specified unconfirmed transaction output was spent.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<txid>/<voutIndex>/unconfirmed/spent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/tx/c6647a562ac6a3cce0f46c2fb2b417cbd5daf1258f2a96d7556e6b9304f2889a/0/unconfirmed/spent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/tx/f656777a198cc497da4ed2f159f56868508fce40b3d32edeca770aba79afd52a/1/unconfirmed/spent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "txid": "6fe244e16ea34b30ec2888c41d7e05a36fc1838de6a612008adf71c99678c0c1",
    "vin": 0,
    "status": "unconfirmed"
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "txid": "246523804e2fd48cf27314897d3abe8d2737376549c21b162dec64aa741265df",
    "vin": 0,
    "status": "unconfirmed"
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |
| voutIndex | Output index.                       |

## Get Confirmed Spent Tx Output

This endpoint retrieves where the specified confirmed transaction output was spent.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<txid>/<voutIndex>/confirmed/spent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/tx/17d533c6a215223a62eef389707f77bef1601a18e4e994805a7846c3f3d50870/2/confirmed/spent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/tx/27e9a5d180186ccd0ff343a11e6595cec753ed9dcc7e62e977112bf8bf426436/0/confirmed/spent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "txid": "87645a7c4a9a5a9b9cd1468db19cdba44129c35cc487fc57c4d8843141ad2551",
    "vin": 2,
    "status": "confirmed"
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "txid": "ad7e7be78c298efdc375c3500d17199b9051825afcc91a6974c615a81f9a0afd",
    "vin": 0,
    "status": "confirmed"
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |
| voutIndex | Output index.                       |

## Get Spent Transaction Output

This endpoint retrieves where the specified transaction output was spent, checking both confirmed and unconfirmed in a single call.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<txid>/<voutIndex>/spent
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/tx/17d533c6a215223a62eef389707f77bef1601a18e4e994805a7846c3f3d50870/2/spent"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/tx/27e9a5d180186ccd0ff343a11e6595cec753ed9dcc7e62e977112bf8bf426436/0/spent"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "txid": "87645a7c4a9a5a9b9cd1468db19cdba44129c35cc487fc57c4d8843141ad2551",
    "vin": 2,
    "status": "confirmed"
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "txid": "ad7e7be78c298efdc375c3500d17199b9051825afcc91a6974c615a81f9a0afd",
    "vin": 0,
    "status": "confirmed"
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |
| voutIndex | Output index.                       |

**Errors**

| Error             | Description                                                                 |
| ----------------- | --------------------------------------------------------------------------- |
| `400 Bad Request` | If UTXO is unknown.                                                         |
| `404 Not Found`   | If UTXO is known but spent details are not found, i.e., it's still unspent. |

## Bulk Spent Transaction Outputs

This endpoint retrieves where the specified transaction outputs were spent, checking both confirmed and unconfirmed in a single call.

{% hint style="info" %}
Max 20 transaction outputs per request.
{% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/utxos/spent
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "utxos": [
        {
        "txid": "<txid>",
        "vout": <vout>
        },
        {
        "txid": "<txid>",
        "vout": <vout>
        },
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/utxos/spent" \
  --header "Content-Type: application/json" \
  --data "{\"utxos\" :[{ \"txid\" :\"87645a7c4a9a5a9b9cd1468db19cdba44129c35cc487fc57c4d8843141ad2551\", \"vout\" : 2}, {\"txid\" :\"c6647a562ac6a3cce0f46c2fb2b417cbd5daf1258f2a96d7556e6b9304f2889a\", \"vout\" : 0}]}"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/utxos/spent" \
  --header "Content-Type: application/json" \
  --data "{\"utxos\" :[{ \"txid\" :\"27e9a5d180186ccd0ff343a11e6595cec753ed9dcc7e62e977112bf8bf426436\", \"vout\" : 0}, {\"txid\" :\"f656777a198cc497da4ed2f159f56868508fce40b3d32edeca770aba79afd52a\", \"vout\" : 1}]}"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "utxo": {
        "txid": "87645a7c4a9a5a9b9cd1468db19cdba44129c35cc487fc57c4d8843141ad2551",
        "vout": 2
    },
    "spentIn": {
        "txid": "87645a7c4a9a5a9b9cd1468db19cdba44129c35cc487fc57c4d8843141ad2551",
        "vin": 2,
        "status": "confirmed"
    },
    "error": ""
}, {
    "utxo": {
        "txid": "c6647a562ac6a3cce0f46c2fb2b417cbd5daf1258f2a96d7556e6b9304f2889a",
        "vout": 0
    },
    "spentIn": {
        "txid": "c6647a562ac6a3cce0f46c2fb2b417cbd5daf1258f2a96d7556e6b9304f2889a",
        "vin": 0,
        "status": "unconfirmed"
    },
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "utxo": {
        "txid": "27e9a5d180186ccd0ff343a11e6595cec753ed9dcc7e62e977112bf8bf426436",
        "vout": 0
    },
    "spentIn": {
        "txid": "27e9a5d180186ccd0ff343a11e6595cec753ed9dcc7e62e977112bf8bf426436",
        "vin": 0,
        "status": "confirmed"
    },
    "error": ""
}, {
    "utxo": {
        "txid": "f656777a198cc497da4ed2f159f56868508fce40b3d32edeca770aba79afd52a",
        "vout": 1
    },
    "spentIn": {
        "txid": "f656777a198cc497da4ed2f159f56868508fce40b3d32edeca770aba79afd52a",
        "vin": 1,
        "status": "confirmed"
    },
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

**Errors**

| Parameter         | Description                                                                 |
| ----------------- | --------------------------------------------------------------------------- |
| `400 Bad Request` | If UTXO is unknown.                                                         |
| `404 Not Found`   | If UTXO is known but spent details are not found, i.e., it's still unspent. |

## ElectrumX Wrapper for ElectrumSV (Beta)

We've created a wrapper for our UTXO service that acts exactly like an ElectrumX server that you can plug into the [ElectrumSV](https://electrumsv.io/) wallet (Network - Server).

Use any of these URLs to try it out and let us know what you think in the [Telegram channel](https://t.co/2WWqPUGUoK):

* URL1: <http://electrumx-adapter-1.whatsonchain.com/>
* URL2: <http://electrumx-adapter-2.whatsonchain.com/>

Use either the `50001` ,`50002` , or `50003` port.


# Address

## Get Address Info

This endpoint retrieves various information for a given address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/address/<address>/info
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/16ZqP5Tb22KJuvSAbjNkoiZs13mmRmexZA/info"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/381qVpM6titKUxxsN7cYcZwo5wYN8CMs3J/info"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "isvalid": true,
    "address": "16ZqP5Tb22KJuvSAbjNkoiZs13mmRmexZA",
    "scriptPubKey": "76a9143d0e5368bdadddca108a0fe44739919274c726c788ac",
    "ismine": false,
    "iswatchonly": false,
    "isscript": false
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "isvalid": true,
    "address": "381qVpM6titKUxxsN7cYcZwo5wYN8CMs3J",
    "ismine": false,
    "iswatchonly": false,
    "isscript": true,
    "witness_version": 0,
    "iswitness": false,
    "witness_program": "",
    "scriptPubKey": "a914455ff45b915000add09a1d1a014ec57f6ee38dcb87"
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Get Address Usage Status

This endpoint serves as a usage status flag for a given address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/used
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/174XactYXkNJkPYBpsPAuzHkwG5snmLNpC/used"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd/used"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```
true
```

{% endtab %}

{% tab title="BTC" %}

```
true
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Get Associated Script Hashes

There are some addresses that are associated with multiple script types. This endpoint returns a list of  script hashes associated to the given address, and their types.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/address/<address>/scripts
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX/scripts"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/bc1q695z03z6kweljcvpwft7vfu6kd0guf24yaaht2/scripts"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "script": "cc0d7111befe9f24f1824c797e837c5cff2f8773901ccb9aca0372a2a6c48d34",
    "type": "pubkey"
}, {
    "script": "55f4cd3dabddd62707b374f69f66b97f5f53dac5b204bd6c09dcad39b54862d1",
    "type": "pubkeyhash"
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "script": "cf869569e05c0efe7d40dc0add9b7a52d0193fbb022070cc7b54f96e9eb1cd8f",
    "type": "witness_v0_keyhash"
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Download Statement (BSV-only)

You can download the statement (in `PDF`) for a given address.

{% code title="HTTP Request" %}

```
GET https://<network>.whatsonchain.com/statement/<address>
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location --request GET  "https://main.whatsonchain.com/statement/16ZqP5Tb22KJuvSAbjNkoiZs13mmRmexZA"
```

{% endcode %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Get Unconfirmed Balance

This endpoint retrieves the unconfirmed balance for a given address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/unconfirmed/balance
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4/unconfirmed/balance"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/bc1qju8ttjzcucwvums0cxy3gsp0vt52sgyd2glyv6/unconfirmed/balance"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4",
    "script": "f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441",
    "unconfirmed": 5842074,
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "bc1qju8ttjzcucwvums0cxy3gsp0vt52sgyd2glyv6",
    "script": "71789d552fae15cc11e9a77599dfe7794884802d0b68c7a9ae6863ae9ca17dac",
    "unconfirmed": 820000,
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Bulk Unconfirmed Balance

This endpoint retrieves the unconfirmed balance for multiple addresses in a single request.

{% hint style="info" %}
Max 20 addresses per request.
{% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/addresses/unconfirmed/balance
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
        "<addess>",
        "<addess>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/unconfirmed/balance" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4\", \"1AyWnLhRYqt5VcGvVmXpieCbY3agHk53cJ\"] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/unconfirmed/balance" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"bc1qju8ttjzcucwvums0cxy3gsp0vt52sgyd2glyv6\", \"bc1qm9cvc9v7yczthvn40jf40hvt3unqd67649ytx7\"] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4",
    "script": "f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441",
    "unconfirmed": 5836266,
    "error": ""
}, {
    "address": "1AyWnLhRYqt5VcGvVmXpieCbY3agHk53cJ",
    "script": "a6595fcfa6ac7870f3caa04633b5d60dbbb219ecdd75fc09e0f790f35bc161bd",
    "unconfirmed": 605968,
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "bc1qju8ttjzcucwvums0cxy3gsp0vt52sgyd2glyv6",
    "script": "71789d552fae15cc11e9a77599dfe7794884802d0b68c7a9ae6863ae9ca17dac",
    "unconfirmed": 820000,
    "error": ""
}, {
    "address": "bc1qm9cvc9v7yczthvn40jf40hvt3unqd67649ytx7",
    "script": "c6968cde45ab187c03f2a130858e7f88a14c158867135cb0527b3d622ebb1a7a",
    "unconfirmed": 990000,
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

## Get Confirmed Balance

This endpoint retrieves the confirmed balance for a given address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/address/<address>/confirmed/balance
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1Dbj1LUxTqtuZ1U52KZiZChLPHkTAMiD6h/confirmed/balance"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd/confirmed/balance"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "1Dbj1LUxTqtuZ1U52KZiZChLPHkTAMiD6h",
    "script": "0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832",
    "confirmed": 181827,
    "error": "",
    "associatedScripts": [{
        "script": "0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832",
        "type": "pubkeyhash"
    }]
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd",
    "script": "d9d46113eb0f3759c0dabf23b87b58a4c76a0633d13add20922cc5f6ede8ddd9",
    "confirmed": 56555981260,
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Bulk Confirmed Balance

This endpoint retrieves the confirmed balance for multiple addresses in a single request.

{% hint style="info" %}
Max 20 addresses per request.
{% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/addresses/confirmed/balance
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
        "<address>",
        "<address>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/confirmed/balance" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"1KGHhLTQaPr4LErrvbAuGE62yPpDoRwrob\",\"1NQKomMAEPEq6jSdpRNFRjcKPvVvhUL33f\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/confirmed/balance" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [\"3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd\",\"1DPexcq8rkPn5mXV6hPr9mpL3b5j26JG4N\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "1KGHhLTQaPr4LErrvbAuGE62yPpDoRwrob",
    "script": "4f8f588fc9bd7304dc73a14c5d3d0813e048986465e22587e3166ce04225a756",
    "confirmed": 0,
    "error": ""
}, {
    "address": "1NQKomMAEPEq6jSdpRNFRjcKPvVvhUL33f",
    "script": "c0f739302655f27531f70206e5f47dcfc22e8bdae6bcb143d62cef90040c2f9e",
    "confirmed": 305718273076,
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "3MqUP6G1daVS5YTD8fz3QgwjZortWwxXFd",
    "script": "d9d46113eb0f3759c0dabf23b87b58a4c76a0633d13add20922cc5f6ede8ddd9",
    "confirmed": 56555981260,
    "error": ""
}, {
    "address": "1DPexcq8rkPn5mXV6hPr9mpL3b5j26JG4N",
    "script": "8722be669964f355ced09afef9d40cefbc49fe96121c78d1405ce0857d77624e",
    "confirmed": 4382070173,
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Unconfirmed History

This endpoint retrieves unconfirmed transactions for a given address. Returns up to 100k results in one request.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/unconfirmed/history
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4/unconfirmed/history"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/16AvgD6VzCkQaJEgTAJrERt1f9RSuJ9Dg5/unconfirmed/history"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4",
    "script": "f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441",
    "result": [{
        "tx_hash": "2fde4146ae470efb337395987261b028c38e4e095b44ae3bc800c4073daf4730"
    }, {
        "tx_hash": "3570f77cc006b507b4198370b0f97adbbdf3a83c84fe3b72c1cb0579ec34ca9f"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "16AvgD6VzCkQaJEgTAJrERt1f9RSuJ9Dg5",
    "script": "02f81194bd8a705cb6edf1da950400e51e65f052f06380133504839d4b5cbc36",
    "result": [{
        "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308"
    }],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| address   | Address.                            |

## Bulk Unconfirmed History

This endpoint retrieves  the history of unconfirmed transactions for a given set of addresses.

{% hint style="info" %}

* Max 20 addresses per request.
* Max 100 items returned per request.
  {% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/addresses/unconfirmed/history
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
        "<address>",
        "<address>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/unconfirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [ \"1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4\", \"1AyWnLhRYqt5VcGvVmXpieCbY3agHk53cJ\"] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/unconfirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [ \"16AvgD6VzCkQaJEgTAJrERt1f9RSuJ9Dg5\", \"bc1qww3yxs7cx3hce445azx965se5msk6x6tqqfmq8\"] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "1QC6bjxvSBdiHqGM48t5RxjTEYW6BX4vu4",
    "script": "f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441",
    "result": [{
        "tx_hash": "36f1ed66752c78c6d1e8e73a060002b056015ef646e01508e8802bd8cb180b2d"
    }, {
        "tx_hash": "2cd3963137335c982005fae40846c269cf022061cae0a28f7bccf6d53a0252c6"
    },
    ...
    ],
    "nextPageToken": "890dc80865d1259528b1ec07e82d02efb77f1bcd9dbd714874bf1d00a54106f5",
    "error": ""
}, {
    "address": "1AyWnLhRYqt5VcGvVmXpieCbY3agHk53cJ",
    "script": "a6595fcfa6ac7870f3caa04633b5d60dbbb219ecdd75fc09e0f790f35bc161bd",
    "result": [{
        "tx_hash": "2fde4146ae470efb337395987261b028c38e4e095b44ae3bc800c4073daf4730"
    }, {
        "tx_hash": "3570f77cc006b507b4198370b0f97adbbdf3a83c84fe3b72c1cb0579ec34ca9f"
    },
    ...
    ],
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "16AvgD6VzCkQaJEgTAJrERt1f9RSuJ9Dg5",
    "script": "02f81194bd8a705cb6edf1da950400e51e65f052f06380133504839d4b5cbc36",
    "result": [{
        "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308"
    }],
    "error": ""
}, {
    "address": "bc1qww3yxs7cx3hce445azx965se5msk6x6tqqfmq8",
    "script": "9ed63d5c4771581e454f3343de70e5d7967832dc3de1f8002d3d8a89dc23cec3",
    "result": [{
        "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308"
    }],
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

## Get Confirmed History

This endpoint retrieves confirmed transactions for a given address. Pagination is available using the provided `next-page` token.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/address/<address>/confirmed/history
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1Dbj1LUxTqtuZ1U52KZiZChLPHkTAMiD6h/confirmed/history"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/address/bc1q6yxjfhj94w5ej79nvuls9fsyt33k8knp8yu594/confirmed/history"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "address": "1Dbj1LUxTqtuZ1U52KZiZChLPHkTAMiD6h",
    "script": "0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832",
    "result": [{
        "tx_hash": "6cc9631ef3dad77eb0141134167f20469d0b4e61405de57fe6a9ac71b943bb9f",
        "height": 797518
    }],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "address": "bc1q6yxjfhj94w5ej79nvuls9fsyt33k8knp8yu594",
    "script": "81e6f015f6ad293f6eb863f76bf2d3b53722974d3b040cb397030164102eb2f0",
    "result": [{
        "tx_hash": "705ecc93d7a9866b5a42b7d67802824d1f901ee782099c46dd7c1c40b2d1a8a7",
        "height": 770399
    }, {
        "tx_hash": "972185013aac0a709c426ec26c1cdf48a5baa34ae386d969e9b83ede7642b644",
        "height": 770679
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter         | Description                                        |
| ----------------- | -------------------------------------------------- |
| chain             | Desired blockchain: `bsv` or `btc`.                |
| network           | Selected network: `main` or `test`.                |
| address           | Address.                                           |
| order             | Ordering: `asc` or `desc` (default).               |
| limit (optional)  | Between `1` and `1000`; default is `100`.          |
| height (optional) | Starting block height for history; default is `0`. |
| token             | Provided `next-page` token.                        |

## Bulk Confirmed History

This endpoint retrieves  the history of confirmed transactions for a given set of addresses.

{% hint style="info" %}

* Max 20 addresses per request.
* Max 20 items returned per request.
* For pagination please use the single address endpoint.
  {% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/addresses/confirmed/history
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
        "<address>",
        "<address>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/confirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [ \"16ZBEb7pp6mx5EAGrdeKivztd5eRJFuvYP\", \"1CQuHnTR1HExx9KBvwuzeERx7CZmVkFtPs\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/confirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [ \"bc1q6yxjfhj94w5ej79nvuls9fsyt33k8knp8yu594\", \"3PWuL3LkpvUwPYQw43h1oAuFkBc2x8EFr6\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "16ZBEb7pp6mx5EAGrdeKivztd5eRJFuvYP",
    "script": "c7713679ea48e31aec663612f5cbaeb86f9241677c0397b42d957545b47ca2fe",
    "result": [{
        "tx_hash": "6216506e2b5ef029595e1b29a20c279889873a9da4e98bcb5c619a4756ab6932",
        "height": 658093
    }, {
        "tx_hash": "df860638d1530d2ba1f25d167fa24bbef3b1387e94207ee5e11fa535413aff39",
        "height": 658093
    }],
    "error": ""
}, {
    "address": "1CQuHnTR1HExx9KBvwuzeERx7CZmVkFtPs",
    "script": "6b854b53cdea2cca701bb62d792b1dbbbf9e84f6049f93afe17734b5bc4ab08f",
    "result": [{
        "tx_hash": "817bc35394ce8ad598d7dfe37efc01f719bc1caa079d7f83ea3c51254af40277",
        "height": 666566
    }, {
        "tx_hash": "b781592ecb45b7587729e7e7b764e6e369f0259b3323470292c004410a4e0ddb",
        "height": 666566
    },
    ...
    ],
    "nextPageToken": "00000000de0000004c00000001000000400000003662383534623533636465613263636137303162623632643739326231646262626639653834663630343966393361666531373733346235626334616230386601180000000200000004000000000a2bc60400000000005f4cebffffff4b40922badad1114d77dbb7f48be9882010000003900000001190000001400000001000000080000009923897a084cde8f0101190000001400000001000000080000009923897a084cde8f010101000000ed4bed6135c0ae12f382dd544c57ef9a010000000000ffffffff000000000002",
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "bc1q6yxjfhj94w5ej79nvuls9fsyt33k8knp8yu594",
    "script": "81e6f015f6ad293f6eb863f76bf2d3b53722974d3b040cb397030164102eb2f0",
    "result": [{
        "tx_hash": "e5f8afed665da723421226c1d8d7c9e78dffaff0215d09d38041ee951ee5bed0",
        "height": 899701
    }, {
        "tx_hash": "16b6e3a92cc549a7b392f3ce703201b7b4c14621fc1d2629f8ef29c4648a02da",
        "height": 858541
    },
    ...
    ],
    "error": ""
}, {
    "address": "3PWuL3LkpvUwPYQw43h1oAuFkBc2x8EFr6",
    "script": "b57c68f5c74e4c58cce13c93d9c8356f9c23bdcb8cd9e6de07f9e1530db6ae28",
    "result": [{
        "tx_hash": "5eb4cd7446cc5aff11f3154eac6876dd6d9fc7167e1d3d8a48078b07f761f1ad",
        "height": 848507
    }, {
        "tx_hash": "ce1a42ec6ce4ed712f86b518eeb4201af26e16918387d3d0d8ae4ad7f874bbfd",
        "height": 847976
    },
    ...
    ],
    "nextPageToken": "00000000de0000004c00000001000000400000006235376336386635633734653463353863636531336339336439633833353666396332336264636238636439653664653037663965313533306462366165323801180000000200000004000000000cf27b040000000000024bebffffff794de2f3d61b0fda5d1dc1c8398b9390010000003900000001190000001400000001000000080000002890c2ca153d9e520101190000001400000001000000080000002890c2ca153d9e52010101000000164715117e017b366640b372f29546ae010000000000ffffffff000000000002",
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Bulk History

This endpoint retrieves  the history of both confirmed and unconfirmed transactions for a given set of addresses.

{% hint style="info" %}

* Max 20 addresses per request.
* Max 1000 confirmed and max 1000 unconfirmed history items returned per request.
* Page tokens provided if address contains more items than above.
* Call standard individual [unconfirmed](#get-unconfirmed-history-beta) and [confirmed](#get-confirmed-history-beta) endpoints with page token for more history if required.
  {% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/addresses/history/all
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "addresses": [
        "<address>",
        "<address>",
        ..
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/addresses/history/all" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [ \"16ZBEb7pp6mx5EAGrdeKivztd5eRJFuvYP\", \"19SsDUJ29XM2VDCkZKnTXJ9Zjt3gMtnrwC\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/addresses/history/all" \
  --header "Content-Type: application/json" \
  --data "{\"addresses\" : [ \"16AvgD6VzCkQaJEgTAJrERt1f9RSuJ9Dg5\", \"bc1qww3yxs7cx3hce445azx965se5msk6x6tqqfmq8\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "address": "16ZBEb7pp6mx5EAGrdeKivztd5eRJFuvYP",
    "script": "c7713679ea48e31aec663612f5cbaeb86f9241677c0397b42d957545b47ca2fe",
    "unconfirmed": {
        "result": [],
        "error": ""
    },
    "confirmed": {
        "result": [{
            "tx_hash": "6216506e2b5ef029595e1b29a20c279889873a9da4e98bcb5c619a4756ab6932",
            "height": 658093
        }, {
            "tx_hash": "df860638d1530d2ba1f25d167fa24bbef3b1387e94207ee5e11fa535413aff39",
            "height": 658093
        }],
        "error": ""
    }
}, {
    "address": "19SsDUJ29XM2VDCkZKnTXJ9Zjt3gMtnrwC",
    "script": "9ad0daaac33264199ce40596970c5ccf0096eb05b9b020002a3f1c2202841ef9",
    "unconfirmed": {
        "result": [],
        "error": ""
    },
    "confirmed": {
        "result": [{
            "tx_hash": "06f978c8758b45aa298e74d2951123811da06d9b22ad433fcaeceb90fb3db6cd",
            "height": 825487
        }, {
            "tx_hash": "064cad8a9ff3caad45579ee514d6a352f402ab02ed355bc9d4f9fce3eac07813",
            "height": 825488
        }],
        "error": ""
    }
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "address": "16AvgD6VzCkQaJEgTAJrERt1f9RSuJ9Dg5",
    "script": "02f81194bd8a705cb6edf1da950400e51e65f052f06380133504839d4b5cbc36",
    "unconfirmed": {
        "result": [{
            "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308"
        }],
        "error": ""
    },
    "confirmed": {
        "result": [{
            "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308",
            "height": 905522
        }],
        "error": ""
    }
}, {
    "address": "bc1qww3yxs7cx3hce445azx965se5msk6x6tqqfmq8",
    "script": "9ed63d5c4771581e454f3343de70e5d7967832dc3de1f8002d3d8a89dc23cec3",
    "unconfirmed": {
        "result": [{
            "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308"
        }],
        "error": ""
    },
    "confirmed": {
        "result": [{
            "tx_hash": "ac69c967982a0dcd9a3d2ef99b52f5b4dfd0f0d9eb0b44d1744d92cf79ba2308",
            "height": 905522
        }],
        "error": ""
    }
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |


# Script

## Get Script Usage Status

This endpoint serves as a usage status flag for a given script.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/script/<scriptHash>/used
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/3a9b9e2285ae40de7679e48efcef7d029a46a7b3120063a6d24347ce4452e6ee/used"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/script/6cf6b0690edac65afb8ba0aede291027af7aed93a81e590a0f5b381eae09f5ab/used"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```
false
```

{% endtab %}

{% tab title="BTC" %}

```
true
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter  | Description                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| chain      | Desired blockchain: `bsv` or `btc`.                                                                                       |
| network    | Selected network: `main` or `test`.                                                                                       |
| scriptHash | Script hash: `Sha256` hash of the binary bytes of the locking script (`ScriptPubKey`), expressed as a hexadecimal string. |

## Get Unconfirmed Script History

This endpoint retrieves  the history of unconfirmed transactions for a given script.

{% hint style="info" %}
Returns up to 100k results in one request.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/script/<scriptHash>/unconfirmed/history
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832/unconfirmed/history"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/script/fdedaf756e9eec43f745da5c3c4047d9f1cac9569f9236713238f69730435787/unconfirmed/history"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "script": "f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441",
    "result": [{
        "tx_hash": "2ee65e24a9cd8ba26305c8754d306680a8fba9931ac569e91f230cbb8595cf4f"
    }, {
        "tx_hash": "1dc75c98dd544093db8c10ea68bdab36e1b209f17b41b12bfadceccdaea3a15d"
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "script": "fdedaf756e9eec43f745da5c3c4047d9f1cac9569f9236713238f69730435787",
    "result": [{
        "tx_hash": "697c41528c239fd869bd876513e2c9afd48d7e3caa9d3b35cf459df0f807b262"
    }, {
        "tx_hash": "057490809f6cf77c588aeab5416be313feb0a3e91bd8585e06c34b04e4af472d"
    }],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter  | Description                                                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| network    | Selected network: `main` or `test`.                                                                                       |
| scriptHash | Script hash: `Sha256` hash of the binary bytes of the locking script (`ScriptPubKey`), expressed as a hexadecimal string. |

## Bulk Unconfirmed Script History

This endpoint retrieves  the history of unconfirmed transactions for a given set of scripts.

{% hint style="info" %}

* Max 20 script hashes per request.
* Max 100 items returned per request.
  {% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/bsv/<network>/scripts/unconfirmed/history
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "scripts": [
        "<script>",
        "<script>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/unconfirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [ \"f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441\", \"a6595fcfa6ac7870f3caa04633b5d60dbbb219ecdd75fc09e0f790f35bc161bd\"] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/scripts/unconfirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [ \"fdedaf756e9eec43f745da5c3c4047d9f1cac9569f9236713238f69730435787\", \"12eb49134d1eb488a080856a7bf2556f044dea82155f98d4c77559b0a41eb250\"] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```sh
[{
    "script": "f80a9ad71e1f2a5e83bfddb639e87e0c0bdeefd6f1b4f760dd0f88ccae3a8441",
    "result": [{
        "tx_hash": "36f1ed66752c78c6d1e8e73a060002b056015ef646e01508e8802bd8cb180b2d"
    }, {
        "tx_hash": "2cd3963137335c982005fae40846c269cf022061cae0a28f7bccf6d53a0252c6"
    },
    ...
    ],
    "nextPageToken": "ecc52be40f3645ac03b0e0c39a8b041badebd2901955b2903e1db2c59732f90a",
    "error": ""
}, {
    "script": "a6595fcfa6ac7870f3caa04633b5d60dbbb219ecdd75fc09e0f790f35bc161bd",
    "result": [{
        "tx_hash": "807802f9a6d70951feb4841b7d8050db2d984815e3d40387ab935fa9062c8f01"
    }, {
        "tx_hash": "2fde4146ae470efb337395987261b028c38e4e095b44ae3bc800c4073daf4730"
    }, 
    ...
    ],
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```sh
[{
    "script": "fdedaf756e9eec43f745da5c3c4047d9f1cac9569f9236713238f69730435787",
    "result": [{
        "tx_hash": "697c41528c239fd869bd876513e2c9afd48d7e3caa9d3b35cf459df0f807b262"
    }, {
        "tx_hash": "057490809f6cf77c588aeab5416be313feb0a3e91bd8585e06c34b04e4af472d"
    }],
    "error": ""
}, {
    "script": "12eb49134d1eb488a080856a7bf2556f044dea82155f98d4c77559b0a41eb250",
    "result": [{
        "tx_hash": "1ae4a70085cfbea991e8d9175dd5b919c2610bbeedcc575627ea49d467adefba"
    }],
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |

## Get Confirmed Script History

This endpoint retrieves the history of confirmed transactions for a given script.

{% hint style="info" %}
Pagination is available using the provided `next-page` token.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/script/<scriptHash>/confirmed/history
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832/confirmed/history"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/script/aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3/confirmed/history"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "script": "0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832",
    "result": [{
        "tx_hash": "6cc9631ef3dad77eb0141134167f20469d0b4e61405de57fe6a9ac71b943bb9f",
        "height": 797518
    }],
    "error": ""
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "script": "aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3",
    "result": [{
        "tx_hash": "a41d03a56f9864f9aa75a380e14145bf21c2cdcfcad5769d1ab7e480fa93315e",
        "height": 896169
    }, {
        "tx_hash": "ec21f0c8616a93575e7f9f9dfdec83b1c39cf7e6e06f27646aa455e36f96e0ee",
        "height": 896188
    },
    ...
    ],
    "error": ""
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter         | Description                                                                                                               |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------- |
| chain             | Desired blockchain: `bsv` or `btc`.                                                                                       |
| network           | Selected network: `main` or `test`.                                                                                       |
| scriptHash        | Script hash: `Sha256` hash of the binary bytes of the locking script (`ScriptPubKey`), expressed as a hexadecimal string. |
| order             | Ordering: `asc` or `desc` (default).                                                                                      |
| limit (optional)  | Between `1` and `1000`; default is `100`.                                                                                 |
| height (optional) | Starting block height for history; default is `0`.                                                                        |
| token             | Provided `next-page` token.                                                                                               |

## Bulk Confirmed Script History

This endpoint retrieves the history of confirmed transactions for a given set of scripts.

{% hint style="info" %}

* Max 20 script hashes per request.
* Max 20 items returned per request.
  {% endhint %}

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/scripts/confirmed/history
```

{% endcode %}

{% code title="Request Data" %}

```json
{
    "scripts": [
        "<script>",
        "<script>",
        ...
    ]
}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/confirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [ \"8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8\", \"f5ee5d1753a33864040aee64c4103ef697116e28f66953a8b1369ac8d210b1d6\" ] }"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request POST "https://api.whatsonchain.com/v1/btc/main/scripts/confirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [ \"aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3\", \"0def09e897fd2ccf0317a6320521db9a149827cc654663466e6418619a3aa9ef\" ] }"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "script": "8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8",
    "result": [{
        "tx_hash": "d5f404cb61451034aaa19366054d26c2d30ffe475989d37dbc97c21ad9fbbf3c",
        "height": 826342
    }, {
        "tx_hash": "30d352353d7c0efb4ef17e869bc1bb780d6f2f3013e97f2dc4ec5b660643eff0",
        "height": 826342
    },
    ...
    ],
    "nextPageToken": "00000000de0000004c00000001000000400000003863613064323238303636636666663262376633316337646237373337313835626539643036666635633037323036623631663036643830613463646439613801180000000200000004000000000c9be604000000000057b6ebffffff0a46a1a48995f9b0f494c3b008eda3b5010000003900000001190000001400000001000000080000007d25cc5cb0235cc00101190000001400000001000000080000007d25cc5cb0235cc0010101000000ed4bed6135c0ae12f382dd544c57ef9a010000000000ffffffff000000000002",
    "error": ""
}, {
    "script": "f5ee5d1753a33864040aee64c4103ef697116e28f66953a8b1369ac8d210b1d6",
    "result": [{
        "tx_hash": "be2a95172191bb8a2dbe7c4215ea5bde2e1a96dad04d8f302650c00d6df033a1",
        "height": 826342
    }, {
        "tx_hash": "b0b095946d58891887a2f1274396427183e8c78be04116d28a6ff2d5b36d73e8",
        "height": 826342
    },
    ...
    ],
    "nextPageToken": "00000000de0000004c00000001000000400000006635656535643137353361333338363430343061656536346334313033656636393731313665323866363639353361386231333639616338643231306231643601180000000200000004000000000c9be60400000000005668ebffffff1343121f637efa8263cd9107bbdf029301000000390000000119000000140000000100000008000000dce928bd462018fb010119000000140000000100000008000000dce928bd462018fb010101000000ed4bed6135c0ae12f382dd544c57ef9a010000000000ffffffff000000000002",
    "error": ""
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "script": "aebd9e3018dbb5eed9220f275d3098dad2448fecd1c4c253d8c75a780bb08ce3",
    "result": [{
        "tx_hash": "e74bd31fcf4efeaea6ec32aab7d0af074ba51554352075555e0d0eb22a4eff07",
        "height": 898961
    }, {
        "tx_hash": "9b2ee6187970dbff1a696dd26297dcbc5e964e0b36145f3d1cf7ab0f204889e4",
        "height": 898841
    },
    ...
    ],
    "nextPageToken": "00000000de0000004c00000001000000400000006165626439653330313864626235656564393232306632373564333039386461643234343866656364316334633235336438633735613738306262303863653301180000000200000004000000000db79104000000000000ffebffffff6542ae3daaa4009867392cd8f52ab3a6010000003900000001190000001400000001000000080000008721a0afa4db0b3c0101190000001400000001000000080000008721a0afa4db0b3c010101000000164715117e017b366640b372f29546ae010000000000ffffffff000000000002",
    "error": ""
}, {
    "script": "0def09e897fd2ccf0317a6320521db9a149827cc654663466e6418619a3aa9ef",
    "result": [{
        "tx_hash": "5dc685c2eb98cacd5ea879b6ac40b666a4e89510982f65fa626525e91e05aa83",
        "height": 805111
    }, {
        "tx_hash": "c6a06fbc0936cc30f15869fe2be57a3d119b667d663af642763766d7db17e4e0",
        "height": 805111
    },
    ...
    ],
    "nextPageToken": "00000000de0000004c00000001000000400000003064656630396538393766643263636630333137613633323035323164623961313439383237636336353436363334363665363431383631396133616139656601180000000200000004000000000c48f70400000000000444ebffffffc74ee3c62e91b733e8f0f46aea0e488e01000000390000000119000000140000000100000008000000384f4f9c1b221a90010119000000140000000100000008000000384f4f9c1b221a90010101000000164715117e017b366640b372f29546ae010000000000ffffffff000000000002",
    "error": ""
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |


# Exchange Rate

## Get Exchange Rate

This endpoint provides the current exchange rate for the specified blockchain.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/<network>/exchangerate
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/exchangerate"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/exchangerate"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "rate": 27.055,
    "time": 1752257180,
    "currency": "USD"
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "rate": 117581.6,
    "time": 1752257200,
    "currency": "USD"
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

## Get Historical Exchange Rate

This endpoint provides the historical exchange rate data for the specified blockchain.&#x20;

Exchange rate data goes back to:

* `2018/11/19` for BSV.
* `2010/07/18` for BTC.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/exchangerate/historical?from=<unixtimestamp>&to=<unixtimestamp>
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/exchangerate/historical?from=1660139745&to=1660312545"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/exchangerate/historical?from=1660139745&to=1660312545"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "rate": 60.3905,
    "time": 1660089600
},{
    "rate": 62.661,
    "time": 1660176000
},{
    "rate": 62.9375,
    "time": 1660262400
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "rate": 23962.9,
    "time": 1660089600
},{
    "rate": 23935.3,
    "time": 1660176000
},{
    "rate": 24398.7,
    "time": 1660262400
}]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                                                             |
| --------- | ----------------------------------------------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`.                                     |
| from      | The starting date (`unixtimestamp`) to retrieve the exchange rate data. |
| to        | The end date (`unixtimestamp`) to retrieve the exchange rate data.      |


# Search

## Get Explorer Links

This endpoint identifies whether the posted query string is a `block hash`, `txid`, or `address`, and responds with WoC links. Ideal for extending customized search in apps.

{% code title="HTTP Request" %}

```
POST https://api.whatsonchain.com/v1/<chain>/<network>/search/links
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl -X POST https://api.whatsonchain.com/v1/bsv/main/search/links   -H 'Content-Type: application/json' -d '{    "query": "1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl -X POST https://api.whatsonchain.com/v1/btc/main/search/links   -H 'Content-Type: application/json' -d '{    "query": "bc1q89zqat5x9cye7v2uwun2ds7980p25n02g7g90w"}'
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "results": [{
        "type": "address",
        "url": "https://whatsonchain.com/address/1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H"
    }]
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "results": [{
        "type": "address",
        "url": "https://btc.whatsonchain.com/address/1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H"
    }]
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| network   | Selected network: `main` or `test`. |

**Request Parameters**

| Parameter | Description           |
| --------- | --------------------- |
| query     | The string to search. |


# WoC Widgets

Right now, this functionality is BSV-only.

You can embed aspects of the WhatsOnChain *Home*, *Transaction*, or *Block* pages in any application.

Go to the URL - [WhatsOnChain.com](https://WhatsOnChain.com),  Click the **TOOLS** menu, and there you can find the **Widget Creator**.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FXbF8JxLWUD9SgHKrTUHt%2Fimage.png?alt=media&amp;token=db9237f9-52c8-4116-8c0e-51325fa15a87" alt=""><figcaption></figcaption></figure>

You can use the **Widget Creator** tool to toggle sections of the selected page and can immediately see what it will look like in the preview section.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2F2L8LpxUk4TwIKVZKXWeH%2Fimage.png?alt=media&amp;token=a109f2d3-e0e5-42ee-98a8-b2d3132e59c3" alt=""><figcaption></figcaption></figure>

Based on the selected options, a URL and the HTML code are generated for the integration into any website or application.

![](https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FuOyh8ISc0iIymWQA8qG8%2Fimage.png?alt=media\&token=cab2128b-5b18-4017-bd22-f5f0e4d92bf7)


# WoC Plugins

It is our goal to make it easier for anyone to provide metadata or showcase the on-chain data. We believe that by empowering the community, we will continue to unlock another aspect of the boundless potential of blockchain.

To facilitate this, we have provided the ability to create and publish plugins. The plugins feature allows anyone to add more context or provide a different view/UI for transactions, blocks, addresses, `OP_RETURN` data, or user's searched terms.

To create a new plugin or see the existing plugins, navigate to the [WhatsOnChain.com](https://whatsonchain.com/) "Plugins" Menu and then on "Manage Plugins"

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FWkqrmmBw3EHZAYjxfZsi%2Fimage.png?alt=media&amp;token=b2b29db3-06ac-40ea-b790-9c50a0fbc0f7" alt="" width="275"><figcaption></figcaption></figure>

On the Manage Plugins page, click on the "Lab" tab and fill in the required plugin details.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2F3yAzmhB5BPGY55uBbEOU%2Fimage.png?alt=media&amp;token=2963d091-f861-4f45-b284-65fd46c1456c" alt=""><figcaption></figcaption></figure>

Below is the list and purpose of different plugin types. And here you can find a [GitHub repo of example plugins](https://github.com/TAAL-GmbH/woc-plugins-example).

**Data:** You can create this Plugin type to decode and display the OP\_RETURN output. The response provided by the plugin's webhook will be rendered when a user tries to decode the OP\_RETURN data on the transactions page.

**Block:** This type of plugin can be used to share any metadata/stats for a given block. Appears as a new tab on the block page with the data provided by the plugin's webhook.

**Address:** This type of plugin can be used to share any metadata/stats for a given address. Appears as a new tab on the address page with the data provided by the plugin's webhook.

**Transaction:** This type of plugin can be used to share any metadata/stats for a given transaction. Appears as a new tab on the transaction page with the data provided by the plugin's webhook.

**Script:** This type of plugin can be used to share any metadata/stats for a given scripthash. Appears as a new tab on the scripthash page with the data provided by the plugin's webhook.

**Search engine:** If you are interested in sharing data from your specialized indexer, use this plugin type to help users search your indexed data when they search anything on whatsonchain.com via the search bar.

Don't forget to press "Save" after providing the required plugin details.

To Edit, Delete or Publish a plugin, click on the menu option next to the plugin name.

![Publish Plugin](https://developers-stage.whatsonchain.com/images/plugin_options-2252a0c8.png)

When a new plugin is created or is in the development phase, it is listed in the "Lab" tab. Plugins listed in the "Lab" are not available publicly and the plugin data is saved locally in the browser's local storage.

All the published plugins are listed under the "Plugins" section.

If you have any questions, please free free to ask via the [WoC devs telegram channel.](https://t.me/joinchat/FfE6-EjZhoTHwhDhZH6F-w)


# On-Chain Data

## Get OP\_RETURN Data by Transaction ID (BSV-only) <a href="#get-op_return-data-by-tx-hash" id="get-op_return-data-by-tx-hash"></a>

This endpoint returns `OP_RETURN` data as hex for each output in the transaction.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<txid>/opreturn
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/tx/46c5495468b68248b69e55aa76a6b9ca1cb343bee9477c9c121358380e421ff3/opreturn"
```

{% endcode %}

{% code title="Example Response" %}

```json
[{
    "n": 2,
    "hex": "006a075354554b2e434f"
}]
```

{% endcode %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |


# Output Tags

WhatsOnChain tags recognized transaction outputs in every block. We also provide basic block stats around those tags, both in the [API](/core-products/whatsonchain/stats#get-tag-count-by-height) and on the [Explorer website](https://whatsonchain.com/tag-stats).

If you want your transaction outputs to be tagged, please reach out to us over [email](mailto:info@taal.com) or in our [Telegram channel](https://t.me/joinchat/FfE6-EjZhoTHwhDhZH6F-w) with these details:

* IDs of a few example transactions;
* Any pattern that could be used to detect your transactions with enough precision;
* Name of the protocol used for the data/script (if any);
* Brand colors, for tag background and tag text;
* The logo file.

Optional:

* A link to the webpage for your app, protocol, or token.
* A short description of your app, protocol, or token.

After we've received this information, we can go ahead and add the new tag to our system, which should be available from then on.


# Stats

## Get Block Stats by Height

This endpoint retrieves the block stats for a given height.&#x20;

* Exchange rate information is not available for blocks processed before:
  * *`2018/11/19`* for BSV.
  * *`2010/07/18`* for BTC.
* Unidentified block miners are tagged as an empty string.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/block/height/<height>/stats
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/height/698730/stats"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/height/698730/stats"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "hash": "000000000000000002799ba826646d0060b06779e7bde9622145b410f114c1fb",
    "tx_count": 7088,
    "height": 698730,
    "version": 939515904,
    "version_hex": "37ffe000",
    "merkle_root": "58f529bbf8319340ee299a7b577177ca877ba3ecc2a4e8ef231ccd6387e9dbe6",
    "time": 1627996871,
    "median_time": 1627993031,
    "nonce": 111084755,
    "bits": "181112b7",
    "difficulty": 64399232575.38872,
    "chainwork": "0000000000000000000000000000000000000000012ef34e8452b98b968b3134",
    "miner_tag": "qdlnk",
    "total_fee": 9868209,
    "total_fee_usd": 13.628983449900002,
    "total_out": 58639450178,
    "avg_fee": 1392,
    "avg_fee_usd": 0.0019224912000000002,
    "median_fee": 175,
    "median_fee_usd": 0.00024169250000000004,
    "input_count": 16930,
    "output_count": 19002,
    "total_out_usd": 80986.9446408358,
    "subsidy": 625000000,
    "subsidy_usd": 863.1875000000001,
    "reward": 634868209,
    "reward_usd": 876.8164834499001,
    "coinbase": "036aa90a2f71646c6e6b2ff3d24370c50084e8887a0100",
    "size": 17444558,
    "exchange_rate": {
        "rate": 138.11,
        "time": 1627948800
    },
    "min_tx_size": 190,
    "max_tx_size": 1151375,
    "median_tx_size": 313,
    "avg_tx_size": 2461,
    "cdd_total": 200.48376520212884
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "hash": "0000000000000000000a04cdff683678eb8c8cd62b56aed5418d779c322621a3",
    "tx_count": 2165,
    "height": 698730,
    "version": 939515908,
    "version_hex": "37ffe004",
    "merkle_root": "8bb0fd825e89d8af9231b5a667bd492f581d5404eeb771925354ae25c7de5620",
    "time": 1630606067,
    "median_time": 1630603713,
    "nonce": 1740888747,
    "bits": "170ffaa0",
    "difficulty": 17615033039278.88,
    "chainwork": "0000000000000000000000000000000000000000211d176a2da1d7170a5c7106",
    "miner_tag": "Braiins Pool",
    "total_fee": 12150237,
    "total_fee_usd": 5986.9442300910005,
    "total_out": 256922954942,
    "avg_fee": 5614,
    "avg_fee_usd": 2.766259202,
    "median_fee": 1565,
    "median_fee_usd": 0.771142795,
    "input_count": 6848,
    "output_count": 5676,
    "total_out_usd": 126596987.58698592,
    "subsidy": 625000000,
    "subsidy_usd": 307964.375,
    "reward": 637150237,
    "reward_usd": 313951.319230091,
    "coinbase": "036aa90afabe6d6d5a8485ec362d8087a524e5e2edf60a40dfa9cceefae429a37eb0c92395c5414601000000000000000a6507008d6a4f79fd2500000000009389b5b1182f736c7573682f",
    "size": 1310274,
    "exchange_rate": {
        "rate": 49274.3,
        "time": 1630540800
    },
    "min_tx_size": 188,
    "max_tx_size": 102754,
    "median_tx_size": 225,
    "avg_tx_size": 605,
    "cdd_total": 4622.627489398172
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| height    | Block height.                       |

## Get Block Stats by Hash

This endpoint retrieves the block stats for a given hash.&#x20;

{% hint style="info" %}

* Exchange rate information is not available for blocks processed before:
  * *`2018/11/19`* for BSV.
  * *`2010/07/18`* for BTC.
* Unidentified block miners are tagged as an empty string.
  {% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/block/hash/<hash>/stats
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/hash/000000000000000002799ba826646d0060b06779e7bde9622145b410f114c1fb/stats"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/hash/0000000000000000000a04cdff683678eb8c8cd62b56aed5418d779c322621a3/stats"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "hash": "000000000000000002799ba826646d0060b06779e7bde9622145b410f114c1fb",
    "tx_count": 7088,
    "height": 698730,
    "version": 939515904,
    "version_hex": "37ffe000",
    "merkle_root": "58f529bbf8319340ee299a7b577177ca877ba3ecc2a4e8ef231ccd6387e9dbe6",
    "time": 1627996871,
    "median_time": 1627993031,
    "nonce": 111084755,
    "bits": "181112b7",
    "difficulty": 64399232575.38872,
    "chainwork": "0000000000000000000000000000000000000000012ef34e8452b98b968b3134",
    "miner_tag": "qdlnk",
    "total_fee": 9868209,
    "total_fee_usd": 13.628983449900002,
    "total_out": 58639450178,
    "avg_fee": 1392,
    "avg_fee_usd": 0.0019224912000000002,
    "median_fee": 175,
    "median_fee_usd": 0.00024169250000000004,
    "input_count": 16930,
    "output_count": 19002,
    "total_out_usd": 80986.9446408358,
    "subsidy": 625000000,
    "subsidy_usd": 863.1875000000001,
    "reward": 634868209,
    "reward_usd": 876.8164834499001,
    "coinbase": "036aa90a2f71646c6e6b2ff3d24370c50084e8887a0100",
    "size": 17444558,
    "exchange_rate": {
        "rate": 138.11,
        "time": 1627948800
    },
    "min_tx_size": 190,
    "max_tx_size": 1151375,
    "median_tx_size": 313,
    "avg_tx_size": 2461,
    "cdd_total": 200.48376520212884
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "hash": "0000000000000000000a04cdff683678eb8c8cd62b56aed5418d779c322621a3",
    "tx_count": 2165,
    "height": 698730,
    "version": 939515908,
    "version_hex": "37ffe004",
    "merkle_root": "8bb0fd825e89d8af9231b5a667bd492f581d5404eeb771925354ae25c7de5620",
    "time": 1630606067,
    "median_time": 1630603713,
    "nonce": 1740888747,
    "bits": "170ffaa0",
    "difficulty": 17615033039278.88,
    "chainwork": "0000000000000000000000000000000000000000211d176a2da1d7170a5c7106",
    "miner_tag": "Braiins Pool",
    "total_fee": 12150237,
    "total_fee_usd": 5986.9442300910005,
    "total_out": 256922954942,
    "avg_fee": 5614,
    "avg_fee_usd": 2.766259202,
    "median_fee": 1565,
    "median_fee_usd": 0.771142795,
    "input_count": 6848,
    "output_count": 5676,
    "total_out_usd": 126596987.58698592,
    "subsidy": 625000000,
    "subsidy_usd": 307964.375,
    "reward": 637150237,
    "reward_usd": 313951.319230091,
    "coinbase": "036aa90afabe6d6d5a8485ec362d8087a524e5e2edf60a40dfa9cceefae429a37eb0c92395c5414601000000000000000a6507008d6a4f79fd2500000000009389b5b1182f736c7573682f",
    "size": 1310274,
    "exchange_rate": {
        "rate": 49274.3,
        "time": 1630540800
    },
    "min_tx_size": 188,
    "max_tx_size": 102754,
    "median_tx_size": 225,
    "avg_tx_size": 605,
    "cdd_total": 4622.627489398172
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| hash      | Block hash.                         |

## Get Miner Block Stats

This endpoint retrieves the miner block stats for a specified number of days.&#x20;

{% hint style="info" %}
Unidentified block miners are tagged as an empty string.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/miner/blocks/stats?days={days}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/miner/blocks/stats?days=1"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/miner/blocks/stats?days=1"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "header": {
        "size": 122926,
        "height": 904971,
        "time": 1752184082
    },
    "stats": {
        "total_size": 122926,
        "total_fee": 1341
    },
    "details": {
        "miner_tag": "SA100"
    }
}, {
    "header": {
        "size": 526989,
        "height": 904972,
        "time": 1752184167
    },
    "stats": {
        "total_size": 526989,
        "total_fee": 17769
    },
    "details": {
        "miner_tag": "qdlnk"
    }
},
...
]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "header": {
        "size": 1609339,
        "height": 904982,
        "time": 1752185033
    },
    "stats": {
        "total_size": 1609339,
        "total_fee": 5703865
    },
    "details": {
        "miner_tag": "Foundry USA"
    }
}, {
    "header": {
        "size": 1531032,
        "height": 904983,
        "time": 1752185066
    },
    "stats": {
        "total_size": 1531032,
        "total_fee": 2141792
    },
    "details": {
        "miner_tag": "Foundry USA"
    }
},
...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                                                                         |
| --------- | ----------------------------------------------------------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`.                                                 |
| days      | The number of days to retrieve the data for. Only `1` or `30` days can be selected. |

## Get Miner Minimum Fee Rate Stats

This endpoint retrieves the miner minimum fee rate stats for a specified time period.&#x20;

{% hint style="info" %}
Minimum fee rate is in `sat/KB`.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/miner/fees?from={from}&to={to}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/miner/fees?from=1714608000&to=1714653060"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/miner/fees?from=1714608000&to=1714653060"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "miner": "taal.com",
    "min_fee_rate": 1
},{
    "miner": "CUVVE",
    "min_fee_rate": 1.0003060717198577
},{
    "miner": "GorillaPool.com 🦍",
    "min_fee_rate": 1.001001001001001
},{
    "miner": "qdlnk",
    "min_fee_rate": 1.0001427259380782
}]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "miner": "Binance Pool",
    "min_fee_rate": 1471.6703458425313
},{
    "miner": "F2Pool",
    "min_fee_rate": 2.7438016528925617
},{
    "miner": "Others",
    "min_fee_rate": 635.6877323420075
},{
    "miner": "MARA Pool",
    "min_fee_rate": 2038.4615384615383
},
...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| from      | Starting from as `Unix timestamp`.  |
| to        | Until to as `Unix timestamp`.       |

## Get Miner **Summary** Stats

This endpoint retrieves the miner summary stats for specified number of days.

{% hint style="info" %}
Unidentified block miners are tagged as an empty string.
{% endhint %}

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/miner/summary/stats?days={days}
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/miner/summary/stats?days=90"
```

{% endtab %}

{% tab title="BTC" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/miner/summary/stats?days=90"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
[{
    "period": 1744416000,
    "stats": {
        "CUVVE": {
            "count": 38,
            "header": {
                "size": 2257161430
            },
            "stats": {
                "total_size": 2257161430,
                "total_fee": 6589515
            }
        },
        "GorillaPool.com 🦍": {
            "count": 4,
            "header": {
                "size": 86653775
            },
            "stats": {
                "total_size": 86653775,
                "total_fee": 333117
            }
        },
        "Mining-Dutch": {
            "count": 1,
            "header": {
                "size": 14891083
            },
            "stats": {
                "total_size": 14891083,
                "total_fee": 181009
            }
        },
        "SA100": {
            "count": 18,
            "header": {
                "size": 730803192
            },
            "stats": {
                "total_size": 730803192,
                "total_fee": 2836590
            }
        },
        ...
    }
},
...
]
```

{% endtab %}

{% tab title="BTC" %}

```json
[{
    "period": 1744416000,
    "stats": {
        "": {
            "count": 7,
            "header": {
                "size": 9682966
            },
            "stats": {
                "total_size": 9682966,
                "total_fee": 35303459
            }
        },
        "AntPool": {
            "count": 27,
            "header": {
                "size": 35183506
            },
            "stats": {
                "total_size": 35183506,
                "total_fee": 87763130
            }
        },
        "Binance Pool": {
            "count": 5,
            "header": {
                "size": 7744328
            },
            "stats": {
                "total_size": 7744328,
                "total_fee": 20838766
            }
        },
        "CloverPool": {
            "count": 4,
            "header": {
                "size": 6619483
            },
            "stats": {
                "total_size": 6619483,
                "total_fee": 19247812
            }
        },
        ...
    }
},
...
]
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                                                                           |
| --------- | ------------------------------------------------------------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`.                                                   |
| days      | The number of days to retrieve the data for. Only `90` or `365` days can be selected. |

## Get **Tag Count by Height**

This endpoint retrieves stats on tag count for a specific block at a given height.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/<chain>/main/block/tagcount/height/{height}/stats
```

{% endcode %}

#### Example Request

{% tabs %}
{% tab title="BSV" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/tagcount/height/762291/stats"
```

{% endtab %}

{% tab title="BTC cURL" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/btc/main/block/tagcount/height/762291/stats"
```

{% endtab %}
{% endtabs %}

#### Example Response

{% tabs %}
{% tab title="BSV" %}

```json
{
    "count": 9128,
    "results": [{
        "name": "certihash",
        "count": 5588
    }, {
        "name": "my2cents",
        "count": 2320
    }, {
        "name": "run#cryptofights",
        "count": 709
    }, {
        "name": "OP_RETURN",
        "count": 144
    }, 
    ...
    ]
}
```

{% endtab %}

{% tab title="BTC" %}

```json
{
    "count": 1489,
    "results": [{
        "name": "stacks",
        "count": 6
    }, {
        "name": "nonstandard",
        "count": 1479
    }, {
        "name": "OP_RETURN",
        "count": 4
    }]
}
```

{% endtab %}
{% endtabs %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| chain     | Desired blockchain: `bsv` or `btc`. |
| height    | Block height.                       |


# WebSockets

Use WoC Sockets to stream chain stats, mempool transactions, block headers, and more! The [V2 API](/core-products/whatsonchain/websockets/woc-sockets-v2-beta) is available in Beta, and the V1 is deprecated.

If your application needs customized/filtered events via WebSockets, please let us know in the [WoC devs Telegram channel.](https://t.me/joinchat/FfE6-EjZhoTHwhDhZH6F-w)


# WoC Sockets V1 (Deprecated)

This API is deprecated, please use the V2 going forward.

We recommend the centrifuge websocket client side libraries below:

* [centrifuge-js](https://github.com/centrifugal/centrifuge-js) – for a browser, NodeJS and React Native
* [centrifuge-go](https://github.com/centrifugal/centrifuge-go) - for Go language
* [centrifuge-mobile](https://github.com/centrifugal/centrifuge-mobile) - for iOS/Android with `centrifuge-go` as basis and [gomobile](https://github.com/golang/mobile)
* [centrifuge-dart](https://github.com/centrifugal/centrifuge-dart) - for Dart and Flutter
* [centrifuge-swift](https://github.com/centrifugal/centrifuge-swift) – for native iOS development
* [centrifuge-java](https://github.com/centrifugal/centrifuge-java) – for native Android development and general Java

Non-centrifuge clients connect to separate endpoints specified in each section.

The supported networks are:

* Mainnet
* Testnet

{% code title="Example using centrifuge client:" %}

```html
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/centrifugal/centrifuge-js@latest/dist/centrifuge.min.js"></script>
    <script type="text/javascript">
    $(function () {
        const centrifuge = new Centrifuge('wss://socket.whatsonchain.com/blockheaders');

        centrifuge.on('publish', function(message) {
              console.log('Data: '+   JSON.stringify(message.data, null, 2))
        });

        centrifuge.on('disconnect', function(ctx){
            console.log('Disconnected: ' + ctx.reason + (ctx.reconnect?", will try to reconnect":", won't try to reconnect"));
        });

        centrifuge.on('connect', function(ctx){
            console.log('Connected with client ID ' + ctx.client + ' over ' + ctx.transport );
        });

        centrifuge.connect();
    });
    </script>
```

{% endcode %}

{% code title="Example using websocket API client" %}

```html
    <script type="text/javascript">
        window.addEventListener('load', function() {
            let clientID;
            let reconnect = true;
            let numFailures = 0;

            function connect() {
                // Subscribe to multiple channels
                const ws = new WebSocket('wss://socket.whatsonchain.com/websocket?channels=woc:chainStats');
                ws.onopen = function(e) {
                    numFailures = 0;
                    console.log("websocket: connection open",e);
                    // This is required to trigger connect on server side.
                 ws.send(JSON.stringify({}));
                };

                ws.onerror = function(e) {
                    numFailures++;
                    console.log("websocket: connection error: ", e);
                };

                ws.onclose = function (e) {
                    if (!reconnect) {
                        return;
                    }
                    setTimeout(function () {
                        console.log("websocket: connection reconnecting");
                        connect();
                    }, Math.min(numFailures * 1000, 20000));
                }

                ws.onmessage = function(e) {
                    console.log("websocket: new message");
                    processData(e.data);
                };
            }

            connect();

            function processData(rawData) {
                if (rawData.length === 0) {
                    console.log("--> ping");
                    return
                }
                console.log("--> " + rawData);
                const data = JSON.parse(rawData);
                const pushType = data.type || 0;
                switch (pushType) {
                    case 0:
                        console.log("new data from a channel " + data.channel + ": " + JSON.stringify(data.data));
                        break;
                    case 6:
                        clientID = data.data.client;
                        let subscriptions = [];
                        const subs = data.data.subs;
                        if (subs) {
                            for (const m in subs) {
                                if (subs.hasOwnProperty(m)) {
                                    subscriptions.push(m);
                                }
                            }
                        }
                        console.log("connected with client ID " + clientID + " and subscriptions: " + JSON.stringify(subscriptions));
                        break;
                    case 7:
                        clientID = null;
                        if (!data.data.reconnect) {
                            reconnect = false;
                            ws.close();
                            console.log("disconnected from a server, won't reconnect");
                        } else {
                            console.log("disconnected from a server, will reconnect");
                        }
                        break;
                    case 3:
                    console.log("unsubscribed from a channel " + data.channel);
                        break;
                    case 5:
                    console.log("subscribed to a channel " + data.channel);
                        break;
                    default:
                    console.log("unsupported push type " + data.type);
                }
            }

        });
    </script>
```

{% endcode %}

## New Block Header Event

Receive new block header events in real time.

**URL s**

* Mainnet: `wss://socket.whatsonchain.com/websocket?channels=woc:blockHeader`
* Testnet: `wss://socket-testnet.whatsonchain.com/websocket?channels=woc:blockHeader`

**URLs - for centrifuge clients**

* Mainnet: `wss://socket.whatsonchain.com/blockheaders`
* Testnet: `wss://socket-testnet.whatsonchain.com/blockheaders`

{% code title="Example Response" %}

```json
{
  "hash": "0000000000000000010cb155a44577ff3541940ec4355c026dc2706fb7e261d6",
  "confirmations": 4,
  "size": 1229956,
  "height": 676421,
  "version": 541065216,
  "versionHex": "20400000",
  "merkleroot": "e2f64e87c0362314b65dc28b4367c41d904c22b891b652951779336ef735386b",
  "txcount": 654,
  "time": 1614534798,
  "mediantime": 1614527058,
  "nonce": 610133701,
  "bits": "180d359d",
  "difficulty": 83235621087.7299,
  "chainwork": "00000000000000000000000000000000000000000127d3854a414d8ec8f53190",
  "previousblockhash": "00000000000000000428ca33597675bd85f5a2ef464ba25e4db7b4a74d898d33",
  "nextblockhash": "00000000000000000cb40c1d850dece5cd3747e08a1e4066ef887251388c4ae6",
  "coinbaseTx": {
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff410345520a2f7461616c2e636f6d2f506c656173652070617920302e3520736174732f627974652c20696e666f407461616c2e636f6d6eead6b0ad91f2ce86be0400ffffffff0176674325000000001976a9148e9170be3f733a9773c907517fb9b786f1c884c688ac00000000",
    "txid": "13686a10870d23b4c94642bf0b78d6630e2640fc0de83bc30af835d96bb17482",
    "hash": "13686a10870d23b4c94642bf0b78d6630e2640fc0de83bc30af835d96bb17482",
    "size": 150,
    "version": 1,
    "locktime": 0,
    "vin": [
      {
        "coinbase": "0345520a2f7461616c2e636f6d2f506c656173652070617920302e3520736174732f627974652c20696e666f407461616c2e636f6d6eead6b0ad91f2ce86be0400",
        "sequence": 4294967295
      }
    ],
    "vout": [
      {
        "value": 6.2517439,
        "n": 0,
        "scriptPubKey": {
          "asm": "OP_DUP OP_HASH160 8e9170be3f733a9773c907517fb9b786f1c884c6 OP_EQUALVERIFY OP_CHECKSIG",
          "hex": "76a9148e9170be3f733a9773c907517fb9b786f1c884c688ac",
          "reqSigs": 1,
          "type": "pubkeyhash",
          "addresses": [
            "1DzqBck9oyCBzxJbbje2s15deZis6BeATi"
          ],
          "isTruncated": false
        }
      }
    ],
    "blockhash": "0000000000000000010cb155a44577ff3541940ec4355c026dc2706fb7e261d6",
    "confirmations": 4,
    "time": 1614534798,
    "blocktime": 1614534798
  }
}
```

{% endcode %}

## Block Headers History

Stream block headers starting at a pre-specified block height.

**URLs**

* Mainnet: `wss://socket.whatsonchain.com/websocket/history?from=<blockHeight>`
* Testnet: `wss://socket-testnet.whatsonchain.com/websocket/history?from=<blockHeight>`

**URLs - for centrifuge clients**

* Mainnet: `wss://socket.whatsonchain.com/blockheaders/history?from=<blockHeight>`
* Testnet: `wss://socket-testnet.whatsonchain.com/blockheaders/history?from=<blockHeight>`

{% code title="Example Response" %}

```json
{
  "hash": "000000000000000007dde2992ff13fdaba5473341af1c45d0c19c86deb4c732a",
  "confirmations": 1,
  "size": 3449218,
  "height": 676417,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "df1fe3b56cacd2f4063fbe41d15b51071c72d5748d265f4e61793db79ce0d8ff",
  "txcount": 8859,
  "time": 1614529458,
  "mediantime": 1614524118,
  "nonce": 347880361,
  "bits": "180d6633",
  "difficulty": 82056657294.07133,
  "chainwork": "00000000000000000000000000000000000000000127d3376e97bb73257c98c5",
  "previousblockhash": "00000000000000000b04692ac2bf62654e2ea577476e20ea74eb9e5b53f0ed48",
  "nextblockhash": ""
}
```

{% endcode %}

## Block Transactions

Stream transactions from a block height and transaction index.

* *hex*, *vin* and *vout* values are not published for message sizes greater than 10MB. Recommended to fetch details for such transactions using the REST endpoints using the published txid value.

**URLs**

* Mainnet: `wss://socket.whatsonchain.com/websocket/transactions?from=<blockHeight>&txIndex={txIndex}&to=<blockHeight>&format={hex|json}`
* Testnet: `wss://socket-testnet.whatsonchain.com/websocket/transactions?from=<blockHeight>&txIndex={txIndex}&to=<blockHeight>&format={hex|json}`

**URLs - for centrifuge clients**

* Mainnet: `wss://socket.whatsonchain.com/block/transactions?from=<blockHeight>&txIndex={txIndex}&to=<blockHeight>&format={hex|json}`
* Testnet: `wss://socket-testnet.whatsonchain.com/block/transactions?from=<blockHeight>&txIndex={txIndex}&to=<blockHeight>&format={hex|json}`

{% code title="Example Response" %}

```json
{
  "txid": "20ac30f5aa6aebc0f9e532f32a9691bf7faa332c755d6aea1fd3f6ba36d195e8",
  "hash": "20ac30f5aa6aebc0f9e532f32a9691bf7faa332c755d6aea1fd3f6ba36d195e8",
  "size": 219,
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "txid": "15b416adf871f9285788ebf36b67714d9e49f413f3a3f083d80e01535bd40433",
      "vout": 1,
      "scriptSig": {
        "asm": "304402204ac1d9f22f09044f66aa6055835b19d5617c19ef180422683b9d168da272e40d022078d3e876f7134eb29cd9e26081feae70f393a1aa3e9926307233f1c419bd1eb641 02a3089907380f086e9d5616ef6e62876a2777ea0c5abca785b15ef92d173afdff",
        "hex": "47304402204ac1d9f22f09044f66aa6055835b19d5617c19ef180422683b9d168da272e40d022078d3e876f7134eb29cd9e26081feae70f393a1aa3e9926307233f1c419bd1eb6412102a3089907380f086e9d5616ef6e62876a2777ea0c5abca785b15ef92d173afdff"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_FALSE OP_RETURN 39366665313633626131303138386636",
        "hex": "006a1039366665313633626131303138386636",
        "type": "nulldata",
        "isTruncated": false
      }
    },
    {
      "value": 0.00007511,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 966a0c69734d51307ba0bcfcd9092b51addfaf78 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914966a0c69734d51307ba0bcfcd9092b51addfaf7888ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1EiKQ9qiAkjDn86JvUt6aJpZvETq8uim2D"
        ],
        "isTruncated": false
      }
    }
  ]
}
```

{% endcode %}

**URL  Parameters**

| Parameter   | Description                                                                                                                |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- |
| blockHeight | Block height.                                                                                                              |
| txIndex     | Index of a transaction as a starting point in the first block to deliver. Default value `0`.                               |
| format      | `Hex` or `json` (default). If `hex`, the response will include transaction hex and metadata. If `json`, `hex` is excluded. |

## Mempool Transactions

Receive mempool transactions in real time.

* Mempool transactions are collected from multiple nodes.
* Client side should be idempotent because duplicate transaction events are not guaranteed to have been removed.
* *hex*, *vin* and *vout* values are not published for message sizes greater than 10MB. Recommended to fetch details for such transactions using the  REST endpoints using the published txid value.

**URLs**

* Mainnet: `wss://socket.whatsonchain.com/websocket?channels=woc:mempoolTx?filter=<filter1,filter2,...>`
* Testnet: `wss://socket-testnet.whatsonchain.com/websocket?channels=woc:mempoolTx?filter=<filter1,filter2,...>`

**URLs - for centrifuge clients**

* Mainnet: `wss://socket.whatsonchain.com/mempool?filter=<filter1,filter2,...>`
* Testnet: `wss://socket-testnet.whatsonchain.com/mempool?filter=<filter1,filter2,...>`

{% code title="Example Response" %}

```json
{
  "hex": "02 ...",
  "txid": "20ac30f5aa6aebc0f9e532f32a9691bf7faa332c755d6aea1fd3f6ba36d195e8",
  "hash": "20ac30f5aa6aebc0f9e532f32a9691bf7faa332c755d6aea1fd3f6ba36d195e8",
  "size": 219,
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "txid": "15b416adf871f9285788ebf36b67714d9e49f413f3a3f083d80e01535bd40433",
      "vout": 1,
      "scriptSig": {
        "asm": "304402204ac1d9f22f09044f66aa6055835b19d5617c19ef180422683b9d168da272e40d022078d3e876f7134eb29cd9e26081feae70f393a1aa3e9926307233f1c419bd1eb641 02a3089907380f086e9d5616ef6e62876a2777ea0c5abca785b15ef92d173afdff",
        "hex": "47304402204ac1d9f22f09044f66aa6055835b19d5617c19ef180422683b9d168da272e40d022078d3e876f7134eb29cd9e26081feae70f393a1aa3e9926307233f1c419bd1eb6412102a3089907380f086e9d5616ef6e62876a2777ea0c5abca785b15ef92d173afdff"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_FALSE OP_RETURN 39366665313633626131303138386636",
        "hex": "006a1039366665313633626131303138386636",
        "type": "nulldata",
        "isTruncated": false
      }
    },
    {
      "value": 0.00007511,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 966a0c69734d51307ba0bcfcd9092b51addfaf78 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914966a0c69734d51307ba0bcfcd9092b51addfaf7888ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1EiKQ9qiAkjDn86JvUt6aJpZvETq8uim2D"
        ],
        "isTruncated": false
      }
    }
  ]
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                                                                                                                                                     |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filter    | The filter transactions based on the output (*vout*) types. The available filters are: `nulldata`*,* `multisig`*,* `pubkey`*,* `pubkeyhash`*,* `scripthash`, and `nonstandard`. |

## Chain Stats

Receive common chain stats every 10 seconds.

**URLs**

* Mainnet: `wss://socket.whatsonchain.com/websocket?channels=woc:chainStats`
* Testnet: `wss://socket-testnet.whatsonchain.com/websocket?channels=woc:chainStats`

**URLs - for centrifuge clients**

* Mainnet: `wss://socket.whatsonchain.com/stats`
* Testnet: `wss://socket-testnet.whatsonchain.com/stats`

{% code title="Example Response" %}

```json
{
   "chainSummary":{
      "blocks":691040,
      "bestblockhash":"000000000000000006f693315876096d472a8313780df342905e1003a6cf0b70",
      "difficulty":102522924402.0986,
      "chainwork":"0000000000000000000000000000000000000000012cfa97321f921dab48da26",
      "networkhashps":650555175336335400,
      "circulatingSupply":18756500,
      "mempoolSize":6554,
      "mempoolBytes":16540861,
      "mempoolUsage":26650576,
      "exchangeRate":{
         "currency":"USD",
         "rate":"170.70749999999998"
      }
   },
   "latestBlocks":[
      {
         "hash":"000000000000000006f693315876096d472a8313780df342905e1003a6cf0b70",
         "confirmations":1,
         "size":208141,
         "height":691040,
         "version":538968064,
         "versionHex":"20200000",
         "merkleroot":"e3454f52b6715dcf4db5d8c8f237344ef6bd6d415d6e754a3b4b1083cd3ab48c",
         "txcount":102,
         "time":1623330613,
         "mediantime":1623328816,
         "nonce":3022302528,
         "bits":"180ab971",
         "difficulty":102522924402.0986,
         "chainwork":"0000000000000000000000000000000000000000012cfa97321f921dab48da26",
         "previousblockhash":"0000000000000000013ab5705e150967a057f807f396628231a7ceaa11a0bac1",
         "nextblockhash":"",
         "coinbaseTx":{...},
         "totalFees":0.0009790499999997593
      },
      {...},
      ...
   ]
}
```

{% endcode %}


# WoC Sockets V2 (Beta)

{% code title="Example using WebSocket API client" %}

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>WOC Socket V2 - blockheaders (JSON format)</title>
  <script type="text/javascript">
    window.addEventListener('load', function() {
      const wsUrl = "wss://socket-v2.whatsonchain.com/websocket/blockheaders?format=json";
      let ws;
      let pingInterval;

      function doConnect() {
        console.log("[SocketV2] Connecting ->", wsUrl);
        ws = new WebSocket(wsUrl);

        ws.onopen = function(e) {
          console.log("[SocketV2] OPEN:", wsUrl, e);

          pingInterval = setInterval(() => {
            if (ws && ws.readyState === WebSocket.OPEN) {
              console.log("[SocketV2] Sending ping to server");
              ws.send('ping'); // Send ping as text message
            }
          }, 25000);
        };

        ws.onerror = function(e) {
          console.warn("[SocketV2] ERROR event – possibly normal if server closes. URL:", wsUrl);
        };

        ws.onclose = function(e) {
          console.log("[SocketV2] CLOSE:", wsUrl, e);

          // Clear ping interval when connection closes
          if (pingInterval) {
            clearInterval(pingInterval);
            pingInterval = null;
          }
        };

        ws.onmessage = async function(e) {
          if (!e.data) {
            console.log("[SocketV2] PING or empty message ->", wsUrl);
            return;
          }

          const blob = e.data;
          if (blob && blob.size > 0) {
            try {
              const text = await blob.text();

              // Handle ping/pong messages
              if (text === 'ping') {
                console.log("[SocketV2] Received ping from server, sending pong");
                ws.send('pong');
                return;
              }

              if (text === 'pong') {
                console.log("[SocketV2] Received pong from server");
                return;
              }

              console.log("[SocketV2] MESSAGE (JSON):", text);
            } catch (err) {
              console.log("[SocketV2] MESSAGE (error reading blob):", err);
            }
          } else {
            // Handle direct string messages
            const text = e.data;

            // Handle ping/pong messages
            if (text === 'ping') {
              console.log("[SocketV2] Received ping from server, sending pong");
              ws.send('pong');
              return;
            }

            if (text === 'pong') {
              console.log("[SocketV2] Received pong from server");
              return;
            }

            console.log("[SocketV2] MESSAGE (direct string):", text);
          }
        };
      }

      doConnect();
    });
  </script>
</head>
<body>
  <h1>WOC Socket V2 - blockheaders (JSON format)</h1>
  <p>Open the browser console to see messages from the WebSocket.</p>
</body>
</html>
```

{% endcode %}

## New Block Header Event

Receive new block header events in real time.

#### Mainnet URLs

{% tabs %}
{% tab title="BSV" %}

<pre><code><strong>wss://socket-v2.whatsonchain.com/websocket/blockheaders
</strong></code></pre>

{% endtab %}
{% endtabs %}

{% code title="Testnet URL (BSV)" %}

```
wss://socket-v2-testnet.whatsonchain.com/websocket/blockheaders
```

{% endcode %}

{% code title="Example Response" overflow="wrap" %}

```json
{
  "channel": "woc:blockHeader",
  "pub": {
    "data": {
      "hash": "000000000000000007405fd882e9d4bf3d7b2388010081fe443ee1e323d8a668",
      "confirmations": 1,
      "size": 368170789,
      "height": 892466,
      "version": 939524096,
      "versionHex": "38000000",
      "merkleroot": "b0ac43a40a42775d8f533a8eda00bed3257e12a5fca3c8cade47188e6b7aa382",
      "txcount": 9230,
      "time": 1744648860,
      "mediantime": 1744645401,
      "nonce": 2893086732,
      "bits": "181246e3",
      "difficulty": 60157618395.71893,
      "chainwork": "00000000000000000000000000000000000000000164d487adbc2b84d47d2831",
      "previousblockhash": "0000000000000000090fa4de4c971b0b3609acc1061b2020d22dc8d8bf72746a",
      "nextblockhash": "",
      "coinbaseTx": {
        "hex": "...",
        "txid": "1932aa0229b6b44be4b749b9e7279c02136374e2e77b4e890db761f8e74d2111",
        "hash": "1932aa0229b6b44be4b749b9e7279c02136374e2e77b4e890db761f8e74d2111",
        "size": 111,
        "version": 1,
        "locktime": 0,
        "vin": [
          {
            "n": 0,
            "coinbase": "03329e0d2f7461616c2e636f6d2fb9df41e723a18d95e09d0200",
            "sequence": 4294967295
          }
        ],
        "vout": [
          {
            "value": 3.13276008,
            "n": 0,
            "scriptPubKey": {
              "asm": "OP_DUP OP_HASH160 522cf9e7626d9bd8729e5a1398ece40dad1b6a2f OP_EQUALVERIFY OP_CHECKSIG",
              "hex": "...",
              "reqSigs": 1,
              "type": "pubkeyhash",
              "addresses": [
                "18VWHjMt4ixHddPPbs6righWTs3Sg2QNcn"
              ],
              "isTruncated": false
            },
            "scripthash": "1981f116576960fab6ac9a71ba3c12e4f98c2d9b34532bdb40f2e8cc03337fa2"
          }
        ],
        "blockhash": "000000000000000007405fd882e9d4bf3d7b2388010081fe443ee1e323d8a668",
        "confirmations": 1,
        "time": 1744648860,
        "blocktime": 1744648860,
        "blockheight": 892466,
        "vincount": 1,
        "voutcount": 1,
        "voutvalue": 3.13276008
      },
      "totalFees": 0.007760080000000169
    }
  }
}
```

{% endcode %}

## Block Headers History

Stream block headers between the provided block heights `from` and `to`.

#### Mainnet URLs

{% tabs %}
{% tab title="BSV" %}

```
wss://socket-v2.whatsonchain.com/websocket/blockheaders/history?from=<from>&to=<to>
```

{% endtab %}
{% endtabs %}

{% code title="Testnet URL (BSV)" %}

```
wss://socket-v2-testnet.whatsonchain.com/websocket/blockheaders/history?from=<from>&to=<to>
```

{% endcode %}

{% code title="Example Response" %}

```json
{
  "channel": "blockHeaders",
  "pub": {
    "data": {
      "version": 536870912,
      "previousblockhash": "4e4bc1c98159804f2c9c73fbf44100292a277a9747ba52f522490fd3502b3233",
      "merkleroot": "16c7262127cf64a42a406da9961c9223c2e35ebbb48c4e3e4af6f5ac99510772",
      "time": 1750787660,
      "bits": 545259519,
      "nonce": 5,
      "hash": "60111525d2acddf07f9eb9be1c8824d4462b0a696d3c32829d6864fde63067ff",
      "height": 7967
    }
  }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                 |
| --------- | --------------------------- |
| from      | Block heigh to stream from. |
| to        | Block height to stream to.  |

## Block Transactions

Stream transactions from a block height and transaction index.

{% hint style="info" %}

* `hex`, `vin` and `vout` values are not published for message sizes greater than 10MB.&#x20;
* Recommended to fetch details for such transactions using the REST endpoints using the published txid value.
  {% endhint %}

#### Mainnet URLs

{% tabs %}
{% tab title="BSV" %}

```
wss://socket-v2.whatsonchain.com/websocket/block/transactions?from=<from>&to=<to>&txIndex=<txIndex>&format=<format>
```

{% endtab %}
{% endtabs %}

{% code title="Testnet URL (BSV)" %}

```
wss://socket-v2-testnet.whatsonchain.com/websocket/block/transactions?from=<from>&to=<to>&txIndex=<txIndex>&format=<format>
```

{% endcode %}

{% code title="Example Response" %}

```json
{
  "channel": "blockTxs",
  "pub": {
    "data": {
        "txid": "03dd6bc953033a2b5e283b64bc3852ebbcbc1a6120fb51088e9d40d94db41871",
        "hash": "03dd6bc953033a2b5e283b64bc3852ebbcbc1a6120fb51088e9d40d94db41871",
        "size": 263,
        "version": 1,
        "locktime": 0,
        "vin": [
            {
            "n": 0,
            "txid": "797bb9fe7ce40a1628d4e9a91637c555df7d429abcd51dfc774eb98c3efc7111",
            "vout": 2,
            "scriptSig": {
                "asm": "3045022100... 02e24a81ebae0...",
                "hex": "...",
                "isTruncated": false
            },
            "sequence": 4294967295
            }
        ],
        "vout": [
            {
            "value": 0,
            "n": 0,
            "scriptPubKey": {
                "asm": "0 OP_RETURN 746478702e617070 703a313337303439322c70726f666974",
                "hex": "006a08746478702e61707010703a...",
                "type": "nulldata",
                "isTruncated": false
            },
            "scripthash": "2ac0e4bef9f2..."
            },
            ...
        ],
        "vincount": 1,
        "voutcount": 3,
        "voutvalue": 2.2054052100000003
    }
  }
}
```

{% endcode %}

**URL Parameters**

| Parameter          | Description                                                                                                                  |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| from               | Block height to stream from.                                                                                                 |
| to                 | Block height to stream to.                                                                                                   |
| txIndex (optional) | Transaction index as a starting point in the first block to deliver. Default value `0`.                                      |
| format (optional)  | `hex` (default) or `json`. If `hex`, the response will include transaction *hex* and metadata. If `json`, `hex` is excluded. |

## Mempool Transactions

Receive mempool transactions in real time.

* Mempool transactions are collected from multiple nodes.
* Client side should be idempotent because duplicate transaction events are not guaranteed to have been removed.
* *hex*, *vin* and *vout* values are not published for message sizes greater than 10MB. Recommended to fetch details for such transactions using the REST endpoints using the published txid value.

#### Mainnet URLs

{% tabs %}
{% tab title="BSV" %}

```
wss://socket-v2.whatsonchain.com/websocket/mempool?format=<format>
```

{% endtab %}
{% endtabs %}

{% code title="Testnet URL (BSV)" %}

```
wss://socket-v2-testnet.whatsonchain.com/websocket/mempool?format=<format>
```

{% endcode %}

{% code title="Example Response" %}

```json
{
  "channel": "woc:mempoolTx:json",
  "pub": {
    "data": {
      "txid": "0ec9f572dc98234b6ee8860a04beeaba824cb60741a5d11054dc15dc300fa666",
      "hash": "0ec9f572dc98234b6ee8860a04beeaba824cb60741a5d11054dc15dc300fa666",
      "size": 170193,
      "version": 1,
      "locktime": 0,
      "vin": [
        {
          "n": 0,
          "txid": "181cb20e80d333d87aeedf1aa3aebc5b884ef3f68d14401d6c2d5b12dc16ce71",
          "vout": 55403,
          "scriptSig": {
            "asm": "30440220... 0342494361ea8...",
            "hex": "...",
            "isTruncated": false
          },
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 1e-8,
          "n": 0,
          "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 d5eb631a0e9d8c5728c68fc15b0e54754b29d83e OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "...",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
              "1LW6uqvMLPf2R62LFNnAizPjfQijE9vfsg"
            ],
            "isTruncated": false
          },
          "scripthash": "f70ee0566985..."
        },
        {
          "value": 1e-8,
          "n": 1,
          "scriptPubKey": { ... }
        },
        {
          "value": 0.00000654,
          "n": 5000,
          "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 38041fad29e8c1dce7fbcf3fc98b800a26dd2a4c OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "...",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": [
              "167BnGMU9cXjr5tDbJSBJJekKLMTrAQcry"
            ],
            "isTruncated": false
          },
          "scripthash": "8b55ee1a86..."
        }
      ],
      "vincount": 1,
      "voutcount": 5001,
      "voutvalue": 0.00005654000000000542
    }
  }
}
```

{% endcode %}

**URL Parameters**

| Parameter         | Description                                                                                                                  |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| format (optional) | `hex` (default) or `json`. If `hex`, the response will include transaction *hex* and metadata. If `json`, `hex` is excluded. |

## Confirmed Transactions

Receive confirmed transactions in real time.

* Confirmed transactions are collected from multiple nodes.

#### Mainnet URLs

{% tabs %}
{% tab title="BTC" %}

```
wss://socket-v2.whatsonchain.com/btc/websocket/confirmed
```

{% endtab %}
{% endtabs %}

{% code title="Example Response" %}

```json
{
  "channel": "woc:confirmedTx",
  "pub": {
    "data": {
      "txid": "0ec9f572dc98234b6ee8860a04beeaba824cb60741a5d11054dc15dc300fa666",
      "blockhash": "39b664939b6229f25274a74b0289ab81fcbf21f1d7cbffbc85b1470cacc8b80b",
      "blocktime": 1756463257,
      "blockheight": 912225
    }
  }
}
```

{% endcode %}

## Chain Stats

Receive common chain stats every 10 seconds.

#### Mainnet URLs

{% tabs %}
{% tab title="BSV" %}

```
wss://socket-v2.whatsonchain.com/websocket/stats
```

{% endtab %}
{% endtabs %}

{% code title="Testnet URL (BSV)" %}

```
wss://socket-v2-testnet.whatsonchain.com/websocket/stats
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "chainSummary": {
        "blocks": 892459,
        "bestblockhash": "0000000000000000051b71584570f8e5b335b821678c13161cf22b6ad34674c0",
        "difficulty": 59976456494.39465,
        "chainwork": "00000000000000000000000000000000000000000164d4254584d55761a28f20",
        "networkhashps": 409429675870798000,
        "circulatingSupply": 19851434.375,
        "mempoolSize": 16130,
        "mempoolBytes": 227959287,
        "mempoolUsage": 348692384,
        "exchangeRate": {
        "currency": "USD",
        "rate": "28.453333333333333"
        }
    },
    "txStatsSummary": [
        {
        "time": 1744643752,
        "txcount": 2093233133,
        "window_block_count": 144,
        "window_tx_count": 3012566,
        "window_interval": 85093,
        "txrate": 35.40321765597641
        },
        ...
    ],
    "latestBlocks": [
        {
        "hash": "0000000000000000051b71584570f8e5b335b821678c13161cf22b6ad34674c0",
        "confirmations": 1,
        "size": 140294551,
        "height": 892459,
        "version": 541065216,
        "versionHex": "20400000",
        "merkleroot": "3eee592dcd873f39bd98118582fc49b8d56e072ea28984041cd735111753edca",
        "txcount": 9723,
        "time": 1744643752,
        "mediantime": 1744641985,
        "nonce": 2459067680,
        "bits": "18125505",
        "difficulty": 59976456494.39465,
        "chainwork": "00000000000000000000000000000000000000000164d4254584d55761a28f20",
        "previousblockhash": "000000000000000004e776b40810b944b47a59ce4e8d9187eb05a351273116fe",
        "nextblockhash": "",
        "coinbaseTx": {
            "hex": "...",
            "txid": "7519a6fb28cd2796bf855b55f928c5effb0217cc0e98b935c646649bc3aba9e4",
            "hash": "7519a6fb28cd2796bf855b55f928c5effb0217cc0e98b935c646649bc3aba9e4",
            "size": 125,
            "version": 1,
            "locktime": 0,
            "vin": [
            {
                "n": 0,
                "coinbase": "032b9e0d04...",
                "sequence": 0,
                "minerInfo": {
                "name": "GorillaPool.com 🦍",
                "link": "https://GorillaPool.com",
                "type": "tag"
                }
            }
            ],
            "vout": [
            {
                "value": 3.1281591,
                "n": 0,
                "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 ad6684ded42b6a8edf8f5b64cec273c996039e02 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "...",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "1GoriLLa2bdsQ8fB1CA4JNkDX88mLqXf4u"
                ],
                "isTruncated": false
                },
                "scripthash": "c3ad9b15557df4604e5699d28b71ce8a8c479759472e6b9f252c93658c56b31a"
            }
            ],
            "blockhash": "...",
            "confirmations": 1,
            "time": 1744643752,
            "blocktime": 1744643752,
            "vincount": 1,
            "voutcount": 1,
            "voutvalue": 3.1281591
        },
        "totalFees": 0.0031590999999999703
        },
        {
        "hash": "000000000000000004e776b40810b944b47a59ce4e8d9187eb05a351273116fe",
        "confirmations": 2,
        "size": 270319069,
        "height": 892458,
        ...
        }
        ...
    ]
}
```

{% endcode %}

## Customized Events

If your application needs customized/filtered events via WebSockets, please let us know in the [WoC devs Telegram channel.](https://t.me/joinchat/FfE6-EjZhoTHwhDhZH6F-w)


# Tokens

This section covers the supported token protocols.

BSV-only at this point.


# 1Sat Ordinals (Beta)

1SatOrdinals in an implementation of Ordinals running on the BSV blockchain. More information [here](https://docs.1satordinals.com/).

{% hint style="info" %}
At this moment only NFT tokens are supported. BSV-20 fungible tokens are not yet supported, but stay tuned!
{% endhint %}

## Get Token by Outpoint

The token origin represents the moment the NFT was created on the blockchain (more details [here](https://docs.1satordinals.com/readme/terms#ordinal-number:~:text=sensitive%20to%20reorgs.-,Origin,-This%20is%20like)).

This endpoint retrieves the token details by outpoint (An outpoint is the transaction ID and the output index). It returns an ordinal or transfer with the origin of the ordinal. Consequently, this endpoint allows one to verify whether an outpoint is part of an ordinal performing “back to origin”.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/1satordinals/<outpoint>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/1satordinals/b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717_0"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "token":{
      "outpoint": "b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717_0",
      "scriptHash": "e260c235d47f4418076ad4de93942508d0d7de6286337d753ee560b003f3c16a",
      "ownerAddress": "1siPrNPYBmWEwgsJLu6LS84iqJYBSCAf3",
      "origin":{
         "number": "827748:753:0",
         "outpoint": "b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717_0",
         "scriptHash": "e260c235d47f4418076ad4de93942508d0d7de6286337d753ee560b003f3c16a",
         "ownerAddress": "1siPrNPYBmWEwgsJLu6LS84iqJYBSCAf3",
         "data":{
            "insc":{
               "file":{
                  "hash": "Yb51ss8Unqt43ziwJUm8LNCKSooBWrJLe5x2A/qldEw=",
                  "size": 13,
                  "type": "text/plain"
               },
               "text": "464400.bsvmap",
               "words":[
                  "bsvmap",
                  "464400"
               ]
            },
            "types":[
               "text"
            ]
         }
      },
      "data":{
         "insc":{
            "file":{
               "hash": "Yb51ss8Unqt43ziwJUm8LNCKSooBWrJLe5x2A/qldEw=",
               "size": 13,
               "type": "text/plain"
            },
            "text": "464400.bsvmap",
            "words":[
               "bsvmap",
               "464400"
            ]
         },
         "types":[
            "text"
         ]
      },
      "current":{
         "txid": "b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717"
      }
   }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                                                                  |
| --------- | -------------------------------------------------------------------------------------------- |
| network   | Selected network: `main` or `test`.                                                          |
| outpoint  | Inscription ID. More info [here](https://docs.1satordinals.com/readme/terms#inscription-id). |

## Get Token by Origin Number

The token origin represents the moment the NFT was created on the blockchain (more details [here](https://docs.1satordinals.com/readme/terms#ordinal-number:~:text=sensitive%20to%20reorgs.-,Origin,-This%20is%20like)).

This endpoint retrieves the token details by Origin number (the number is the block height, transaction index, and output index).

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/1satordinals/<originNumber>/origin
```

{% endcode %}

{% code title="Response Structure" %}

```json
{
   "token":{
      "outpoint": string,
      "scriptHash": string,
      "ownerAddress": string,
      "origin":{
         "number": string,
         "outpoint": string,
         "scriptHash": string,
         "ownerAddress": string,
         "data":{
            "insc":{
               "file":{
                  "hash": string,
                  "size": integer,
                  "type": string
               },
               "text": string,
               "words":[
                  string,
                  string
               ]
            },
            "types":[
               string
            ]
         }
      },
      "data":{
         "insc":{
            "file":{
               "hash": string,
               "size": integer,
               "type": string
            },
            "text": string,
            "words":[
               string
            ]
         },
         "types":[
            string
         ]
      },
      "current":{
         "txid": string
      }
   }
}
```

{% endcode %}

{% code title="Example Request" %}

```sh
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/1satordinals/827748:753:0/origin"
```

{% endcode %}

<pre class="language-json" data-title="Example Response"><code class="lang-json"><strong>{
</strong>   "token":{
      "outpoint": "b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717_0",
      "scriptHash": "e260c235d47f4418076ad4de93942508d0d7de6286337d753ee560b003f3c16a",
      "ownerAddress": "1siPrNPYBmWEwgsJLu6LS84iqJYBSCAf3",
      "origin":{
         "number": "827748:753:0",
         "outpoint": "b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717_0",
         "scriptHash": "e260c235d47f4418076ad4de93942508d0d7de6286337d753ee560b003f3c16a",
         "ownerAddress": "1siPrNPYBmWEwgsJLu6LS84iqJYBSCAf3",
         "data":{
            "insc":{
               "file":{
                  "hash": "Yb51ss8Unqt43ziwJUm8LNCKSooBWrJLe5x2A/qldEw=",
                  "size": 13,
                  "type": "text/plain"
               },
               "text": "464400.bsvmap",
               "words":[
                  "bsvmap",
                  "464400"
               ]
            },
            "types":[
               "text"
            ]
         }
      },
      "data":{
         "insc":{
            "file":{
               "hash": "Yb51ss8Unqt43ziwJUm8LNCKSooBWrJLe5x2A/qldEw=",
               "size": 13,
               "type": "text/plain"
            },
            "text": "464400.bsvmap",
            "words":[
               "bsvmap",
               "464400"
            ]
         },
         "types":[
            "text"
         ]
      },
      "current":{
         "txid": "b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717"
      }
   }
}
</code></pre>

**URL Parameters**

| Parameter    | Description                                                                                 |
| ------------ | ------------------------------------------------------------------------------------------- |
| network      | Selected network: `main` or `test`.                                                         |
| originNumber | Origin number. More info [here](https://docs.1satordinals.com/readme/terms#inscription-id). |

## Get Token's Data Content

This endpoint retrieves the content of the token's file, in case it has one.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/1satordinals/<outpoint>/content
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/1satordinals/b847a5c9aff596fb98435dd179fd7a6d541d54556518c357f53f54812d46f717_0/content"
```

{% endcode %}

{% code title="Example Response" %}

```
464400.bsvmap
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                                                                  |
| --------- | -------------------------------------------------------------------------------------------- |
| network   | The selected network: `main` or `test`.                                                      |
| outpoint  | Inscription ID. More info [here](https://docs.1satordinals.com/readme/terms#inscription-id). |

## Get the Latest Token's Transfer

This endpoint retrieves the token's latest transfer with the origin token.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/1satordinals/<outpoint>/latest
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/1satordinals/6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156/latest"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "token":{
      "outpoint": "7e796f68d56b7b530b91ff551f402d8972aa3ea6ecf9eb7187616cb4bf75bcb9_0",
      "scriptHash": "c34e301999f898cb3e8f50bc85b5f1c3a45ab3aee33f125c59784915a06d7b67",
      "scriptLockType": "p2pkh",
      "ownerAddress": "1N1QG9hdaMhaTwBDweVrrkbyrXxNeCBHst",
      "origin":{
         "number": "783989:21395:156",
         "outpoint": "6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156",
         "vout":156,
         "scriptHash": "28110cffb0f31f2ea4d13cdb9a848ffd0e3cd912ebf3ab5239b63733d3fec3da",
         "scriptLockType": "nonstandard",
         "ownerAddress": "1J3CFrgrmqmHrEtqCiP6ybjedKBwA3tELN",
         "spentTxid": "fda8480b34526ed3b5e780288b6b3851de94ef81018e3e752b561bf8324d7535",
         "data":{
            "insc":{
               "file":{
                  "hash": "TeOqczWHftnhDJjMza6Z/siyzLOTN9QkZ7lhYVPW/mQ=",
                  "size": 1841,
                  "type": "image/png"
               }
            },
            "map":{
               "app": "BigBlockPunkz",
               "collection": "BigBlockPunkz",
               "type": "ord"
            },
            "types":[
               "file"
            ]
         }
      },
      "current":{
         "txid": "7e796f68d56b7b530b91ff551f402d8972aa3ea6ecf9eb7187616cb4bf75bcb9",
         "txIndex": 2553,
         "blockHeight": 832795,
         "blockTime": 1708693512
      }
   }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                                                                  |
| --------- | -------------------------------------------------------------------------------------------- |
| network   | Selected network: `main` or `test`.                                                          |
| outpoint  | Inscription ID. More info [here](https://docs.1satordinals.com/readme/terms#inscription-id). |

## Get the Token's Transfer History

This endpoint retrieves the token's history of transfers.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/1satordinals/<outpoint>/history
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/1satordinals/6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156/history"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "tokens":[
      {
         "outpoint": "6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156",
         "vout":156,
         "scriptHash": "28110cffb0f31f2ea4d13cdb9a848ffd0e3cd912ebf3ab5239b63733d3fec3da",
         "scriptLockType": "nonstandard",
         "ownerAddress": "1J3CFrgrmqmHrEtqCiP6ybjedKBwA3tELN",
         "spentTxid": "fda8480b34526ed3b5e780288b6b3851de94ef81018e3e752b561bf8324d7535",
         "origin":{
            "number": "783989:21395:156",
            "outpoint": "6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156",
            "vout": 156,
            "scriptHash": "28110cffb0f31f2ea4d13cdb9a848ffd0e3cd912ebf3ab5239b63733d3fec3da",
            "scriptLockType": "nonstandard",
            "ownerAddress": "1J3CFrgrmqmHrEtqCiP6ybjedKBwA3tELN",
            "spentTxid": "fda8480b34526ed3b5e780288b6b3851de94ef81018e3e752b561bf8324d7535",
            "data":{
               "insc":{
                  "file":{
                     "hash": "TeOqczWHftnhDJjMza6Z/siyzLOTN9QkZ7lhYVPW/mQ=",
                     "size": 1841,
                     "type": "image/png"
                  }
               },
               "map":{
                  "app": "BigBlockPunkz",
                  "collection": "BigBlockPunkz",
                  "type": "ord"
               },
               "types":[
                  "file"
               ]
            }
         },
         "data":{
            "insc":{
               "file":{
                  "hash": "TeOqczWHftnhDJjMza6Z/siyzLOTN9QkZ7lhYVPW/mQ=",
                  "size": 1841,
                  "type": "image/png"
               }
            },
            "map":{
               "app": "BigBlockPunkz",
               "collection": "BigBlockPunkz",
               "type": "ord"
            },
            "types":[
               "file"
            ]
         },
         "current":{
            "txid": "6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603",
            "txIndex": 21395,
            "blockHeight": 783989,
            "blockTime": 1679320103
         }
      },
      //...
      {
         "outpoint": "7e796f68d56b7b530b91ff551f402d8972aa3ea6ecf9eb7187616cb4bf75bcb9_0",
         "scriptHash": "c34e301999f898cb3e8f50bc85b5f1c3a45ab3aee33f125c59784915a06d7b67",
         "scriptLockType": "p2pkh",
         "ownerAddress": "1N1QG9hdaMhaTwBDweVrrkbyrXxNeCBHst",
         "origin":{
            "number": "783989:21395:156",
            "outpoint": "6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156",
            "vout":156,
            "scriptHash": "28110cffb0f31f2ea4d13cdb9a848ffd0e3cd912ebf3ab5239b63733d3fec3da",
            "scriptLockType": "nonstandard",
            "ownerAddress": "1J3CFrgrmqmHrEtqCiP6ybjedKBwA3tELN",
            "spentTxid": "fda8480b34526ed3b5e780288b6b3851de94ef81018e3e752b561bf8324d7535",
            "data":{
               "insc":{
                  "file":{
                     "hash": "TeOqczWHftnhDJjMza6Z/siyzLOTN9QkZ7lhYVPW/mQ=",
                     "size": 1841,
                     "type": "image/png"
                  }
               },
               "map":{
                  "app": "BigBlockPunkz",
                  "collection": "BigBlockPunkz",
                  "type": "ord"
               },
               "types":[
                  "file"
               ]
            }
         },
         "current":{
            "txid": "7e796f68d56b7b530b91ff551f402d8972aa3ea6ecf9eb7187616cb4bf75bcb9",
            "txIndex": 2553,
            "blockHeight": 832795,
            "blockTime": 1708693512
         }
      }
   ],
   "total_count": 9
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                                                                  |
| --------- | -------------------------------------------------------------------------------------------- |
| network   | Selected network: `main` or `test`.                                                          |
| outpoint  | Inscription ID. More info [here](https://docs.1satordinals.com/readme/terms#inscription-id). |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get Transaction's Tokens

This endpoint retrieves tokens that a transaction contains.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/1satordinals/tx/<txid>
```

{% endcode %}

{% code title="Response Structure" %}

```json
{
   "tokens":[
      {
         "outpoint": string,
         "scriptHash": string,
         "scriptLockType": string,
         "ownerAddress": string,
         "spentTxid": string,
         "origin":{
            "number": string,
            "outpoint": string,
            "vout": integer,
            "scriptHash": string,
            "scriptLockType": string,
            "ownerAddress": string,
            "spentTxid": string,
            "data":{
               "insc":{
                  "file":{
                     "hash": string,
                     "size": integer,
                     "type": string
                  }
               },
               "map":{
                  string: string
               },
               "types":[
                  string
               ]
            }
         },
         "data":{
            "insc":{
               "file":{
                  "hash": string,
                  "size": integer,
                  "type": string
               }
            },
            "map":{
               string: string
               },
               "type": string
            },
            "sigma":[
               {
                  "address": string,
                  "algorithm": string,
                  "signature": string,
                  "valid": boolean,
                  "vin": integer
               }
            ],
            "types":[
               string
            ]
         },
         "current":{
            "txid": string,
            "txIndex": integer,
            "blockHeight": integer,
            "blockTime": integer
         }
      }
   ],
   "total_count": integer
}
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/1satordinals/tx/9c59baa1944e93771379f110526f7c80a9c9627af583df3f760f1c01f8ea8d42"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "tokens":[
      {
         "outpoint": "9c59baa1944e93771379f110526f7c80a9c9627af583df3f760f1c01f8ea8d42_0",
         "scriptHash": "435ef0918227553dec7539da2fd0faeb4dfda2405f46b12193035482a4164088",
         "scriptLockType": "nonstandard",
         "ownerAddress": "1PjgYHLBqkKhzddfhNN6A428irtAhDWZTN",
         "spentTxid": "99995013a737ed4437d87a2fbaafeae89630cd8ea228afc71f0393fd2f4b8e2b",
         "origin":{
            "number": "783989:21395:156",
            "outpoint": "6fecd063b0ee00489f79a0e9c0793e0bcb265f81faa43e36193833a849bf9603_156",
            "vout":156,
            "scriptHash": "28110cffb0f31f2ea4d13cdb9a848ffd0e3cd912ebf3ab5239b63733d3fec3da",
            "scriptLockType": "nonstandard",
            "ownerAddress": "1J3CFrgrmqmHrEtqCiP6ybjedKBwA3tELN",
            "spentTxid": "fda8480b34526ed3b5e780288b6b3851de94ef81018e3e752b561bf8324d7535",
            "data":{
               "insc":{
                  "file":{
                     "hash": "TeOqczWHftnhDJjMza6Z/siyzLOTN9QkZ7lhYVPW/mQ=",
                     "size": 1841,
                     "type": "image/png"
                  }
               },
               "map":{
                  "app": "BigBlockPunkz",
                  "collection": "BigBlockPunkz",
                  "type": "ord"
               },
               "types":[
                  "file"
               ]
            }
         },
         "data":{
            "insc":{
               "file":{
                  "hash": "hTBTPtJh/pEWUQnCmVFdu296UhaslM9q2ilDJtB74lM=",
                  "size": 785409,
                  "type": "image/png"
               }
            },
            "map":{
               "app": "ZoideNFT",
               "subType": "collectionItem",
               "subTypeData":{
                  "collectionId": "2a48f67ae1da8e679210b073d2e2cb5f0eb7bfcc68dc07f2f6b05e78fb407152_0",
                  "mintNumber": "6",
                  "name": "Reverb 6",
                  "rarityLabel": "COMMON"
               },
               "type": "ord"
            },
            "sigma":[
               {
                  "address": "12KP5KzkBwtsc1UrTrsBCJzgqKn8UqaYQq",
                  "algorithm": "BSM",
                  "signature": "H6nlPVuBqlTsK2B/Sh+oevNRcZDmTtmkRVTZeRGjnZXZfVxVhV9nZ5x5GWDbLnfbWYEAPnngoiF30nv0PaCjF68=",
                  "valid":true,
                  "vin":0
               }
            ],
            "types":[
               "file"
            ]
         },
         "current":{
            "txid": "9c59baa1944e93771379f110526f7c80a9c9627af583df3f760f1c01f8ea8d42",
            "txIndex": 829,
            "blockHeight": 832677,
            "blockTime": 1708617885
         }
      }
   ],
   "total_count": 1
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                         |
| --------- | ----------------------------------- |
| network   | Selected network: `main` or `test`. |
| txid      | Transaction ID.                     |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

### Need an additional API endpoint?

If you want to make a request for an additional API endpoint that would help with your use case, please reach out to us using our [WoC Telegram channel](http://t.me/+SNmGhFqKVB9kf%E2%80%A6). Please provide as much detail on what you're trying to achieve as possible.


# BSV-21 (Beta)

{% hint style="info" %}
BSV-21 protocol was originally called BSV-20 v2 but was renamed for clarity.
{% endhint %}

Here is a brief intro from the [official documentation](https://docs.1satordinals.com/fungible-tokens/bsv-21):

*"This iteration of the BSV-20 protocol introduces a new* `tickerless` *mode functionality.* `Tickerless` *mode forgoes the* `first is first` *nature of BRC20-BTC, and allows the capabilities to have a smart contract, or an administrator, control distribution. Additionally, every transaction of a* `tickerless` *mode token forms part of a single on-chain DAG (Directed Acyclic Graph), such that the transaction can easily be tracked back to that token's genesis* `mint`*. "*

## Get Address Balance

This endpoint retrieves the amount of tokens that were not spent.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/<address>/balance
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/1MMRcQnACaByFV6gYPoSzd9VPjemLeT57q/balance"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "tokens":[
      {
         "outpoint":"7ea4f03a1e3b9e2c0509a3bc523814e911d0306048ee73c435ba05b50d0d18a8_0",
         "amount":"200",
         "decimals":2,
         "symbol":"YWT33"
      },
      {
         "outpoint":"c5bea9ef8bd1bd9de47cef5179bee557c8e7ae5ed303338b925088c6cae3f4e2_1",
         "amount":"10",
         "decimals":1,
         "symbol":"smtfg1",
         "icon":"c5bea9ef8bd1bd9de47cef5179bee557c8e7ae5ed303338b925088c6cae3f4e2_0"
      }
   ],
   "total_count":2
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| id        | Token identifier - `<txid>_<vout>`.     |

**Query Parameters**

| Parameter                | Description                                    |
| ------------------------ | ---------------------------------------------- |
| filterMempool (optional) | Options: `both`, `mempool`, `mined` (default). |

## Get a Depth

This endpoint retrieves transfers inscribed by the provided address and where they are spent.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/<address>/id/<id>/depth
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/1s2YXTRJce8k8VybXz4EmUnxC6jLyWPes/id/e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0/depth"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "branches":[
      {
         "txid":"02c7c1a574766b6755217df1d51219797ad9e68986669c761fe00210b3075898",
         "txIndex":405,
         "blockHeight":857818,
         "spent":{
            "outpoint":"a652c3d01b73d417d785c299cb397540de0474146c6e978fd20db31941157fcf_1",
            "txIndex":388,
            "blockHeight":861969
         }
      },
      {
         "txid":"22d79dd02b1b1c85b1119f800b5626b7f12645599098e2557b79ecb551e02b2a",
         "txIndex":444,
         "blockHeight":861969,
         "spent":{
            "outpoint":"f9ec4e4aee1bec1255108424a1c5b595151a35b1302be00ddb2d1c1503e010e7_1",
            "txIndex":422,
            "blockHeight":863272
         }
      }
   ],
   "total_count":2
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| address   | Address.                                |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get a Token

This endpoint retrieves the token details given the token's identifier.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/id/<id>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/id/942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba_0"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "token": {
        "outpoint": "942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba_0",
        "scriptHash": "96e31317c9059acb339ee65be792de959b4aee32ee79d9bddfd4f7689091ae73",
        "funderAddress": "1MxwReRMY53Y1G4rQN53w8DFZRYHTpHfYm",
        "data": {
            "bsv20": {
                "amt": 21000000,
                "icon": "ecb483eda58f26da1b1f8f15b782b1186abdf9c6399a1c3e63e0d429d5092a41_0",
                "id": "942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba_0",
                "op": "deploy+mint",
                "protocol": "bsv-20",
                "symbol": "27ff2993c1e873e286a8a6fcfd5639ccaed466467f5907d737f5f051eb11b520"
            },
            "insc": {
                "file": {
                    "hash": "ZczVOfCd+PT0n7DbU2zSPH3gW31gkM4p8iN1bWUH7hU=",
                    "size": 199,
                    "type": "application/bsv-20"
                },
                "json": {
                    "amt": "21000000",
                    "icon": "ecb483eda58f26da1b1f8f15b782b1186abdf9c6399a1c3e63e0d429d5092a41_0",
                    "op": "deploy+mint",
                    "p": "bsv-20",
                    "sym": "27ff2993c1e873e286a8a6fcfd5639ccaed466467f5907d737f5f051eb11b520"
                }
            },
            "types": [
                "json"
            ]
        },
        "current": {
            "txid": "942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba",
            "txIndex": 69616,
            "blockHeight": 880067,
            "blockTime": 1737168515
        }
    }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| address   | Address.                                |
| id        | Token identifier - `<txid>_<vout>`.     |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get a Transfer

This endpoint retrieves the token's transfer details given the inscription's outpoint.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/outpoint/<outpoint>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/outpoint/6dc1a50dd6f18f5c55d60fa8532043e19cd91e9d2d9fbceee8166868e0263e65_1"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "inscription":{
      "vout":1,
      "scriptHash":"7df2cabb01151773b2484da0752ead2e86f0b0604b67d562b3cbec780af6b179",
      "ownerAddress":"1Pp4sGru37gAfpbyLME6rVjamyJ9nd2ym",
      "data":{
         "bsv20":{
            "amt":1000,
            "id":"459f0e8bb038d55e3f732f11cc80af75c86b8f48dd17eac2bf92ebe9ac3a040c_0",
            "op":"transfer",
            "protocol":"bsv-20"
         },
         "insc":{
            "file":{
               "hash":"c6cYm2ltooXmDRSL6HOBF7gfuvgs5QEG5MXu4H4smbE=",
               "size":117,
               "type":"application/bsv-20"
            },
            "json":{
               "amt":"1000",
               "id":"459f0e8bb038d55e3f732f11cc80af75c86b8f48dd17eac2bf92ebe9ac3a040c_0",
               "op":"transfer",
               "p":"bsv-20"
            }
         },
         "types":[
            "json"
         ]
      },
      "current":{
         "txid":"6dc1a50dd6f18f5c55d60fa8532043e19cd91e9d2d9fbceee8166868e0263e65",
         "txIndex":40,
         "blockHeight":841255,
         "blockTime":1713795871
      }
   }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| outpoint  | Outpoint - `<txid>_<vout>`.             |

## Get History by Address

This endpoint retrieves transfers history given the address and token's identifier.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/<address>/id/<id>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "1s2YXTRJce8k8VybXz4EmUnxC6jLyWPes/id/e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0/history?skip=3&limit=2"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "inscriptions":[
      {
         "vout":0,
         "scriptHash":"1629429acdd3c8cd72738b292caa616830ef82546fc9a0f8ad742e8c32caddfb",
         "ownerAddress":"1s2YXTRJce8k8VybXz4EmUnxC6jLyWPes",
         "data":{
            "bsv20":{
               "amt":22222200000000,
               "id":"e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0",
               "op":"transfer",
               "protocol":"bsv-20"
            },
            "insc":{
               "file":{
                  "hash":"xM/dPLDlGFvpp/7113yjkqI/HkaaJjG8Cv3QznokKEo=",
                  "size":127,
                  "type":"application/bsv-20"
               },
               "json":{
                  "amt":"22222200000000",
                  "id":"e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0",
                  "op":"transfer",
                  "p":"bsv-20"
               }
            },
            "types":[
               "json"
            ]
         },
         "current":{
            "txid":"22d79dd02b1b1c85b1119f800b5626b7f12645599098e2557b79ecb551e02b2a",
            "txIndex":444,
            "blockHeight":861969,
            "blockTime":1726254528
         }
      },
      {
         "vout":1,
         "scriptHash":"d931f30431274374fb8a0ee69cb0cfdb59555404089bf6a2d4627bc73adba192",
         "ownerAddress":"1s2YXTRJce8k8VybXz4EmUnxC6jLyWPes",
         "data":{
            "bsv20":{
               "amt":46666700000000,
               "id":"e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0",
               "op":"transfer",
               "protocol":"bsv-20"
            },
            "insc":{
               "file":{
                  "hash":"XK86+/JWmnz2rU3IdgYUMg519oFtWA5pk3T2BkNP1rY=",
                  "size":127,
                  "type":"application/bsv-20"
               },
               "json":{
                  "amt":"46666700000000",
                  "id":"e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0",
                  "op":"transfer",
                  "p":"bsv-20"
               }
            },
            "types":[
               "json"
            ]
         },
         "current":{
            "txid":"22d79dd02b1b1c85b1119f800b5626b7f12645599098e2557b79ecb551e02b2a",
            "txIndex":444,
            "blockHeight":861969,
            "blockTime":1726254528
         }
      }
   ],
   "total_count":2
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| address   | Address.                                |
| id        | Token identifier - `<txid>_<vout>`.     |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get Spent Outputs

This endpoint retrieves spent inscriptions given the transaction's identifier.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/txid/<txid>/spent
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/txid/22d79dd02b1b1c85b1119f800b5626b7f12645599098e2557b79ecb551e02b2a/spent"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
   "inscriptions":[
      {
         "vout":0,
         "scriptHash":"7bc83b8837be332181e7d8f098c3f9bcbf34a1fd8acb3a4e0114f261f014b955",
         "ownerAddress":"1s2YXTRJce8k8VybXz4EmUnxC6jLyWPes",
         "spentTxid":"22d79dd02b1b1c85b1119f800b5626b7f12645599098e2557b79ecb551e02b2a",
         "data":{
            "bsv20":{
               "amt":10000000000000,
               "id":"e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0",
               "op":"transfer",
               "protocol":"bsv-20"
            },
            "insc":{
               "file":{
                  "hash":"YtnAMmnJcV0qk50dbdAUxGWz/QUkM+zl51OpLPWhoK0=",
                  "size":127,
                  "type":"application/bsv-20"
               },
               "json":{
                  "amt":"10000000000000",
                  "id":"e6d40ba206340aa94ed40fe1a8adcd722c08c9438b2c1dd16b4527d561e848a2_0",
                  "op":"transfer",
                  "p":"bsv-20"
               }
            },
            "types":[
               "json"
            ]
         },
         "current":{
            "txid":"38f8a1e8d2953323cd3cace35341aaaffb46b0366c2d5eb1881ca0ec565a3867",
            "txIndex":403,
            "blockHeight":861969,
            "blockTime":1726254528
         }
      }
   ],
   "total_count":1
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| txid      | Transaction ID.                         |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get Tokens by Transaction ID

This endpoint retrieves tokens that a given transaction contains.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/txid/<txid>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/txid/942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "tokens": [
        {
            "outpoint": "942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba_0",
            "scriptHash": "96e31317c9059acb339ee65be792de959b4aee32ee79d9bddfd4f7689091ae73",
            "funderAddress": "1MxwReRMY53Y1G4rQN53w8DFZRYHTpHfYm",
            "data": {
                "bsv20": {
                    "amt": 21000000,
                    "icon": "ecb483eda58f26da1b1f8f15b782b1186abdf9c6399a1c3e63e0d429d5092a41_0",
                    "id": "942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba_0",
                    "op": "deploy+mint",
                    "protocol": "bsv-20",
                    "symbol": "27ff2993c1e873e286a8a6fcfd5639ccaed466467f5907d737f5f051eb11b520"
                },
                "insc": {
                    "file": {
                        "hash": "ZczVOfCd+PT0n7DbU2zSPH3gW31gkM4p8iN1bWUH7hU=",
                        "size": 199,
                        "type": "application/bsv-20"
                    },
                    "json": {
                        "amt": "21000000",
                        "icon": "ecb483eda58f26da1b1f8f15b782b1186abdf9c6399a1c3e63e0d429d5092a41_0",
                        "op": "deploy+mint",
                        "p": "bsv-20",
                        "sym": "27ff2993c1e873e286a8a6fcfd5639ccaed466467f5907d737f5f051eb11b520"
                    }
                },
                "types": [
                    "json"
                ]
            },
            "current": {
                "txid": "942fa8659a65cbcfaf979c4abef28a8f9c1454836cc3a9b42662f2bf784d92ba",
                "txIndex": 69616,
                "blockHeight": 880067,
                "blockTime": 1737168515
            }
        }
    ],
    "total_count": 1
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| txid      | Transaction ID.                         |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get Unspent Tokens by Address

This endpoint retrieves unspent BSV-21 inscriptions given an address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/<address>/unspent
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/14h6iBhUj2SBDtMkSiGxed9SyaWpFwCw4j/unspent"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "tokens": [
        {
            "scriptHash": "d5b8124a3cec0843ced890272b64c745fc1a311a9d9dc1453ba6d77c4a519305",
            "data": {
                "bsv20": {
                    "amt": 999000,
                    "id": "459f0e8bb038d55e3f732f11cc80af75c86b8f48dd17eac2bf92ebe9ac3a040c_0",
                    "op": "transfer",
                    "protocol": "bsv-20"
                },
                "insc": {
                    "file": {
                        "hash": "eXPedD7bUNMRNMu7a5zFX9GSMn1nyOwbI/5+Sa8CA4Y=",
                        "size": 119,
                        "type": "application/bsv-20"
                    },
                    "json": {
                        "amt": "999000",
                        "id": "459f0e8bb038d55e3f732f11cc80af75c86b8f48dd17eac2bf92ebe9ac3a040c_0",
                        "op": "transfer",
                        "p": "bsv-20"
                    }
                },
                "types": [
                    "json"
                ]
            },
            "current": {
                "txid": "6dc1a50dd6f18f5c55d60fa8532043e19cd91e9d2d9fbceee8166868e0263e65",
                "txIndex": 40,
                "blockHeight": 841255,
                "blockTime": 1713795871
            }
        }
    ],
    "total_count": 1
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| address   | Address.                                |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

## Get Token Owners

This endpoint retrieves addresses that own a token or transfer(s) of the inscription.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/bsv21/id/<id>/owners
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/bsv21/id/cc7a38cfd087b9411b8533e6c5d30590a9e50ea9adc5ca3e3d947bb201a15ebd_0/owners"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "owners": [
        {
            "address": "1JwtQdKJM9GrARS5X9cNaGadqbNSfzSKwF"
        },
        {
            "address": "1Gi1ahKC1Ybbi85RTMsyuifxHS754nd6Ni"
        },
        {
            "address": "1G6CB3Ch4zFkPmuhZzEyChQmrQPfi86qk3"
        }
    ],
    "total_count": 3
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                             |
| --------- | --------------------------------------- |
| network   | The selected network: `main` or `test`. |
| id        | Token identifier - `<txid>_<vout>`.     |

**Query Parameters**

| Parameter        | Description                            |
| ---------------- | -------------------------------------- |
| skip (optional)  | Skip items. For pagination.            |
| limit (optional) | Limit number of items. For pagination. |

### Need an additional API endpoint?

If you want to make a request for an additional API endpoint that would help with your use case, please reach out to us using our [WoC Telegram channel](http://t.me/+SNmGhFqKVB9kf%E2%80%A6). Please provide as much detail on what you're trying to achieve as possible.


# STAS Tokens (Beta)

STAS is a token protocol that consists of a bitcoin script for locking/unlocking bitcoin transaction outputs. Read more in the [official documentation](https://docs.stastoken.com/).

## Get All Tokens

This endpoint retrieves a list of supported tokens along with the relevant metadata.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/tokens
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/tokens"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "tokens": [
        {
            "description": "-",
            "image": "https://firebasestorage.googleapis.com/v0/b/musicartstaging/o/nftAssets%2F3e75ba7e-fa51-4efb-a483-3b2c71bab180_250x250?alt=media",
            "name": "fdsfs",
            "properties": {
                "issuer": {
                    "email": "info@musicart.io",
                    "governing_law": "England and Wales",
                    "issuer_country": "UK",
                    "jurisdiction": "UK",
                    "legal_form": "Limited",
                    "organisation": "Calekta Limited"
                },
                "legal": {
                    "terms": "\u00a9 2020 TAAL TECHNOLOGIES SEZC\nALL RIGHTS RESERVED. ANY USE OF THIS SOFTWARE IS SUBJECT TO TERMS AND CONDITIONS OF LICENSE. USE OF THIS SOFTWARE WITHOUT LICENSE CONSTITUTES INFRINGEMENT OF INTELLECTUAL PROPERTY. FOR LICENSE DETAILS OF THE SOFTWARE, PLEASE REFER TO: www.taal.com/stas-token-license-agreement"
                }
            },
            "protocol": "STAS",
            "schema_id": "NFT1.0/MA",
            "symbol": "ujtVA5",
            "token_id": "7bfb2ae7e878d107191259c1be72cf116da3f59d"
        },
        {
            "token_id": "2",
            "protocol": "STAS",
            "ticker": "CIPS",
            ....
        }
        ]
}
```

{% endcode %}

**URL Parameters**

<table><thead><tr><th width="381">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>network</td><td>Selected network: <code>main</code>.</td></tr></tbody></table>

## Get Token by ID

This endpoint retrieves the token metadata including contract and issuance details.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/<tokenId>/<symbol>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/c402bc341157265f5f8a747c11099847056a229a/test1124"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "token": {
        "contract_txs": [
            "72ae93f5fdc5a4fa5abfab780d7d1c8ad988d25ae34578b80dce5ff9e5c3db03"
        ],
        "description": "generating stas token",
        "image": "https://firebasestorage.googleapis.com/v0/b/nftdev/o/nftTemp%2FWL1DdD?alt=media",
        "issuance_txs": [
            "b00bcc9dfc7dd483ff989f3d1d3f091b23e88ca2207c9e15788e3e84a5b10c8b"
        ],
        "name": "test",
        "properties": {
            "issuer": {
                "email": "info@vaionex.com",
                "governing_law": "US",
                "issuer_country": "US",
                "jurisdiction": "US",
                "legal_form": "Limited",
                "organisation": "vaionex corp."
            },
            "legal": {
                "terms": "test"
            }
        },
        "protocol": "STAS",
        "schema_id": "NFT1.0/MA",
        "symbol": "test1124",
        "token_id": "c402bc341157265f5f8a747c11099847056a229a",
        "tx_count": 3
    }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                   |
| --------- | --------------------------------------------- |
| network   | Selected network: `main`.                     |
| tokenId   | Unique ID of the token.                       |
| symbol    | Symbol used in the registration of the token. |

## Get Token UTXOs for Address

This endpoint retrieves the token UTXOs for a given address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/tokens/unspent
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H/tokens/unspent"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "address": "1JsQieDaYUg5pSRtpeEQhTv3buHvSX7WH4",
    "utxos": [
        {
            "amount": 2000,
            "index": 1,
            "redeemAddr": "c402bc341157265f5f8a747c11099847056a229a",
            "symbol": "test1124",
            "txid": "cf3968e6950286cf94aa9efb7a1cc1b9c74190d159ff6d2a4dc7d9feb6e50c55"
        }
    ]
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description               |
| --------- | ------------------------- |
| network   | Selected network: `main`. |
| address   | Address.                  |

## Get Address Token Balance

This endpoint retrieves the token balances for a given address.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/address/<address>/tokens
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/address/1JsQieDaYUg5pSRtpeEQhTv3buHvSX7WH4/tokens"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "address": "1JsQieDaYUg5pSRtpeEQhTv3buHvSX7WH4",
    "tokens": [
        {
            "balance": 0,
            "image": "https://firebasestorage.googleapis.com/v0/b/nftdev/o/nftTemp%2FWL1DdD?alt=media",
            "protocol": "STAS",
            "redeemAddr": "c402bc341157265f5f8a747c11099847056a229a",
            "symbol": "test2"
        },
        {
            "balance": -2000,
            "image": "https://firebasestorage.googleapis.com/v0/b/nftdev/o/nftTemp%2FWL1DdD?alt=media",
            "protocol": "STAS",
            "redeemAddr": "c402bc341157265f5f8a747c11099847056a229a",
            "symbol": "test1124"
        }
    ]
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description               |
| --------- | ------------------------- |
| network   | Selected network: `main`. |
| address   | Address.                  |

## Get Token Transactions

This endpoint retrieves the transactions for a given token.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/<tokenId>/<symbol>/tx
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/token/c402bc341157265f5f8a747c11099847056a229a/test1124/tx"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "redeem_addr": "c402bc341157265f5f8a747c11099847056a229a",
    "symbol": "test1124",
    "txs": [
        "cf3968e6950286cf94aa9efb7a1cc1b9c74190d159ff6d2a4dc7d9feb6e50c55",
        "b00bcc9dfc7dd483ff989f3d1d3f091b23e88ca2207c9e15788e3e84a5b10c8b",
        "72ae93f5fdc5a4fa5abfab780d7d1c8ad988d25ae34578b80dce5ff9e5c3db03"
    ]
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description                                   |
| --------- | --------------------------------------------- |
| network   | Selected network: `main`.                     |
| tokenId   | Unique ID of the token.                       |
| symbol    | Symbol used in the registration of the token. |

## Get Token Output Details

This endpoint returns the details of a valid token output or *Not Found (404)* for an invalid token output.

{% code title="HTTP Request" %}

```
GET https://api.whatsonchain.com/v1/bsv/<network>/token/tx/<txid>/out/<index>
```

{% endcode %}

{% code title="Example Request" %}

```shell
curl --location --request GET "wget -O- https://api.whatsonchain.com/v1/bsv/main/token/tx/cf3968e6950286cf94aa9efb7a1cc1b9c74190d159ff6d2a4dc7d9feb6e50c55/out/1"
```

{% endcode %}

{% code title="Example Response" %}

```json
{
    "has_data": true,
    "icon_url": "https://firebasestorage.googleapis.com/v0/b/nftdev/o/nftTemp%2FWL1DdD?alt=media",
    "index": 1,
    "is_splittable": true,
    "symbol": "test1124",
    "token_id": "c402bc341157265f5f8a747c11099847056a229a",
    "txid": "cf3968e6950286cf94aa9efb7a1cc1b9c74190d159ff6d2a4dc7d9feb6e50c55",
    "value": 2000
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description               |
| --------- | ------------------------- |
| network   | Selected network: `main`. |
| txid      | Transaction ID.           |
| index     | Output/Vout index.        |

### Need an additional API endpoint?

If you want to make a request for an additional API endpoint that would help with your use case, please reach out to us using our [WoC Telegram channel](http://t.me/+SNmGhFqKVB9kf%E2%80%A6). Please provide as much detail on what you're trying to achieve as possible.


# Change Log

These are the most recent changes and additions to the API:

* 07/21/2025
  * Removing deprecated endpoints:
    * (Un)Spent Transaction Outputs - Get UTXOs by Address
    * (Un)Spent Transaction Outputs - Bulk UTXOs by Address
    * (Un)Spent Transaction Outputs - Get UTXOs by Script
    * (Un)Spent Transaction Outputs - Bulk UTXOs by Script
    * Address - Get Balance
    * Address - Bulk Balance
    * Address - Get History
    * Script - Get Script History
* 07/14/2025
  * Adding basic BTC support to existing endpoint groups:
    * [Health](/core-products/whatsonchain/health)
    * [Chain Info](/core-products/whatsonchain/chain-info)
    * [Block](/core-products/whatsonchain/block)
    * [Transaction](/core-products/whatsonchain/transaction)
    * [Mempool](/core-products/whatsonchain/mempool)
    * [(Un)Spent Transaction Outputs](/core-products/whatsonchain/un-spent-transaction-outputs)
    * [Address](/core-products/whatsonchain/address)
    * [Script](/core-products/whatsonchain/script)
    * [Exchange Rate](/core-products/whatsonchain/exchange-rate)
    * [Search](/core-products/whatsonchain/search)
    * [Stats](/core-products/whatsonchain/stats)
  * Removing
    * Transaction - Download Receipt
* 04/25/2025
  * New
    * WebSockets - [WoC Sockets V2](/core-products/whatsonchain/websockets/woc-sockets-v2-beta)
  * Changes
    * Deprecated WebSockets - [WoC Sockets V1](/core-products/whatsonchain/websockets/woc-sockets-v1-deprecated)
    * Removed the Confirmed Transactions endpoint in WoC Sockets V1
* 12/31/2024
  * Changes
    * Transaction - [Get Merkle Proof](/core-products/whatsonchain/transaction#get-merkle-proof)
* 12/02/2024
  * New
    * Tokens - [1Sat Ordinals (Beta)](/core-products/whatsonchain/tokens/1sat-ordinals-beta)
* 10/22/2024
  * New
    * Transaction - [Get a Transaction as Binary](/core-products/whatsonchain/transaction#get-a-transaction-as-binary)
* 09/09/2024
  * Changes
    * (Un)Spent Transaction Outputs - [Get Confirmed UTXOs by Address](/core-products/whatsonchain/un-spent-transaction-outputs#get-confirmed-utxos-by-address-beta)
    * (Un)Spent Transaction Outputs - [Get Confirmed UTXOs by Script](/core-products/whatsonchain/un-spent-transaction-outputs#get-confirmed-utxos-by-script-beta)
* 10/05/2024
  * Changes
    * Block - [Get Header by Hash or Height](/core-products/whatsonchain/block#get-header-by-hash-or-height)
* 19/03/2024
  * New
    * Address - [Get Associated Scripthashes](/core-products/whatsonchain/address#get-associated-scripthashes)
    * Address - [Bulk History (Beta)](/core-products/whatsonchain/address#bulk-history-beta)
* 21/11/2023
  * New
    * (Un)Spent Transaction Outputs - [Bulk Spent Transaction Outputs (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#bulk-spent-transaction-outputs-beta)
* 15/11/2023
  * New
    * (Un)Spent Transaction Outputs - [Bulk Unconfirmed UTXOs by Address (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#bulk-unconfirmed-utxos-by-address-beta)
    * (Un)Spent Transaction Outputs - [Bulk Confirmed UTXOs by Address (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#bulk-confirmed-utxos-by-address-beta)
    * (Un)Spent Transaction Outputs - [Bulk Unconfirmed UTXOs by Script (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#bulk-unconfirmed-utxos-by-script-beta)
    * (Un)Spent Transaction Outputs - [Bulk Confirmed UTXOs by Script (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#bulk-confirmed-utxos-by-script-beta)
    * Address - [Bulk Unconfirmed Balance (Beta)](/core-products/whatsonchain/address#bulk-unconfirmed-balance-beta)
    * Address - [Bulk Confirmed Balance (Beta)](/core-products/whatsonchain/address#bulk-confirmed-balance-beta)
    * Address - [Bulk Unconfirmed History (Beta)](/core-products/whatsonchain/address#bulk-unconfirmed-history-beta)
    * Address - [Bulk Confirmed History (Beta)](/core-products/whatsonchain/address#bulk-confirmed-history-beta)
    * Script - [Bulk Unconfirmed Script History (Beta)](/core-products/whatsonchain/script#bulk-unconfirmed-script-history-beta)
    * Script - [Bulk Confirmed Script History (Beta)](/core-products/whatsonchain/script#bulk-confirmed-script-history-beta)
* 26/10/2023
  * New
    * (Un)Spent Transaction Outputs - [Get Confirmed UTXOs by Address (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#get-confirmed-utxos-by-address-beta)
    * (Un)Spent Transaction Outputs - [Get Confirmed UTXOs by Script (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#get-confirmed-utxos-by-script-beta)
    * (Un)Spent Transaction Outputs - [Get Unconfirmed Spent Tx Output (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#get-unconfirmed-spent-tx-output-beta)
    * (Un)Spent Transaction Outputs - [Get Confirmed Spent Tx Output (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#get-confirmed-spent-tx-output-beta)
    * (Un)Spent Transaction Outputs - [Get Spent Transaction Output (Beta)](/core-products/whatsonchain/un-spent-transaction-outputs#get-spent-transaction-output-beta)
    * Address - [Get Confirmed Balance (Beta)](/core-products/whatsonchain/address#get-confirmed-balance-beta)
    * Address - [Get Confirmed History (Beta)](/core-products/whatsonchain/address#get-confirmed-history-beta)
    * Script - [Get Confirmed Script History (Beta)](/core-products/whatsonchain/script#get-confirmed-script-history-beta)
* 28/07/2023
  * New
    * Address - [Get Address Usage Status](/core-products/whatsonchain/address#get-address-usage-status)
    * Script - [Get Script Usage Status](/core-products/whatsonchain/script#get-script-usage-status)
* 07/07/2023
  * New
    * Address - [Get Mempool Balance](/core-products/whatsonchain/address#get-mempool-balance-beta)
    * Address - [Get Mempool History](/core-products/whatsonchain/address#get-mempool-history-beta)
    * Address - [Get Unspent Mempool Transactions](/core-products/whatsonchain/address#get-unspent-mempool-transactions-beta)
    * Script - [Get Mempool History](/core-products/whatsonchain/script#get-mempool-script-history-beta)
    * Script - [Get Script Mempool Unspent Transactions](/core-products/whatsonchain/script#get-script-mempool-unspent-transactions-beta)
* 03/05/2023
  * New
    * On-Chain Data - [Get OP\_RETURN Data by Tx Hash](/core-products/whatsonchain/on-chain-data#get-op_return-data-by-tx-hash)
* 20/04/2023
  * New
    * Transaction - [Get Transaction Propagation Status](/core-products/whatsonchain/transaction#get-transaction-propagation-status)
* 16/03/2023
  * New
    * [Output Tags](/core-products/whatsonchain/output-tags) (documentation only)
* 21/02/2023
  * New
    * Block - [Get Header Byte File Links](/core-products/whatsonchain/block#get-header-bytes-file-links)
    * Block - [Get Latest Header Bytes](/core-products/whatsonchain/block#get-latest-header-bytes)
* 20/10/2022
  * New
    * Stats - [Get tag count by height](/core-products/whatsonchain/stats#get-tag-count-by-height)
* 18/10/2022
  * New
    * Stats - [Get miner block stats](/core-products/whatsonchain/stats#get-miner-block-stats)
    * Stats - [Get miner summary stats](/core-products/whatsonchain/stats#get-miner-summary-stats)
* 13/10/2022
  * New
    * Stats - [Get block stats by height](/core-products/whatsonchain/stats#get-block-stats-by-height)
    * Stats - [Get block stats by hash](/core-products/whatsonchain/stats#get-block-stats-by-hash)
* 10/10/2022
  * New
    * Chain info - [Get peer info](/core-products/whatsonchain/chain-info#get-blockchain-info-1)
    * Exchange rate - [Get historical exchange rate](/core-products/whatsonchain/exchange-rate#get-historical-exchange-rate)
* 19/07/2022
  * New
    * [WoC Plugins](/core-products/whatsonchain/woc-plugins)
* 11/05/2022
  * New
    * [STAS Token endpoints](broken://pages/lPGx1nDc1m6ZtKyZmaec)
    * WebSockets - Options to filter [Mempool transactions](/core-products/whatsonchain/websockets#mempool-transactions) by the output type.
    * WebSockets - Options to filter [Confirmed transactions](/core-products/whatsonchain/websockets#confirmed-transactions) by the output type.
    * [WoC Widgets](/core-products/whatsonchain/woc-widgets)
* 02/03/2022
  * New
    * WebSockets - [Block transactions](/core-products/whatsonchain/websockets#block-transactions)
* 10/01/2022
  * New
    * [Get chain tips](/core-products/whatsonchain/chain-info#get-chain-tips)
    * [Get block header by hash with block-headers-client response format](/core-products/whatsonchain/block#get-header-by-hash)
* 03/08/2021
  * New
    * [Bulk transactions status](/core-products/whatsonchain/transaction#bulk-transaction-status)
    * [Bulk transactions raw data](/core-products/whatsonchain/transaction#bulk-raw-transaction-data)
* 17/06/2021
  * New
    * WebSockets - Adding testnet support
* 14/06/2021
  * New
    * WebSockets - [Chain Stats](/core-products/whatsonchain/websockets#chain-stats)
    * WebSockets - Extending support for non-centrifuge [clients](/core-products/whatsonchain/websockets)
* 22/03/2021
  * New
    * WebSockets - [Mempool transactions](/core-products/whatsonchain/websockets#mempool-transactions)
    * WebSockets - [Confirmed transactions](/core-products/whatsonchain/websockets#confirmed-transactions)
    * WebSockets - [Customized events](/core-products/whatsonchain/websockets#customized-events)
* 02/03/2021
  * Changes
    * Deprecating WoC Merchant API. Recommended to switch to [TAAL Merchant API](broken://pages/SeU2SvmzgfcvVyV4F2HE).
    * Deprecating WoC Bulk Broadcast. Recommended to switch to [TAAL Merchant AP](broken://pages/SeU2SvmzgfcvVyV4F2HE)I.
  * New
    * Adding [TAAL Merchant API](broken://pages/SeU2SvmzgfcvVyV4F2HE) details
    * WebSockets - [New block header event](/core-products/whatsonchain/websockets#new-block-header-event)
    * WebSockets - [Block headers history](/core-products/whatsonchain/websockets#block-headers-history)
* 26/11/2020
  * New
    * [Bulk script unspent transactions](/core-products/whatsonchain/script#bulk-script-unspent-transactions)
    * [Bulk address unspent transactions](/core-products/whatsonchain/address#bulk-unspent-transactions)
    * [Bulk address balance](/core-products/whatsonchain/address#bulk-balance)
* 13/07/2020
  * New
    * [Get block header by hash](/core-products/whatsonchain/block#get-header-by-hash)
    * [Get last 10 block headers](/core-products/whatsonchain/block#get-headers)
* 25/05/2020
  * New
    * Merchant API - [Get Fee Quotes](broken://pages/SeU2SvmzgfcvVyV4F2HE#get-fee-quote) from multiple transaction processors
    * Merchant API - [Submit tx](broken://pages/SeU2SvmzgfcvVyV4F2HE#submit-transaction) to a transaction processor
    * Merchant API - [Request Transaction status](broken://pages/SeU2SvmzgfcvVyV4F2HE#query-transaction-status) from a transaction processor
* 08/03/2020
  * New
    * Enabled [Get raw transaction data (hex)](/core-products/whatsonchain/transaction#get-raw-transaction-data) for testnet
    * Enabled [Get raw transaction output data by index (hex)](/core-products/whatsonchain/transaction#get-raw-transaction-output-data) for testnet
    * [Get script history](/core-products/whatsonchain/script#get-script-history)
    * [Get script unspent transactions](/core-products/whatsonchain/script#get-script-unspent-transactions)
    * [Get exchange rate](/core-products/whatsonchain/exchange-rate#get-exchange-rate)
* 03/02/2020
  * Changes
    * Removing support of STN network from address balance, history and UTXOs endpoints
    * Removing hex field from response body of [Get transaction by hash](/core-products/whatsonchain/transaction#get-by-tx-hash) request
    * Limiting vout\[x].scriptPubKey.asm and vout\[x].scriptPubKey.hex size to return max 100KB in response body of [Get transaction by hash](/core-products/whatsonchain/transaction#get-by-tx-hash)
    * Adding vout\[x].scriptPubKey.isTruncated flag, if data size is more than 100KB in vout\[x].scriptPubKey.hex
    * Removing old merkle proof endpoint \*/tx/{txid}/merkleproof
  * New
    * [Get raw transaction data](/core-products/whatsonchain/transaction#get-raw-transaction-data)&#x20;
    * [Get raw transaction output data by index (hex)](/core-products/whatsonchain/transaction#get-raw-transaction-output-data)
    * [Get Merkle Proof for transaction (Beta)](/core-products/whatsonchain/transaction#get-merkle-proof)
* 18/01/2020
  * New
    * [Bulk transaction details](/core-products/whatsonchain/transaction#bulk-transaction-details)
    * [Get circulating supply](/core-products/whatsonchain/chain-info#get-circulating-supply)
    * [Community Libraries](/core-products/whatsonchain/community-libraries)
* 18/11/2019
  * New
    * Bulk Broadcast transactions
* 09/11/2019
  * New
    * [Get merkle proof](/core-products/whatsonchain/transaction#get-merkle-proof)
* 21/10/2019
  * New
    * [Decode raw transaction](/core-products/whatsonchain/transaction#decode-transaction)
* 23/06/2019
  * New
    * [Download address statement](/core-products/whatsonchain/address#download-statement)
    * [Download transaction receipt](/core-products/whatsonchain/transaction#download-receipt)
  * Fixed
    * [Broadcast transaction](/core-products/whatsonchain/transaction#broadcast-transaction) endpoint now returns txid on success or error msg from node on failure
* 19/05/2019
  * New
    * [Get address balance](/core-products/whatsonchain/address#get-balance)
    * [Get address history](/core-products/whatsonchain/address#get-history)
    * [Get address UTXOs](/core-products/whatsonchain/address#get-unspent-transactions)
    * [Get explorer links](/core-products/whatsonchain/search#get-explorer-links)
* 22/04/2019
  * New
    * [Get chain info](/core-products/whatsonchain/chain-info#get-blockchain-info)
    * [Get mempool info](/core-products/whatsonchain/mempool#get-mempool-info)
    * [Get mempool transactions](/core-products/whatsonchain/mempool#get-mempool-transactions)
    * [Get address info](/core-products/whatsonchain/address#get-address-info)
* 15/04/2019
  * New
    * Get Health
    * [Get block by hash](/core-products/whatsonchain/block#get-by-hash)
    * [Get block by height](/core-products/whatsonchain/block#get-by-height)
    * [Get block pages](/core-products/whatsonchain/block#get-block-pages)
    * [Get transactions by hash](/core-products/whatsonchain/transaction#get-by-tx-hash)
    * [Broadcast transactions](/core-products/whatsonchain/transaction#broadcast-transaction)


# Community Libraries

Awesome community-maintained libraries

```
       .---.                   .---.
   .---|___|           .-.     |~~~|
.--|===| B |_          |_|     |~~~|--.
|  |===| I |'\     .---!~|  .--|   |--|
|  |   | T |.'\    |===| |--|%%| W |  |
|  |   | C |\.'\   | S | |__|  | O |py|
|go|   | O | \  \  |===| |==|  | C |  |
|  |   | I |  \.'\ | V |_|__|  |~~~|__|
|  |===| N |   \.'\|===|~|--|%%|~~~|--|
^--^---'---^    `-'`---^-^--^--^---'--' 
```

### Golang

| Description                                    | Link                                                 |
| ---------------------------------------------- | ---------------------------------------------------- |
| Go Wrapper for WoC API by **MrZ**              | [GitHub](https://github.com/mrz1836/go-whatsonchain) |
| Go Wrapper for bitcoin RPC by **Simon Ordish** | [GitHub](https://github.com/ordishs/go-bitcoin)      |

### Python

| Description                                 | Link                                               |
| ------------------------------------------- | -------------------------------------------------- |
| Python3 Wrapper for WOC API by **AustEcon** | [GitHub](https://github.com/AustEcon/whatsonchain) |

### Node.js

| Description                                              | Link                                                                     |
| -------------------------------------------------------- | ------------------------------------------------------------------------ |
| JS Wrapper for WoC API by **baryon**                     | [npmjs](https://www.npmjs.com/package/whatsonchain)                      |
| Example: How to verify merkle proofs by **Simon Ordish** | [Gist](https://gist.github.com/ordishs/7c4d2bf77b9fe74eb044aaa5a6867fc2) |


# Transaction Processing


# TAAL Transaction Endpoints

The simplest way to broadcast transactions to BSV is to use the broadcast and the batchBroadcast endpoints. /api/v1/broadcast expects a single transaction whilst /api/v1/batchBroadcast expects a batch of them.

With both of these it is possible to send your request as text with the `application/json` mimetype or binary with the `application/octet-stream` mimetype (discussed below).

The binary format has 2 advantages:

1. The size of the request payload is half of the text equivalent.
2. Unlike with JSON, the 1st transaction in the binary stream can be processed before the entire payload has been received.

The endpoints are:

```
curl -X POST https://api.taal.com/api/v1/broadcast
curl -X POST https://api.taal.com/api/v1/batchBroadcast
```

**Please note that these endpoints require a Taal APIKey that can be obtained for free by registering at <https://platform.taal.com>**

#### /api/v1/broadcast (`application/json`)

**Request body**

```json
{
  "rawTx": "bitcoin transaction in hex..."
}
```

**Response, if successful:**

```
201 Created
text/plain
<32 byte TXID in 64 hexadecimal characters>
```

**Response, if not successful**

```json
400 Bad request
application/json
{
  "status": number,
  "code": number,
  "error": "string"
}
```

These are the exact responses returned by the bitcoin node.

#### /api/v1/broadcast (`application/octet-stream`)

**Request body**

```
bitcoin transaction as a stream of bytes (binary) 
```

**Response, if successful:**

```
201 Created
text/plain
<32 byte TXID in 64 hexadecimal characters>
```

#### /api/v1/batchBroadcast (`application/json`)

**Request body**

```json
[
  {
    "rawTx": "bitcoin transaction in hex..."
  },
  {
    "rawTx": "bitcoin transaction in hex..."
  },
  ....
]
```

#### /api/v1/batchBroadcast (`application/octet-stream`)

**Request body**

```
one or more bitcoin transactions as a stream of bytes (binary) 
```

**Response for both text and binary requests:**

```json
200 OK
application/json
{
  "txs": [
    {
      "txid": "<32 byte TXID in 64 hexadecimal characters>",
      "returnResult": "success or failure",
      "resultDescription": "string"
    }
  ],
  "failureCount": number
}
```

The resultDescription contains the exact responses returned by the bitcoin node for each transaction.

***


# MAPI Endpoints

### MAPI endpoints (as per <https://github.com/bitcoin-sv-specs/brfc-merchantapi>)

```url
curl -X GET  https://api.taal.com/mapi/policyQuote
curl -X GET  https://api.taal.com/mapi/feeQuote
curl -X GET  https://api.taal.com/mapi/tx/{hash:[0-9a-fA-F]+}
curl -X POST https://api.taal.com/mapi/tx
curl -X POST https://api.taal.com/mapi/txs
```

These endpoints will point to the current live MAPI reference implementation.

It is also possible to access endpoints for a specific MAPI specification:

### **MAPI 1.1 endpoints (as per <https://github.com/bitcoin-sv-specs/brfc-merchantapi/tree/v1.1>)**

```
curl -X GET  https://api.taal.com/mapi/v1.1/feeQuote
curl -X GET  https://api.taal.com/mapi/v1.1/tx/{hash:[0-9a-fA-F]+}
curl -X POST https://api.taal.com/mapi/v1.1/tx
curl -X POST https://api.taal.com/mapi/v1.1/txs
```


# Bitcoin Endpoints

### Bitcoin endpoints (only with bitcoin-enabled APIKey)

```
curl -X POST https://api.taal.com/api/v1/bitcoin
```

The possible bitcoin RPC commands that are available are:

* getbestblockhash
* gettxout
* gettxouts
* decoderawtransaction
* getrawtransaction
* getmempoolancestors
* getmempooldescendants

Examples:

```
curl \
	--header 'Authorization: {APIKey}' \
	--header 'Content-Type: application/json' \
	--data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' \
	https://api.taal.com/api/v1/bitcoin

curl \
	--header 'Authorization: {APIKey}' \
	--header 'Content-Type: application/json' \
```


# Electrum X Endpoints

### Electrum X endpoints (only with electrum-enabled APIKey)

```
curl -X GET  https://api.taal.com/api/v1/address/{address}/info

curl -X GET  https://api.taal.com/api/v1/address/{address}/balance
curl -X GET  https://api.taal.com/api/v1/address/{address}/history
curl -X GET  https://api.taal.com/api/v1/address/{address}/unspent

curl -X GET  https://api.taal.com/api/v1/address/hash/{scriptHash}/balance
curl -X GET  https://api.taal.com/api/v1/address/hash/{scriptHash}/history
curl -X GET  https://api.taal.com/api/v1/address/hash/{scriptHash}/unspent

curl -X POST https://api.taal.com/api/v1/addresses/balance
curl -X POST https://api.taal.com/api/v1/addresses/history
curl -X POST https://api.taal.com/api/v1/addresses/unspent
```

Examples:

```
curl \
  --header 'Authorization: {APIKey}' \
  https://api.taal.com/api/v1/address/1HRADRLckTpFJJskkihZp16X6jR8JVRJcr/unspent
```


# ARC Endpoints

ARC is the successor of mAPI, the merchant API.

The URL of TAAL's mainnet ARC API is: <https://arc.taal.com/v1>

For instance the policy could be fetched using the following `curl` command

```powershell
curl --location 'https://arc.taal.com/v1/policy' \
--header 'Authorization: <API Key>'
```

A complete description of ARC API endpoints can be found under the following link: <https://bitcoin-sv.github.io/arc/api.html>.

It is recommended to use the BIP-239 transaction format for submitting transactions to ARC.

More information about ARC can be found under these links

* High-level documentation: <https://bitcoin-sv.github.io/arc/>
* Github repository: <https://github.com/bitcoin-sv/arc>
* Description of BIP-239 standard: <https://github.com/bitcoin-sv/arc/blob/master/doc/BIP-239.md>

### ARC Testnet

URL: [`https://arc-test.taal.com/v1`](https://arc-test.taal.com/v1)


# Transaction format and fee rate

### Fee rate

The current standard fee rate which applies to all transactions submitted to any of the TAAL transaction processing APIs is: 100 sat/kb

The minimum fee for any transaction is 100 sat/kB.

The fee required is rounded depending on size of the transaction. The following list exemplifies the logic:

* Transactions with 1.4999... kb > size > 0.0 kb => min absolute fee required = 1 sat.&#x20;
* Transactions with 2.4999... kb > size > 1.5 kb => min absolute fee required = 2 sat
* Transactions with 3.4999... kb > size > 2.5 kb => min absolute fee required = 3 sat
* ...

### Transaction format

The format of transaction is bound to the standard of BSV transactions as described [here](https://wiki.bitcoinsv.io/index.php/Bitcoin_Transactions).

There is a number of libraries which allow to build BSV transactions. Here is a short list:

* <https://www.npmjs.com/package/bsv>
* <https://github.com/libsv/go-bt>

#### Javascript example using version 1 of bsv.js and request modules

1. Create a new Node.js project:

   ```bash
   mkdir example
   cd example
   npm init -y
   npm install bsv@1
   npm install request
   ```
2. Save the following code to a main.js in your example folder:

   ```javascript
   const fs = require('fs')
   const bsv = require('bsv')

   // Random key produced each time...
   const newKey = bsv.PrivateKey()

   console.log(`Private key:     ${newKey.toString()}`)
   console.log(`Mainnet address: ${newKey.toAddress('mainnet').toString()}`)

   console.log(`
   1. Create a funding transaction by sending 1000 satoshis (0.00001 BSV) to ${newKey.toAddress('mainnet').toString()}.

   2. Add your Taal apiKey, and funding transaction txid and vout to 'generated.js'.

   3. Execute the generated code:

     node generated.js

   `)


   fs.writeFileSync('generated.js', `
   const bsv = require('bsv')
   var request = require('request')

   const privKey = bsv.PrivateKey('${newKey}')

   const apiKey = ""        // Add Taal mainnet API Key
   const fundingTxid = ""   // Add the funding transaction txid
   const fundingVout = -1   // Replace with funding transaction vout
   const returnAddress = "" // The address to return the 1000 satoshis (less fees)

   if (apiKey === "" || fundingTxid === "" || fundingVout === -1 || returnAddress === "") {
     console.log('This generated file needs an apiKey, a fundingTxid, a fundingVout and a returnAddress')
     process.exit(1)
   }

   const utxo1 = {
     txId: fundingTxid,
     outputIndex: fundingVout,
     address: privKey.toAddress('mainnet').toString(),
     script: bsv.Script.buildPublicKeyHashOut(privKey.publicKey).toHex(),
     satoshis: 1000
   }

   const tx1 = bsv.Transaction()
     .from(utxo1)
     .to(privKey.toAddress('mainnet').toString(), 800)
     .change(returnAddress)
     .sign(privKey)

   const utxo2 = {
     txId: tx1.hash,
     outputIndex: 0,
     address: privKey.toAddress('mainnet').toString(),
     script: bsv.Script.buildPublicKeyHashOut(privKey.publicKey).toHex(),
     satoshis: 800
   }

   const tx2 = bsv.Transaction()
     .from(utxo2)
     .change(returnAddress)
     .sign(privKey)
     

   const txBuffer = Buffer.concat([
     tx1.toBuffer(),
     tx2.toBuffer()
   ])

   // Send the transaction to Taal API...
   request.post({
     url: 'https://api.taal.com/api/v1/batchBroadcast',
     headers: {
       'Authorization': apiKey,
       'Content-Type': 'application/octet-stream'
     },
     body: txBuffer
   }, function(error, response, body) {
     console.log(error, response.statusCode, body)
   })
   `)
   ```
3. Execute the code and follow the onscreen instructions:

   ```bash
   node main.js   
   ```


# TAAL Wallet


# Introduction

TAAL Wallet is a non-custodial chrome extension for managing native BSV and tokens.

The following are the features of TAAL Wallet:

* Ability to connect a wallet to a web application.
* Manage and store your keys locally.
* Send and receive native BSV transactions
* Sign token transactions

### System Requirements

The following are the system requirements for the TAAL Wallet:

* TAAL Wallet works only with Google Chrome web browser.


# Architecture

List of tech stack used

TAAL Wallet Chrome extension is built using React and Typescript.

## **Features**

* [React 18](https://reactjs.org/)
* [Redux Toolkit](https://redux-toolkit.js.org/)
* [BSV Javascript library](https://github.com/moneybutton/bsv)
* [TypeScript](https://www.typescriptlang.org/)
* [Webpack](https://webpack.js.org/)
* [ESLint](https://eslint.org/)
* [Prettier](https://prettier.io/)
* [Chrome Extension Manifest Version 3](https://developer.chrome.com/docs/extensions/mv3/intro/)

## Chrome Extension Documentation

* [ChromeExtension](https://developer.chrome.com/docs/extensions/mv3/)

## Communication

### Long lived connection

#### In background.js

```
chrome.runtime.onConnectExternal.addListener(port => {
  console.log('Client connected', port);
  port.onMessage.addListener(msg => {
    console.log('onExternalMessage', msg);
  });
});
```

#### In web page

```
const port = chrome.runtime.connect(extensionId, { name: 'some-name' });
port.onMessage.addListener(console.log);
port.postMessage({ payload: 'anything' })
```

#### In content script

```
const port = chrome.runtime.connect({ name: 'some-name' });
port.postMessage({ payload: 'anything' });
port.onMessage.addListener(msg => {
  console.log('onMessage', msg);
});
```

### One time communication (web -> background.js)

#### In background.js

```
chrome.runtime.onMessageExternal.addListener((payload, data, cb) => {
  console.log('onMessageExternal', { payload, data });
  if (typeof cb === 'function') {
    cb('response from background.js');
  }
  return true;
});
```

#### In web page

```
chrome.runtime.sendMessage(extensionId, { payload: 'anything' }, console.log)
```

#### In content script

```
chrome.runtime.sendMessage({ payload: 'anything' }, console.log);
```


# Terminology

#### Send BSV

Ability for the user to send satoshis to a valid address on the network.

#### Receive BSV

reveals a BSV address or QR code.

#### History

It shows the history of transaction with transaction ID and block height.

#### Add account

Ability for the user to add  new account by creating new wallet with password, network selection and mnemonics .

#### Satoshis

The smallest indivisible unit is a bitcoin. 1E8 Satoshis = 1 bitcoin

#### Recovery phrase (also called seed phrase or mnemonic phrase)

A recovery phrase is a group of words, usually 12 or more that are generated when a new crypto wallet is created. You can use the recovery phrase to retrieve your crypto accounts, using any compatible wallet.

#### Passphrase

The Passphrase is an advanced feature that adds a 13th word of your choosing to your recovery phrase.

Using a Passphrase will cause an entirely different set of addresses to be created which cannot be accessed via the 12-word recovery phrase alone.

Aside of adding another layer, the Passphrase grants you plausible deniability when under duress.

If using a Passphrase, it’s key to store it securely and remember it perfectly, character for character.

#### Get Balance

Enables user to get the latest balance reflected in the account.

#### Airdrop

Testnet only. Will send a small amount of BSV test coins to your account.


# UI Elements

## Welcome to TAAL Wallet window

This is the welcome window of the TAAL Wallet.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2F0ESjDrKKxwZlV98bwm9V%2Fimage.png?alt=media&amp;token=763cac87-f631-4eee-a8c7-71056add7ae5" alt=""><figcaption><p>Start by creating a new wallet or recovering an existing one</p></figcaption></figure>

The following table describes the UI elements available on this window.

| UI Elements            | Description                                                                                                               |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| CREATE A WALLET button | Displays the *Create a new Wallet* window, where you can create a new wallet.                                             |
| IMPORT WALLET button   | Displays the *Import your Wallet* window, where you can import an existing wallet if you have the secret recovery phrase. |

## Create a new wallet window

You can use this window to create a new wallet.

**To reach this window**: On the *Welcome to TAAL Wallet* window, click **CREATE A WALLET** or on the *Wallet* window, click on **Add new account**.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FukCUNd0c83jVx6nPyJy7%2Fimage.png?alt=media&amp;token=211b478d-773c-4d62-a187-27c0c0168fc9" alt="" width="411"><figcaption><p>Step 1</p></figcaption></figure>

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FYkuCAifO9nGjNuwibuDk%2Fimage.png?alt=media&amp;token=35681823-f072-44dd-a256-177ec382f4b0" alt="" width="431"><figcaption></figcaption></figure>

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FigbW6Dj4R6vqxriEmsqh%2Fimage.png?alt=media&amp;token=23959317-af34-4cd6-8661-0fc6b0586130" alt="" width="427"><figcaption></figcaption></figure>

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2F7bedcZfWC392T60Bp5pu%2Fimage.png?alt=media&amp;token=6bb51c52-18be-42da-a4f9-9e8f9750cfe1" alt="" width="430"><figcaption></figcaption></figure>

The following table describes the UI elements available on this window.

| UI Elements            | Description                                                                                                                                                                                                                                                                                                                 |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Account name field     | The name of the account. This field is mandatory.                                                                                                                                                                                                                                                                           |
| Password field         | The 8 characters password for the account. This field is mandatory.                                                                                                                                                                                                                                                         |
| Repeat password field  | The password for the account same as provided in the previous field. This field is mandatory.                                                                                                                                                                                                                               |
| Network drop-down list | <p>The available networks, and the options are:</p><ul><li>Testnet</li><li>Mainnet </li></ul><p>This field is mandatory.</p>                                                                                                                                                                                                |
| Recovery phrase        | <p>It is a group of words, usually 12 or more that are generated when a new crypto wallet is created.<br><strong>Note:</strong> Here is your 12 words recovery phrase. It is incredibly important to take a note of this and keep it safe as without you may lose access to your wallet and the funds contained within.</p> |

## Import your Wallet window

You can use this window to import an existing wallet.

**To reach this window**: On the *Welcome to TAAL Wallet* window, click **IMPORT WALLET** or on the *Wallet* window, click <img src="broken://files/6nI9VkHiT8p7292jZFzs" alt="" data-size="line"> > **Import account**.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2Ft8OH03ezw7JbMsTZWnV3%2Fimage.png?alt=media&amp;token=790540c4-afad-4219-acec-d81ded392ed7" alt="" width="374"><figcaption></figcaption></figure>

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2F3NGqKl0VLX5fNJi8Pdyi%2Fimage.png?alt=media&amp;token=446ab88c-0919-4cbc-8403-0e38aa46081c" alt="" width="403"><figcaption><p>Recover an account secured with a standard recovery phrase</p></figcaption></figure>

&#x20;

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FG6IwRprBUocy9EwHvsl9%2Fimage.png?alt=media&amp;token=1ab478b7-09aa-47c1-9188-3442884a90ad" alt=""><figcaption><p>Recover an account secured with a standard recovery phrase and a passphrase</p></figcaption></figure>

The following table describes the UI elements available on this window.

| UI Elements             | Description                                                                                                                  |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| create a new one button | Displays the *Create a new Wallet* window, where you can create a new wallet.                                                |
| Account name field      | The name of an existing account. This field is mandatory.                                                                    |
| Password field          | The 8 characters password for the account. This field is mandatory.                                                          |
| Repeat password field   | The password for the account same as provided in the previous field. This field is mandatory.                                |
| Network drop-down list  | <p>The available networks, and the options are:</p><ul><li>Testnet</li><li>Mainnet </li></ul><p>This field is mandatory.</p> |
| Recovery phrase field   | It is a group of words, usually 12 or more that are generated when a new crypto wallet is created.                           |
| Passphrase              | The Passphrase is an advanced feature that adds a 13th word of your choosing to your recovery phrase.                        |

## Wallet main window

The main window of the TAAL Wallet.

&#x20;The following table describes the UI elements available on this window.

| UI Elements                                                                    | Description                                                                                                                      |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| <img src="broken://files/ZewzchVbeCdy2NZtaoiS" alt="" data-size="line"> button | Displays the wallets and selected network.                                                                                       |
| Add new account button                                                         | Displays the *Create a new Wallet* window, where you can create a new wallet.                                                    |
| Import account button                                                          | Displays the *Import your Wallet* window, where you can import an existing wallet.                                               |
| <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> button | Displays all the menu options available.                                                                                         |
| Home button                                                                    | Displays *Home* window.                                                                                                          |
| Select Wallet button                                                           | Displays the *Your Wallets* window, where you can select the Wallet you want.                                                    |
| Send BSV button                                                                | Displays the *Send BSV* window, where you can send satoshis to a valid address on the network.                                   |
| Receive BSV button                                                             | Displays the *Receive BSV* window, where you can view the BSV address or QR code of the account.                                 |
| History button                                                                 | Displays the *Your Wallet's history* window, where you can view the history of transaction with transaction ID and block height. |
| Tokens button                                                                  | Displays the *Your Tokens* window, where you can view the tokens.                                                                |
| Options button                                                                 | Display the Access Control List window, where you can view and delete the Websites with access to TAAL Wallet.                   |
| Airdrop button                                                                 | Testnet only. Will send a small amount of BSV test coins to your account.                                                        |
| Lock Wallet button                                                             | Locks the wallet.                                                                                                                |

## Home window

This window displays the current account, wallets details, and balance.

**To reach this window**: on the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Home**.

The following table describes the UI elements available on this window.

| UI Elements                                                               | Description                                                                                                                                   |
| ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Current account                                                           | The name of the current account.                                                                                                              |
| ![](broken://files/hfskCJKskBST2GCf0sBp)                                  | Edits the name of the current account.                                                                                                        |
| Name field                                                                | The name of the wallet.                                                                                                                       |
| Path field                                                                | The path of the wallet                                                                                                                        |
| Address field                                                             | The address of the wallet.                                                                                                                    |
| Balance field                                                             | The balance in satoshis available in the wallet.                                                                                              |
| Updated at field                                                          | The date and time when the wallet was last updated.                                                                                           |
| SELECT ANOTHER WALLET button                                              | Displays the *Your Wallets* window, where you can view the wallets available in your current account, and you can select the wallet you want. |
| Balance                                                                   | <p>The balance in </p><p>satoshis available in the current account.</p>                                                                       |
| ![](broken://files/bTkY1Zp33lMpmwWSiVDA)Refresh balance or refresh button | Refreshes the balance.                                                                                                                        |
| SEND BSV button                                                           | Displays the *Send BSV* window, where you can send satoshis to a valid address on the network.                                                |
| RECEIVE BSV button                                                        | Displays the *Receive BSV* window, where you can view the BSV address or QR code of the account.                                              |
| HISTORY button                                                            | Displays the *Your Wallet's history* window, where you can view the history of transaction with transaction ID and block height.              |
| TOKENS button                                                             | Displays the *Your Tokens* window, where you can view the tokens.                                                                             |

## Your Wallets window

This window displays the wallets available in your current account, and you can select the wallet you want.

**To reach this window**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Select Wallet**,  or on the *Home* window, click **SELECT ANOTHER WALLET**.

The following table describes the UI elements available on this window.

| UI Elements                | Description                                                                       |
| -------------------------- | --------------------------------------------------------------------------------- |
| CREATE A NEW WALLET button | Display the *Create a New Wallet* window, where you can create a new wallet.      |
| Wallet section             | Display the wallet details, such as Name, address, Path, Balance, and Updated at. |
| SELECT button              | Enables you to select the wallet you want.                                        |

## Send BSV window

You can use this window to send satoshis to a valid address on the network.

**To reach this window**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Send BSV** or on the *Home* window, click **SEND BSV**.

The following table describes the UI elements available on this window.

| UI Elements                            | Description                                                              |
| -------------------------------------- | ------------------------------------------------------------------------ |
| Destination address field              | The address to which you want to send satoshis. This field is mandatory. |
| Amount in satoshis (max 1002500) field | The amount in satoshis you want to send. This field is mandatory.        |
| CANCEL button                          | Cancels the transaction.                                                 |
| SEND button                            | Sends satoshis to a valid address on the network.                        |

## Receive BSV

This window displays the BSV address or QR code of the account.

{% hint style="info" %}
It works only with BSV. If you send any other cryptos, it will result in the loss of funds.
{% endhint %}

**To reach this window**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Receive BSV** or on the *Home* window, click **RECEIVE BSV**.

The following table describes the UI elements available on this window.

| UI Elements                                                                                 | Description                            |
| ------------------------------------------------------------------------------------------- | -------------------------------------- |
| Your BSV address: field                                                                     | The BSV address of the account.        |
| <img src="broken://files/LHgrSnebvwszTjnNBW1L" alt="" data-size="line">Click to copy button | Copies the BSV address of the account. |
| QR code                                                                                     | The QR code of the account.            |

## Your Wallet's history window

This window displays the history of transaction with transaction ID and block height.

**To reach this window**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **History** or on the *Home* window, click **HISTORY**.

The following table describes the UI elements available on this window.

| UI Elements            | Description                           |
| ---------------------- | ------------------------------------- |
| Refetch history button | Retrieves the history of the wallets. |
| TX ID field            | The ID of the transaction.            |

## Your token window

This view displays the tokens.

**To reach this window**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Tokens** or on the *Home* window, click **TOKENS**.

## Access Control List window

This window displays the Websites with access to TAAL Wallet, and you can also delete them.

**To reach this window**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Options**.&#x20;


# Tutorial

## Install TAAL Wallet from Chrome Web Store

The following are the steps to install TAAL Wallet in your system from Chrome Web Store:

1. Go to [Chrome Web Store](https://chrome.google.com/webstore). \
   The *chrome web store* window is displayed.
2. In the **Search the store** field, search for TAAL Web3 Wallet.
3. Click **Add to Chrome**. \
   You can see the TAAL Wallet in your extensions.
4. Click TAAL Wallet. \
   The *Terms of Service agreement* window is displayed.
5. Click **ACCEPT**. \
   The *Welcome to TAAL Wallet* window is displayed and you are ready to use the TAAL Wallet.

{% hint style="info" %}
TAAL Wallet works only with Google Chrome web browser.
{% endhint %}

## Install TAAL Wallet using the code from GitHub

The following are the steps to install TAAL Wallet using the code from GitHub:

1. Clone the code available at: <https://github.com/TAAL-GmbH/taal-wallet>.
2. In your **Command Prompt**, go to the working directory.
3. Run `yarn.`
4. Run`yarn dev.`
5. Go to the Google Chrome web browser.
6. Click **Extensions** > **Manage Extensions**.\
   The *Extensions* window is displayed.
7. In the *Extensions* window, enable **Developer mode**.
8. Click **Load unpacked**.\
   The **Select the extension directory.** dialog box is displayed.
9. In the **Select the extension directory.** dialog box, select the **dist** folder from the project.\
   The TAAL Wallet extension is available in your **Extensions**.
10. Click TAAL Wallet. \
    The *Terms of Service agreement* window is displayed.
11. Click **ACCEPT**. \
    The *Welcome to TAAL Wallet* window is displayed and you are ready to use the TAAL Wallet.

### Customise the password length

Copy `sample.env` to `.env` and customise it with your requirements, Eg. PASSWORD\_MIN\_LENGTH=1

## Create a new Wallet

The following are the steps to create a wallet:

1. On the *Welcome to TAAL Wallet* window, click **CREATE A WALLET** or on the *Wallet* window, click <img src="broken://files/6nI9VkHiT8p7292jZFzs" alt="" data-size="line"> > **Add new account**. \
   The *Create a new wallet* window is displayed.
2. In the **Account name** field, enter the account name.
3. In the **Password** field, enter the 8 characters password.
4. In the **Repeat password** field, repeat the password.
5. In the **Network** list, select the network, such as Taalnet, Testnet, and Mainnet.
6. In the **Secret phase** field, you are provided with the 12 words seen phrase.
7. Click **NEXT**. \
   A new wallet is created.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FeEmtrehJ7PYnWUmmV2Eo%2Fimage%20(1).png?alt=media&amp;token=0f8f2be0-7862-4009-8503-d4b75ba1577c" alt=""><figcaption></figcaption></figure>

## Import an existing Wallet

The following are the steps to import an existing wallet:

1. On the *Welcome to TAAL Wallet* window, click **IMPORT WALLET** or on the *Wallet* window, click <img src="broken://files/6nI9VkHiT8p7292jZFzs" alt="" data-size="line"> > **Import account**. \
   The *Import your Wallet* window is displayed.
2. In the **Account name** field, enter the name of an existing account.
3. In the **Password** field, enter the 8 characters password.
4. In the **Repeat password** field, repeat the password.
5. In the **Network** list, select the network, such as Taalnet, Testnet, and Mainnet.
6. In the **Secret phase** field, enter the 12 words seen phrase provided when you created the this account.
7. Click **NEXT**. \
   An existing wallet is imported.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FyKugSDJHED0L2xojPAjD%2Fimage%20(2).png?alt=media&amp;token=d8125f91-d377-46e6-8d7c-fe245ae2b40a" alt=""><figcaption></figcaption></figure>

## Create a new Wallet in the current account

The following are the steps to create a new wallet in the current account:

1. On the **Wallet** main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Select Wallet**.\
   The *Your Wallets* window is displayed.
2. On the *Your Wallets* window, click **CREATE A NEW WALLET**. \
   The *Create a New Wallet* window is displayed.
3. In the **Name** field, enter the name of the wallet.
4. Click **NEXT**. \
   A new wallet is created

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FFCQ30sueDZ0rjt3otLQr%2Fimage3.png?alt=media&amp;token=291add98-7453-4f92-9a2a-86d718c752c0" alt=""><figcaption></figcaption></figure>

## Send BSV

The following are the steps to send BSV:

1. On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Send BSV** or on the *Home* window, click **SEND BSV**. \
   The *Send BSV* window is displayed.
2. In the **Destination address** field, enter the address to which you want to send satoshis.
3. In the **Amount in satoshis (max 1002500)** field, enter the amount in satoshis you want to send.
4. Click **SEND**. \
   The satoshis is sent to a valid address on the network.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FsfYJELzKBFMeBrrRRyML%2Fimage4.png?alt=media&amp;token=ba69b635-bd8c-4c9f-802a-eada3728eea4" alt=""><figcaption></figcaption></figure>

## Receive BSV

1. On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Receive BSV** or on the *Home* window, click **RECEIVE BSV**. \
   The *Receive BSV* window is displayed.
2. Click ![](broken://files/HzjR8aFVyQEUNkqdMJO3)to copy the BSV address of the account or scan the QR code.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FcGOWS1nXTmqerZmldkpQ%2Fimage5.png?alt=media&amp;token=0f7bfac4-a04a-4c60-8670-70881286d278" alt=""><figcaption></figcaption></figure>

## View History

**To view History**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **History** or on the *Home* window, click **HISTORY**. \
The *Your Wallet's history* window is displayed in which you can view the history of transaction with transaction ID and block height.

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2F96y4iHBxaymauzpECRDI%2Fimage6.png?alt=media&amp;token=433ea6af-f08d-4a98-85a3-320eca3b7a42" alt=""><figcaption></figcaption></figure>

## Airdrop

**To airdrop**: On the *Wallet* main window, click <img src="broken://files/1UWgfa1I05sWDP4gmCFc" alt="" data-size="line"> > **Airdrop**. \
**Testnet** only. Will send a small amount of BSV test coins to your account.


# 1Sat Ordinals tokens API


# Introduction

1SatOrdinals in an implementation of Ordinals running on the BSV blockchain.

See the [<img src="https://243402672-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FszFH9JXtqC2V7WUpj8IT%2Ficon%2FOaw1NzFvVpELXIqAcAH2%2Fonsatlogo.png?alt=media&#x26;token=54ed8cfe-68af-49d9-9896-425c04d15e58" alt="" data-size="line">Protocol Specification | 1Sat Ordinals](https://docs.1satordinals.com/) for more information on 1Sat Ordinals and the [Ordinals Docs](https://docs.ordinals.com/) for more information on Ordinals and ordinal theory.


# Terminology

**Satoshis**

The smallest indivisible unit of a bitcoin. 1E8 Satoshis = 1 bitcoin

**Script**

Low level bitcoin script.

**SDK**

Software Developer Kit is a software library to make certain tasks easier for a software developer.

**UTXO**

An Unspent Transaction Output is an amount of bitcoin that can be spent by the recipient.

**Inscription ID**

An outpoint representing a particular inscription, comprised of a transaction ID and output index with the following formatting: \`txid\_vout\`

**Inscription Number**

This is an auto-incrementing id given to each inscription as they appear in mined blocks, starting with inscription #0. Because inscription numbers are dependent on the order of transactions in a block, inscription numbers are not assigned until a transaction is confirmed. This also makes inscription number sensitive to reorgs.

**Origin**

This is like a "low resolution" ordinal number. It represents the last time a particular ordinal became a 1 satoshi output. Since utxos can be split and joined over time, an ordinal can have more than one origin. This is a 1Sat protocol specific concept, not present in the original ordinals protocol.

**Ordinal Number**

An ordinal is an identifier given to a specific satoshi. It is given when the sat comes into existence during a coinbase transaction. To learn more about this concept read the original "ordinal theory" documentation.


# Flow Diagram

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FwA6lkPnuLGO8LL91chtz%2Fimage.png?alt=media&amp;token=687cfd2e-a4d4-40fd-abd9-e5aa1d2703aa" alt=""><figcaption></figcaption></figure>


# Basic Tutorial - Node

**Github Repository**

[**https://github.com/TAAL-GmbH/1sat-tutorial**](https://github.com/TAAL-GmbH/1sat-tutorial)

`mkdir 1sat-tutorial`

cd `1sat-tutorial`

Demo code using our 1Sat Token Studio API can be found on Github so you can clone our repository or if you want to do it manually, we need to make now a node project

`npm init`

and answer in the questions.

Let’s add the dependencies\
`npm install bsv@1.5.4` \
`npm install axios`

Make sure your package.json looks like this (you might need to change the type to “module” and add a new entry to run the tutorial- `"tutorial": "node index.js"`\ <br>

`{ "name": "1sat-tutorial",` \
&#x20;  `"version": "1.0.0",` \
&#x20;  `"description": "1sat-tutorial",` \
&#x20;  `"type": "module",` \
&#x20;  `"main": "index.js",` \
&#x20;  `"scripts": { "test": "echo \"Error: no test specified\" && exit 1",` \
&#x20;               `"tutorial": "node index.js"` \
&#x20;   `},`\
&#x20;  `"author": "TAAL",`\
&#x20;  `"license": "ISC",` \
&#x20;  `"dependencies": {` \
&#x20;        `"dependencies": { "axios": "^1.7.2",` \
&#x20;                          `"bsv": "^1.5.4"`  \
&#x20;   `}` \
`}`

Now we are ready to start coding. Create the main file you specified during the setup e.g. `index.js`in the root of the `1sat-tutorial` folder as well as the helping file 1sat\_utils.cjs using your editor or IDE of choice.

1. Copy the code from our files and paste.
2. in index.js you will need to replace the sample API key from your TAAL API Key
3. You can also tune which steps to run, only the creation of a single/standalone token, the inscription of a collection with one item or individual steps you may want to debug in depth e.g.\ <br>

   `const STEPS_TO_TEST =[ 'single', 'collection'];` \
   `///const STEPS_TO_TEST =['1.1','1.2','1.3','1.4','1.5', '1.6', '1.7']; //const STEPS_TO_TEST =['2.1','2.2','2.3','2.4','2.5', '2.6', '2.7', '2.8', '2.9'];`

&#x20;

You can test now. If all was properly configured you should see something like this:

&#x20;

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2Foacp79FQ9vO7Vs09JakZ%2Fimage.png?alt=media&amp;token=57c1d15a-ce02-4df3-afa9-f2d9ae41da6c" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FUz7MaqoH0gPlE0dkSuqV%2Fimage.png?alt=media&amp;token=af210320-65cd-4651-a58e-0684c49107af" alt="" width="375"><figcaption></figcaption></figure>

&#x20;

Add label


# Basic Tutorial - Postman

You can download our Postman Collection from here:

<https://github.com/TAAL-GmbH/1sat-tutorial>

Once imported you will need to type in your personal values in the 1.1 Create Project Pre-request script

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FpyFPZTMECtJqYTEhMYmD%2Fimage.png?alt=media&amp;token=11a86734-18bd-4138-a4e5-bf6148f6b03c" alt=""><figcaption></figcaption></figure>

Once done, you can go through the steps one by one to create:

1.- A Standalone token (HTML token)

2.- A Collection (Image Token) with one collectionItem (Text token)

<figure><img src="https://2508019120-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyfAtaTqtkuE86sIuMiYD%2Fuploads%2FutSnU6G7n0cKt3KW68y3%2Fimage.png?alt=media&amp;token=29a26fd8-64b6-49b8-ba91-733e47065221" alt=""><figcaption></figcaption></figure>


# API

This API will allow you to create 1SatOrdinals Single and Collection Tokens.

## Common

#### An Api Key must be passed in the header of all requests see [Authentication](broken://pages/sscPhAYRcbx6gUatghiE#authentication)

## Create a Token Studio Project for your Standalone - Collection

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/project/create
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/project/create' \
--header 'Apikey: ## VALID_API_KEY ##' \
--header 'Content-Type: application/json' \
--data '{
    "name": "1satcol project 1718100516565",
    "isFungible": false,
    "type": "single", //"collection"
    "tokenProtocol": "OneSatOrdinal"
}'


```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": boolean,
    "data": {
        "projectUid": <uid>
    }
}
```

{% endcode %}

## Get a list of your Token Studio projects

It will return all projects associated with your API Key.

{% code title="HTTP Request" %}

```
GET https://platform.taal.com/token-studio/api/v1/project/
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/project/' \
--header 'Apikey: ## VALID_API_KEY ##'
```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": boolean,
    "data": {
        "projectList": [
            {
                "uid": <uid>,
                "name": string,
                "network": string,
                "offChainData": {
                    "isFungible": boolean
                },
                "tokenProtocol": string
            }
        ]
    }
}
```

{% endcode %}

## Get details for a specific project id

Returns a project for a valid project id.

{% code title="HTTP Request" %}

```
GET https://platform.taal.com/token-studio/api/v1/project/<projectId>
```

{% endcode %}

{% code title="cURL" %}

```shell
  curl --location 'https://platform.taal.com/token-studio/api/v1/project/<projectId>' \
  --header "Apikey: ## VALID_API_KEY ##"
```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": true,
    "data": {
        "uid": <uid>,
        "name": string,
        "tokenProtocol": string,
        "network": string,
        "isFungible": boolean,
        "type": string
    }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description        |
| --------- | ------------------ |
| projectId | A valid project Id |

## Output creation

Creates an output (single, collection, collectinItem) in the project.&#x20;

Single projects can only contain single/standalone outputs

Collection projects need first a collection output created and then one or several collectionItems linked to the initial collection output

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-output
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-output' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json' \
--data '{
    "projectUid": "<projectId>",
    
    "contentType":"text/html;charset=utf8",
    "b64File":"PGh0bWw+PGJvZHk+SGVsbG8gV29ybGQ8L2JvZHk+PC9odG1sPg==",
    
    "metadata": {
        "name": "My single token 1718101145907",
         "subType": "single",
         "subTypeData": "{\"description\": \"this is description\" }",
        "type": "ord",
        "description": "this is a standalone token description",
        "info": "anything",
        "eyes": "green"
    }
}'

```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": true,
    "data": {
        "uid": <uid>,
        "type": string,
        "tokenProtocol": string
    }
}

```

{% endcode %}

**Body Parameters**

<table><thead><tr><th width="361">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>subType</td><td><ul><li>'single' for standalone tokens in single projects</li><li><p>'collection' for the seed token in collection projects</p><ul><li>'collectionItem' for each element linked to the collection</li></ul></li></ul></td></tr><tr><td>projectUid</td><td>projectUid</td></tr><tr><td>contentType</td><td>contentType depending on the desired output type (text, html or image)</td></tr><tr><td>b64File</td><td>Raw content formatted in b64</td></tr><tr><td>metadata</td><td><pre><code>Mandatory:
"name": NFT name
"type": "ord"
"subType": "single" //"collection" or "collectionItem",
"subTypeData": stringified JSON,
"description": string,
Other e.g. traits:
        "info": "anything",
        "eyes": "green"
</code></pre></td></tr></tbody></table>

## Output deletion

Deletes an output (single, collection, collectinItem) in the project.&#x20;

{% code title="HTTP Request" %}

```
DELETE https://platform.taal.com/token-studio/api/v1/output/{{outputUid}} 
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location --request DELETE 'https://platform.taal.com/token-studio/api/v1/output/{{outputUid}}' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json'

```

{% endcode %}

{% code title="Response JSON structure" %}

````json
```json
"success": true,
    "data": {
        "uid": "<uid>",
        "createdAt": "<timestamp>",
        "type": "token",
        "tokenProtocol": "OneSatOrdinal",
        "projectUid": "<uid>",
        "transactionUid": null,
        "txId": null,
        "identityUid": "<uid>",
        "address": null,
        "metadata": { <metadata>
        },
        "offChainData": {
            <fileData>
        }
    }
}
```
````

{% endcode %}

**Query Parameters**

| Parameter | Description       |
| --------- | ----------------- |
| outputUid | A valid output Id |

## Output List

Returns all outputs for a valid project id.

{% code title="HTTP Request" %}

```
GET https://platform.taal.com/token-studio/api/v1/output/by-project/{{projectUid}}?on-chain=0&type=collectionItem
```

{% endcode %}

{% code title="cURL" %}

```shell
  curl --location 'https://platform.taal.com/token-studio/api/v1/' \
  --header "Apikey: ## VALID_API_KEY ##"
```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": boolean,
    "data": {
        "outputList": [
            {
                "createdAt": <date>,
                "uid": <uid>,
                "projectUid": <uid>,
                "transactionUid": <uid> (null if has not been used in a transaction yet),
                "type": string,
                "tokenProtocol": string,
                "metadata": { //Key / value pairs e.g.
                    "app": string,
                    "eyes": string,
                    "info": string,
                    "name": string,
                    "type": string,
                    "subType": string,
                    "description": string,
                    "subTypeData": stringified JSON
                },
                "offChainData": {
                    "b64FileHash": string,
                    "b64FileSize": int,
                    "contentType": string
                }
            }
        ]
    }
}

```

{% endcode %}

**Query Parameters**

| Parameter  | Description                                                                                                        |
| ---------- | ------------------------------------------------------------------------------------------------------------------ |
| projectUid | A valid project Id                                                                                                 |
| on-chain   | Optional. If provided, the accepted values are 0/1 (false / true) to filter by outputs already broadcast           |
| type       | Optional. If provided, the accepted values are collection / collectionItem, to filter by a specific type of output |

## Unsigned Transaction creation

Creates an unsigned transaction ready to sign and then be broadcast.&#x20;

Unsigned transactions can refer to different outputs as well as different UTXO to be used for funding it

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-transaction
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-transaction' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json' \
--data '{
    "projectUid": "<projectUid>",
    "publicKey":  <Public Key>,
    "dstAddress": <Token Recipient Address>,
    "outputList": [<outputList>],
    "utxoList": [
        {
           "outputIndex": num,
            "txId": "<txId>"
        }
    ]
}'
```

{% endcode %}

Response JSON structure

```postman_json
{
    "success": boolean,
    "data": {
        "transactionUid": <uid>,
        "txObj": {<txObj>
        }
    }
}
```

**Body Parameters**

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>&#x3C;projectUid>
</code></pre></td><td>project Id</td></tr><tr><td><pre><code>&#x3C;publicKey>
</code></pre></td><td>publicKey</td></tr><tr><td><pre><code>dstAddress
</code></pre></td><td><pre><code>&#x3C;Token Recipient Address>
</code></pre></td></tr><tr><td><pre><code>outputList
</code></pre></td><td>List of output Ids</td></tr><tr><td><pre><code>txId
</code></pre></td><td>Funding txId</td></tr><tr><td><pre><code>outputIndex
</code></pre></td><td>Output Index of the tx e.g. 1</td></tr></tbody></table>

## Broadcast Transaction

Broadcast a signed transaction and returns its transaction Id

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/submit
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/submit' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json' \
--data '{
    "transactionUid": "<transactionUid>",
    "tx": "<txObjSigned>"
}
'
```

{% endcode %}

Response JSON structure

```postman_json
    {
      success: boolean,
      data: {
        txId: string
      }
    }

```

Body Parameters

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>transactionUid
</code></pre></td><td>Transaction Uid returned by the create transaction endpoint</td></tr><tr><td><pre><code>txObjSigned
</code></pre></td><td>Signed transaction ready to be broadcast</td></tr><tr><td></td><td></td></tr></tbody></table>


# FAQ

#### 1. **How can I cancel a subscription?** <a href="#id-1.-cancel-your-subscription" id="id-1.-cancel-your-subscription"></a>

Subscriptions last for a month and they are automatically renewed unless you specify it. If you don’t want to renew one of your subscriptions:

* Go to “My Account”
* Unselect “Auto Renewal” for that subscription

**2. What can I do when I can’t find the subscription that I want to cancel?**

* Go to “Support” &#x20;
* Create a ticket for Taal Support team.

#### 3. **How can I view my purchase history?** <a href="#id-2.-view-your-purchase-history" id="id-2.-view-your-purchase-history"></a>

* Go to “My Account”
* Click on “Invoicing & Billing”

**4. How can I change my payment method?**

* Go to “My Account”
* Click on “Invoicing & Billing” - “View More”
* Click on “Payment methods” - “Add payment method”
* Edit the desired subscription to use the new payment method.

**5.  How can I request a refund?**

* Go to “Support”&#x20;
* Create a ticket for Taal Support team.

**6. How can I check the status of my refund request?**

* Status of refund requests will be updated on the ticket

**7. When will I get the money back?**

* It takes about 10 business days for those valid refund cases. You will be kept informed on the ticket you raised for refund.

#### 8. **How can I get the invoice?** <a href="#id-4.-invoice" id="id-4.-invoice"></a>

* Go to “My Account”
* Click on “Invoicing & Billing”

#### 9. **What happens if I don't pay TAAL Client subscription?** <a href="#id-5.-others" id="id-5.-others"></a>

Subscription will be terminated and the corresponding API Key revoked.

**10. Will TAAL charge me after free trial?**

TAAL will only charge for the paid plans. To avoid limitations on Free keys, you will need to upgrade that specific key.

**11.  Can I upgrade my account?**

In the circumstance where you change your subscription pursuant to the Transaction Processing Agreement, you must cancel your previous subscription directly with Stripe. Subscriptions through the TAAL services will continue to accrue automatic renewal charges via Stripe until such cancellation is received by Stripe.

**12.  When will I be billed for my subscription?**

Billing happens at the time of subscription or renewal

**13. When will my subscription be renewed?**

Same day next month.

**14.  Can I pay with PayPal?**

At the moment it is only possible to pay with Credit Card

**15. What will happen if the remaining allowance for my plan is 0?**

The usage exceeding the allowance will be billed apart


# Support

### TAAL Community

Join our [TAAL Blockchain Discord](https://discord.com/invite/rAYtUfpuhx) community for support on the Transaction Processing and STAS services.

Join our WhatsOnchain Telegram channel for support on the WhatsOnchain services: <https://t.me/joinchat/FfE6-EjZhoTHwhDhZH6F-w>

###


# Glossary

**Blockchain**

It is a form of distributed database (or ledger) that acts as a record of all the valid transactions which are transmitted to the blockchain network.

#### Contract

An on-chain document representing the contract between token issuer and user.

#### Issue

Mint a token from an on-chain contract transaction.

#### P2PKH (Pay to public key hash)

The most common locking script used by default to send bitcoin.

#### Redeem

Destroy the token and return the locked Satoshis to the issuer.

#### Satoshis

The smallest indivisible unit of a bitcoin. 1E8 Satoshis = 1 bitcoin.

#### Script

Low level bitcoin script.

#### SDK

Software Developer Kit is a software library to make certain tasks easier for a software developer.

#### STAS

A token script named after its creator Stas. Also a reverse acronym: Substantiated Tokens from Actualized Satoshis.

#### Token

It is a type of digital property or control element that can be transferred using a blockchain.

#### UTXO

An Unspent Transaction Output is an amount of bitcoin that can be spent by the recipient.


# Acronyms and Abbreviations

| Acronym | Abbreviation                                  |
| ------- | --------------------------------------------- |
| API     | Application Programming Interface             |
| BSV     | Bitcoin Satoshi Vision                        |
| JSON    | JavaScript Object Notation                    |
| MIME    | Multipurpose Internet Mail Extensions         |
| P2P     | Peer-to-peer transactions                     |
| P2PKH   | Pay to public key hash                        |
| SDK     | Software Developer Kit                        |
| SPV     | Simplified Payment Verification               |
| STAS    | Substantiated Tokens from Actualized Satoshis |
| TXID    | Transaction ID                                |
| UTXO    | Unspent Transaction Output                    |


