You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
715 B

13 years ago
#!/usr/bin/env python
import sys
import time
import electrum
13 years ago
try:
addr = sys.argv[1]
except Exception:
13 years ago
print "usage: watch_address <bitcoin_address>"
sys.exit(1)
13 years ago
# start network
c = electrum.SimpleConfig()
s = electrum.daemon.get_daemon(c,True)
network = electrum.NetworkProxy(s,c)
network.start()
13 years ago
# wait until connected
while network.is_connecting():
time.sleep(0.1)
if not network.is_connected():
print_msg("daemon is not connected")
sys.exit(1)
# 2. send the subscription
callback = lambda response: electrum.print_json(response.get('result'))
network.send([('blockchain.address.subscribe',[addr])], callback)
# 3. wait for results
while network.is_connected():
time.sleep(1)