decodescript - Litecoin

Example code for the decodescript JSON-RPC method. Complete guide on how to use decodescript JSON-RPC in GetBlock Web3 documentation.

Decode a hex-encoded script.

Parameters

Parameter
Type
Description

hexstring

string

The hex-encoded script.

Request

cURL
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "decodescript",
    "params": ["76a914..."],
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "asm": "OP_DUP OP_HASH160 ... OP_EQUALVERIFY OP_CHECKSIG",
        "type": "pubkeyhash",
        "reqSigs": 1,
        "addresses": ["LTCaddress..."],
        "p2sh": "address..."
    }
}

Response Parameters

Field
Type
Description

asm

string

Script public key.

type

string

The output type.

addresses

array

Array of addresses.

Use Case

The decodescript method is essential for:

  • Script analysis

  • Address extraction

  • Transaction debugging

  • Smart contract analysis

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN.

Integration Notes

The decodescript method helps developers build robust applications that interact with the Litecoin blockchain.

Last updated

Was this helpful?