P2P Graph Simulator - Part 1

1 minute read

For some time I’ve been wanting to start a project related to web development or networking, so I decided to create a chat application. The premise of this chat application is it being completely descentralized (P2P) and secure, with GPG signing and end-to-end encryption. Each client would need to store the whole message history locally, in a blockchain fashion. I’m also designing it with the goal of being able to support at least 50 users in the same chat room.

For this, I need to first develop a protocol for the application, and later implement it in various platforms (a Rust TUI, a web application, an android application, etc). I have been looking into many ways of organizing the peer to peer network, but I found it hard to visualize and thought that it would be nice to be able to see how the many protocols behaved in some kind of simulator. So, I started working on a P2P graph simulator. Right now the nodes have no behaviour other than simply connecting to the only node they now (which the user specifies).

P2P Graph Simulator

You can see the code in its public repo or try the simulator on its page (hosted by GitHub Pages). To add a node you must change to creation node (click the plus button), and then either click on a node to connect the new one to the already existing one or click somewhere else to create a free node. You can also change to deletion mode, which allows you to kill nodes or individual connections. This will be useful to check how the different algorithms deal with failures.

The next step is implementing different protocols (like Chord, Gossip, etc) and see the advantages and disadvantages of each one.