I know the topic has already been discussed but I did not find any satisfying answer. Do you know a way to put some private data in the blockchain and release / reveal it to a designated personn.

I know about zk proof but from my understanding its purpose is to prove something without revealing it. I want to hide data (a password) and revealing layer when a condition is met.

Thank you very much for your help

1 Answer 1


You can use a commit-reveal scheme. "A" sends to "B" some bytes using symmetric encryption. At some point A reveals to B the password to decrypt those bytes. Once decrypted, the new bytes turn out to be information again encrypted (this time with asymmetric encryption) with B's public key, so that only B with his private key can read it. The transmission of the password doesn't necessarily need to be made through the blockchain, though. It can simply be sent offline.

  • Thank you for the Quick answer. Here is what I want to do : I have an encrypted file outside blockchain. I want my smart contract to escrow the decryption key as trustlessly as possible. And release/reveal it to the beneficiary when a condition is met. With your solution how do I hide the password on thé blockchain and reveal it later Commented Nov 2, 2019 at 7:44
  • Exactly as I said. You can send any string of bytes you want with this method, it's just a bit more confusing because you'd be using a second password to encrypt the actual file's password. Commented Nov 2, 2019 at 9:06
  • I understand but the password to decrypt the bytes Can I stock it somehow hidden in the smart contract. And then reveal it when a condition is met. Commented Nov 2, 2019 at 9:41
  • You can't "hide" anything on the blockchain, not even marking the attribute as private. The only way is to store information encrypted with different mechanisms, like the one I mentioned. Commented Nov 2, 2019 at 10:59
  • Oh ok I see ! I'm going with this then, thank you ! Commented Nov 2, 2019 at 20:29

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.