This repo represents a prototype built for our Master Thesis. The prototype represents one transaction "unlock a car" wthin the use case "keyless vehicle access control". In this way, it simulates the unlocking of a car by having a Raspberry Pi representing the server of the car, an RFID sensor as the car lock, and the RFID tag as the keyless option to open the door. The transaction is verified in the blockchain network of Hyperledger Fabric. Overall, our focus in this prototype has been to explore the interaction between an IoT device (RFID with RPi) and the blockchain network (Hyperledger Fabric).
The basic setup is as followed:
- Raspberry Pi 3 Model B+
- RFID reader/sensor (RC522) and RFID tag (Milfare1 S50 non-standard)
- Messaging Protocol MQTT used to send the data in a JSON payload to the blockchain network
- Libraries: Paho MQTT, SimpleMRFC522 and Mosquitto
- Written in Python
- Using VMWare (Ubuntu) that represents one blockchain node locally
- Blockchain network based on First Network sample by Hyperledger Fabric
- Blockchain application based on Fabcar sample by Hyperledger Fabric
- Written in Node.js
- "User" data is sent from the Raspberry Pi to the VM blockchain node when opening the car (holding the RFID tag against the reader)
- Transaction is submitted and verified in the blockchain checking whether the user ID matches with the one stored in the ledger
- End-result: having a submitted transaction and a newly created block
See an entire deployment demo in this video here as well as more about the whole development enviorment and step-by-step guide to deploy in our Master Thesis
For a first getting started and overview of the relevant programs in the directories:
- Run in VM the shell script
./startFabric.sh javascript
stored infabcar
folder in order to start the first-network creating two organizations and a channel as well as to deploy the smart contractfabcar
stored inchaincode
>fabcar
>lib
. - Run the node.js
node enrollAdmin.js
andnode registerUser.js
in the folderfabcar
>javascript
in order to register the two users admin and user1 - Run the node.js
node invoke.js
in the same folder as before - Run on RPi the Python file
read_publis.py
in therfid
folder in order to publish a topic to the network
Here the directory structure:
├───fabric-samples
│ ├───balance-transfer
│ │ ├─── ...
│ ├───basic-network
│ │ ├─── ...
│ ├───bin
│ ├───chaincode
│ │ ├─── ...
│ │ ├───fabcar
│ │ │ ├─── ...
│ │ │ ├───javascript
│ │ │ │ └───lib
│ │ │ ├─── ...
│ │ ├─── ...
│ ├───chaincode-docker-devmode
│ │ └─── ...
│ ├───ci
│ ├───commercial-paper
│ │ ├─── ...
│ ├───docs
│ ├───fabcar
│ │ ├─── ...
│ │ ├───javascript
│ │ │ └───Fetched_Blocks
│ │ ├─── ...
│ ├───first-network
│ │ ├───base
│ │ ├───channel-artifacts
│ │ ├───org3-artifacts
│ │ └───scripts
│ ├───high-throughput
│ │ ├─── ...
│ ├───interest_rate_swaps
│ │ ├─── ...
│ ├───off_chain_data
│ └───scripts
│ ├───ci_scripts
│ └───Jenkins_Scripts
└───rfid
├───Example
├───SPI-Py
├───src
'''