0

This question already has an answer here:

When I set an attribute to private it's not accessible from outside, but everyone who runs a node can still see it.

Someone told me to use encryption to hide attribute values, but how should this work, would not everyone also see than the key I used to encrypt my data? Is there a default way to handle this in Solidity?

marked as duplicate by Ismael, Richard Horrocks, Roman Frolov, Harry Wright, Nicolas Massart Jan 13 '18 at 15:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The solution there is also to encrypt the data. But how to do it? If I do it from outside the blockchain I need to store the keys by myself, what would destroy the intention of the blockchain, because I could lose the key or it get stolen. If I store it in the blockchain you have the problem I mentioned above. How to do it, is there a way in Solidity? – user23858 Jan 7 '18 at 19:25
  • Also related (basically the same): ethereum.stackexchange.com/questions/1286/… – Richard Horrocks Jan 7 '18 at 19:45
  • @user7014175 AFAIK the easy solution is not to store private data in a contract. You can use an oracle to process private data outside your contract. A possible alternative is to use zksnarks but it is very recent and the libraries are developing. – Ismael Jan 7 '18 at 19:54