A decentralized chat application built on blockchain technology, featuring a peer-to-peer network using Kademlia DHT for node discovery and communication.
- Decentralized Architecture: No central authority, fully peer-to-peer
- Blockchain-based: Secure and immutable message storage
- Multiple Nodes: Run and manage multiple blockchain nodes
- RESTful API: Easy integration with frontend applications
- Docker Support: Containerized deployment
- Railway Deployment: One-click deployment to Railway
- Python 3.8+
- Docker and Docker Compose (for containerized deployment)
- Railway account (for cloud deployment)
- Docker Desktop installed and running
- Git (for cloning the repository)
-
Clone the repository
git clone https://github.com/yourusername/blockchain-blockchat.git cd blockchain-blockchat
-
Build and start the containers
docker-compose up --build
-
Access the application
- Main interface: http://localhost:8080
- Node 0: http://localhost:8080/node0
- Node 1: http://localhost:8080/node1
- Node 2: http://localhost:8080/node2
-
Stop all containers
docker-compose down
-
Stop and remove all data
docker-compose down -v
-
View logs
docker-compose logs -f
- Railway account (https://railway.app/)
- GitHub/GitLab repository with your code
- Create a new project on Railway dashboard
- Connect your repository to Railway
- Configure environment variables:
PORT
: 8080 (automatically set by Railway)RAILWAY_STATIC_URL
: Your Railway deployment URL (e.g.,https://your-app-name.up.railway.app
)
- Deploy your application
Your deployment will run multiple blockchain nodes accessible at different paths:
Node | URL | Endpoints |
---|---|---|
Node 0 (Bootstrap) | https://your-app-name.up.railway.app/node0 |
- /chain - /mine - /pending_tx |
Node 1 | https://your-app-name.up.railway.app/node1 |
- /chain - /mine - /pending_tx |
Node 2 | https://your-app-name.up.railway.app/node2 |
- /chain - /mine - /pending_tx |
Visit the home page at https://your-app-name.up.railway.app/
to see all available nodes.
GET /node{id}/chain
- View the blockchainGET /node{id}/mine
- Mine a new blockGET /node{id}/pending_tx
- View pending transactionsPOST /node{id}/transactions/new
- Create a new transaction
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Built with Python and Flask
- Uses Kademlia DHT for peer-to-peer networking
- Deployed on Railway