Skip to content

nietus/blockchain-blockchat

Repository files navigation

Blockchain BlockChat

A decentralized chat application built on blockchain technology, featuring a peer-to-peer network using Kademlia DHT for node discovery and communication.

Features

  • 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

Prerequisites

  • Python 3.8+
  • Docker and Docker Compose (for containerized deployment)
  • Railway account (for cloud deployment)

Local Development with Docker

Prerequisites

  • Docker Desktop installed and running
  • Git (for cloning the repository)

Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/blockchain-blockchat.git
    cd blockchain-blockchat
  2. Build and start the containers

    docker-compose up --build
  3. Access the application

Managing the Application

  • Stop all containers

    docker-compose down
  • Stop and remove all data

    docker-compose down -v
  • View logs

    docker-compose logs -f

Deployment to Railway

Prerequisites

Deployment Steps

  1. Create a new project on Railway dashboard
  2. Connect your repository to Railway
  3. 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)
  4. Deploy your application

Accessing Deployed Nodes

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.

API Documentation

Node Endpoints

  • GET /node{id}/chain - View the blockchain
  • GET /node{id}/mine - Mine a new block
  • GET /node{id}/pending_tx - View pending transactions
  • POST /node{id}/transactions/new - Create a new transaction

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Acknowledgments

  • Built with Python and Flask
  • Uses Kademlia DHT for peer-to-peer networking
  • Deployed on Railway

About

Simulador de blockchain com deploy facilitado por docker compose, usado em TI 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages