# On Blockchain-Based Cross-Service Communication and Resource Orchestration on Edge Clouds
## 4 Network Service Marketplace Operations
### Marketplace Functionality  
The User layer supports the interaction of both providers and users with the NSM and it provides the following functionalities,  
* **Registration**: In the Registration phase, a tenant of an EC registers to the marketplace. Also, some minimum information described in Section 4.2 is provided about the tenant's Network Slice for orchestration purposes. In the registration phase, a tenant can also register a service for leasing providing information about the service to be leased, quotas pricing, etc.
* **Advertisement**: After a service is registered for lease and committed to the datastore, it is automatically retrieved and advertised in a service catalogue for the rest marketplace users, in order to browse and select it for lease in an automated fashion.
* **Discovery**: In the discovery phase, the users of the marketplace can browse and select a service for lease according to their needs through the service catalogue.
* **Lease**: After service selection, users request the leasing of a service for a specific time period, which can be renewed. Upon request, the leasing is granted by the smart contract and then the appropriate establishment of cross-service communication is performed automatically, and the leased service is ready to be consumed.
* **Usage**: In the usage phase of a leased service, depending on the pricing model of the service, the usage of the service is monitored and stored in the data store for logging, while the user can track the usage of the leased service.
* **Billing**: Depending on the usage monitoring data of a leased service and the pricing model defined by the service provider, billing is calculated by a smart contract and the appropriate fee is sent to the consumer for a specific predefined time period. Also, the users can monitor their usage and expected fees at any moment.  
As an example, we present the workflow of the Register Lease function of the smart contract that corresponds to one the Lease functionalities of the user layer. This function grants a requested service lease, commits the Lease object in the data store as described in Section 4.2 and supports the CSC orchestration process. As depicted in Figure 2, when a user requests a lease, the client invokes the register function of the Smart Contract. All attributes of the Lease object are provided as input. Then, the Smart Contract checks if the requested Service for lease exists in the ledger. If the Service exists, then the Smart Contract checks the received service object from the ledger to validate that the service requested belongs to the grantor specified in the request. Lastly, the Smart Contract checks if the lease requested has already been granted and already exists in the ledger. If it does not exist, the lease is granted and committed to the ledger and the client is informed for the lease success. If any of the above validations fails, the smart contract returns to the client the appropriate error message. The above functionality corresponds to the Request Lease operation as depicted in Figure 3. More details about all developed smart contracts can be found here ([[https://gitlab.com/cpapad/bcpaper](https://gitlab.com/cpapad/bcpaper)]([https://gitlab.com/cpapad/bcpaper](https://gitlab.com/cpapad/bcpaper)) (accessed on 31 January 2021)).