POSTdecoderawtransaction

Bitcoin Mainnethttps://bitcoin-mainnet.nodit.io/

Decodes a serialized, hex-encoded transaction and returns it as a JSON object. Use it to inspect the structure of a transaction without submitting it to the node.

Request Body
idintegerrequired
jsonrpcstringrequired
methodstringrequired
paramsoneOf[]required

It contains following parameters in order:

  1. hexstring: The transaction to decode, as a hex string. (required)
  2. iswitness: Whether the given string is a serialized witness transaction, as a boolean. (optional)
params[0]string

The hex string of the transaction to decode.

params[1]boolean

Whether the given string is a serialized witness transaction. Heuristic tests are used when omitted; true attempts witness deserialization only, and false non-witness deserialization only.

Responses
in_active_chainboolean

Whether the specified block is in the active chain. Returned only when blockhash is provided.

hexstring

The serialized transaction, hex-encoded.

txidstring

The transaction id.

hashstring

The transaction hash. It differs from txid for witness transactions.

sizeinteger

The serialized transaction size, in bytes.

vsizeinteger

The virtual transaction size as defined in BIP 141. It differs from size for witness transactions.

weightinteger

The transaction weight as defined in BIP 141. The value is between vsize * 4 - 3 and vsize * 4.

versioninteger

The transaction version.

locktimeinteger

The lock time that determines when the transaction becomes valid.

coinbasestring

The coinbase value of the input. Returned only for coinbase inputs.

txidstring

The id of the previous transaction referenced by this input. Returned only for non-coinbase inputs.

voutinteger

The output index of the previous transaction referenced by this input. Returned only for non-coinbase inputs.

scriptSigobject

The signature script (scriptSig) that unlocks the output referenced by the input.

asmstring

Disassembly of the script.

hexstring

The script, hex-encoded.

txinwitnessstring[]

The hex-encoded witness data. Returned only for SegWit inputs.

prevoutobject

The previous output spent by this input. It is returned when verbosity is 2 for getrawtransaction or 3 for getblock, and omitted if the block undo data is not available.

generatedboolean

Whether the output was generated by a coinbase transaction.

heightinteger

The height of the block containing the previous output.

valuenumber

The value of the previous output, denominated in BTC.

scriptPubKeyobject

The output script (scriptPubKey) that defines the conditions for spending the output.

asmstring

Disassembly of the script.

descstring

Inferred descriptor for the script.

hexstring

The raw script bytes, hex-encoded.

addressstring

The Bitcoin address for the script. Returned only when a well-defined address exists.

typestring

The output type.

  • nonstandard: A script that does not match any standard type.
  • anchor: A Pay-to-Anchor (P2A) output.
  • pubkey: An output locked directly by a public key (P2PK).
  • pubkeyhash: An output locked by a public key hash (P2PKH).
  • scripthash: An output locked by a script hash (P2SH).
  • multisig: An output that requires multiple signatures.
  • nulldata: An output that only records data via OP_RETURN.
  • witness_v0_keyhash: A SegWit v0 public key hash output (P2WPKH).
  • witness_v0_scripthash: A SegWit v0 script hash output (P2WSH).
  • witness_v1_taproot: A Taproot output (P2TR).
  • witness_unknown: An output with an unknown witness version.

예: witness_v0_keyhash

sequenceinteger

The script sequence number of the input.

예: 4294967295

valuenumber

The value of the output, denominated in BTC.

예: 0.0125

ninteger

The index of the output within the transaction.

예: 0

scriptPubKeyobject

The output script (scriptPubKey) that defines the conditions for spending the output.

asmstring

Disassembly of the script.

descstring

Inferred descriptor for the script.

hexstring

The raw script bytes, hex-encoded.

addressstring

The Bitcoin address for the script. Returned only when a well-defined address exists.

typestring

The output type.

  • nonstandard: A script that does not match any standard type.
  • anchor: A Pay-to-Anchor (P2A) output.
  • pubkey: An output locked directly by a public key (P2PK).
  • pubkeyhash: An output locked by a public key hash (P2PKH).
  • scripthash: An output locked by a script hash (P2SH).
  • multisig: An output that requires multiple signatures.
  • nulldata: An output that only records data via OP_RETURN.
  • witness_v0_keyhash: A SegWit v0 public key hash output (P2WPKH).
  • witness_v0_scripthash: A SegWit v0 script hash output (P2WSH).
  • witness_v1_taproot: A Taproot output (P2TR).
  • witness_unknown: An output with an unknown witness version.

예: witness_v0_keyhash

feenumber

The transaction fee, denominated in BTC. Returned when verbosity is 2, and omitted if the block undo data is not available.

blockhashstring

The hash of the block containing the transaction.

confirmationsinteger

The number of confirmations of the transaction.

blocktimeinteger

The time of the block containing the transaction, expressed in UNIX epoch time.

timeinteger

Same as blocktime.

X-API-KEY
RequestCU20
cURL
curl -X POST "https://bitcoin-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "decoderawtransaction",
  "params": [
    "020000000001011a8b0e3d5f9c2b7a4e6d8f1c3b5a79685746352413020100ffffffff",
    true
  ]
}'
Response
Example · 200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
    "hash": "9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5",
    "size": 225,
    "vsize": 144,
    "weight": 573,
    "version": 2,
    "locktime": 0,
    "vin": [
      {
        "txid": "3a1b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b",
        "vout": 1,
        "scriptSig": {
          "asm": "",
          "hex": ""
        },
        "txinwitness": [
          "3044022012ab34cd56ef78901234567890abcdef1234567890abcdef1234567890abcdef0220"
        ],
        "sequence": 4294967295
      }
    ],
    "vout": [
      {
        "value": 0.0125,
        "n": 0,
        "scriptPubKey": {
          "asm": "0 3123f9ba48c9a80f4e7f7ea6a7d5028a9c0018a2",
          "desc": "addr(bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh)#8rvxaqzk",
          "hex": "00143123f9ba48c9a80f4e7f7ea6a7d5028a9c0018a2",
          "address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
          "type": "witness_v0_keyhash"
        }
      }
    ]
  }
}