rest/mempool/contents - Bitcoin
Example code for the rest/mempool/contents REST endpoint. Complete guide on how to use the rest/mempool/contents REST endpoint in the GetBlock Web3 documentation.
This endpoint returns every transaction in the node's memory pool, keyed by transaction id, with fee, size, and ancestry detail for each.
Parameters
This endpoint takes no parameters.
Request
curl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/mempool/contents.json'const response = await fetch(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/mempool/contents.json'
);
console.log(await response.json());import requests
response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/mempool/contents.json')
print(response.json())Response
{
"ceb5a478b0a44835626fa450b345da2ea238023429da02069d001332b713c720": {
"vsize": 141,
"weight": 561,
"time": 1789899404,
"height": 967816,
"descendantcount": 1,
"descendantsize": 141,
"ancestorcount": 1,
"ancestorsize": 141,
"wtxid": "73f3430babb5c56e0d7aebf85e72a18118305b89ae22e94cee5f62d5618b601b",
"chunkweight": 561,
"fees": {
"base": 0.0001974,
"modified": 0.0001974,
"ancestor": 0.0001974,
"descendant": 0.0001974,
"chunk": 0.0001974
},
"depends": [],
"spentby": [],
"bip125-replaceable": true,
"unbroadcast": false
}
}The response is an object keyed by txid; one entry is shown.
Response Parameters
vsize
numeric
Virtual size in vbytes
weight
numeric
Transaction weight
time
numeric
Unix time the transaction entered the mempool
height
numeric
Chain height when the transaction entered the mempool
descendantcount
numeric
In-mempool descendants, including this transaction
ancestorcount
numeric
In-mempool ancestors, including this transaction
wtxid
string
Witness transaction id
fees
object
Fees in BTC: base, modified, and the ancestor, descendant, and chunk aggregates
depends
array
Transaction ids of unconfirmed parents
spentby
array
Transaction ids of unconfirmed children
bip125-replaceable
boolean
True when the transaction may be replaced under RBF
Use Cases
Fee Estimation: Build your own estimate from the fee rates currently queued
Pending Detection: Find whether a specific transaction is still waiting
Ancestry Analysis: Read
dependsandspentbyto map unconfirmed chains
Error Handling
400
Bad request
The path is malformed, or a hash or height is invalid
403
Forbidden
Missing or invalid ACCESS-TOKEN
404
Not found
No object matches the requested hash, height, or outpoint
500
Internal error
The node failed to process the request
Was this helpful?