3

What is the best way to encrypt and decrypt a variable in Solidity so only the msg.sender and contract can see that variable?

3

Practical answer: You can't. If the contract can see it when it executes, everyone who has the blockchain can see it.

Theoretical answer that won't help you: Homomorphic encryption. See Can smart contracts compute on encrypted data?

| improve this answer | |

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