|
1 | | -# fhevm-react-template |
2 | | - |
3 | | -This is an example dApp made with React.js to let users do transfers of a `ConfidentialERC20` token on fhEVM. It contains also a button to request the decryption of an encrypted secret value. |
| 1 | +# fhEVM dApp examples |
4 | 2 |
|
| 3 | +This repository contains example dApps built using fhEVM (Fully Homomorphic EVM). Each example demonstrates different aspects of building privacy-preserving smart contracts using FHE operations. |
5 | 4 |
|
6 | 5 | ## Examples featured |
7 | 6 |
|
8 | 7 | ### Confidential Counter |
| 8 | +The Confidential Counter examples demonstrate progressively more complex uses of FHE operations through four samples: |
9 | 9 |
|
10 | | -The Confidential Counter examples demonstrate progressively more complex uses of FHE operations: |
11 | | - |
12 | | -1. **Basic Counter (Sample 1)** |
13 | | - - Simple encrypted counter using `euint8` type |
14 | | - - Basic increment operation using FHE addition |
15 | | - - Demonstrates minimal FHE setup and operations |
16 | | - |
17 | | -2. **Input Counter (Sample 2)** |
18 | | - - Accepts encrypted input values to increment by |
19 | | - - Shows how to handle encrypted inputs with proofs |
20 | | - - Demonstrates converting between encrypted types |
21 | | - |
22 | | -3. **Decryptable Counter (Sample 3)** |
23 | | - - Adds decryption capability via Gateway integration |
24 | | - - Shows how to request and handle decryption callbacks |
25 | | - - Maintains both encrypted and decrypted state |
26 | | - |
27 | | -4. **Multi-User Counter (Sample 4)** |
28 | | - - Individual encrypted counters per user address |
29 | | - - Demonstrates access control with FHE |
30 | | - - Shows re-encryption for specific users |
31 | | - - Uses mapping for multiple encrypted values |
| 10 | +1. **Basic Counter**: Simple encrypted counter with basic increment operations |
| 11 | +2. **Input Counter**: Handles encrypted inputs with proofs and type conversions |
| 12 | +3. **Decryptable Counter**: Adds decryption capabilities and state management |
| 13 | +4. **Multi-User Counter**: Supports per-user encrypted counters with access control |
32 | 14 |
|
33 | | -Each sample builds on the previous one to showcase different FHE capabilities while maintaining security and privacy of the counter values. |
| 15 | +Each sample builds on the previous one to showcase different FHE capabilities. |
34 | 16 |
|
35 | 17 | ### GuessRandomNumberGame |
36 | 18 |
|
@@ -117,34 +99,13 @@ The system leverages FHE operations to enable privacy-preserving identity and cr |
117 | 99 | ### MyConfidentialERC20.sol |
118 | 100 |
|
119 | 101 | **How it works** |
| 102 | +1. **Confidential Token**: A privacy-preserving ERC20 token using FHE with encrypted balances, transfers and approvals. |
120 | 103 |
|
121 | | -1. **Confidential Token**: A privacy-preserving ERC20 token implementation using Fully Homomorphic Encryption (FHE): |
122 | | - - Balances and allowances are stored as encrypted values |
123 | | - - Transfers and approvals operate on encrypted data |
124 | | - - Inherits from ConfidentialERC20Mintable for basic token functionality |
125 | | - |
126 | | -2. **Key Features**: |
127 | | - - Encrypted balances using euint64 type |
128 | | - - Standard ERC20 functions (transfer, approve, etc.) with FHE |
129 | | - - Minting capability restricted to owner |
130 | | - - Built-in decryption request/callback mechanism |
131 | | - |
132 | | -3. **Secret Value Demo**: |
133 | | - - Contains an encrypted SECRET value (set to 42) |
134 | | - - Demonstrates Gateway decryption flow: |
135 | | - - requestSecret() initiates decryption request |
136 | | - - callbackSecret() receives and stores decrypted value |
137 | | - - Shows basic FHE operations and Gateway integration |
138 | | - |
139 | | -4. **Privacy Protection**: |
140 | | - - All token balances and transfers are encrypted |
141 | | - - Only transaction participants can view their own balances |
142 | | - - Uses TFHE library for homomorphic operations |
143 | | - - Integrates with Zama's FHE infrastructure |
144 | | - |
145 | | -The contract showcases how to implement confidential tokens while maintaining ERC20 compatibility and leveraging FHE for privacy preservation. |
| 104 | +2. **Key Features**: Encrypted balances (euint64), standard ERC20 functions with FHE, and owner-restricted minting. |
146 | 105 |
|
| 106 | +3. **Privacy Protection**: All operations are encrypted using TFHE, with balances visible only to transaction participants. |
147 | 107 |
|
| 108 | +The contract implements confidential tokens with ERC20 compatibility using FHE for privacy. |
148 | 109 |
|
149 | 110 | ## How to use this repo |
150 | 111 |
|
|
0 commit comments