This is a learning project to learn more about cryptocurrency by building one. I have implemented various components of a cryptocurrency like blockchain, wallets, miners, and proof of work. I have also made few Flask routes to test these functionalities and simulate how cryptocurrency would work in real life.
After cloning the project to the workstation enter the following command in cmd/terminal to install all the dependencies.
pip install -r requirements.txtFirst, move into the src folder
cd src- To start a blockchain node, execute the command below:
python blockchain.py -p 5000 - You can add a new node to blockchain by executing the same command and specifying a port that is not already used. For example,
python blockchain.py -p 5001 - To start the blockchain client,
python blockchain_client.py -p 8080 - Now you will need an application like postman to send requests to routes you want to access.
- You can create a new wallet by sending a get request at route
localhost:8080/wallet/new - Now you can send a post request to make the transaction at route
localhost:8080/generate/transaction - Now as a node you can mine a block by sending get request at route
localhost:5000/mine - To add new nodes to the network you can send post request at route
localhost:5000/nodes/register