# Blockchain-Enabled NextGen Service Architecture for Mobile Internet Offload
## 3 Blockchain-Based Subscriber Offloading Framework
The smart contract module allows the WP to create a new smart contract and set its variables based on the subscriber authentication mechanism. Once the subscriber is allowed to offload and subsequently terminates their connection, the billing module records the data usage and writes this as a new transaction to the blockchain. Figure 2 details the various phases of the offloading framework. Figure 1: System Architecture. **Phase 1: One-time Registration. ** The registration process for a new entity, such as an MNO or WP, wishing to join the system commences with their trusted third party (TTP) issuing a public-key certificate to the BK. The BK, which maintains its own blockchain node, stores the certificate as a transaction on the blockchain. All the communication amongst the entities in the system is carried out using public-key cryptography, and backed by transparent logs to ensure auditing at a later stage [22]. MNOs and WPs join the blockchain network by creating their corresponding blockchain nodes. **Phase 2: Offloading Initiation and Local Authentication. ** In phase 2, an offloading request is initiated by the NEMO app on the user's mobile device. The mobile app automatically senses the presence of WPs that are registered with the BK and requests an offload onto their network. The app connects with the wireless access point and accesses the landing page of the WP. The landing page can be common for internal and external users. By supplying the IMSI and HNI of the subscriber, in the form _imsi@hni_, in both the _username_ and _password_ fields, the app signals that the user is external to the WP and wishes to initiate an offloading procedure. The WP generates a random one-time password (\(OTP_{WP}\)) and sends it to the mobile number entered into the landing page by the app. The mobile app then enters the received \(OTP_{WP}\) into the next field of the landing page. Once the WP tests the validity of the mobile number, it generates a new smart contract for this transaction and sets the value of the parameter \(Auth_{WP}\) to 1. The WP then encrypts the mobile number of the user with the public key (\(PK_{MNO}\)) of the MNO, which it obtains from the blockchain, and assigns this encrypted value to the smart contract. The WP also includes the MNO identifier in the smart contract, so that all other entities know for whom the smart contract is intended. **Phase 3: MNO Level Authentication and Smart Contract Execution. ** In phase 3, open smart contracts stored on the blockchain are searched by the MNO. Once it finds the intended contract by matching the MNO identifier to itself, it will fetch the encrypted identity of the subscriber and decrypt it using its private key (\(SK_{MNO}\)). The decrypted data reveals the mobile number of the subscriber. The MNO tries to verify the identity of the user against its subscriber database, and if successful, sets the value of \(Auth_{MNO}\) to 1 in the  
Figure 2: Sequence Diagram Illustrating the Various Phases. sart contract. The MNO also generates a random one-time password (\(OTP_{MNO}\)), and sets the value of \(OTPCheck_{MNO}\) to \(OTP_{MNO}\) in the smart contract. The value \(OTP_{MNO}\) is also forwarded to the subscriber's MN for further processing. Once the MN receives \(OTP_{MNO}\), the mobile app enters it into the next field on the landing page of the WP. The WP in turn assigns the \(OTP_{MNO}\) value to the \(OTPCheck_{WP}\) field of the smart contract. Now, if the values of \(Auth_{WP}\) and \(Auth_{MNO}\) are both equal to 1, the blockchain deduces that both the WP and MNO have validated the subscriber's identity. If the \(OTPCheck_{MNO}\) and \(OTPCheck_{WP}\) are the same, it means that the subscriber is authorized to offload, and the smart contract has been executed on the blockchain. The smart contract can also include other information, such as the total time allowed to offload, or any other conditions with the associated offload which need to be honoured by all the parties.