Initial novacoin support
[electrum-nvc.git] / scripts / watch_address
1 #!/usr/bin/env python
2
3 import sys, time, electrum_nvc
4
5 try:
6     addr = sys.argv[1]
7 except Exception:
8     print "usage: watch_address <bitcoin_address>"
9     sys.exit(1)
10
11
12 # 1. start the interface and wait for connection
13 interface = electrum.Interface('electrum.no-ip.org:50002:s')
14 interface.start(wait = True)
15 if not interface.is_connected:
16     print "not connected"
17     exit()
18
19 # 2. send the subscription
20 callback = lambda _,result: electrum.print_json(result.get('result'))
21 interface.send([('blockchain.address.subscribe',[addr])], callback)
22
23 # 3. wait for results
24 while True:
25     time.sleep(1)
26