decodepsbt - Bitcoin
Example code for the decodepsbt jJSON RPC method. Сomplete guide on how to use decodepsbt JSON RPC in GetBlock Web3 documentation.
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": "decodepsbt",
"params": ["cHNidP8BAHUCAAAAASaBcTce3/KF6Tig7cez..."],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "decodepsbt",
"params": ["cHNidP8BAHUCAAAAASaBcTce3/KF6Tig7cez..."],
"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": {
"tx": {
"txid": "7e7b9b4c66e6af1e867adf7de48c8e5e5e1a90e60ad9c4c0ab2e8f8a...",
"hash": "7e7b9b4c66e6af1e867adf7de48c8e5e5e1a90e60ad9c4c0ab2e8f8a...",
"version": 2,
"size": 117,
"vsize": 117,
"weight": 468,
"locktime": 0,
"vin": [
{
"txid": "ee652f0b40209bd02468de0c6336854f5efdd79fb865560aef2c46f4fa0b4a07",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00100000,
"n": 0,
"scriptPubKey": {
"asm": "0 e8df018c7e326cc253f167d922d5b8e7cd25f1c9",
"hex": "0014e8df018c7e326cc253f167d922d5b8e7cd25f1c9",
"address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
"type": "witness_v0_keyhash"
}
}
]
},
"global_xpubs": [],
"psbt_version": 0,
"proprietary": [],
"unknown": {},
"inputs": [
{
"witness_utxo": {
"amount": 0.00200000,
"scriptPubKey": {
"asm": "0 a1b2c3d4e5f6...",
"hex": "0014a1b2c3d4e5f6...",
"type": "witness_v0_keyhash",
"address": "bc1q..."
}
},
"partial_signatures": {},
"sighash": "ALL"
}
],
"outputs": [
{}
],
"fee": 0.00100000
}
}Response Parameters
Field
Type
Description
Use Case
Error Handling
Status Code
Error Message
Cause
Integration Notes
Last updated
Was this helpful?