Skip to content

FredyRamadhan/P2P-gossip-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gossip Protocol-based P2P Messaging Application

OVERVIEW

This is a peer-to-peer messaging app where multiple nodes can connect to each other and exchange encrypted messages. Messages are synchronized across the network using a gossip protocol.

INSTALLATION

Install dependencies:

pip install -r requirements.txt

RUNNING LOCALLY

Start the first node on port 5001:

py app.py 5001

In another terminal, start the second node on port 5002:

py app.py 5002

Open http://localhost:5001 and http://localhost:5002 in separate browser windows

  • On the 5001 interface, click "Sambungkan Peer" and enter 5002
  • On the 5002 interface, click "Sambungkan Peer" and enter 5001

Select a peer from the sidebar and send messages

HOW IT WORKS

  • Each node generates RSA public/private key pairs on startup
  • When you connect to a peer, your public key is exchanged
  • Messages are encrypted with the recipient's public key
  • The gossip protocol automatically spreads messages across all connected peers
  • Messages are stored locally in SQLite databases

STRUCTURE

app.py - Main Flask server with all routes and logic
requirements.txt - Python dependencies
docker-compose.yaml - Multi-node Docker setup
static/ - CSS and JavaScript files
templates/ - HTML template
instance/ - Created automatically for database files

NOTES

  • Each node listens on its own port (5001, 5002, etc.)
  • Data persists in node_PORT.db files
  • The app runs in debug mode locally
  • Messages sync every 2 seconds in the UI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors