Crypto Bank is a decentralized blockchain application that enables secure transactions between users. It allows users to create and manage transactions, mine blocks, and validate the blockchain. With a focus on transparency and security, Crypto Bank ensures the integrity of transaction records in a reliable digital currency platform.
- Create and manage transactions
- Mine new blocks
- Validate the blockchain
- View transaction history
- Python 3.x
- Flask
- Flask-CORS (for cross-origin requests)
- React (for frontend)
Clone this repository to your local machine using:
git clone https://github.com/Yash22222/CryptoBank.git
cd CryptoBank
-
Navigate to the backend directory:
cd backend
-
Create a virtual environment (optional but recommended):
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Navigate to the frontend directory:
cd ../frontend
-
Install the frontend dependencies:
npm install
-
Navigate back to the backend directory:
cd ../backend
-
Run the Flask application:
python app.py
The backend server should start running at
http://127.0.0.1:5000/
.
-
Open a new terminal window and navigate to the frontend directory:
cd CryptoBank/frontend
-
Start the React application:
npm start
The frontend will be accessible at
http://localhost:3000/
.
- GET /: Welcome message.
- GET /mine: Mine a new block.
- POST /transaction: Create a new transaction (provide JSON body).
- GET /chain: View the entire blockchain.
- GET /validate: Validate the blockchain.
Use Postman or any REST client to send a POST request to:
http://127.0.0.1:5000/transaction
With the following JSON body:
{
"sender": "Alice",
"recipient": "Bob",
"amount": 10
}
Send a GET request to:
http://127.0.0.1:5000/mine
You will receive a JSON response indicating that a new block has been mined.
Send a GET request to:
http://127.0.0.1:5000/validate
This will return a response indicating whether the blockchain is valid or not.
Send a GET request to:
http://127.0.0.1:5000/chain
This will return the complete blockchain, showing all blocks and transactions.
After successfully creating a transaction or mining a block, you will receive a JSON response indicating the success of the operation. For example, after mining a block, you might see:
{
"message": "New block mined successfully!",
"block": {
"index": 1,
"transactions": [...],
"proof": 12345,
"previous_hash": "abcdef..."
}
}
Crypto Bank demonstrates the practical implementation of blockchain technology, showcasing how transactions can be securely processed in a decentralized manner. It provides insights into the workings of cryptocurrencies and the fundamental concepts of blockchain.
This project is licensed under the MIT License - see the LICENSE file for details.