Skip to main content

decodescript RPC Method

Decodes a hex-encoded script.

Updated on
Feb 03, 2026

Parameters

hexstring
string
REQUIRED

The hex-encoded script

Returns

result
object

The decoded script object

asm
string

The script public key in the form of string

desc
string

Descriptor for the script

address
string

Bitcoin address for this script

type
string

The output type. This can be any one of the following: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot or witness_unknown

p2sh
string

An address of the P2SH script wrapping this redeem script (not returned if the script is already a P2SH)

segwit
object

The result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness)

asm
string

The script public key in the form of string

desc
string

Witness descriptor

hex
string

The hex of the script's public key in string format

address
string

Witness address

type
string

The type of the script public key

p2sh-segwit
string

An address of the P2SH script wrapping this witness redeem script

reqSigs
string

The required signatures

addresses
array

JSON array of addresses

str
string

The segwit address

reqSigs
integer

(Optional) The required signatures

addresses
array

(Optional) A JSON array of addresses used in the transaction

str
string

The bitcoin address

p2sh_32
string

(Optional) P2SH-32 address when applicable

error
object | null

(Optional) JSON-RPC error when the request failed; omitted or null on success

code
integer

Error code

message
string

Error message

Request
Response
1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"asm": "OP_DUP OP_HASH160 af92ad98c7f77559f96430dfef2a6805b87b24f8 OP_EQUALVERIFY OP_CHECKSIG",
5
"desc": "addr(1H1LxwmSw6f82AeHcQvNcupXjD9nKqQXLd)#m3zmae6u",
6
"address": "1H1LxwmSw6f82AeHcQvNcupXjD9nKqQXLd",
7
"type": "pubkeyhash",
8
"p2sh": "3GjR3YFueMLUqufNmCn8uZF48LYXiUn2nr",
9
"segwit": {
10
"asm": "0 af92ad98c7f77559f96430dfef2a6805b87b24f8",
11
"desc": "addr(bc1q47f2mxx87a64n7tyxr0772ngqku8kf8cmd9d27)#g0l3qavj",
12
"hex": "0014af92ad98c7f77559f96430dfef2a6805b87b24f8",
13
"address": "bc1q47f2mxx87a64n7tyxr0772ngqku8kf8cmd9d27",
14
"type": "witness_v0_keyhash",
15
"p2sh-segwit": "39LsCEAz9RgxMsofDEZFggVjUpNsQojhsi"
16
}
17
},
18
"id": 1
19
}
1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"asm": "OP_DUP OP_HASH160 af92ad98c7f77559f96430dfef2a6805b87b24f8 OP_EQUALVERIFY OP_CHECKSIG",
5
"desc": "addr(1H1LxwmSw6f82AeHcQvNcupXjD9nKqQXLd)#m3zmae6u",
6
"address": "1H1LxwmSw6f82AeHcQvNcupXjD9nKqQXLd",
7
"type": "pubkeyhash",
8
"p2sh": "3GjR3YFueMLUqufNmCn8uZF48LYXiUn2nr",
9
"segwit": {
10
"asm": "0 af92ad98c7f77559f96430dfef2a6805b87b24f8",
11
"desc": "addr(bc1q47f2mxx87a64n7tyxr0772ngqku8kf8cmd9d27)#g0l3qavj",
12
"hex": "0014af92ad98c7f77559f96430dfef2a6805b87b24f8",
13
"address": "bc1q47f2mxx87a64n7tyxr0772ngqku8kf8cmd9d27",
14
"type": "witness_v0_keyhash",
15
"p2sh-segwit": "39LsCEAz9RgxMsofDEZFggVjUpNsQojhsi"
16
}
17
},
18
"id": 1
19
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free