decodescript

Decode a hex-encoded script.

Example Request and Result for decodescript method

In this section, we provide an illustrative example of a request made to retrieve details contents using the decodescript method. Additionally, we present the resulting response containing information about decoding a hex-encoded script.

Parameters

FieldTypeDescription

hexstring*

string

the hex-encoded script

The example in this section uses a non-existing project id.

Make sure you replace it with your Bitcoin mainnet or Bitcoin Testnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Decode a hex-encoded script.

POST https://bitcoin-mainnet.blastapi.io/<project-id>

Request Body

NameTypeDescription

jsonrpc*

string

1.0

id*

string

bwarelabs

method*

string

decoderawtransaction

params*

string

["0101010293"]

{
    "result": {
        "asm": "1 2 OP_ADD",
        "desc": "raw(0101010293)#xad8302v",
        "type": "nonstandard",
        "p2sh": "3NuAiSPGTMEYLSDh7LmLmKeyrnVBudU9BG",
        "segwit": {
            "asm": "0 91c293d7e5df52a3d8f09e6014fc51795f6e6996f92c446a13d3649bb83cd15c",
            "desc": "addr(bc1qj8pf84l9maf28k8snespflz3090ku6vklykyg6sn6djfhwpu69wq4gj2az)#nu8f09v8",
            "hex": "002091c293d7e5df52a3d8f09e6014fc51795f6e6996f92c446a13d3649bb83cd15c",
            "address": "bc1qj8pf84l9maf28k8snespflz3090ku6vklykyg6sn6djfhwpu69wq4gj2az",
            "type": "witness_v0_scripthash",
            "p2sh-segwit": "3DQtWy4QwM6yC1ruJ1TdANjX39YzRQsVwr"
        }
    },
    "error": null,
    "id": "bwarelabs"
}

Curl Request example

curl --location 'https://bitcoin-mainnet.blastapi.io/<project-id>' \
--header 'content-type: application/json;' \
--data '{
    "jsonrpc": "1.0",
    "id": "bwarelabs",
    "method": "decodescript",
    "params": [
        "0101010293"
    ]
}'

Last updated