Skip to main content
. 2022 Oct 26;22(21):8186. doi: 10.3390/s22218186
Algorithm 1 Registering a device with the service registry.
Require:
B:   Global state of the blockchain.
P:   Service registry smart contract caller.
Cdev:   Device’s digital identity. Must be unique within an organization.
Iorg: ID of the organization to which the device belongs.
Ndev:  Nickname of the device.
Ddev:   A short summary of the device’s function and usage.
Tdev: The date and time when the last update is made to the device information.
Ensure:
 Device information is saved or updated in the blockchain.
 1: if  WRITE GetCallerPermissions (P) then
 2:  return error      ▹ Abort if caller is not allowed to update the blockchain
 3: end if
 4: Idev GenerateDeviceId (Cdev)  ▹ Generate device ID from its digital identity
 5: if  Idev GetContractCallerId (P) then
 6:  return error           ▹ Abort if caller impersonates another device
 7: end if
 8: if  Iorg GetContractCallerOrgId (P) then
 9: return error        ▹ Abort if caller impersonates another organization
 10: end if
 11:  Sdev Serialize (Idev,Iorg,Ndev,Ddev,Tdev)
 12:  B[Iorg,Idev]Sdev
 13: return  Sdev