How private are private variables?

Guys this time I wanted to ask about privacy of data in the IC…

In Solidity even private variables are not really private because you can still read them as part of transactions on the blockchain. Right?

What about IC? What is the approach to protect private data? Let’s say in Rust (if different)

4 Likes

Hey guys, anyone who knows by any chance?

Did you search for previous discussions?

Unfortunately not very insightful… What I am asking can be divided in 2 parts:

  1. when variables are set to private are the data private when produced by internal functions?

let’s say you set:
private stable myVar = 0;

and a private function not in candid then is called and sets myVar = 5;

can anyone see the myVar has become 5? and what if i return it as a result of a query call? is it still kept private for everyone except for the user that got it as a result of the query call of course?

  1. is the data sent on an update call private? so if my functions is myFun(string) and string is something i send with my JS client… is string possible to unveil?

I believe in those topics it sais the latter is not private… the data I send from client can be unveiled. correct?


However if the first is at least correct i can make a fucntion that generates a kind of private key so i can give back to the user so the user can send me encrypted data that i can decrypt and save safely… so the encrypted data would be discoverable as part of the update request but at least it wouldn’t be “naked”…

Up to the caveats in the other posts about possibly malicious node providers: No

No, again up to possibly bad intentions by someone who has access to nodes or (in this case) boundary nodes.

is the data sent on an update call private? so if my functions is myFun(string) and string is something i send with my JS client… is string possible to unveil?

Same as above: Boundary nodes providers can likely peek at the transferred data.

Using cryptography within the canister can protect you from a possible attacker on the boundary node, but someone with access to the subnet state can exfiltrate your private key from the canister’s state.

1 Like

Thank you. That has been very helpful.

1 Like