EE 629 �Internet of Things �Lesson 10: Blockchain
Kevin W. Lu
2021-10-16
Lesson 10: Blockchain
2
Lab 10A — Blockchain
$ cd iot/lesson10
$ python3 hash_value.py
$ python3 snakecoin.py
$ python3 snakecoin-server-full-code.py
$ cd
$ git clone https://github.com/satwikkansal/python_blockchain_app.git
$ export FLASK_APP=node_server.py
$ cd python_blockchain_app
$ flask run --port 8000
* Serving Flask app "node_server"
* Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)
$ cd python_blockchain_app
$ python3 run_app.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with inotify reloader
* Debugger is active!
* Debugger PIN: 184-619-943
3
Lab 10B — IOTA
Install PyOTA and connect to an IRI node
$ sudo pip3 install pyota[ccurl]
$ cd ~/iot/lesson10
$ python3 iri_node_info.py
$ cd
Send DHT11 sensor data to the IOTA Tangle using MAM (by Robert Lie)
$ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
$ tar zxvf bcm2835-1.60.tar.gz
$ cd bcm2835-1.60
$ ./configure
$ make
$ sudo make check
$ sudo make install
$ cd
$ git clone https://github.com/robertlie/dht11-raspi3.git
$ cd dht11-raspi3
$ npm install
4
Lab 10B — IOTA
$ nano mam_publish.js
$ nano mam_receive.js
$ nano mam_sensor.js
$ cd lib
$ nano mam.client.js
$ node mam_publish.js
$ node mam_receive.js YOUR_ROOT
$ nano sensor.js
$ nano mam_sensor.js
$ node sensor.js
$ node mam_sensor.js
$ node mam_receive.js YOUR_ROOT
5
Distributed Ledger Technology
6
Transparency and Traceability
7
Blockchain
8
Blockchain Technology Key Forces
9
Blockchain of Things
10
Blockchain and Cryptocurrency
11
Non-Fungible Tokens (NFTs)
12
Hash Functions
pi@piot4:~/iot/lesson10 $ python3 hash_value.py
pi@piot4:~$ python3
>>> import hashlib; m=hashlib.sha256(b"hello, world")
>>> m.hexdigest()
'09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b'
>>> m.digest_size
32
>>> m.block_size
64
>>> exit()
pi@piot4:~$
13
Hash Trees
14
Bitcoin Transactions
15
Timestamp Server
16
Proof-of-Work
17
Peer-to-Peer Network
18
Reclaiming Disk Space
19
Simplified Payment Verification
20
Combining and Splitting Value
21
Privacy
22
Bitcoin Blocks
23
Bitcoin Electricity Consumption
24
Aluminum Smelting
25
Natural Gas Flaring
26
Smart Contracts and Ethereum
27
Chainlink
28
Contribution by Aldin Llolla, 2019 Fall
Build a Blockchain 0/3
pi@piot4:~/iot/lesson10 $ python3 snakecoin.py
pi@piot4:~/iot/lesson10 $ python3 snakecoin-server-full-code.py
29
Build a Blockchain 1/3
$ git clone https://github.com/satwikkansal/python_blockchain_app.git
$ export FLASK_APP=node_server.py
$ cd python_blockchain_app
$ flask run --port 8000
* Serving Flask app "node_server"
* Running on http://127.0.0.1:8000/ (Press CTRL+C to quit)
$ cd python_blockchain_app
$ python3 run_app.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with inotify reloader
* Debugger is active!
* Debugger PIN: 184-619-943
30
Build a Blockchain 2/3
31
Build a Blockchain 3/3
32
Blockchain Classes
33
Enterprise Blockchain
34
Hyperledger
35
Trusted IoT Alliance
36
MOBI
37
Quorum
38
Diem Blockchain and Protocol
39
Government Cryptocurrency
40
IoT Blockchain Examples
41
IOTA Foundation
42
IOTA, Tangle, and MAM
43
Contribution by Ziran Gong, 2018 Fall
Directed Acyclic Graph (DAG)
44
PyOTA and IRI
$ sudo pip3 install pyota[ccurl]
$ cd ~/iot/lesson10
$ python3 iri_node_info.py
$ cd
45
IOTA Ecosystem
46
IOTA MAM Example 0/1
Tutorial, quick guide, code, and app by Robert Lie of Mobilefish.com
$ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
$ tar zxvf bcm2835-1.60.tar.gz
$ cd bcm2835-1.60
$ ./configure
$ make
$ sudo make check
$ sudo make install
$ cd
$ git clone https://github.com/robertlie/dht11-raspi3.git
$ cd dht11-raspi3
$ npm install
$ nano mam_publish.js
$ nano mam_receive.js
$ nano mam_sensor.js
$ nano ./lib/mam.client.js
47
Contribution by Dhruvil Joshi, 2019 Fall
IOTA MAM Example 1/1
$ node mam_publish.js
$ node mam_receive.js YOUR_ROOT
nano sensor.js
nano mam_sensor.js
$ node sensor.js
$ node mam_sensor.js
$ node mam_receive.js YOUR_ROOT
48
Contribution by Dhruvil Joshi, 2019 Fall
RuuviTag
49
InterPlanetary File System (IPFS)
50
Contributions by Anwar Alruwaili and Kyra DiFrancesco, 2019 Spring
Blockchain-based IoT Standards
51
Lesson 10 Summary
52
IoT Course Summary
53
IoT Course Takeaways
54
| | Application | | |
Web App ThingSpeak, Google Sheet, Particle Cloud | App Server Django, Node.js | Database Server SQLite, MySQL | ||
Management | | Services | | Security |
Device Management NETCONF, YANG, Pyang, PlantUML, Docker, Netopeer2, Kubernates, Istio | Native Services Python (RPi.GPIO, spidev, os, subprocess, psutil) | Analysis Python (NumPy, SciPy, Scikit-learn, Matplotlib, Pandas, TensorFlow, Keras) | Web Services Python (smtplib, requests, json, Django, Flask, gspread) | Authentication WPA, SSH, VNC, Google 2-Step Verification Authorization MySQL Root User, Django Superuser, OAuth |
| Communication | | ||
Request and Respond Django REST | Publish and Subscribe Crossbar.io, Paho | Wireless Communications Wi-Fi, Socket, ZigBee, BT | ||
| | Device | | |
Sensors BMP, DHT, LDR, PIR, TMP, etc. | Actuators Relay, Motor Driver | Computing Devices Raspberry Pi, Arduino, Particle |
Contribution by Dler Hasan, 2017 Spring
Course Survey
55
Course Survey Result
56
Response | Weight | Grade |
Strongly Agree | 4 | A |
Agree | 3 | B |
Neutral | 2 | C |
Disagree | 1 | D |
Strongly Disagree | 0 | F |