I am building a site with python/django, running bitcoind in the background. I need to constantly check all addresses in the wallet to do a sql insert statement to my database whenever an incoming transaction is received, and maybe send some funds out in certain cases.

My site is working ok, and I wrote a python script that runs separate and uses a simple while true loop to achieve this. The problem is, when the script is running, it takes up too much memory and the site times out when I reload it. How to avoid this? I really need a background process running at all times. I am trying to use threading in the script, but it still seems to hog too much memory.

I thought about running bitcoind with the same wallet and the script on a separate computer, but I heard that is a bad idea.



1 Answer 1


Use wallet notify. You can set it in your bitcoin.conf file and have it call some python or django script.

Or another solution would be to constantly poll for new transactions, though I would not recommend this.

  • Thank you, this helped immensely. Exactly what I needed! Unfortunately, when I call walletnotify= python /path/to/script %s, it passes 'sh: 1: <txid> could not find 32512' into sys.argv[1]. However, if I pass it to a C++ program, it just passes the txid. So strange. Feb 7, 2014 at 3:52
  • weird, though shouldn't it be sys.argv[2]?
    – Loourr
    Feb 7, 2014 at 15:16
  • It said that was out of index. Also, it works in C++ just fine. I don't know, I will mess with it more and try to get it working. I don't have any quotations in my -walletnotify command. Feb 8, 2014 at 8:27

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.