POSTdecodescript

Bitcoin Mainnethttps://bitcoin-mainnet.nodit.io/

Decodes a hex-encoded script and returns it as a JSON object. It lets you inspect the output type, the corresponding address, and the addresses of the P2SH and SegWit wrappings.

Request Body
idintegerrequired
jsonrpcstringrequired
methodstringrequired
paramsoneOf[]required

It contains following parameter:

  1. hexstring: The script to decode, as a hex string. (required)
params[0]string

The hex string of the script to decode.

Responses
asmstring

Disassembly of the script.

descstring

Inferred descriptor for the script.

typestring

The output type. Returns one of nonstandard, anchor, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot or witness_unknown.

addressstring

The Bitcoin address for the script. Returned only when a well-defined address exists.

p2shstring

The address of the P2SH script wrapping this redeem script. Not returned for types that should not be wrapped.

asmstring

Disassembly of the output script.

hexstring

The raw output script bytes, hex-encoded.

typestring

The type of the output script.

addressstring

The corresponding Bitcoin address. Returned only when a well-defined address exists.

descstring

Inferred descriptor for the script.

p2sh-segwitstring

The address of the P2SH script wrapping this witness redeem script.

X-API-KEY
RequestCU20
cURL
curl -X POST "https://bitcoin-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "decodescript",
  "params": [
    "00143123f9ba48c9a80f4e7f7ea6a7d5028a9c0018a2"
  ]
}'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "asm": "0 3123f9ba48c9a80f4e7f7ea6a7d5028a9c0018a2",
    "desc": "addr(bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh)#8rvxaqzk",
    "address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "type": "witness_v0_keyhash",
    "p2sh": "3KfxWuBLLXFRYFCUeaJhvUzMxrJHzLA7Bd"
  }
}