Question: Let's say I have more than 10 addresses, is there a quick and easy way to get a report of the total number of coins combined in all those addresses? Asking because it is quite hard to keep track of your net worth in DRK if you own a bunch of masternodes.
bump
python script to scrape the balance of each address from the blockchain explorer?
Here you go, crude and gratis: (change the url to whatever main-net explorer you like, this is a testnet blockchain explorer)
import re
import urllib
from bs4 import BeautifulSoup
total = 0
# use this if you have the addresses you want to check stored in a text file
with open('masternodelist.txt', 'r') as f:
addresses = [line.strip() for line in f]
# uncomment this and comment the two lines above if you want to manually enter the addresses to check here
#addresses = ['mmfb6hxTdLT3gQGAEDr2g6Qug8ew2MwKoJ', 'n3477ZfbKrovCAZ8WgBHHk1f9YwzWgjJ3o', 'mgvVYoBuN2Rmr9XPbgsLcu14i3U3YW9LC2']
for a in addresses:
print 'Felching balance for ' + a
url = "http://test.explorer.darkcoin.qa/address/" + a
html = urllib.urlopen(url).read()
soup = BeautifulSoup(html)
text = soup.get_text()
lines = (line.strip() for line in text.splitlines())
for line in lines:
if 'Balance:' in line:
output = line + '\n'
print output
b = float(re.sub("[^0-9.]", " ", (line)))
total = total + b
print 'Running Total = ' + str(total) + '\n'
example textfile, put it in the same directory as the above script: (this is a list of testnet masternode pubkeys, for the sake of demonstration)
n463zhqSexzpLtvz1iGmLKGsnRVXdXTCWZ
n3LPtjo2QNUzdpyn3yQkqTDvGn74yTSP7w
n37LjfqZYfyAJdNvp2wpHJbnA9jb4YAtVW
n3477ZfbKrovCAZ8WgBHHk1f9YwzWgjJ3o
n2xU4Y743oiWpu1nkHXdvbQTVKTqB8FRKo
n2Wg5yQx258L4emt3tFgrmv9nPnVVi26aB
n23eoeYKnmh8Ybg7U9DQ7kfpsU8N7C6hKZ
n1bb8zU5A3aS1ZoGCLAkggWJnGQdfMkHhR
n1AZHixxuwXH2hTcXyEDu63gBESnRQwier
mzVPa9pUKviaLFYMBcPRxUfG8yALXjHbpa
mzUwVLqv4WMAPbfCJxtG4YfwSjcT5Vt1Em
my63g87UR36Kdov6m2SBMAmRGAsjWSDX7j
mwfrRyK7kpwTqAqdwdwvxWAo21H6MTnEpL
mvrfEXW1ZazecE2cMufCoz2RyGssLwysLr
mubrbRNo51o9sj4hiyFSqkPzUkMEtrao6Q
mu2EV6HqFEDZWdXEKmeNQVGWLxadLPXRAG
msuYaWseCEFm6FtU9iaEPBT6HiSTd4MTDX
mpwjKxJSpTN1LTDbu2BPtXryRpMQi5BSwa
mpuTzSLxMQcSzgdPgs4BHxfCvTSBvWZKF4
mpuD7ci4Y3PA8THoHCWz7GfAZSrnGTSgCf
mmC4xYH8D38h7xsQ8XqfmsTTsaDrdGbHNb
mj79S74NkQbkVnrJq1xyry9K8htg19g9px
mj1eJunhQuBnxShsMxwDKWonANzB3uZsKh
mgLthxzMjabQLnLNZCAcQVxky5JfeiaS8h
mg3NpRmgu4Wv7ARJB3XTEa2vBGKvkgJGNw
Output:
stu@stu-laptop:~/Desktop/python$ python felch.py
Felching balance for n463zhqSexzpLtvz1iGmLKGsnRVXdXTCWZ
Balance: 4800.0208 DRK
Running Total = 4800.0208
Felching balance for n3LPtjo2QNUzdpyn3yQkqTDvGn74yTSP7w
Balance: 26.00000001 DRK
Running Total = 4826.02080001
Felching balance for n37LjfqZYfyAJdNvp2wpHJbnA9jb4YAtVW
Balance: 6100.0326 DRK
Running Total = 10926.0534
Felching balance for n3477ZfbKrovCAZ8WgBHHk1f9YwzWgjJ3o
Balance: 39963.54480008 DRK
Running Total = 50889.5982001
...etc
You might need to 'pip install beautifulsoup4' if you don't already have it as part of your python installation.
And if you want it wrapped in a fancy QT GUI let me know, I charge 10DRK/hr.