0

I would like to understand the importance of encrypting sensitive data before sending them to an Ethereum smart contract and its significant benefit compared to the case where we don't encrypt them.

Case 1: no encryption For example, in a use case where we would like to register an academic degree on the Ethereum blockchain, data like student's Date of birth, Birth place, Parents names, etc. might be needed to register a certification.

  1. If these data are not encrypted, can anyone view them? For example, on Etherscan can someone see the exact date of birth, birth place, etc.??
  2. If so, do they see it as plain human-readable text?

Case 2: In the second case, lets say that we encrypt the aforementioned data, before sending them to the smart contract. Lets say that we utilize a javascript library to do so.

  1. Now if someone tries to see this transaction in Etherscan, what they are going to see?? For example, something like an arbitrary string that does not give insight on what it is about?

Thank you in advance, Nikolas.

1 Answer 1

2

All data on the blockchain is considered plain text and can be freely accessed by anyone. So if someone wants to read unencrypted data, it will be visible in plain text. Including date of birth and all other data. The data may be encoded in a bit weird way, but it can always be easily decoded by anyone who knows a bit what they are doing.

For example here's a random transaction I picked from Etherscan: https://etherscan.io/tx/0x9b12db4b430e1fff1843427d2a27b838de15587ef901a2ad485a299ae7f7ffc2 . The original input data is actually close to 0xa22cb4650000000000000000000000001e0049783f008a0085193e00003d00cd54003c710000000000000000000000000000000000000000000000000000000000000001, but Etherscan does a lot of the decoding for you and therefore it can even display the function name for you.

The blockchain doesn't understand about data encryption. It only stores the data it's given, so it has no idea when data is encrypted and when it's not.

If you encrypt data before it's sent to the blockchain, everyone will see the encrypted string. Most likely it will be unreadable for them, since they don't have the decryption key.

4
  • Thank you so much for your detailed answer :) In the tx that you mentioned, I can see this: MethodID: 0xa22cb465 [0]: 0000000000000000000000001e0049783f008a0085193e00003d00cd54003c71 [1]: 0000000000000000000000000000000000000000000000000000000000000001 And then if I click on Decode input data, I see for example that the second parameter is approved=true. Considering that I can see the value "true", this means that the one who sent the transaction did not encrypt the values, right?If the values were encrypted, even if I clicked Decrypt input data, I would see just an arbitrary string?
    – Nikolas
    Jul 20, 2022 at 12:15
  • You are mixing up encryption with encoding. Ethereum just decodes the data. It's not related to encryption/decryption. Jul 20, 2022 at 12:28
  • Maybe I need to reshape my question. If I send the date of birth and other data for a student as plain text, where I am supposed to see this data on Etherscan? Again on the input data field?
    – Nikolas
    Jul 20, 2022 at 13:34
  • Yes. All of the data is in the input data field. It's just all encoded as numbers - not encrypted (unless you've encrypted it before sending to the blockchain) Jul 20, 2022 at 17:45

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.