Go-Chain is a custom cryptocurrency blockchain implementation with transaction management and validation. This project includes the following features and components. 👇
- A custom cryptocurrency blockchain.
- Transaction management and validation.
- Managed transactions before adding them to a block.
- Created and tracked reward transactions in the transaction pool.
- Validated transactions to ensure they follow specified rules.
- Supported multiple nodes with blockchain synchronization.
- Utilized Redis for network communication.
- Stored the blockchain, blocks and transactions in a MongoDB database.
- Implemented user registration and login.
- Used JSON Web Tokens (JWT) for user validation.
- Stored user information in MongoDB.
- 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.
- 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.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/codebatine/gochain.git cd gochain
-
Install dependencies for both backend and frontend:
cd backend npm i cd ../frontend npm i
-
Run Redis server:
redis-server
-
Set up MongoDB:
Make sure you have MongoDB installed and running on your local machine.
-
Add environment variables:
Create a file named
.env
in thebackend/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
-
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
- Run tests in backend:
To run tests for the backend, use the following command:
cd backend npm test
-
Register and log in:
- Create a new user account and log in to access the blockchain features.
-
Create transactions:
- Use the client application to create and send new transactions.
-
Mine blocks:
- Mine blocks to add transactions to the blockchain and receive rewards.
-
View blockchain:
- Explore the blockchain, view transactions and monitor blocks.
Here are some screenshots of the Go-Chain application in action: