blockchainTransactionGet

Electrum for Bitcoin

Overview

The blockchain.transaction.get method retrieves a raw transaction from Bitcoin using the transaction hash. It can return a simple hexadecimal string or a detailed, decoded transaction object.

Parameters

NameTypeRequiredDescription
tx_hashstringYesThe transaction hash as a hexadecimal string.
verbosebooleanNoSpecifies whether to return a decoded transaction.

Returns

If verbose is false, the raw transaction is returned as a hexadecimal string. If verbose is true, a detailed dictionary of the transaction is returned.

FieldDescription
hexThe raw transaction as a hexadecimal string.
txidThe transaction ID.
sizeThe transaction size in bytes.
versionThe version number of the transaction format.
locktimeThe transaction's lock time.
vinAn array of transaction inputs.
voutAn array of transaction outputs.
blockhashThe block hash containing this transaction (if confirmed).
confirmationsThe number of confirmations of the block containing this transaction.
timeTransaction timestamp from the block.
blocktimeBlock timestamp as seen by the network.
feeTransaction fee (if available).

Example Result for Verbose = false

"0100000001abcdef..."

Example Result for Verbose = true

{
  "hex": "0100000001abcdef...",
  "txid": "exampletxid",
  "size": 225,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "sometxid",
      "vout": 0,
      "scriptSig": {
        "asm": "asm code",
        "hex": "hex code"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.0001,
      "n": 0,
      "scriptPubKey": {
        "asm": "asm code",
        "hex": "hex code",
        "addresses": ["bitcoincash:address"]
      }
    }
  ],
  "blockhash": "someblockhash",
  "confirmations": 10,
  "time": 1510000000,
  "blocktime": 1510000000,
  "fee": "0.00001"
}

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/bitcoin-mainnet-electrs/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
    "method": "blockchain.transaction.get",
    "params": ["exampletxid", true],
    "id": 1,
    "jsonrpc": "2.0"
}'
// yarn add @tatumio/tatum

import { TatumSDK, BitcoinElectrs, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<BitcoinElectrs>({ network: Network.BITCOIN_ELECTRS })

const transaction = await tatum.rpc.getTransaction('exampletxid', true)

console.log('Transaction Details:', transaction)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs when done