* docs: update README and MockZamaFHEVMConfig removed * docs: update typescript sample templates * docs: gas added * docs: resolve webpack error structure * docs: readme upgrade and tests * docs: mini change * docs: review * docs: added immutable * docs: types removed Declaring encrypted state variables * docs: add asxxoperation * docs: added asXXoperation * docs: mini change * docs: apply suggestions from code review Co-authored-by: yuxizama <157474013+yuxizama@users.noreply.github.com> * docs: mini changes * docs: mini changes * docs: mini change * docs: mini change Co-authored-by: yuxizama <157474013+yuxizama@users.noreply.github.com> * Update README.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update README.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update README.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update README.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update docs/fundamentals/asXXoperation.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update docs/fundamentals/asXXoperation.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update docs/fundamentals/asXXoperation.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update docs/fundamentals/asXXoperation.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * Update docs/fundamentals/asXXoperation.md Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com> * docs: mini changes * docs: gitbook problems * docs: mini change * docs: change * docs: remove changes from tests * docs: mini update --------- Co-authored-by: yuxizama <157474013+yuxizama@users.noreply.github.com> Co-authored-by: jat <153528475+jatZama@users.noreply.github.com>
2.4 KiB
Supported types
This document introduces the encrypted integer types provided by the TFHE library in fhEVM and explains their usage, including casting, state variable declarations, and type-specific considerations.
Introduction
The TFHE library offers a robust type system with encrypted integer types, enabling secure computations on confidential data in smart contracts. These encrypted types are validated both at compile time and runtime to ensure correctness and security.
Key features of encrypted types
- Encrypted integers function similarly to Solidity’s native integer types, but they operate on Fully Homomorphic Encryption (FHE) ciphertexts.
- Arithmetic operations on
e(u)inttypes are unchecked, meaning they wrap around on overflow. This design choice ensures confidentiality by avoiding the leakage of information through error detection. - Future versions of the
TFHElibrary will support encrypted integers with overflow checking, but with the trade-off of exposing limited information about the operands.
{% hint style="info" %}
Encrypted integers with overflow checking will soon be available in the TFHE library. These will allow reversible arithmetic operations but may reveal some information about the input values.
{% endhint %}
Encrypted integers in fhEVM are represented as FHE ciphertexts, abstracted using ciphertext handles. These types, prefixed with e (for example, euint64) act as secure wrappers over the ciphertext handles.
List of encrypted types
The TFHE library currently supports the following encrypted types:
| Type | Supported |
|---|---|
ebool |
Yes |
euint4 |
Yes |
euint8 |
Yes |
euint16 |
Yes |
euint32 |
Yes |
euint64 |
Yes |
euint128 |
Yes |
euint256 |
Yes |
eaddress |
Yes |
ebytes64 |
Yes |
ebytes128 |
Yes |
ebytes256 |
Yes |
eint8 |
No, coming soon |
eint16 |
No, coming soon |
eint32 |
No, coming soon |
eint64 |
No, coming soon |
eint128 |
No, coming soon |
eint256 |
No, coming soon |
{% hint style="info" %}
Higher-precision integer types are available in the TFHE-rs library and can be added to fhEVM as needed.
{% endhint %}