Best Flask open-source libraries and packages

Baby_Blockchain

Created a Blockchain using Python to allow baby product management while ensuring secure data transmission. Implemented replication with consensus and designed the back-end of Merkle tree to attain an efficient manner. Coded the data storing technique in a way like without database one can record the chain by keeping at least one node always on.
Updated 5 years ago

Baby_Blockchain

Blockchain for Baby Product Inventory

Technology used

-> Flask
-> Python3
-> Merkle Trees (tools)
-> HTML/CSS/Javascript/Bootstrap
-> Consensus algorithm
-> Replication
-> Proof of Work

How to run

Start nodes

FLASK_APP=server.py flask run --port=5001
FLASK_APP=server.py flask run --port=5002

Register nodes

Include all other nodes in the JSON file other than the node you're already on. Uses proof of work and forges a new block. For registering node 5002 on node 5001:

curl -i -X POST http://localhost:5001/nodes/register -d @register-node5001.json --header "Content-Type: application/json"

For registering node 5001 on node 5002:

curl -i -X POST http://localhost:5002/nodes/register -d @register-node5002.json --header "Content-Type: application/json"

Register a new item as a manufacturer node

curl -i -X POST http://localhost:5001/register -d @entry.json --header "Content-Type: application/json"

{
	"upc": "123",
	"product":"MEGNYA Leather Baby Moccasins",
	"link": "https://www.amazon.com/MEGNYA-Leather-Moccasins-Toddler-ZH0003-Brown-12-5/dp/B07BBVPSPW/ref=sr_1_1_sspa?ie=UTF8&qid=1525936891&sr=8-1-spons&keywords=baby+shoes&psc=1",
	"quantity": "90",
	"price":"18.99",
	"manufacturer": "MEGNYA"
}

Replicate/update nodes

To replicate all new changes (such as the ones made on 5001) on node 5002:

curl -i -X GET http://127.0.0.1:5002/nodes/resolve

To replicate all new changes (such as the ones made on 5002) on node 5001:

curl -i -X GET http://127.0.0.1:5001/nodes/resolve

Run on all nodes that have not been updated.

Transfer ownership of a product : UPDATE THIS JSON

Checks to see that the original owner actually has the product or not. Also checks to see if a product exists with that ID.

curl -i -X GET http://127.0.0.1:5001/transfer

{
	"upc": 123123,
	"old_owner": "Aditi", 
	"new_owner": "Femi"
}

Get the updated blockchain to see updates

curl -i -X GET http://127.0.0.1:5001/chain

Get a specific transaction with transaction ID (returns block that contains the transaction)

curl -i -X GET http://127.0.0.1:5001/transaction/<transaction_ID>

Get a specific product with product ID (returns block that contains the product)

Returns an error statement if a product with that ID does not exist.

curl -i -X GET http://127.0.0.1:5001/product/<product_ID>
Tags blockchain