IoT Temperature Monitoring System

Powered by QBFT Blockchain Technology (ERM Units)

System Overview

This project implements a decentralized IoT temperature monitoring system using QBFT (Quorum Byzantine Fault Tolerant) blockchain technology. Two ERM devices communicate through a blockchain network to ensure immutable, tamper-proof data storage.

Decentralized Storage

QBFT consensus ensures data integrity across 5 validator nodes

Immutable Records

Temperature data stored permanently on blockchain

Real-time Communication

Instant data transmission between IoT devices

Alert System

Automatic notifications for temperature thresholds

Key Components

  • ERM-1: Simulates and sends temperature data (Sender)
  • ERM-2: Receives and displays temperature data (Receiver)
  • Blockchain Network: 5-node QBFT network for consensus
  • Backend Server: Node.js API bridge between devices and blockchain

System Requirements

Verified Environment: This system has been tested on Ubuntu 22.04.3 LTS with WSL2

Minimum Hardware Requirements

Component Requirement
CPU 2 cores or more
RAM 4GB minimum, 8GB recommended
Storage 10GB free space
ERM Boards 2x ERM

Software Prerequisites

1. Node.js & npm

Bash
# Install Node.js v22.x
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

# Verify installation
node --version  # Should output: v22.21.0 or later
npm --version   # Should output: 10.9.4 or later

2. GoQuorum

Bash
# Download GoQuorum v24.4.1
cd ~
# File available on GitHub repository

# Extract
tar -xvf geth_v24.4.1_linux_amd64.tar.gz

# Install globally
sudo mv geth /usr/local/bin/
sudo mv bootnode /usr/local/bin/

# Verify installation
geth version

Architecture

System Data Flow

ERM-1

Temperature Sender

Backend API

Node.js Server

QBFT Network

5 Validator Nodes

ERM-2

Temperature Receiver

Data Flow Process

  1. Temperature Generation: ERM-1 simulates temperature (20-30°C)
  2. HTTP POST: ERM-1 sends JSON payload to backend API
  3. Blockchain Transaction: Backend creates signed transaction
  4. QBFT Consensus: 5 validator nodes reach consensus
  5. Block Creation: Transaction included in new block (5s intervals)
  6. Data Retrieval: ERM-2 queries backend via HTTP GET
  7. Display: Temperature displayed on ERM-2 with alerts

Installation Guide

Phase 1: Project Files Setup

Bash
git clone https://github.com/Arasulingam/QBFT-Quorum.git
cd QBFT-Network

# Verify directory structure
ls -la QBFT-Network/

Phase 2: Backend Dependencies

Bash
# Navigate to backend directory
cd ~/QBFT-Network/server/iot-blockchain-backend

# Install Node.js dependencies
npm install

# Verify installation
npm list --depth=0
Expected Packages:
body-parser@1.20.2, cors@2.8.5, dotenv@16.0.3, express@4.18.2, web3@1.10.0

Network Configuration

Parameter Value
Chain ID 1337
Consensus QBFT (Byzantine Fault Tolerant)
Block Period 5 seconds
Validators 5 nodes
Gas Price 0 (free transactions)

Running the System

Important: You need 5 separate terminal windows to run all blockchain nodes.

Step 1: Start QBFT Blockchain Network

Terminal 1 - Node 0 (RPC: 22000)

Bash - Node 0
cd /home/arasu/QBFT-Network/QBFT-Network/Node-0
export ADDRESS=$(grep -o '"address": *"[^"]*"' ./data/keystore/accountKeystore | grep -o '"[^"]*"$' | sed 's/"//g')
export PRIVATE_CONFIG=ignore

geth --datadir data \
    --networkid 1337 --nodiscover --verbosity 5 \
    --syncmode full \
    --istanbul.blockperiod 5 --mine --miner.threads 1 --miner.gasprice 0 --emitcheckpoints \
    --http --http.addr 127.0.0.1 --http.port 22000 --http.corsdomain "*" --http.vhosts "*" \
    --ws --ws.addr 127.0.0.1 --ws.port 32000 --ws.origins "*" \
    --http.api admin,eth,debug,miner,net,txpool,personal,web3,istanbul \
    --ws.api admin,eth,debug,miner,net,txpool,personal,web3,istanbul \
    --unlock ${ADDRESS} --allow-insecure-unlock --password ./data/keystore/accountPassword \
    --port 30300

Continue starting Nodes 1 through 4 in separate terminals using their respective ports (22001-22004)...

Step 2: Start Backend Server

Bash - Terminal 6
cd /home/arasu/QBFT-Network/server/iot-blockchain-backend
node server.js
Expected Output:
🚀 Server running on port 3000
📡 Connected to blockchain: http://127.0.0.1:22000

ERM Configuration

ERM-1 (Sender Unit) - Key Configuration

C++ (Arduino)

// Device configuration
const char* deviceId = "ERM-1-SENDER";
const char* serverUrl = "http://192.168.1.9:3000/api/temperature"; 
const char* devicePrivateKey = "0x87123236c30996f3116601ed979e7b4f526e0f7c738e6c8a1ef843602059e05d"; 

// ... inside setup/loop ...
Serial.println("ERM-1 Temperature Sender Active");

ERM-2 (Receiver Unit) - Key Configuration

C++ (Arduino)

// Device configuration
const char* deviceId = "ERM-2-RECEIVER";
const char* senderDeviceAddress = "0x5c303cef53e62c9ea820bacfc67066362c1daed7"; 

// ... inside setup/loop ...
Serial.println("ERM-2 Temperature Receiver Active");

API Reference

Base URL: http://localhost:3000

Sample Registration for ERM-1

POST /api/register-device
{
  "deviceAddress": "0x5c303cef53e62c9ea820bacfc67066362c1daed7",
  "deviceId": "ERM-1",
  "location": "Main-Lab"
}

IoT Monitoring System (ERM-1 & ERM-2 Units)
Built with ❤️ using Node.js and GoQuorum