I am currently using the structure and mapping to store the user data in the blockchain. In the mapping I am using user's address (msg.sender) for mapping it with structure so every user can only access his/her data on the base of ethereum account.

struct User{

    byte32 fname;
    byte32 lname;
    byte32 email;

mapping(address => User) UserData;

I read about the function name


that can return the data at the particular storage point,I want to know what level of data security i could achieve as i am also making the dapp.

1 Answer 1


You have to proceed on the basis that everything on the blockchain is revealed to anyone interested.

As well as this function, contracts can explore storage with assembler.

The important thing to keep in mind is that the platform is optimized for transparency. Miners and nodes verify transactions using knowledge of the state. Until such time as zero-knowledge proofs are baked into the protocol at a deep level, you should not expect that any data in any contract is confidential.

Hope it helps.

  • Thanks, @rob for the answer. I understand that due to transparency in blockchain data is visible. What would be the best practice to use the decentralized system and store the private data? Or we are still dependent on centralized systems for the security of data.
    – Uahmed
    Jan 29, 2019 at 15:07
  • 1
    It's a big topic. You're not limited to storing confidential information in centralized systems (could be IPFS, swarm, others) but you will want to store only obfuscated secrets on-chain. Have a look over here for a description of a common approach and an experimental approach: medium.com/@robhitchens/… Jan 29, 2019 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.