I am trying to build a blockchain on ethereum but keeping the data related to blocks in some distributed file storage system like IPFS or Storj and storing the hash of data in blocks. But we need our data to be private / shared, so to achieve that we are thinking of using some Key Management Service like NuCypher KMS. But we will have smart contracts on ethereum which can access the data and perform some operations. My question is, is this the correct approach or is this even possible?

2 Answers 2


Your smart contract can not access the data due to the following issues:

1) The data is outside the blockchain and contracts can't access anything outside the blockchain

2) Even if your contracts could access the data, the data would be encrypted (per your specification). If the contract can decrypt the data, it means anyone can decrypt the data as the cipher key is then available in the transactions / inside the contract.

There are some ideas about public key cryptography and so on to store private data within the blockchain but even if they work, the usage costs (gas costs) would be quite substantial. There are several posts about it on this forum, for example: How to cryptographically challenge a public/private address key pair? . Some more general discussion can be found at Storing private data on the ethereum blockchain

There is ongoing research into this field (privacy within Ethereum), namely zk-Snarks. Here's some info: https://blog.ethereum.org/2016/01/15/privacy-on-the-blockchain/


In this way you can use Blockchain to validate data (see ERC-735 as an example) but you can’t access off-chain data using a smart contract. You design your smart contract so as not to need the original data for the operation. As long as you only need validation, this is the right use case.

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.