Encrypted Types
The encrypted values are expressed aseuint
on fhEVM, and the largest supported encrypted integer is up to 64 bits with euint64
. Larger encrypted integer types (128, 256) will be supported in the future. As of now, the available encrypted types include:
ebool
euint4
euint8
euint16
euint32
euint64
eaddress
ebytes256
Please bear in mind that "revert on overflow" is not supported because it would leak information on the encrypted value.
Cipher texts generated on the client side are converted into euint
types in the smart contract by casting with the TFHE.asEuint8
function. Here's an example:
The other casting functions include:
TFHE.asEuint4
TFHE.asEuint8
TFHE.asEuint16
TFHE.asEuint32
TFHE.asEuint64
TFHE.asEbytes256
TFHE.asEbool
TFHE.asEaddress
To generate a cipher text on the client side, please refer to this document:
Encryption & Re-encryptionPlease note that the number of bits of the cipher text should match the euint type. For example, the value generated by input.add64(10)
with fhevmjs can only be cast with TFHE.asEuint64
on the smart contract.
Last updated