Script

Get Script Usage Status

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

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

Example Request

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

Example Response

false

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.

Returns up to 100k results in one request.

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

Example Request

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

Example Response

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

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.

  • Max 20 script hashes per request.

  • Max 100 items returned per request.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/scripts/unconfirmed/history
Request Data
{
    "scripts": [
        "<script>",
        "<script>",
        ...
    ]
}

Example Request

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

Example Response

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

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.

Pagination is available using the provided next-page token.

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

Example Request

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

Example Response

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

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.

  • Max 20 script hashes per request.

  • Max 20 items returned per request.

HTTP Request
POST https://api.whatsonchain.com/v1/<chain>/<network>/scripts/confirmed/history
Request Data
{
    "scripts": [
        "<script>",
        "<script>",
        ...
    ]
}

Example Request

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

Example Response

[{
    "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": ""
}]

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

Last updated

Was this helpful?