Research Article
Convergence of Blockchain and IoT for Secure Transportation Systems in Smart Cities
Algorithm 1
Pseudocode for IoT device state transaction.
| Ensure: Initialize var deviceRegistry | | Ensure: Initialize var deviceID | | Ensure: Initialize var t-list | | Ensure: Initialize var station = getstation () | | if tx.newstate = True then | | deviceID.state = tx.newstate | | if tx.enables ! = null then | | deviceID.enabled = tx.enabled }\newline | | dev-station = station }\newline | | t-list = deviceID }\newline | | elseif tx.newstate = False | | event.msg (“State of IoT dvice having ID “+ deviceID +” has not changed”) | | end if | | end if | | return asset.update (deviceID) | | return event.msg (“State of IoT dvice having ID “+ deviceID +” has been changed.”) = 0 |
|