# SMS: A Secure Healthcare Model for Smart Cities
## 5 Role of MEC in the Proposed SMS
#### Blockchain in SMS  
The information exchange between the users, IoT devices, edge devices, and servers are governed by the blockchain mechanism. All the participating entities form a smart contract among each other on mutually agreed conditions (consensus). Blockchain is a digital distributed ledger that consists of a series of timestamped records that are immutable, secured, and linked using cryptographic techniques [41; 59; 60; 71]. Consensus algorithms are used to establish agreement between the nodes on a single state of the ledger across the distributed decentralized system. Proof of work is the most commonly used consensus algorithm that works on the idea that the miner nodes in the underlying network must provide proof of their effort. It is achieved by solving a cryptographic puzzle by the miner nodes. Other popular consensus algorithms include proof of stake, delegated proof of stake, byzantine fault tolerance, etc. The smart contract is an agreement in the form of a computer code that can be stored on a public database and cannot be manipulated. The entire system works on the if-then premise where the transactions are executed only when the conditions specified in the agreement are met, thus eliminating the need of an intermediary third party [71; 72; 73]. In the blockchain-based healthcare systems like the SMS, smart contracts are used to empower the patients to control their own data. Smart contracts can record and safely transfer data. The use of zero-knowledge proofs in healthcare data can allow for anonymous querying and aggregation of patient's medical data and, hence, ensure patients anonymity. Further, using the smart contract, the patient can control the access and usage of their data by establishing an agreement to revoke the access and remove the data once the purpose is fulfilled. Smart contracts can also be used to record the health insurance of patients, which eliminates the need to file lengthy insurance claims in the case of need. Moreover, the health records of patients can easily be accessed while moving from one hospital to another. It also allows efficiency in telemedicine. Broadly, the smart contracts apply to the following aspects of the healthcare system [69; 70; 71; 72; 73]:  
Figure 4: Creation of unique key in SMS. * Medical data safety
* Interoperability
* Loans and payments
* Health insurance
* Research and development
* Social Service/Philanthropic activities  
These smart contracts identify the role, access mechanism, data ownerships, and data exchange policies. As blockchain is a distributed ledger technology that is immutable, there are no chances of data compromises or other tampering issues, as all the entities of the SMS system will be able to uniquely identify the legitimacy of each other. Figure 5 shows the formation of smart contracts between the participating entities of the SMS. There are several types of consensus algorithms that are widely used in blockchain technology. These include \"Proof of Work (PoW),\" \"Proof of Stake (PoS),\" \"Delegated Proof of Stake (DPoS),\" \"Proof of Burns (PoB),\" \"Proof of Capacity (PoC),\" \"Proof of Elapsed Time,\" \"Practical Byzantine Fault tolerance,\" etc. [71; 72; 73]. All these consensus algorithms can be used in different scenarios and for different purposes within a healthcare system. The different participating entities of the SMS can use the combination of these consensus algorithms to provide granular access control, transparency, and security. In the proposed SMS, critical cases that require real-time 24/7 monitoring of the patient's physiological parameters can leverage the potentials of edge computing to provide instant diagnosis and alert the care providers of the current situation of the patients. Furthermore, on the basis of extensive real-time data analysis and historical data available in the cloud, models can be developed that can provide predictive healthcare facilities.