Blockchain based social network that allows people to interact each others This application is based on this repo Blockchain
Main purpose of this dapp is to allow users whithin the network post messages into the app.
The proof of work for this blockchain is based on the hash of each Block as well as a sentimental analysis about the comment posted. For this app each block contains a single transaction. Each transaction is defined by the next info:
- Author
- Content
- Timestamp
Each block is defined by the next:
- Index
- Transaction
- Timestamp
- Previous block (defined by its hash)
Algorithm consists in look for such a Nonce value that when calculating hash function for that block, result begin with "00". Sentimental analysis consists in detect spam or bad words in the comment with help of Bayesian filter. If the comment is detected as spam, block is not mined
The consensus for this blockchain is as simple as just select the larger chain as the valid chain
It's possible to run this Dapp (Descentralized Application) by two ways
This tutorial is assuming you have python installed and running on a Linux-based OS
If you go by this way, I suggest you to use virtual environment
- Clone this repo
git clone https://github.com/ManuGS2/Blockchain.git
- Go to the folder
cd Blockchain
- Install the dependencies
pip install -r server/requirements.txt
pip install -r front/requirements.txt
- Run the node server for connecting to blockchain network with the next commands
export FLASK_APP=server/blockchain_api.py
flask run --port 8000
- Run the web application with the next commands
export FLASK_APP=front/views.py
flask run --port 5000
- If you want to run more nodes, just follow the samen in step 4 but changing the port
export FLASK_APP=server/blockchain_api.py
flask run --port 8001
Your web application will be running on http://127.0.0.1:5000/
NOTE: for each instance of the web app or node server it's necessary to open new console window
If you go by this way, you need to have docker installed in your machine as well as docker-compose in onder to run this Dapp in containers.
If you don't have docker neither docker-compose installed follow the instructions from official page.
Once you have docker compose installed follow the next steps
- Clone this repo
git clone https://github.com/ManuGS2/Blockchain.git
- Go to the folder
cd Blockchain
- Build, crate and run the containers
docker-compose up --build
This last command will run the services defined in docker-compose.yml file. You can modify it in order to create more nodes or instances
By default this will create 1 web app instance, 1 node and 1 redis instance.
Your web application will be running on http://127.0.0.1:5000/