Skip to content

A cryptocurrency blockchain app with transaction management, mining, wallet, user admin, database, tdd and more.

Notifications You must be signed in to change notification settings

codebatine/gochain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go-Chain

Go-Chain is a custom cryptocurrency blockchain implementation with transaction management and validation. This project includes the following features and components. 👇

Features

Blockchain Implementation 🧱

  • A custom cryptocurrency blockchain.
  • Transaction management and validation.

Transaction Pool 🤽

  • Managed transactions before adding them to a block.
  • Created and tracked reward transactions in the transaction pool.

Validation ✅

  • Validated transactions to ensure they follow specified rules.

Networking 🧲

  • Supported multiple nodes with blockchain synchronization.
  • Utilized Redis for network communication.

Database 💾

  • Stored the blockchain, blocks and transactions in a MongoDB database.

Security 🔐

  • Implemented user registration and login.
  • Used JSON Web Tokens (JWT) for user validation.
  • Stored user information in MongoDB.

Client Application 🎈

  • Developed a client application using React with Vite.
  • Enabled the creation of new transactions.
  • Listed transactions and blocks.
  • Provided functionality to mine blocks with transactions.

Best Practices 🔮

  • TDD for transaction management.
  • Followed best practices: Clean Code, Separation of Concerns (SOC) and Model-View-Controller (MVC).
  • Secured the server against various attacks, including NoSQL injections, DDOS and XSS attempts.

Installation 📜

To run this project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/codebatine/gochain.git
    cd gochain
  2. Install dependencies for both backend and frontend:

    cd backend
    npm i
    cd ../frontend
    npm i
  3. Run Redis server:

    redis-server
  4. Set up MongoDB:

    Make sure you have MongoDB installed and running on your local machine.

  5. Add environment variables:

    Create a file named .env in the backend/config directory with the following content:

    NODE_ENV=development
    PORT=5000
    MONGO_URI=your_mongo_uri_here
    JWT_SECRET=your_jwt_secret_here
    JWT_TTL=90d
    JWT_COOKIE_TTL=90d
    REDIS_HOST=localhost
    REDIS_PORT=6379
  6. Start the backend and frontend servers:

    Open two terminal windows or tabs and run the following commands in each:

    In the first terminal (backend):

    cd backend
    npm run dev

    In the second terminal (frontend):

    cd frontend
    npm run dev
    1. Run tests in backend:

    To run tests for the backend, use the following command:

    cd backend
    npm test

Usage 🦩

  1. Register and log in:

    • Create a new user account and log in to access the blockchain features.
  2. Create transactions:

    • Use the client application to create and send new transactions.
  3. Mine blocks:

    • Mine blocks to add transactions to the blockchain and receive rewards.
  4. View blockchain:

    • Explore the blockchain, view transactions and monitor blocks.

Screenshots 📸

Here are some screenshots of the Go-Chain application in action:

Start

Registration and Login

Signup

Creating a Transaction

Create Transaction

Viewing the Blockchain

View Blockchain