Monitor Transactions on Bitcoin Addresses with Python and TxWatcher

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.

Feedback

Please don't hesitate if you have any feedback/question/suggestion !

You should follow me on Twitter

Share this article

Tip with Bitcoin

Tip me with Bitcoin and vote for this post!

1FKdaZ75Ck8Bfc3LgQ8cKA8W7B86fzZBe2

Leave a comment

© Thomas Sileo. Powered by Pelican and hosted by DigitalOcean.