This is the tenth lab from Professor Kevin Lu's iot GitHub
Here we create a small blockchain program and run it on our computers.
Up first is the usual installation of flask and requests (if you don't already have them)
$ pip3 install flask requests
And then some setting up.
First we will run the below commands to get a feel for hashing out some text. There will be quite a bit of output. I did not picture mine below for space saving purposes
$ cd ~/iot/lesson10
$ python3 hash_value.py
$ python3 snakecoin.py
$ python3
>>> import hashlib
>>> m=hashlib.sha256(b"hello, world")
>>> m.hexdigest()
>>> m.digest_size
>>> m.block_size
>>> exit()
Next, we will need two terminals to run the app and set up the flask server
On the first terminal I ran :
$ git clone https://github.com/satwikkansal/python_blockchain_app.git
$ export FLASK_APP=node_server.py
$ cd ~/python_blockchain_app
$ flask run --port 8000
And on a second terminal I ran:
$ cd ~/python_blockchain_app
$ python3 run_app.py
Then, I opened up my browser and navigated to localhost:5000 and ran the blockchain app!
Unfortunately, I do not have a Raspberry Pi or a MAM sensor currently available to me, so I was unable to complete the IOTA section of this lab.