2
votes

Let`s say, we have a simple storage smart contract in solidity. Simple storage pattern

Can ethereum store an encrypted string, for instance, "hello world" into the storage? Can ethereum decipher this string "hello world" for specific list of allowed addresses?

1

1 Answers

1
votes

Ethereum can store whatever bytes you want, so you can certainly encrypt a string and store that. But everything on the blockchain is public, so there's no place to store a decryption key. Even if the decryption key is off-chain, if it's ever brought on-chain to do decryption there, then everyone can immediately see it.

So encryption is only relevant of decryption is done off-chain. For example, you could encrypt something with a recipient's public key, and off-chain, that recipient could use their private key to decrypt it.