Links

Script

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

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.