Links

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/bsv/<network>/script/<scriptHash>/used
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/3a9b9e2285ae40de7679e48efcef7d029a46a7b3120063a6d24347ce4452e6ee/used"
Response JSON structure
false
URL Parameters
Parameter
Description
network
The selected network: main or test.
scriptHash
The script hash: Sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string.

Get Script History

This endpoint retrieves both the confirmed and unconfirmed transactions for a given script.
HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/script/<scriptHash>/history
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3/history"
Returns a response as long as the response message is less than 1MB in size.
Response JSON structure
[
{
"tx_hash": "52dfceb815ad129a0fd946e3d665f44fa61f068135b9f38b05d3c697e11bad48",
"height": 620539
},
{
"tx_hash": "4ec3b63d764558303eda720e8e51f69bbcfe81376075657313fb587306f8a9b0",
"height": 620539
}
]
URL Parameters
Parameter
Description
network
The selected network: main or test.
scriptHash
The script hash: Sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string.

Get Mempool Script History (Beta)

This endpoint retrieves 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
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832/unconfirmed/history"
Response JSON structure
{
"result": [
{
"tx_hash": "93d8ae93a9e074c555d80e86c130b6cd4d5c7efa2795f91b2aea285c546512c6"
},
{
"tx_hash": "6bcd7708adf5c8c00d299628ef86fa5d982ccd1909254f46ea0f0a70c4c319f7"
},
{
"tx_hash": "cf1f1fd7962aeac56932b0e522d83c163d89873f2e26a1519bcc0d88772d0e78"
},
...
]
}
URL Parameters
Parameter
Description
network
The selected network: main or test.
scriptHash
The script hash: Sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string.

Get Script Unspent Transactions

This endpoint retrieves the ordered list of UTXOs for a given script.
HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/script/<scriptHash>/unspent
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3/unspent"
Returns a response as long as the response message is less than 1MB in size.
Response JSON structure
[
{
"height": 578325,
"tx_pos": 0,
"tx_hash": "62824e3af3d01113e9bce8b73576b833990d231357bd718385958c21d50bbddd",
"value": 1250020815
},
{
"height": 578326,
"tx_pos": 0,
"tx_hash": "4b008a10eebcf70f384442e4e3147bc76c6e4f764b516b208e148d700b965deb",
"value": 1251827826
},
...
]
URL Parameters
Parameter
Description
network
The selected network: main or test.
scriptHash
The script hash: Sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string.

Get Script Mempool Unspent Transactions (Beta)

This endpoint retrieves the ordered list of unconfirmed UTXOs 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/unspent
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832/unconfirmed/unspent"
Response JSON structure
{
"result": [
{
"tx_pos": 1,
"tx_hash": "93d8ae93a9e074c555d80e86c130b6cd4d5c7efa2795f91b2aea285c546512c6",
"value": 181724,
"hex": "76a9148a32b77e8f9bce47179fe03b6894e3d37003099888ac"
}
]
}
URL Parameters
Parameter
Description
network
The selected network: main or test.
scriptHash
The script hash: Sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string.

Bulk Script Unspent Transactions

This endpoint retrieves a list of UTXOs for multiple scripts in a single request.
  • Max 20 scripts per request.
HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/scripts/unspent
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/unspent" \
--header "Content-Type: application/json" \
--data "{\"scripts\" : [\"f814a7c3a40164aacc440871e8b7b14eb6a45f0ca7dcbeaea709edc83274c5e7\",\"995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3\" ] }"
The JSON structure for the above post request:
JSON structure
{
"scripts": [
"f814a7c3a40164aacc440871e8b7b14eb6a45f0ca7dcbeaea709edc83274c5e7",
"995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3"
]
}
Response JSON structure
[
{
"script": "f814a7c3a40164aacc440871e8b7b14eb6a45f0ca7dcbeaea709edc83274c5e7",
"unspent": [
{
"height": 620539,
"tx_pos": 0,
"tx_hash": "4ec3b63d764558303eda720e8e51f69bbcfe81376075657313fb587306f8a9b0",
"value": 450000
}
],
"error": ""
},
{
"script": "995ea8d0f752f41cdd99bb9d54cb004709e04c7dc4088bcbbbb9ea5c390a43c3",
"unspent": [],
"error": ""
}
]Requwst
URL Parameters
Parameter
Description
network
The selected network: main, test, or stn.