decodescript - Bitcoin
Example code for the decodescript JSON RPC method. Сomplete guide on how to use decodescript JSON RPC in GetBlock.io Web3 documentation.
decodescript - Bitcoin
Parameters
Parameter
Type
Required
Description
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "decodescript",
"params": ["76a91489abcdefabbaabbaabbaabbaabbaabbaabbaabba88ac"],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "decodescript",
"params": ["76a91489abcdefabbaabbaabbaabbaabbaabbaabbaabba88ac"],
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error));Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"asm": "OP_DUP OP_HASH160 89abcdefabbaabbaabbaabbaabbaabbaabbaabba OP_EQUALVERIFY OP_CHECKSIG",
"type": "pubkeyhash",
"address": "1DYwPTpZuLjY2qApmJdHaSAuWRvEF5skCN",
"reqSigs": 1,
"p2sh": "3F6i6kwkevjR7AsAd4te2YB2zZyASEm1HM",
"segwit": {
"asm": "0 89abcdefabbaabbaabbaabbaabbaabbaabbaabba",
"hex": "001489abcdefabbaabbaabbaabbaabbaabbaabbaabba",
"address": "bc1q3x4umaa4w4twa9wa4wa9wa4wa9wa4waav4kwz9",
"type": "witness_v0_keyhash",
"p2sh-segwit": "3Kp6VqwVFECmvPxjvs2tn3dT2JZQmZVrRq"
}
}
}Response Parameters
Field
Type
Description
Use Case
Error Handling
Status Code
Error Message
Cause
Integration Notes
Last updated
Was this helpful?