Skip to main content
. 2022 Oct 26;22(21):8186. doi: 10.3390/s22218186
Algorithm 3 Creating a service request using the service broker.
Require:
B:   Global state of the blockchain.
P:   Service broker smart contract caller.
Ireq:    UUID of the request.
Treq: Date and time when the request is created.
Nsrv:   Name of the requested service.
Idev:    ID of the device that provides the service.
Iorg: ID of the organization to which the device belongs.
Mreq:  Request method.
Areq:  Optional arguments of the request.
Ensure:
 Service request information is saved 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 GetService (Iorg,Idev,Nsrv)= then
 5:   return error          ▹ Abort if requested service is not registered
 6: end if
 7: if GetServiceRequest (Ireq) then
 8:     return error              ▹ Abort if service request already exists
 9: end if
 10: Sreq Serialize (Ireq,Treq,Nsrv,Idev,Iorg,Mreq,Areq)
 11: B[Ireq]Sreq
 12: NotifyEvent (Sreq)
 13: return Sreq