Is it possible to store an encrypted message in the blockchain that reveals itself only when a particular condition is met?

I think that the conditional disclosure can be done with Smart Contracts, but I don’t know if it would be securely encrypted until the condition to disclosure is met.

2 Answers 2


Yes, but with some very strict limitations.

  1. You can store encrypted data in the block chain. This is expensive, hard, and strongly discouraged, but it is possible to place the encrypted data in nulldata (OP_RETURN) transactions. Each standard OP_RETURN output is limited to an 80 byte payload, so you'll probably need to use multiple outputs which will require multiple transactions unless you have the help of a miner.

  2. A later transaction can publicly disclose the key to the encrypted data. You can use a smart contract (specifically a hashlock) to pay someone to release the key. A clever use of cryptography may be able to restrict them from releasing the keys except under certain circumstances; for example Peter Todd's timelocks can restrict the public release of the key by number of CPU hours spent generating the decryption key.

The essential piece of information here is that you can't make the key release mechanism part of a smart contract because the key would need to be public. At best you can only use a smart contract to incentivize someone who already has a key (or the ability to regenerate a key) to publicly release that key when the incentives are worth it.

With that said, it's probably much better in most cases to put your encrypted data in a torrent file rather than the block chain, and at most use a Bitcoin hashlock to incentivize anyone with the decryption key to release it. (It'd be nice if you also made the hashlock an anyone-can-spend after an expiration time so that it wouldn't bloat the UTXO set forever if the decryption key was permanently lost.)


No, you can't.

There is no secret information anywhere in a blockchain. It is exactly the log of all information the public has to verify correctness of the system.

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.