Grant and revoke the permission to read the data that stored in smart contract

yinchienyinchien Member Posts: 1
Is it possible to grant and revoke the permission to read the data that I stored in Smart Contract?

I want to store private data on blockchain and others only can read it if I give them the access. And after I can revoke the access.

Anyone knows how to achieve this?

Answers

  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,253 mod
    edited March 12
    @yinchien Granting and revoking data viewing can only be a superficial thing until homomorphic encryption like zk-Snarks is implemented on Ethereum. Data sent to a block chain is necessarily publicly readable in order to be verified by the clients. Likewise for any state variable.

    Furthermore, the blockchain is not where you want to store data anyway as it is intentionally expensive. What could be done is to store a hash of the data (perhaps hashed with the users address also) in state and use that as part of the decryption for off-chain files in Swarm or IPFS.
Sign In or Register to comment.