mempool on Nostr: There is no API call for the number of mempol blocks, but this can be estimated by ...
There is no API call for the number of mempol blocks, but this can be estimated by dividing the sum of the vBytes in the mempool by 1,000,000
The number of unconfirmed transactions can be called directly.
Here is a python example:
import json
import requests
import math
# Approximate number of blocks in mempool.space's mempool
total_blockVSize = sum(item['blockVSize'] for item in requests.get('https://mempool.space/api/v1/fees/mempool-blocks';).json())
block_count_estimate = math.ceil(total_blockVSize/1000000)
print("Unconfirmed block count: ", block_count_estimate)
# Get transaction count
transaction_count = requests.get("https://mempool.space/api/mempool";).json()['count']
print("Transaction count:", transaction_count)
The number of unconfirmed transactions can be called directly.
Here is a python example:
import json
import requests
import math
# Approximate number of blocks in mempool.space's mempool
total_blockVSize = sum(item['blockVSize'] for item in requests.get('https://mempool.space/api/v1/fees/mempool-blocks';).json())
block_count_estimate = math.ceil(total_blockVSize/1000000)
print("Unconfirmed block count: ", block_count_estimate)
# Get transaction count
transaction_count = requests.get("https://mempool.space/api/mempool";).json()['count']
print("Transaction count:", transaction_count)