electrum-bitcoinprivate/scripts/get_history

29 lines
630 B
Plaintext
Raw Normal View History

2012-06-14 12:11:37 -07:00
#!/usr/bin/env python
import sys
from electrum import Interface
2012-06-14 12:11:37 -07:00
try:
addr = sys.argv[1]
except:
print "usage: get_history <bitcoin_address>"
sys.exit(1)
i = Interface({'server':'electrum.novit.ro:50001:t'})
2012-06-14 12:11:37 -07:00
i.start()
i.send([('blockchain.address.get_history',[addr])])
while True:
2012-06-14 23:29:52 -07:00
try:
r = i.responses.get(True, 100000000000)
except KeyboardInterrupt:
break
2012-06-14 12:11:37 -07:00
method = r.get('method')
if method == 'blockchain.address.get_history':
confirmed = unconfirmed = 0
h = r.get('result')
for item in h:
print item['tx_hash'], item['value']
break