diff --git a/node/rustchain_p2p_gossip.py b/node/rustchain_p2p_gossip.py old mode 100644 new mode 100755 diff --git a/tools/node_dashboard.py b/tools/node_dashboard.py new file mode 100755 index 000000000..1df696d3c --- /dev/null +++ b/tools/node_dashboard.py @@ -0,0 +1,36 @@ +import time +import requests +import os + +def get_node_stats(): + # Attempt to query the local Rustchain RPC + try: + response = requests.post("http://localhost:3000/rpc", + json={"method": "get_status", "params": []}, + timeout=2) + return response.json() + except: + return None + +def print_dashboard(): + os.system('clear') + print("="*40) + print(" RUSTCHAIN NODE HEALTH DASHBOARD ") + print("="*40) + stats = get_node_stats() + + if stats: + print(f"Status: ONLINE") + print(f"Peers: {stats.get('peers', '0')}") + print(f"Block: {stats.get('height', 'Unknown')}") + print(f"Hashrate: {stats.get('hashrate', '0')} H/s") + else: + print(f"Status: OFFLINE (Node not responding on port 3000)") + + print("-" * 40) + print("Press Ctrl+C to exit") + +if __name__ == "__main__": + while True: + print_dashboard() + time.sleep(5)