Block

Get by Hash

This endpoint retrieves the block details of a given hash.

(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 section.

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

Example Request

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

Example Response

{
    "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
}

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.

(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 section.

Example Request

Example Response

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.

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

Example Request

Example Response

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.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

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.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

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.

Example Request

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

count (optional)

Headers requested: between 1 (default) and 100.

Last updated

Was this helpful?