Block

Get by Hash

This endpoint retrieves the block details of a given hash.

For a block with up to 100 transactions, all transaction ids are returned in response to this call. If a block has more than 100 transactions, only the top 100 transaction ids are returned. To get remaining ids see the 'Get block pages' section.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/block/hash/<hash>
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/hash/000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb"
Response JSON structure
{
  "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
  "confirmations": 89,
  "size": 14421,
  "height": 575045,
  "version": 536928256,
  "versionHex": "2000e000",
  "merkleroot": "4ebcba09addd720991d03473f39dce4b9a72cc164e505cd446687a54df9b1585",
  "txcount": 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": {
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff220345c6082f626d67706f6f6c2e636f6d2f473173717918707a8aae4a936f101e0000ffffffff018ed9814a000000001976a91485770ad0ee64a4f3ee4027e199c32f876e03a2d988ac00000000",
    "txid": "bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a",
    "hash": "bb146889d71357667c58a37258f40b0521a6ba7a259fbfa721b747d55567551a",
    "size": 119,
    "version": 1,
    "locktime": 0,
    "vin": [
      {
        "txid": "",
        "vout": 0,
        "scriptSig": {
          "asm": "",
          "hex": ""
        },
        "sequence": 4294967295,
        "coinbase": "0345c6082f626d67706f6f6c2e636f6d2f473173717918707a8aae4a936f101e0000"
      }
    ],
    "vout": [
      {
        "value": 12.50023822,
        "n": 0,
        "scriptPubKey": {
          "asm": "OP_DUP OP_HASH160 85770ad0ee64a4f3ee4027e199c32f876e03a2d9 OP_EQUALVERIFY OP_CHECKSIG",
          "hex": "76a91485770ad0ee64a4f3ee4027e199c32f876e03a2d988ac",
          "reqSigs": 1,
          "type": 0,
          "addresses": ["1DAhUiQxHzL1oAusoUDdUM89spXuAG1sqy"],
          "opReturn": null
        }
      }
    ],
    "blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
    "confirmations": 89,
    "time": 1553416668,
    "blocktime": 1553416668
  },
  "totalFees": 0.0002382199999999557,
  "miner": "Bmgpool",
  "pages": null
}

URL Parameters

Parameter
Description

network

Selected network: main or test.

hash

The hash of the block to retrieve

Get by Height

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

For a block with up to 100 transactions, all transaction ids are returned in response to this call. If a block has more than 100 transactions, only the top 100 transaction ids are returned. To get remaining ids see the 'Get block pages' section.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/block/height/<height>
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/height/575191"
Response JSON structure
{
  "hash": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
  "confirmations": 1,
  "size": 611,
  "height": 575191,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "95a920b1002bed05379a0d2650bb13eb216138f28ee80172f4cf21048528dc60",
  "txcount": 3,
  "tx": [
    "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "7e0ba1980522125f1f40d19a249ab3ae036001b991776813d25aebe08e8b8a50",
    "5c4d44b9b8d2ec6e0835ac90f206cecb26bf51033f31d4c659975b7534853409"
  ],
  "time": 1553501874,
  "mediantime": 1553499038,
  "nonce": 2482491775,
  "bits": "180978d5",
  "difficulty": 116078424449.9863,
  "chainwork": "000000000000000000000000000000000000000000de04fc280ef3a599fbadde",
  "previousblockhash": "00000000000000000012ce7f4bbce3346ac438ab7fdcb6fa5440db9857856a7f",
  "nextblockhash": "",
  "coinbaseTx": {
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040ffffffff01247e814a000000001976a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac00000000",
    "txid": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "hash": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "size": 113,
    "version": 1,
    "locktime": 0,
    "vin": [
      {
        "txid": "",
        "vout": 0,
        "scriptSig": {
          "asm": "",
          "hex": ""
        },
        "sequence": 4294967295,
        "coinbase": "03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040"
      }
    ],
    "vout": [
      {
        "value": 12.5000042,
        "n": 0,
        "scriptPubKey": {
          "asm": "OP_DUP OP_HASH160 492558fb8ca71a3591316d095afc0f20ef7d42f7 OP_EQUALVERIFY OP_CHECKSIG",
          "hex": "76a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac",
          "reqSigs": 1,
          "type": 0,
          "addresses": ["17fm4xevwDh3XRHv9UoqYrVgPMbwcGHsUs"],
          "opReturn": null
        }
      }
    ],
    "blockhash": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
    "confirmations": 1,
    "time": 1553501874,
    "blocktime": 1553501874
  },
  "totalFees": 0.000004199999999343618,
  "miner": "SVpool",
  "pages": null
}

URL Parameters

Parameter
Description

network

The selected network: main or test.

height

The height of the block to retrieve.

Get Block Pages

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

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/block/hash/<hash>/page/<number>
Example pages element in Get block by height or hash response:
{
    "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
    ...
    "pages": {
        "uri": [
            "/block/hash/000000000000000000885a4d8e9912f085b42288adc58b3ee5830a7da9f4fef4/page/1",
            "/block/hash/000000000000000000885a4d8e9912f085b42288adc58b3ee5830a7da9f4fef4/page/2",
            ...
    ],
        "size": 50000
    }
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/block/hash/000000000000000000885a4d8e9912f085b42288adc58b3ee5830a7da9f4fef4/page/1"
Response JSON structure
[
    "89b4e01ea1ab27edb6ea66899637b526faebeb42ca0302ff9ed916670f1330fe",
    "1097bfc9b1f586352a1ab29afd27c1f89e0a5d9790ea08a2b2a7d988ea6f2cfe",
    ....
]

URL Parameters

Parameter
Description

network

The selected network: main or test.

hash

The hash of the block to retrieve.

number

The 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 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.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/block/<hashOrHeight>/header
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb/header"
Response JSON structure
{
  "hash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
  "confirmations": 68461,
  "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"
}

URL Parameters

Parameter
Description

network

The selected network: main or test.

hash

The hash of the block to retrieve.

Get Headers

This endpoint retrieves the last 10 block headers.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/block/headers
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/headers"
Response JSON structure
[
    {
        "hash": "00000000000000000091302d4e60d7f795891ed6355da673bf48179b5d6bb8bf",
        "confirmations": 1,
        "height": 643505,
        "version": 536870912,
        "versionHex": "20000000",
        "merkleroot": "c842e7a774687c83b801c6e7c00344e9c6691f5ed9512c9b21c752821cb6e11e",
        "time": 1594656963,
        "mediantime": 1594632849,
        "nonce": 1235689794,
        "bits": "180322f4",
        "difficulty": 350544350572.5941,
        "chainwork": "000000000000000000000000000000000000000001115d6ba65662692dd816d6",
        "previousblockhash": "000000000000000001a49ccb1c689f0cb2d1a29942ca0631027f9cef221cc5a8",
        "nextblockhash": ""
    },
    {
        "hash": "000000000000000001a49ccb1c689f0cb2d1a29942ca0631027f9cef221cc5a8",
        "confirmations": 2,
        "height": 643504,
        "version": 545259520,
        "versionHex": "20800000",
        "merkleroot": "4b4336460f3f61bfec51608a986f765a9dbd5f9662159cba91a8e7725116cf1d",
        "time": 1594653910,
        "mediantime": 1594629833,
        "nonce": 701438478,
        "bits": "1802d84a",
        "difficulty": 386482093768.0359,
        "chainwork": "000000000000000000000000000000000000000001115d1a07f27698a9ee58d8",
        "previousblockhash": "0000000000000000014ad36062380b1d86a84c98fc97eee672f96e3f5f8c2528",
        "nextblockhash": "00000000000000000091302d4e60d7f795891ed6355da673bf48179b5d6bb8bf"
    },
    ...
]

URL Parameters

Parameter
Description

network

The selected network: main or test.

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.

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.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/main/block/headers/resources
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/headers/resources"
Response JSON structure
{"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"
    ...
]}

Get Latest Header Bytes

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

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/main/block/headers/latest?count=<count>
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/block/headers/latest?count=10"

URL Parameter

Parameter
Description

network

The selected network: main.

count (optional)

Number of headers requested, between 1 and 100.

Last updated