<p>Use <a href="https://bitcointalk.org/index.php?topic=203438.0" rel="nofollow">wallet notify</a>. You can set it in your <code>bitcoin.conf</code> file and have it call some python or django script.</p>

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

CC BY-SA 3.0
2014-02-07T03:52:51.750Z
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.
Matthew Darnell
CC BY-SA 3.0
2014-02-07T15:16:30.827Z
weird, though shouldn't it be `sys.argv[2]`?
Loourr
CC BY-SA 3.0
2014-02-08T08:27:46.010Z
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.
Matthew Darnell
CC BY-SA 3.0
2014-02-06T15:50:08.570Z
2014-02-06T15:50:08.570Z
Loourr
<p>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.</p>

<p>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.</p>

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

<p>Thanks.</p>

CC BY-SA 3.0
2015-02-06T10:13:17.763Z
I have written a Python framework for dealing issues like this in cryptocurrencies: https://bitbucket.org/miohtama/cryptoassets - it comes even with open source example applications for Django
Mikko Ohtamaa
<transactions><bitcoind>
Constantly monitor bitcoin wallet using Python/Django?
Matthew Darnell
# Constantly monitor bitcoin wallet using Python/Django?

(Asked by: username_0 on 2014-02-06)

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.

Thanks.

**Tags:** transactions, bitcoind

> **Comments:**
> **username_1**: I have written a Python framework for dealing issues like this in cryptocurrencies: https://bitbucket.org/miohtama/cryptoassets - it comes even with open source example applications for Django  

---

## 1 answers

### Answer by username_2 on 2014-02-06. Score: 3 | Accepted answer

Use [wallet notify](https://bitcointalk.org/index.php?topic=203438.0). 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.

> **Comments:**
> **username_0**: 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.  
> **username_2**: weird, though shouldn't it be `sys.argv[2]`?  
> **username_0**: 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.  

---

