I have a contract that includes post(string memory title, data content) that will store the data to IPFS, returns an IPFS hash and a postId. postId and hash will be linked by a mapping. reveal(uint256 postId) that is payable and returns the hash associated to the postId.

My question is: can you keep the postId to hash mapping private so that it is known only by addresses that used the reveal() function? I think this is not possible using ethereum only so then what tools do I need to use?

And it is probably not a good idea to send the data of the posts via the eth blockchain (it can be text, images, videos...) How do I send it to IPFS without going through ethereum but somehow record that this specific data has been uploaded?

1 Answer 1


A few important considerations here that may answer your doubts:

  1. ANYTHING that you store in Ethereum is accessible by EVERYONE. This means that even you declare a private variable, this can be easily accessed by using command web3.eth.getStorageAt() from the web3.js library. Therefore, if you want to protect your data, either hash it before storing on the blockchain or store it off-chain (outside the blockchain).

  2. Ethereum is NOT intended to store media files (images, videos), since the cost would be just insane. You can store references that can point out to an external storage, such as an IPFS.

  3. A smart contract can't trigger a data transfer to an external source. If you want to retrieve data from a smart contract, you need to call a function from this contract externally, but the contract can't send data by itself.

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.