Lets say I am building a contract where I want to store some important information on ethereum blockchain. The data should be hidden and people shouldn't have a way to see it.

As per my knowledge, every transaction on ethereum blockchain is open and every one can see the inputs of the transaction. Is this correct?

If I want to make a function payable and want to store a password in this function then would I be able to store the password in raw format? Lets assume I can't encrypt it before sending it to blockchain as my contract needs to do some calculation on top of it.

Given all these conditions, Is there a way I can achieve this on Ethereum blockchain?


No, there's isn't a way to store plain text data on the Ethereum blockchain without anybody knowing about it. The transaction data which includes the inputs to the method being called is open for the public to see.

Storing passwords on-chain like you require doesn't seem like a good application design. You might want to do that logic off-chain and use the smart contract as a means for verification with proofs.

  • 1
    Thanks! I have another question! I don't have problem in encrypting the data but my use case requires processing this data as new data comes. So, whenever there is a new transaction, I need a way to compare the data of the new transaction with the old data. If I will store the encrypted data on blockchain than I won't be able to process this data there. Is there a way I can have this use case on ETH blockchain? – Vivek Kumar Jan 11 '18 at 7:29
  • 1
    We can probably help you better if you can provide an example of what you mean when you say processing. Example of code would be great – Miguel Mota Jan 11 '18 at 7:33

Data is accessible to anyone in the network once you store it in Blockchain. Encryption is the only way to avoid anyone using such data.

  • Encryption is not an option for me as I need a way to compare the raw data included in the newer transaction with the raw data in the older transaction on the blockchain and at the same time keeping the anonymity. – Vivek Kumar Jan 11 '18 at 7:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.