gettxout

Returns details about an unspent transaction output.

Argument #1 - txid

Type: string, required

The transaction id

Argument #2 - n

Type: numeric, required

vout number

Argument #3 - include_mempool

Type: boolean, optional, default=true

Whether to include the mempool. Note that an unspent output that is spent in the mempool won’t appear.

Result

{                             (json object)
  "bestblock" : "hex",        (string) The hash of the block at the tip of the chain
  "confirmations" : n,        (numeric) The number of confirmations
  "value" : n,                (numeric) The transaction value in BTC
  "scriptPubKey" : {          (json object)
    "asm" : "hex",            (string)
    "hex" : "hex",            (string)
    "reqSigs" : n,            (numeric) Number of required signatures
    "type" : "hex",           (string) The type, eg pubkeyhash
    "addresses" : [           (json array) array of bitcoin addresses
      "str",                  (string) bitcoin address
      ...
    ]
  },
  "coinbase" : true|false     (boolean) Coinbase or not
}

Request

curl --location --request POST 'https://btc.api.watchdata.io/node/jsonrpc?api_key=your_api_key' \
--header 'x-api-key: your_api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "gettxout",
    "params": [
        "5081840bfdc0751e48ecf3995179ceb5fc7f10e8bcdc69ff11a96b61da2e7d2f",
        1
    ]
}'

Response

{
    "bestblock": "0000000000000000000559adec1f56ee949c2e20abef7150bb29dd7d2cf0260a",
    "confirmations": 0,
    "value": 1.91332048,
    "scriptPubKey": {
        "asm": "OP_HASH160 39790a15e75a2f6ccbd8becaee975b819da6b636 OP_EQUAL",
        "hex": "a91439790a15e75a2f6ccbd8becaee975b819da6b63687",
        "address": "36vuSSdrx8zBXrGYPCifixtLbbxK615fCR",
        "type": "scripthash"
    },
    "coinbase": false
}

Last updated