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

ParameterDescription

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 Unconfirmed Script History (Beta)

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

ParameterDescription

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 Unconfirmed Script History (Beta)

This endpoint retrieves the history of unconfirmed transactions for a given set of scripts.

  • Max 20 scripthashes per request.

  • Max 100 items returned per request.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/scripts/unconfirmed/history
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/unconfirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [ \"8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8\" ] }"
Request body JSON structure
{
    "scripts": [
        "8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8"
    ]
}
Response JSON structure
[
    {
        "script": "8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8",
        "result": [
            {
                "tx_hash": "4e6be25adf9b2bdf90a9f88e966f7cb5e9d71a22325c8a1e6d687f32aab340d4"
            }
        ],
        "error": ""
    }
]

URL Parameters

ParameterDescription

network

The selected network: main or test.

Get Confirmed Script History (Beta)

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/bsv/<network>/script/<scriptHash>/confirmed/history
cURL
curl --location --request GET "https://api.whatsonchain.com/v1/bsv/main/script/0374d9ee2df8e5d7c5fd8359f33456996f2a1a9c76d9c783d2f8d5ee05ba5832/confirmed/history"
Response JSON structure
{
    "result": [
        {
            "tx_hash": "6cc9631ef3dad77eb0141134167f20469d0b4e61405de57fe6a9ac71b943bb9f",
            "height": 797518
        }
    ]
}

URL Parameters

ParameterDescription

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.

order

Ordering: asc or desc; default is desc.

limit

Between 1 and 1000; default is 100.

height

Starting block height for history; default is 0.

token

Provided next page token.

Bulk Confirmed Script History (Beta)

This endpoint retrieves the history of confirmed transactions for a given set of scripts.

  • Max 20 scripthashes per request.

  • Max 20 items returned per request.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/scripts/confirmed/history
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/scripts/confirmed/history" \
  --header "Content-Type: application/json" \
  --data "{\"scripts\" : [ \"8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8\" ] }"
Request body JSON structure
{
    "scripts": [
        "8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8"
    ]
}
Response JSON structure
[
    {
        "script": "8ca0d228066cfff2b7f31c7db7737185be9d06ff5c07206b61f06d80a4cdd9a8",
        "result": [
            {
                "tx_hash": "4e6be25adf9b2bdf90a9f88e966f7cb5e9d71a22325c8a1e6d687f32aab340d4"
            }
        ],
        "error": ""
    }
]

URL Parameters

ParameterDescription

network

The selected network: main or test.

(Planned for deprecation) Get Script History

This endpoint is powered by ElectrumX and is planned for deprecation in the near future.

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

ParameterDescription

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.

Last updated