decoderawtransaction - Bitcoin
Example code for the decoderawtransaction JSON RPC method. Сomplete guide on how to use decoderawtransactionJSON 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": "decoderawtransaction",
"params": ["0200000001074a0bfaf4462cef0a5665b89fd7fd5e4f8536630cde6824d09b20400b2f65ee0000000000ffffffff01a0860100000000001600149358b74f7cedc75d92f3afb6f47e72e07e2d8f4d00000000"],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "decoderawtransaction",
"params": ["0200000001074a0bfaf4462cef0a5665b89fd7fd5e4f8536630cde6824d09b20400b2f65ee0000000000ffffffff01a0860100000000001600149358b74f7cedc75d92f3afb6f47e72e07e2d8f4d00000000"],
"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",
"result": {
"txid": "054183ee699ff12cf1c9f4413f421c3cf0a8febc6b82a1d8751a30f5e0fd54c0",
"hash": "b07f26a908955f8071620896476d6e2ca6b6610e5edc9e55f19185ca9536c8de",
"version": 2,
"size": 222,
"vsize": 141,
"weight": 561,
"locktime": 894415,
"vin": [
{
"txid": "b9795d456bd0cca5ce90c2621d98f9559a0f728e971c82fe75e924c407bdd642",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"304402204549b10ea1698d4b4605be1d3bfff810f6135395386207664a66f5bb8bd1470902205fb86c95bfbe7b502195ffa65276d292fb074fe18ba171ef0a3539521138409101",
"03cb5de30b343b35cc09b50f064eb289dd3e252f6985fc4309fba795cc950316af"
],
"sequence": 4294967293
}
],
"vout": [
{
"value": 0.10000000,
"n": 0,
"scriptPubKey": {
"asm": "0 d3620fe180a0beb8fcc9682fe92e5a25f0feccd3",
"desc": "addr(bc1q6d3qlcvq5zlt3lxfdqh7jtj6yhc0anxn80rw96)#wu542cq0",
"hex": "0014d3620fe180a0beb8fcc9682fe92e5a25f0feccd3",
"address": "bc1q6d3qlcvq5zlt3lxfdqh7jtj6yhc0anxn80rw96",
"type": "witness_v0_keyhash"
}
},
{
"value": 0.19910000,
"n": 1,
"scriptPubKey": {
"asm": "0 076d998f6b12c3d1da6217d967154f42a5e0afd3",
"desc": "addr(bc1qqakenrmtztparknzzlvkw920g2j7pt7n4kx0sa)#jr6axfjt",
"hex": "0014076d998f6b12c3d1da6217d967154f42a5e0afd3",
"address": "bc1qqakenrmtztparknzzlvkw920g2j7pt7n4kx0sa",
"type": "witness_v0_keyhash"
}
}
]
},
"id": "getblock.io"
}Response Parameters
Field
Type
Description
Use Case
Error Handling
Status Code
Error Message
Cause
Integration Notes
Last updated
Was this helpful?