For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

getmempoolancestors

Returns the in-mempool ancestors of an unconfirmed transaction. This method uses 80 credits from your daily balance.

Ancestors are the unconfirmed transactions that this transaction spends from, directly or indirectly. The method returns an error if the transaction isn't in the mempool.

Parameters​

  • txid: (string) [required] - Transaction ID.
  • verbose: (boolean) [optional] - false returns an array of transaction IDs. true returns an object keyed by transaction ID, with the fields described in getrawmempool. The default is false.

Returns​

result: (array or object) - Ancestor transaction IDs, or an object of mempool entries when verbose is true.

Request​

Replace the transaction ID with one currently in the mempool.

curl https://bitcoin-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "getmempoolancestors", "params": ["5b1d0e9f4c3a2b8170e6d5c4b3a29180f7e6d5c4b3a291807f6e5d4c3b2a1908", false]}'

Response​

{
"jsonrpc": "2.0",
"id": 1,
"result": [
"a4c7e2f1b0d9c8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3"
]
}