-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17c0dcc
commit ded88df
Showing
1 changed file
with
50 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,17 +14,18 @@ | |
<a href="https://github.com/zama-ai/bounty-program"><img src="https://img.shields.io/badge/Contribute-Zama%20Bounty%20Program-%23ffd208?style=flat-square"></a> | ||
</p> | ||
|
||
## About | ||
## About | ||
|
||
### What is fhEVM | ||
### What is fhEVM | ||
|
||
**fhEVM** is a technology that enables confidential smart contracts on the EVM using fully homomorphic encryption (FHE). | ||
|
||
Thanks to a breakthrough in homomorphic encryption, Zama’s fhEVM makes it possible to run confidential smart contracts on encrypted data, guaranteeing both confidentiality and composability with: | ||
|
||
- **End-to-end encryption of transactions and state:** Data included in transactions is encrypted and never visible to anyone. | ||
- **Composability and data availability on-chain:** States are updated while remaining encrypted at all times. | ||
- **No impact on existing dapps and state:** Encrypted state co-exists alongside public one, and doesn't impact existing dapps. | ||
<br></br> | ||
<br></br> | ||
|
||
### Main features | ||
|
||
|
@@ -38,7 +39,7 @@ Thanks to a breakthrough in homomorphic encryption, Zama’s fhEVM makes it poss | |
- **Configurable Decryption :** Threshold, centralized or KMS decryption | ||
- **Unbounded Compute Depth :** Unlimited consecutive FHE operations | ||
|
||
*Learn more about fhEVM features in the [documentation](https://docs.zama.ai/fhevm).* | ||
_Learn more about fhEVM features in the [documentation](https://docs.zama.ai/fhevm)._ | ||
<br></br> | ||
|
||
### Use cases | ||
|
@@ -52,32 +53,32 @@ fhEVM is built for developers to write confidential smart contracts without lear | |
- **Encrypted DIDs**: Store identities on-chain and generate attestations without ZK. | ||
- **Private transfers**: Keep balances and amounts private, without using mixers. | ||
|
||
*Learn more use cases in the [list of examples](https://docs.zama.ai/fhevm/resources/examples).* | ||
_Learn more use cases in the [list of examples](https://docs.zama.ai/fhevm/resources/examples)._ | ||
<br></br> | ||
|
||
## Table of Contents | ||
|
||
- **[Getting Started](#getting-started)** | ||
- [Installation](#installation) | ||
- [A simple example](#a-simple-example) | ||
- [Installation](#installation) | ||
- [A simple example](#a-simple-example) | ||
- **[Resources](#resources)** | ||
- [White paper](#white-paper) | ||
- [Demos](#demos) | ||
- [Tutorials](#tutorials) | ||
- [Documentation](#documentation) | ||
- [White paper](#white-paper) | ||
- [Demos](#demos) | ||
- [Tutorials](#tutorials) | ||
- [Documentation](#documentation) | ||
- **[Working with fhEVM](#working-with-fhevm)** | ||
- [Developer guide](#developer-guide) | ||
- [Citations](#citations) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
- [Developer guide](#developer-guide) | ||
- [Citations](#citations) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
- **[Support](#support)** | ||
<br></br> | ||
<br></br> | ||
|
||
## Getting Started | ||
|
||
### Installation | ||
|
||
For now, fhEVM is implemented on evmos. | ||
### Installation | ||
|
||
For now, fhEVM is implemented on evmos. | ||
|
||
```bash | ||
# Using npm | ||
|
@@ -89,7 +90,8 @@ yarn add fhevm | |
# Using pnpm | ||
pnpm add fhevm | ||
``` | ||
*Find more details on implementation instructions in [this repository](https://github.com/zama-ai/fhevm-evmos).* | ||
|
||
_Find more details on implementation instructions in [this repository](https://github.com/zama-ai/fhevm-evmos)._ | ||
<br></br> | ||
|
||
### A simple example | ||
|
@@ -115,49 +117,55 @@ contract Counter { | |
} | ||
``` | ||
|
||
*This example is explained in more detail in [here](https://github.com/zama-ai/fhevm/tree/main/examples).* | ||
_This example is explained in more detail in [here](https://github.com/zama-ai/fhevm/tree/main/examples)._ | ||
|
||
<p align="right"> | ||
<a href="#about" > ↑ Back to top </a> | ||
</p> | ||
|
||
|
||
## Resources | ||
## Resources | ||
|
||
### White paper | ||
|
||
- [Confidential EVM Smart Contracts using Fully Homomorphic Encryption](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf) | ||
<br></br> | ||
<br></br> | ||
|
||
### Demos | ||
|
||
### Demos | ||
#### Finance | ||
|
||
#### Finance | ||
- [ERC-20](https://github.com/zama-ai/fhevm/blob/main/examples/EncryptedERC20.sol): A variation of the standard ERC20 smart contract that incorporates encrypted balances, providing additional privacy for token holders. | ||
- [Mixnet](https://github.com/anonymousGifter/mixnet-core): A smart contract designed to enhance privacy by mixing transactions in a network, using encryption to obscure the details of the transactions. - by [Remi Gai](https://github.com/remi-gai) | ||
- [Darkpool](https://github.com/omurovec/fhe-darkpools): A smart contract that enables anonymous trading of cryptocurrencies or assets, typically used to execute large orders without affecting the market price. - by [Owen Murovec](https://github.com/omurovec) | ||
|
||
#### Games: | ||
|
||
- [Ciperbomb](https://github.com/immortal-tofu/cipherbomb): A Hardhat-based template for developing Solidity smart contracts, with sensible defaults. - by Clément Danjou | ||
- [Battleship](https://github.com/battleship-fhevm/battleship-hardhat): A smart contract that replicates the classic Battleship game on a blockchain in a transparent manner. - by [Owen Murovec](https://github.com/omurovec) | ||
|
||
#### Others | ||
|
||
- [Governor DAO](https://github.com/zama-ai/fhevm/tree/main/examples/Governor): A DAO smart contract that facilitates governance decisions through encrypted voting. | ||
- [Blind auction](https://github.com/zama-ai/fhevm/blob/main/examples/BlindAuction.sol): A smart contract for conducting blind auctions where bids are encrypted and the winning bid remains private. | ||
- [Decentralized ID](https://github.com/zama-ai/fhevm/tree/main/examples/Identity): A blockchain-based identity management system using smart contracts to store and manage encrypted personal data. | ||
|
||
*If you have built awesome projects using fhEVM, please let us know and we will be happy to showcase them here!* | ||
_If you have built awesome projects using fhEVM, please let us know and we will be happy to showcase them here!_ | ||
<br></br> | ||
|
||
### Tutorials | ||
|
||
- [[Video tutorial] How to Write Confidential Smart Contracts Using Zama's fhEVM](https://www.zama.ai/post/video-tutorial-how-to-write-confidential-smart-contracts-using-zamas-fhevm) | ||
- [Confidential ERC-20 Tokens Using Homomorphic Encryption and the fhEVM](https://www.zama.ai/post/confidential-erc-20-tokens-using-homomorphic-encryption) | ||
- [On-chain Blind Auctions Using Homomorphic Encryption and the fhEVM](https://www.zama.ai/post/on-chain-blind-auctions-using-homomorphic-encryption) | ||
- [Programmable Privacy and Onchain Compliance using Homomorphic Encryption](https://www.zama.ai/post/programmable-privacy-and-onchain-compliance-using-homomorphic-encryption) | ||
*Explore more useful resources in [fhEVM tutorials](https://docs.zama.ai/fhevm/resources/tutorials) and [Awesome Zama repo](https://github.com/zama-ai/awesome-zama).* | ||
|
||
_Explore more useful resources in [fhEVM tutorials](https://docs.zama.ai/fhevm/resources/tutorials) and [Awesome Zama repo](https://github.com/zama-ai/awesome-zama)._ | ||
<br></br> | ||
|
||
### Documentation | ||
|
||
Full, comprehensive documentation is available here: [https://docs.zama.ai/fhevm](https://docs.zama.ai/fhevm). | ||
|
||
<p align="right"> | ||
<a href="#about" > ↑ Back to top </a> | ||
</p> | ||
|
@@ -171,15 +179,17 @@ Install dependencies (Solidity libraries and dev tools) | |
```bash | ||
npm install | ||
``` | ||
>[!Note] | ||
|
||
> [!Note] | ||
> Solidity files are formatted with prettier. | ||
#### Generate TFHE lib | ||
|
||
``` | ||
npm run codegen | ||
``` | ||
>[!Warning] | ||
|
||
> [!Warning] | ||
> Use this command to generate Solidity code and prettier result automatically! | ||
Files that are generated now (can be seen inside `codegen/main.ts`) | ||
|
@@ -192,6 +202,7 @@ mocks/TFHE.sol | |
contracts/tests/TFHETestSuiteX.sol | ||
test/tfheOperations/tfheOperations.ts | ||
``` | ||
|
||
<p align="right"> | ||
<a href="#about" > ↑ Back to top </a> | ||
</p> | ||
|
@@ -264,6 +275,7 @@ TARGET_NETWORK=Network1 npx ts-node codegen/main.ts && npm run prettier | |
# run tests for network1 network, assumes network1 rpc already running locally | ||
npx hardhat test --network localNetwork1 | ||
``` | ||
|
||
<p align="right"> | ||
<a href="#about" > ↑ Back to top </a> | ||
</p> | ||
|
@@ -273,7 +285,6 @@ npx hardhat test --network localNetwork1 | |
Operators can be defined as data inside `codegen/common.ts` file and code automatically generates solidity overloads. | ||
Test for overloads must be added (or the build doesn't pass) inside `codegen/overloadsTests.ts` file. | ||
|
||
|
||
#### Mocked mode | ||
|
||
The mocked mode allows faster testing and the ability to analyze coverage of the tests. In this mocked version, encrypted types are not really encrypted, and the tests are run on the original version of the EVM, on a local hardhat network instance. To run the tests in mocked mode, you can use directly the following command: | ||
|
@@ -289,14 +300,16 @@ npm run coverage:mock | |
``` | ||
|
||
Then open the file `coverage/index.html`. You can see there which line or branch for each contract which has been covered or missed by your test suite. This allows increased security by pointing out missing branches not covered yet by the current tests. | ||
>[!Note] | ||
>Due to intrinsic limitations of the original EVM, the mocked version differ in few corner cases from the real fhEVM, the most important change is the `TFHE.isInitialized` method which will always return `true` in the mocked version. Another big difference in mocked mode, compared to the real fhEVM implementation, is that there is no ciphertext verification neither checking that a ciphertext has been honestly obtained (see section 4 of the [whitepaper](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf)). This means that before deploying to production, developers still need to run the tests with the original fhEVM node, as a final check in non-mocked mode, with `npm run test`. | ||
|
||
> [!Note] | ||
> Due to intrinsic limitations of the original EVM, the mocked version differ in few corner cases from the real fhEVM, the most important change is the `TFHE.isInitialized` method which will always return `true` in the mocked version. Another big difference in mocked mode, compared to the real fhEVM implementation, is that there is no ciphertext verification neither checking that a ciphertext has been honestly obtained (see section 4 of the [whitepaper](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf)). This means that before deploying to production, developers still need to run the tests with the original fhEVM node, as a final check in non-mocked mode, with `npm run test`. | ||
<p align="right"> | ||
<a href="#about" > ↑ Back to top </a> | ||
</p> | ||
|
||
### Citations | ||
|
||
To cite fhEVM or the whitepaper in academic papers, please use the following entries: | ||
|
||
```text | ||
|
@@ -329,9 +342,10 @@ There are two ways to contribute to the Zama fhEVM: | |
Becoming an approved contributor involves signing our Contributor License Agreement (CLA)). Only approved contributors can send pull requests, so please make sure to get in touch before you do! | ||
<br></br> | ||
|
||
|
||
### License | ||
|
||
This software is distributed under the **BSD-3-Clause-Clear** license. If you have any questions, please contact us at [email protected]. | ||
|
||
<p align="right"> | ||
<a href="#table-of-contents" > ↑ Back to top </a> | ||
</p> | ||
|
@@ -342,8 +356,7 @@ This software is distributed under the **BSD-3-Clause-Clear** license. If you ha | |
<img src="https://github.com/zama-ai/fhevm/assets/157474013/4e75e34e-df3f-4e9e-8a22-12b1d4013578"> | ||
</a> | ||
|
||
|
||
🌟 If you find this project helpful or interesting, please consider giving it a star on GitHub! Your support helps to grow the community and motivates further development. | ||
🌟 If you find this project helpful or interesting, please consider giving it a star on GitHub! Your support helps to grow the community and motivates further development. | ||
|
||
<p align="right"> | ||
<a href="#about" > ↑ Back to top </a> | ||
|