Created
August 22, 2018 18:32
-
-
Save shyal/ee76d57b61f0036c998a66fbe6f94074 to your computer and use it in GitHub Desktop.
This should print out how many USDT have been printed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################### | |
# This should print out how many USDT have been printed # | |
# date created: 22/08/2018 # | |
# date updated: 22/08/2018 # | |
######################################################### | |
import requests | |
import os | |
import json | |
import tempfile | |
import arrow | |
from pprint import pprint | |
tmp = tempfile.gettempdir() | |
# get a page from omniexplorer, with local caching | |
# to avoid running into rate limiting | |
def get_page(page): | |
fn = os.path.join(tmp, str(page)) | |
if os.path.exists(fn): | |
with open(fn, 'r') as f: | |
return json.load(f) | |
data = {'addr':'3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL', 'page': '%s'%page} | |
r = requests.post("https://api.omniexplorer.info/v1/transaction/address", data=data) | |
j = r.json() | |
with open(fn, 'w') as f: | |
json.dump(j, f) | |
return j | |
def main(): | |
i = 0 | |
transactions = [] | |
# query pages, and aggregate transactions | |
while True: | |
page = get_page(i) | |
transactions.extend(page['transactions']) | |
if page['pages'] == i+1: | |
break | |
i += 1 | |
total = 0 | |
# accumulate printed amounts | |
for t in reversed(transactions): | |
if t['type'] == 'Grant Property Tokens': | |
total += float(t['amount']) | |
print('tether printed {0} on {1}'.format(t['amount'], arrow.get(t['blocktime']).humanize())) | |
# output results | |
print("-"*50) | |
print("total tokens created: {:,} USDT".format(total)) | |
if __name__ == "__main__": | |
main() |
Author
shyal
commented
Aug 22, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment