getmempoolancestors

If txid is in the mempool, returns all in-mempool ancestors.

Argument #1 - txid

Type: string, required

The transaction id (must be in mempool)

Argument #2 - verbose

Type: boolean, optional, default=false

True for a json object, false for array of transaction ids

Result (for verbose = false)

[           (json array)
  "hex",    (string) The transaction id of an in-mempool ancestor transaction
  ...
]

Result (for verbose = true)

{                                         (json object)
  "transactionid" : {                     (json object)
    "vsize" : n,                          (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.
    "weight" : n,                         (numeric) transaction weight as defined in BIP 141.
    "fee" : n,                            (numeric) transaction fee in BTC (DEPRECATED)
    "modifiedfee" : n,                    (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED)
    "time" : xxx,                         (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT
    "height" : n,                         (numeric) block height when transaction entered pool
    "descendantcount" : n,                (numeric) number of in-mempool descendant transactions (including this one)
    "descendantsize" : n,                 (numeric) virtual transaction size of in-mempool descendants (including this one)
    "descendantfees" : n,                 (numeric) modified fees (see above) of in-mempool descendants (including this one) (DEPRECATED)
    "ancestorcount" : n,                  (numeric) number of in-mempool ancestor transactions (including this one)
    "ancestorsize" : n,                   (numeric) virtual transaction size of in-mempool ancestors (including this one)
    "ancestorfees" : n,                   (numeric) modified fees (see above) of in-mempool ancestors (including this one) (DEPRECATED)
    "wtxid" : "hex",                      (string) hash of serialized transaction, including witness data
    "fees" : {                            (json object)
      "base" : n,                         (numeric) transaction fee in BTC
      "modified" : n,                     (numeric) transaction fee with fee deltas used for mining priority in BTC
      "ancestor" : n,                     (numeric) modified fees (see above) of in-mempool ancestors (including this one) in BTC
      "descendant" : n                    (numeric) modified fees (see above) of in-mempool descendants (including this one) in BTC
    },
    "depends" : [                         (json array) unconfirmed transactions used as inputs for this transaction
      "hex",                              (string) parent transaction id
      ...
    ],
    "spentby" : [                         (json array) unconfirmed transactions spending outputs from this transaction
      "hex",                              (string) child transaction id
      ...
    ],
    "bip125-replaceable" : true|false,    (boolean) Whether this transaction could be replaced due to BIP125 (replace-by-fee)
    "unbroadcast" : true|false            (boolean) Whether this transaction is currently unbroadcast (initial broadcast not yet acknowledged by any peers)
  },
  ...
}

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": "getmempoolancestors",
    "params": [
        "38e31c83049c1b913b48bc5b820d79d8dda7651e79b082571d4fbaa7184c2858"
    ]
}

Response

[
    "dafe927d4f71b96e7c4918e34e4d92494008df479b09693cce3ab455bc5ea23f",
    "6211711959a8582b02bdf5c9e14a747812aef714a4816beb066d7b4adc703848",
    "acf0c094a9987fe8aa4f779fd5fbfbbbb1f7bd5383b29d7b57a1773262b8e353",
    "d265f7cccdd5bf70117226425b9ada8a76057f298e40c1d4b6a3d3697eb77483",
    "7034120946171023865ee8dcd04f36c05890d9f6aa5835d66098f863a5e0b78d",
    "492da72fb79e5494f4ceca74f36724962e8d993a501950baf72666921c7aef92",
    "16794edb11d49f8f122f486d189a17548fbf8efdf3e0b1efd9da61178a17ea97",
    "8c98dba43ac4ba9a59709e0afe403bc6daca227cfe6138ac81905d7b70d661a6",
    "ccaada237ef64b787a2e1c158453bcbd4ba5bf5320aff3c1d205eb77c7f4d5cc",
    "0c1b6737e7adf55a3338bdc7e61928fdab44247e1835603232fb89c5f11a83e6",
    "a8d760f907a4f89ec5ec92fd4eaed54a682cae4cfa37c6e72cd2c5367f43f7f6",
    "d2048d10d7ce8699cbdf8c32bbdd6138d5d1a2f8d6fd176a5c76be28072247fb"
]

Last updated