Bitcoin
Ready to call this in production?
Free tier covers personal projects. Pay-as-you-go scales without a card.
Bitcoin
Free tier covers personal projects. Pay-as-you-go scales without a card.
getmempoolancestors is a Bitcoin Core JSON-RPC method that walks the dependency graph of a pending BTC transaction backwards: given a txid that is still sitting in the node's mempool, it returns every other unconfirmed transaction that must be mined before it — its ancestors. Because Bitcoin uses an unspent-output (UTXO) model rather than accounts, a transaction can only be valid once the outputs it spends exist on-chain, so an unconfirmed transaction that spends an unconfirmed output forms an ancestor chain. Send the request to https://bitcoin.therpc.io/YOUR_API_KEY using positional params. By default the method returns a flat array of ancestor txids; pass verbose = true to get an object keyed by txid carrying the same per-transaction fields as getmempoolentry (vsize, weight, fees in BTC, ancestor/descendant counts, and more).
verbose = true) to compute an effective package fee rate in sat/vB and decide whether a child-pays-for-parent (CPFP) bump is worthwhile.| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | txid | string | Yes | Transaction id, which must be in the mempool. |
| 2 | verbose | boolean | No | false = array of txids; true = object keyed by txid with per-tx data.Default: false |
| Type | Description |
|---|---|
| array | Array of ancestor txids, or (verbose) object keyed by txid with the same per-tx fields as getmempoolentry. |
| Code | Message | Cause |
|---|---|---|
-5 | Transaction not in mempool | The txid is not currently in this node's mempool — it may be confirmed, evicted, or never seen. |
-5 if the txid you pass is not currently in this node's mempool — for example because it has already confirmed, was evicted under fee pressure, or was never relayed to the node.