Skip to main content
. 2022 Oct 26;22(21):8186. doi: 10.3390/s22218186
Algorithm 2 Registering a service with the service registry.
Require:
B:   Global state of the blockchain.
P:    Service registry smart contract caller.
Nsrv:   Name of the service. Must be unique among all services of the same device.
Idev: ID of the device that provides the service.
Iorg:    ID of the organization to which the device belongs.
Vsrv:    Version number of the service.
Dsrv:   A short summary of the service’s function and usage.
Tsrv: The date and time when the last update is made to the service information.
Ensure:
 Service 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: if  Idev GetContractCallerId (P) then
 5:  return error          ▹ Abort if caller impersonates another device
 6: end if
 7: if  Iorg GetContractCallerOrgId (P) then
 8:  return error         ▹ Abort if caller impersonates another organization
 9: end if
 10: if GetDevice (Iorg,Idev)= then
 11:  return error               ▹ Abort if device is not registered
 12: end if
 13:  Ssrv Serialize (Nsrv,Idev,Iorg,Vsrv,Dsrv,Tsrv)
 14:  B[Iorg,Idev,Nsrv]Ssrv
 15: return Ssrv