This repository contains codes for simulating an Infrastructure-less Emergency Communication System
based on Blockchain framework.
This project is developed using Pyhton
. The requirements to run this project is included in the requirements.txt
file in the repository.
Run this command in your shell to install the required libraries.
demo1.mp4
demo2.mp4
Person {
// Initial data stored for every person
DLT = ∅
Position = (x,y)
Info = UniqeID
}
Initialize(Graph G) {
// Start
For each Device D ∈ G.People {
Create-UniqeID(D)
Create-DLT(D)
Start-WiFiScan(G, D)
}
}
Start-WiFiScan(Graph G, Person P) {
// Searching for other devices
Start-Timer
Start-Scanning
if FIND-PEOPLE-NEARBY(G) :
SEND-REQUEST
UPDATE-DLT(G)
else:
if TIME-LIMIT-EXCEEDED:
END
else:
Start-Scanning // Again
Endif
Endif
}
UPDATE-DLT(Graph G) {
// Update and merge of digital ledgers
MAX-DISTANCE = 100 ft
DLT = ∅
For each Device D ∈ G.People {
MAKE-DISJOINT-CLUSTER-SET(D)
}
For each path (u, v) ∈ G.Paths ordered by increasing order by DISTANCE(u, v) {
if FIND-CLUSTER-SET(u) ≠ FIND-CLUSTER-SET(v): // Checking if they are already from the same cluster or not in order to avoid cycles
if DISTANCE(u, v) < MAX-DISTANCE: // Checking if they can be merged or not based on the maximum distance
DLT = DLT ∪ {(u, v)} // Merge
UNION(u, v)
Endif
Endif
}
return DLT
}
Ramtin Ehsani 📖 💻 |
---|