Skip to content

Conversation

@SurvivaLlama
Copy link

Summary

This PR adds a new feature that tracks the total computing power of the swarm. The dashboard will now be able to display the total RAM (in GB) and CPU Cores of all connected nodes combined.

Changes Made

I updated the following files to pass hardware statistics through the P2P network:

  • src/core/identity.js: Added logic to capture the local node's total RAM and CPU count using the os module.
  • src/p2p/swarm.js: Updated the initial handshake and heartbeat messages to broadcast these hardware stats to peers.
  • src/p2p/messaging.js: Updated the input validation to allow the hardware property in incoming messages.
  • src/state/peers.js: Added a getSwarmStats() function to sum up the resources of all known peers.
  • src/web/routes.js: Exposed these new totals in the /api/stats endpoint and the SSE event stream for the frontend.

Motivation

In the spirit of "The Homelab Must Grow," users can now see exactly how much total compute power is currently being wasted by the swarm.

Note

These changes were made via the GitHub Web Editor. I have not run a local build. Also, this was vibe coded by Gemini. 🤖✨

Added comments to clarify each step of the identity generation process and included hardware specifications.
Refactor PeerManager methods to improve code clarity and add support for hardware stats.
Updated the Hello message and Heartbeat to include hardware stats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant