#!/bin/bash
curl -s localhost:46941/json_rpc \
  -d '{"jsonrpc":"2.0","id":"0","method":"getinfo"}' \
  -H 'Content-Type: application/json' | python3 -c "
import sys,json
d=json.load(sys.stdin)['result']
hf = d.get('is_hardfok_active',[])
active = sum(1 for h in hf if h)
print(f'Height:     {d[\"height\"]:,}')
print(f'Hardforks:  HF0-{active-1} active')
print(f'PoW diff:   {d.get(\"pow_difficulty\",0):,}')
print(f'Aliases:    {d.get(\"alias_count\",0)}')
print(f'TX count:   {d.get(\"tx_count\",0):,}')
print(f'Peers in:   {d.get(\"incoming_connections_count\",0)}')
print(f'Peers out:  {d.get(\"outgoing_connections_count\",0)}')
print(f'Status:     {d[\"status\"]}')
"
