When to use einput vs. euintXX?

Hello,

Is it always recommended to prefer einput over euintXX when passing encrypted values? If not, what are the trade-offs?

Best regards,
El-hacen

einput and euintXX are totally different things.

euintXX represents an encrypted integer. The key difference between an euintXX and a uintXX lies in the access control: euintXX is associated with an access control list (ACL) that defines which addresses are permitted to manipulate the data, using TFHE.allow or TFHE.allowTransient.

Additionally, there is an input validation mechanism. When a user sends an encrypted value, we must ensure that the value is neither copy-pasted nor derived from an existing value. To achieve this, we require the user to provide a zero-knowledge proof of encryption.

Since proving multiple ciphertexts can be time-consuming, instead of supplying multiple individual ciphertexts, the user provides a single ciphertext that proves all the inputs at once. The function call would proceed as follows:

function myFunction(einput param1, einput param2, bool isCool, einput param3, bytes inputProof)

To simplify, the user has pushed all inputs in the inputProof which is an encrypted array. einput are basically the index of the encrypted value. So, under the hood, einput are just uin256 containing the index of the data in the encrypted array inputProof. That’s why, to use einput, you’ll call TFHE.asEuint32(param1, inputProof)

Hope it clarifies!

1 Like