Smart contracts for identity and access control

Let's write the smart contracts that will be responsible for registering the identity of patients and service providers, and for providing access control.

Here is the smart contract code:

pragma solidity ^0.4.22;contract Health {    address owner;    struct ServiceProvider {        string publicKey;    }    struct Permission {        bool read;        bool write;        string reEncKey; //Re-Encrypt Key    }    struct Token {        int status;        bool read;        bool write;        string reEncKey; //Re-Encrypt Key    }    struct EMR {        string hash;        address issuer;    }    struct Patient {        string publicKey;        mapping (address => Permission) permissions;        mapping (bytes32 => Token) tokens;        bool closed;        EMR[] EMRs;    }    mapping (address => ServiceProvider) serviceProviders; mapping ...

Get Blockchain for Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.