electrum-bitcoinprivate/scripts/blocks

17 lines
412 B
Plaintext
Raw Normal View History

2012-03-17 04:51:16 -07:00
#!/usr/bin/env python
2012-10-28 00:14:00 -07:00
import sys, electrum
2012-10-12 07:09:20 -07:00
i = electrum.Interface()
2012-10-28 00:14:00 -07:00
i.register_callback('connected', lambda: sys.stderr.write("Connected to %s\n" % i.connection_msg))
2012-03-24 23:53:23 -07:00
i.start()
2012-03-28 14:02:33 -07:00
i.send([('blockchain.numblocks.subscribe',[])])
2012-03-17 04:51:16 -07:00
while True:
2012-06-14 23:29:52 -07:00
try:
r = i.get_response()
2012-06-14 23:29:52 -07:00
except KeyboardInterrupt:
break
2012-05-17 11:26:37 -07:00
if r.get('method') == 'blockchain.numblocks.subscribe':
print r.get('result')