Algorithm 2 Registering a service with the service registry. |
Require: |
B: Global state of the blockchain. |
P: Service registry smart contract caller. |
: Name of the service. Must be unique among all services of the same device. |
: ID of the device that provides the service. |
: ID of the organization to which the device belongs. |
: Version number of the service. |
: A short summary of the service’s function and usage. |
: 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
GetCallerPermissions
then
|
2: return error ▹ Abort if caller is not allowed to update the blockchain |
3: end if
|
4: if
GetContractCallerId
then
|
5: return error ▹ Abort if caller impersonates another device |
6: end if
|
7: if
GetContractCallerOrgId
then
|
8: return error ▹ Abort if caller impersonates another organization |
9: end if
|
10: if
GetDevice
then
|
11: return error ▹ Abort if device is not registered |
12: end if
|
13:
Serialize
|
14:
|
15: return
|