Nyzo balance checker

This Python script will allow you to quickly check the balance of multiple public identifiers, there are no requirements for this script to work other than Python 3.

Create a ‘public.txt’ file and put one public-key on each line.
Put this in the same directory as this script and execute.

Please note that this puts 100% trust in the data displayed on nyzo.co

import csv
import requests
block_url = 'http://nyzo.co/block/last'
balance_url = 'https://nyzo.co/balanceListPlain/'
seed_balance = 0
bounty_balance = 0
balance = 0
count = 0

csv_data = [['Public key', 'Current balance']]
with open('balances.csv', 'w', newline='') as file:
writer = csv.writer(file)

with open('public.txt') as file:
request_url = requests.get(block_url)
page_decoded = request_url.content.decode('utf-8')
start_position = page_decoded.find('

Nyzo block ')
end_position = page_decoded.find('
block_number = str(page_decoded[start_position + 15: end_position])
balance_url = balance_url + block_number
request_url = requests.get(balance_url)
page_decoded = request_url.content.decode('utf-8')
for line in file:
if len(line) > 10:
public_id_clean = line
public_id = str(line[:67]) + " ∩"
start_position = page_decoded.find(public_id) + 73
end_position = start_position + 25
split_me = (page_decoded[start_position:end_position]).split(" ")

temp_bal = split_me[0]


# addresses with zero balance disappear from the balance list, thus we will grab wrong data
# and attempt to make this a float, this will fail but balance is zero
temp_bal = float(temp_bal)
temp_bal = 0

row = [str(public_id_clean), str(temp_bal)]
balance = balance + temp_bal

# seperate negative and positive per address in csv
with open('balances.csv', 'a', newline='') as file:
writer = csv.writer(file)

print('Total balance:', str(balance))

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.