Algorithm 4 Responding to a service request using the service broker. |
Require: |
B: Global state of the blockchain. |
P: Service broker smart contract caller. |
: UUID of the request to which the response answers. |
: Date and time when the response is created. |
: The request processing status. |
: Optional value to be returned to the service request sender. |
Ensure: |
Service request information is saved in the blockchain. |
1: if
GetCallerPermissions
then
|
2: return error ▹ Abort if caller is not allowed to update the blockchain |
3: end if
|
4: if
GetService
then
|
5: return error ▹ Abort if requested service is not registered |
6: end if
|
7:
GetServiceRequest
|
8: if
then
|
9: return error ▹ Abort if service request does not exist |
10: end if
|
11: if
GetDeviceId
GetContractCallerId
then
|
12: return error ▹ Abort if caller impersonates another device |
13: end if
|
14: if
GetOrganizationId
GetContractCallerOrgId
then
|
15: return error ▹ Abort if caller impersonates another organization |
16: end if
|
17:
Serialize
|
18:
|
19: NotifyEvent
|
20: return
|