[Ethereum] IPFS conditional access control through ethereum smart contracts

contract-developmentipfssolidity

This question is about combining IPFS with Ethereum smart contracts to check conditions and encryption to restrict access.

One-on-one file sharing with a known recipient is not an issue. The 'sender' would encrypt the file with the recipient pubkey, upload it to IPFS send the hash to the recipient. The recipient could then decrypt the file with his privkey.

My issue occurs when dealing with (multiple) unknown parties.
If we combine IPFS hashes with Ethereum we could for example transfer the IPFS hash to a recipient that wants to access it and decrypt it once certain conditions have been met eg. a payment has been made.
These recipients are thus not known beforehand, we can not encrypt the file with the pubkey of the recipient.

We can not simply store the decryption key on the ethereum blockchain, this key would be visible to anyone and thus people would be able to access the encrypted file on IPFS without eg. payment.

One solution is to save the decryption keys that belong to their assets on a seperate centralized datastore, making a single point of failure for our dApp yet again possible.

So I'm wondering if there are any solutions to solve this problem like safely storing the decryption keys on-chain.

Many thanks.

Best Answer

Have you checked out Shamir's Secret Sharing algorithm? You could use IPFS to share the secrets between all parties, and use each other's ethereum public keys to send encrypted communications to each other.

https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing

If you don't absolutely need to use the main ethereum chain, you could construct a private quorum blockchain between the parties https://www.jpmorgan.com/global/Quorum using secret contracts.

Related Topic