forked from phearnot/waves-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgs-list.py
36 lines (24 loc) · 820 Bytes
/
gs-list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sys
import requests
def arrange(n, decimals):
return n / pow(10, decimals)
def total_balance(txs):
balance = 0
for ts, height, tx_id, direction, amount, fee, tx_type, total, sponsor in txs:
balance += total
yield height, tx_id, tx_type, amount, fee, direction, total, balance, sponsor
def load_block_headers(node, start, stop):
headers = requests.get(f'{node}/blocks/headers/seq/{start}/{stop}').json()
return headers
def list_gs():
node = sys.argv[1]
start = int(sys.argv[2])
stop = int(sys.argv[3])
blocks = load_block_headers(node, start, stop)
if blocks:
for b in blocks:
print(str(b["height"]) + ": " + b["nxt-consensus"]["generation-signature"])
else:
print(blocks)
if __name__ == '__main__':
list_gs()