I wanted an easy way to monitor Bitcoin addresses for transactions with Python and without having to download the entire block chain, so I created a module that lets you watch Bitcoin addresses through Blockchain Websocket API and perform custom callback: TxWatcher.
You can install it with pip, the code is hosted on Github.
$ pip install txwatcher
Here is an example:
from txwatcher import TxWatcher w = TxWatcher(['18eGUUxUsSetQYxJcQXEQTjSCUETEFeA4E']) def tx_printer(tx): print(tx) # You can add as many callbacks as you want w.on_tx += tx_printer # Blocking way w.run_forever() # or import thread thread.start_new_thread(w.run_forever, ()) # Do some work w.add_addresses(*['16xg9kBKUR2S6bmyccCyPichCpMNMPATAH'])
Check out the README on GitHub.
Please don't hesitate if you have any feedback/question/suggestion !
Tip with Bitcoin
Tip me with Bitcoin and vote for this post!
Leave a comment