{"id":18152295,"url":"https://github.com/deepraj21/connect","last_synced_at":"2026-04-09T17:04:12.213Z","repository":{"id":244675571,"uuid":"815934209","full_name":"deepraj21/connect","owner":"deepraj21","description":"chat application with a unique feature: messages are stored on a blockchain to ensure data integrity and security. The application supports real-time communication, message replies, and user avatars via Gravatar.","archived":false,"fork":false,"pushed_at":"2024-06-19T12:33:37.000Z","size":502,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T23:46:19.645Z","etag":null,"topics":["blockchain","chat-application","flask","gravatar","mongodb","pymongo","python","socket-io","validator"],"latest_commit_sha":null,"homepage":"https://connect-v2.onrender.com","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepraj21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-16T15:19:42.000Z","updated_at":"2025-01-21T13:45:21.000Z","dependencies_parsed_at":"2024-06-19T22:12:04.581Z","dependency_job_id":"7c950ec4-4b56-4eda-8267-bc5875acaf74","html_url":"https://github.com/deepraj21/connect","commit_stats":null,"previous_names":["deepraj21/connect"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deepraj21/connect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraj21%2Fconnect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraj21%2Fconnect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraj21%2Fconnect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraj21%2Fconnect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepraj21","download_url":"https://codeload.github.com/deepraj21/connect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraj21%2Fconnect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280308484,"owners_count":26308492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","chat-application","flask","gravatar","mongodb","pymongo","python","socket-io","validator"],"created_at":"2024-11-02T02:06:45.044Z","updated_at":"2025-10-21T17:54:59.925Z","avatar_url":"https://github.com/deepraj21.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CONNECT : Real-Time Chat Application with Blockchain Integration\n\nThis project is a chat application with a unique feature: messages are stored on a blockchain to ensure data integrity and security. The application supports real-time communication, message replies, and user avatars via Gravatar.\n\n## Features\n\n- **Blockchain Integration**: Messages are stored on a blockchain to ensure data integrity.\n- **Real-time Chat**: Powered by Socket.IO, enabling instant message exchange.\n- **Reply Functionality**: Users can reply to specific messages in the chat.\n- **Gravatar Integration**: User avatars are generated using Gravatar based on their email addresses.\n- **User Authentication**: Users can sign up and log in to the chat application.\n\n## Prerequisites\n\n- Python 3.x\n- Flask\n- Flask-SocketIO\n- PyMongo\n- Requests\n- Validate-Email-Address\n- Gunicorn\n- Dotenv\n\n## Installation guide for Contribution\n\n1. **Clone the repository**:\n    ```bash\n    git clone https://github.com/deepraj21/connect.git\n    cd connect\n    ```\n\n2. **Create venv and Install the dependencies**:\n    ```bash\n    python -m venv venv\n    ./venv/Scripts/activate\n    pip install -r requirements.txt\n    ```\n\n3. **Set up environment variables**:\n    - Create a `.env` file in the root directory.\n    - Add the following environment variables:\n      ```bash\n      SECRET_KEY=your_secret_key\n      MONGO_CONNECTION_STRING=mongodb_uri\n      ```\n\n4. **Run the application**:\n    ```bash\n    python app.py or flask run\n    ```\n\n## Project Structure\n\n```arduino\nconnect/\n├── blockchain/\n│   └── __init__.py\n│   └── blockchain.py\n├── templates/\n│   ├── index.html\n│   └── chat.html\n├── static/\n│   └── css/\n│       └── styles.css\n├── .env\n├── app.py\n├── requirements.txt\n└── README.md\n```\n\n## Webapp Preview\n\n\u003cimg src=\"webapp preview/img1.png\"\u003e\n\u003cimg src=\"webapp preview/img2.png\"\u003e\n\u003cimg src=\"webapp preview/img3.png\"\u003e\n\n## `app.py` Explained\n\n### Flask Application\n\n- **Initialization**:\n  - Set up the Flask application and configure it with a secret key.\n  - Initialize Socket.IO for real-time communication.\n  - Connect to MongoDB for storing user and message data.\n  - Initialize the blockchain.\n\n- **Helper Functions**:\n  - `get_gravatar_url(email)`: Generates a Gravatar URL based on the user's email.\n\n### Socket.IO Events\n\n- **`handle_message`**:\n  - Handles incoming messages.\n  - Validates user session.\n  - Saves the message to MongoDB.\n  - Adds the message to the latest block in the blockchain.\n  - Broadcasts the message to all connected clients.\n\n### Routes\n\n- **`/signup`**:\n  - Handles user registration.\n  - Validates email and checks if the user already exists.\n  - Hashes the password and stores the user data in MongoDB.\n\n- **`/login`**:\n  - Handles user login.\n  - Validates user credentials.\n  - Creates a session for the user.\n\n- **`/`**:\n  - Renders the chat page if the user is logged in.\n  - If not logged in, redirects to the login/signup page.\n\n- **`/mine_block`**:\n  - Mines a new block and adds it to the blockchain.\n  - Returns the details of the mined block.\n\n- **`/get_chain`**:\n  - Returns the entire blockchain.\n\n- **`/valid`**:\n  - Checks if the blockchain is valid.\n\n- **`/logout`**:\n  - Logs out the user by clearing the session.\n\n## Blockchain Class\n\n### `blockchain/blockchain.py`\n\n- **Initialization**:\n  - Initializes the blockchain with the genesis block.\n\n- **Methods**:\n  - `create_block(proof, previous_hash)`: Creates a new block and adds it to the blockchain.\n  - `print_previous_block()`: Returns the last block in the blockchain.\n  - `proof_of_work(previous_proof)`: Generates proof of work for mining a new block.\n  - `hash(block)`: Generates a SHA-256 hash for a block.\n  - `chain_valid(chain)`: Validates the blockchain.\n\n## How It Works\n\n1. **User Registration/Login**:\n   - Users can sign up with a username, email, and password.\n   - Upon login, a session is created, and the user can access the chat page.\n\n2. **Real-time Chat**:\n   - Users can send messages in real-time.\n   - Each message is broadcast to all connected clients and stored in the blockchain.\n\n3. **Message Reply**:\n   - Users can reply to specific messages.\n   - The reply includes the original message and the username of the original sender.\n\n4. **Blockchain Storage**:\n   - Messages are stored in the latest block of the blockchain.\n   - A new block is mined periodically to secure the data.\n\n5. **Gravatar Integration**:\n   - User avatars are generated using Gravatar based on their email addresses.\n\n\n## Conclusion\n\nThis chat application leverages blockchain technology to ensure data integrity and security while providing real-time communication and user-friendly features like message replies and Gravatar integration.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepraj21%2Fconnect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepraj21%2Fconnect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepraj21%2Fconnect/lists"}