decoderawtransaction

Give back a JSON object that represents the hex-encoded, serialized transaction.

Example Request and Result for decoderawtransaction method

In this section, we provide an illustrative example of a request made to retrieve details contents using the decoderawtransaction method. Additionally, we present the resulting response containing information about the hex-encoded and serialized transaction.

Parameters

FieldTypeDescription

hexstring*

string

The transaction hex string

iswitness

boolean

Heuristic tests will be employed for decoding in the event that iswitness is absent. Only witness deserialization will be tried if this is true. We shall try non-witness deserialization only if it is false. If the caller knows, this boolean should indicate if the transaction contains inputs (such as entirely legitimate or on-chain transactions).

The example in this section uses a non-existing project id.

Make sure you replace it with your Bitcoin mainnet or Bitcoin Testnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Return a JSON object that represents the hex-encoded, serialized transaction.

POST https://bitcoin-mainnet.blastapi.io/<project-id>

Request Body

NameTypeDescription

jsonrpc*

string

1.0

id*

string

bwarelabs

method*

string

decoderawtransaction

params*

string

["0200000001e114ded2868c57821e336374c948158cebf18daaf5c7bc756b199d118d6e229d0000000000ffffffff010000000000000000066a040001020300000000"]

{
    "result": {
        "txid": "3565de6b39602582e922f142b8cd3cf6c212b33915c166f228e6635a10f87753",
        "hash": "3565de6b39602582e922f142b8cd3cf6c212b33915c166f228e6635a10f87753",
        "version": 2,
        "size": 66,
        "vsize": 66,
        "weight": 264,
        "locktime": 0,
        "vin": [
            {
                "txid": "9d226e8d119d196b75bcc7f5aa8df1eb8c1548c97463331e82578c86d2de14e1",
                "vout": 0,
                "scriptSig": {
                    "asm": "",
                    "hex": ""
                },
                "sequence": 4294967295
            }
        ],
        "vout": [
            {
                "value": 0.00000000,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_RETURN 50462976",
                    "desc": "raw(6a0400010203)#6scht25q",
                    "hex": "6a0400010203",
                    "type": "nulldata"
                }
            }
        ]
    },
    "error": null,
    "id": "bwarelabs"
}

Curl Request example

curl --location 'https://bitcoin-mainnet.blastapi.io/<project-id>' \
--header 'content-type: application/json;' \
--data '{
    "jsonrpc": "1.0",
    "id": "bwarelabs",
    "method": "decoderawtransaction",
    "params": [
        "0200000001e114ded2868c57821e336374c948158cebf18daaf5c7bc756b199d118d6e229d0000000000ffffffff010000000000000000066a040001020300000000"
    ]
}'

Last updated