# Leveraging Blockchain Technology for Secure 5G Offloading Processes +
## 3 Blockchain-Based Secure 5G Offloading Mechanism
### Blockchain for a Secure Marketplace
#### 3.1.1 Architecture and Components  
The marketplace is the place where operators can engage in the exchange of services in offloading processes to keep their quality of service for their customers. The idea is to provide a secure tool for an operator to register their current network state and available services as well as to search for other operators available services and resources if required. In this way, a market of operators resources and services is created. This market requires security and transparency, features which are provided by design by the backbone Blockchain technology.  
Figure 3 highlights the high-level architecture of all the elements involved in the marketplace operation in orange. The central component of the marketplace is the Marketplace Smart Contract deployed on the Hyperledger Fabric network, which provides all the logic for the operator to register or update their resources (Operator endpoints) and services (Services endpoints) information; or to search for other required resources or services from other registered operators (Consumption endpoints).  
The interaction of the operators with the marketplace will be double. On the one side, all the communications initiated from the operators require the use of a wallet where the cryptographic material required for the Blockchain transactions signing process is securely kept. On the other side, the communications from the marketplace happen through  
Figure 3: Marketplace architecture.  
Blockchain events [99] that are received in the events listener component required in each operator. This event listener should be subscribed to the reception of all the events from the marketplace smart contract as it will notify the selected operators for offloading processes.  
In addition, the possibility of using external services has also been considered. Some examples of potential useful external services for the marketplace could be included but are not limited to the following: (i) intelligent supply and demand-optimized pricing techniques [100]; (ii) payment processing techniques; (iii) review and feedback management; or (iv) digital agreements creation and signature. These external services are accessible through oracles [101], which provide a bridge between smart contracts deployed on a Blockchain network and external services. Since smart contracts on a Blockchain are inherently limited to the data available within the Blockchain itself, oracles are used to fetch and verify external data, making the smart contracts much more versatile and useful.  
Figure 4 shows the architecture of the oracles that could be considered for external services. The oracles have an internal Blockchain events listener subscribed to Blockchain Events emitted by marketplace. The oracle analyses the received event, extracts the required information and sends it to its workflow engine where the specific logic is implemented according to the external service needs. For example, a typical case is the oracle building an HTTP(S) request to a external service API to retrieve the external data needed by marketplace. The workflow engine will process the retrieved data as needed and it is sent to the wallet where a Blockchain transaction to the marketplace is generated and signed, providing the updated information from the external service. The Blockchain transaction will update the information in the marketplace related the external service data.  
This event-driven implementation of the oracle allows to decouple the oracle logic from the marketplace implementation. For example, if the APIs of external services change or are implemented in a different way, only the oracle logic needs to be modified, without affecting the marketplace implementation. In addition, if the oracles are not available for any reason, the marketplace operation is not interrupted and automatically resumes when the oracle becomes available again.