-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
38 lines (31 loc) · 1.31 KB
/
setup.sh
File metadata and controls
38 lines (31 loc) · 1.31 KB
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
37
38
#!/bin/bash
get_data() {
local endpoint=$1
curl -s "http://localhost:3033$endpoint" | jq -r .
}
get_latest_chain_height() {
curl -s "https://f5nodes.com/api/aleo/blocks" | jq -r .maxHeight
}
display_table() {
echo "----------------------------------------------"
echo "| Endpoint | Data |"
echo "----------------------------------------------"
echo "| Latest Chain Height | $(get_latest_chain_height) |"
echo "| Latest Node Height | $(get_data /testnet3/latest/height) |"
echo "| Latest Hash | $(get_data /testnet3/latest/hash) |"
echo "| Latest State Root | $(get_data /testnet3/latest/stateRoot) |"
echo "| Peers Count | $(get_data /testnet3/peers/count) |"
echo "----------------------------------------------"
echo "| Validators IP and Ports |"
echo "----------------------------------------------"
# Fetch validator data
validator_data=$(get_data /testnet3/peers/all/metrics | jq -r '.[] | select(.[1] == "Validator") | "\(.[0])"')
# Display indexed validator data
index=1
while read -r validator; do
echo "| Validator $index | $validator |"
((index++))
done <<< "$validator_data"
echo "----------------------------------------------"
}
display_table