O'Reilly logo

Blockchain for Enterprise by Narayan Prusty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required