i'm new to bitcoin and was wondering, does anyone know how to get unconfirmed transactions with python? I've tried running my own node but my current hardware won't allow it. Is there a way to query the main-net to perhaps get the latest unconfirmed transactions, maybe with a library?

kind of like how it's done on blockchain.info Thanks

  • Hello fboi1, are you sure your hardware won't allow you to run a node? Bitcoin Core can run acceptably on a system with as little as 1 GB or even 512 MB of RAM, a weak CPU (as long as you're fine with waiting several days to sync the blockchain) and a few GB's of disk space (if you're running a pruned node). Commented Aug 2, 2022 at 23:06
  • Hi, yeah I think my hard drive is the problem. It usually says it will take 2 years to sync. Which is unfeasible... If you'd know of a solution other than bitcoin core it would be really helpful.
    – fboi1
    Commented Aug 2, 2022 at 23:18

1 Answer 1


i'm new to bitcoin and was wondering, does anyone know how to get unconfirmed transactions with python?

If you had a bitcoin node:

import requests
import json

url = ""

payload = json.dumps({
  "jsonrpc": "1.0",
  "id": "test",
  "method": "getrawmempool",
  "params": [
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic dXNlcjpwYXNz'

response = requests.request("POST", url, headers=headers, data=payload)


Else you could use API for any 2 block explorers:

import requests

url = "https://mempool.space/api/mempool/txids"

headers = {
  'Content-Type': 'application/json'

response = requests.request("GET", url, headers=headers)


URL can be https://blockstream.info/api/mempool/txids for blockstream.info explorer.

  • As I'm looking for a real time way I'm afraid I might hit some api rate limits with this method. Also, how would you use the txids to view the contents of the transactions, like inputs outputs and time. Thanks
    – fboi1
    Commented Aug 3, 2022 at 14:00
  • mempool.space API has a websocket endpoint although I never tried. For inputs, outputs and other information about transaction you will have to use relevant endpoint in API or getrawtransaction if running a node.
    – user133407
    Commented Aug 3, 2022 at 14:26
  • that seems to be focused on monitoring specific addresses. would you know if bitcoinlib for python would have the capabilities to solve this problem? Thanks
    – fboi1
    Commented Aug 3, 2022 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.