Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update the docs to fhevm06 #612

Merged
merged 19 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 6 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ _Learn more use cases in the [list of examples](https://docs.zama.ai/fhevm/tutor
- [A Simple Example](#a-simple-example)
- **[Resources](#resources)**
- [White paper](#white-paper)
- [Demos](#demos)
- [Tutorials](#tutorials)
[Demos](#demos-and-tutorials)
- [Documentation](#documentation)
- [Blockchain Implementation](#blockchain-implementation)
- **[Working with fhEVM](#working-with-fhevm)**
Expand Down Expand Up @@ -142,34 +141,9 @@ _More examples are available [here](https://github.com/zama-ai/fhevm/tree/main/e
- [Confidential EVM Smart Contracts using Fully Homomorphic Encryption](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf)
<br></br>

### Demos
### Demos and Tutorials

#### 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.
- [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:

- [Cipherbomb](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

- [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.

_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/tutorials/see-all-tutorials) and [Awesome Zama repo](https://github.com/zama-ai/awesome-zama)._
<br></br>
For a comprehensive list of demos and tutorials, visit our [tutorials page](https://docs.zama.ai/fhevm/tutorials/see-all-tutorials).

### Documentation

Expand Down Expand Up @@ -235,52 +209,17 @@ npm run fhevm:start
# in another terminal
npm i
cp .env.example .env
npm run fhevm:faucet:alice
npm run fhevm:faucet:bob
npm run fhevm:faucet:carol
npm test
```

</details>

##### Docker

We provide a docker image to spin up a fhEVM node for local development.

```bash
npm run fhevm:start
# stop
npm run fhevm:stop
```

##### Run test

```bash
npm test
npm run test:mock
```

<details>
<summary>Error: insufficient funds</summary>

Ensure the faucet command was successful.

</details>

##### Run tests for network1 network

Network1 doesn't support shanghai, so you should update the `evmVersion` [here](https://github.com/zama-ai/fhevm/blob/main/hardhat.config.ts#L170) to use `paris`, and make sure contracts are compiled using that version.
##### Run test on a real fhEVM

```bash
# codegen for network1 network
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
npm run test -- --network sepolia
```

<p align="right">
<a href="#about" > ↑ Back to top </a>
</p>

#### Adding new operators

Operators can be defined as data inside `codegen/common.ts` file and code automatically generates solidity overloads.
Expand Down
Binary file added docs/.gitbook/assets/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/computation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/decryption.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/encrypt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/keys_fhe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/reencryption.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ layout:

Learn the basics of fhEVM, set it up, and make it run with ease.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>What is fhEVM</strong></td><td>Understand the basic concepts of fhEVM library.</td><td><a href=".gitbook/assets/start1.png">start1.png</a></td><td><a href="getting_started/overview.md">overview.md</a></td></tr><tr><td><strong>Write contract</strong></td><td>Start writing fhEVM smart contract using Hardhat template</td><td><a href=".gitbook/assets/start4.png">start4.png</a></td><td><a href="getting_started/write_contract/hardhat.md">hardhat.md</a></td></tr><tr><td><strong>Deploy on fhEVM native</strong></td><td>Get 10 Zama token to start working with fhEVM native</td><td><a href=".gitbook/assets/start2.png">start2.png</a></td><td><a href="getting_started/devnet.md">devnet.md</a></td></tr><tr><td><strong>Deploy on Ethereum</strong></td><td>Coming soon!</td><td><a href=".gitbook/assets/start5.png">start5.png</a></td><td><a href="getting_started/ethereum.md">ethereum.md</a></td></tr></tbody></table>
<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>What is fhEVM</strong></td><td>Understand the basic concepts of fhEVM library.</td><td><a href=".gitbook/assets/start1.png">start1.png</a></td><td><a href="getting_started/overview.md">overview.md</a></td></tr><tr><td><strong>Write contract</strong></td><td>Start writing fhEVM smart contract using Hardhat template</td><td><a href=".gitbook/assets/start4.png">start4.png</a></td><td><a href="getting_started/write_contract/hardhat.md">hardhat.md</a></td></tr><tr><td><strong>Learn to write FHE contracts</strong></td><td>Learn how to write your first confidential smart contract</td><td><a href=".gitbook/assets/start2.png">start2.png</a></td><td><a href="fundamentals/first_step/start.md">start.md</a></td></tr><tr><td><strong>Deploy on Ethereum</strong></td><td>Be one of the first to deploy confidential smart contracts on Ethereum!</td><td><a href=".gitbook/assets/start5.png">start5.png</a></td><td><a href="getting_started/ethereum.md">ethereum.md</a></td></tr></tbody></table>

## Develop a fhEVM smart contract

Start developing fhEVM smart contracts in Solidity by exploring its core features, discovering essential guides, and learning more with user-friendly tutorials.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Fundamentals</strong></td><td>Explore core features.</td><td><ul><li><a href="getting_started/write_contract/">Write contract</a></li><li><a href="fundamentals/types/README.md">Use encrypted types</a></li></ul></td><td><a href=".gitbook/assets/build1.png">build1.png</a></td></tr><tr><td><strong>Guides</strong></td><td>Deploy your project.</td><td><ul><li><a href="guides/gas.md">Gas estimation</a></li><li><a href="guides/pitfalls.md">Common pitfalls and best practices</a></li></ul></td><td><a href=".gitbook/assets/build2.png">build2.png</a></td></tr><tr><td><strong>Tutorials</strong></td><td>Learn more with tutorials.</td><td><ul><li><a href="tutorials/see-all-tutorials.md#start-here">Start here</a></li><li><a href="tutorials/see-all-tutorials.md#go-further">Go further</a></li></ul></td><td><a href=".gitbook/assets/build3.png">build3.png</a></td></tr></tbody></table>
<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Fundamentals</strong></td><td>Explore core features.</td><td><ul><li><a href="getting_started/write_contract/hardhat.md">Write contract with Hardhat</a></li><li><a href="fundamentals/first_step/types.md">Use encrypted types</a></li></ul></td><td><a href=".gitbook/assets/build1.png">build1.png</a></td></tr><tr><td><strong>Guides</strong></td><td>Learn further.</td><td><ul><li>Coming soon</li></ul></td><td><a href=".gitbook/assets/build2.png">build2.png</a></td></tr><tr><td><strong>Tutorials</strong></td><td>Learn more with tutorials.</td><td><ul><li><a href="tutorials/see-all-tutorials.md">See all tutorials</a></li></ul></td><td><a href=".gitbook/assets/build3.png">build3.png</a></td></tr></tbody></table>

## Explore more

Expand All @@ -38,7 +38,7 @@ Access to additional resources and join the Zama community.
Refer to the API and access additional resources for in-depth explanations while working with fhEVM.

- [API function specifications](references/functions.md)
- [Repositories](references/repositories.md)
- [Repositories](getting_started/repositories.md)

### Supports

Expand All @@ -55,8 +55,8 @@ Collaborate with us to advance the FHE spaces and drive innovation together.
- [Contribute to fhEVM](developer/contribute.md)
- [Follow the development roadmap](developer/roadmap.md)
- [See the latest test release note](https://github.com/zama-ai/fhevm/releases)
- [Request a feature](https://github.com/zama-ai/fhevm/issues/new)
- [Report a bug](https://github.com/zama-ai/fhevm/issues/new)
- [Request a feature](https://github.com/zama-ai/fhevm/issues/new?assignees=&labels=enhancement&projects=&template=feature-request.md&title=)
- [Report a bug](https://github.com/zama-ai/fhevm/issues/new?assignees=&labels=bug&projects=&template=bug_report_fhevm.md&title=)

---

Expand Down
63 changes: 33 additions & 30 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,58 @@

## Getting Started

- [What is fhEVM](getting_started/overview.md)
- Write contract
- [Quick overview](getting_started/overview.md)
- [Key concepts and features](getting_started/key_concepts.md)
- [Repositories](getting_started/repositories.md)
- [Whitepaper](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf)
poppyseedDev marked this conversation as resolved.
Show resolved Hide resolved
- [Get started](getting_started/ethereum.md)
- [Create a smart contract]()
- [Using Hardhat](getting_started/write_contract/hardhat.md)
- [Using Remix](getting_started/write_contract/remix.md)
- [Other development environment](getting_started/write_contract/others.md)
- [Installing packages](getting_started/write_contract/installation.md)
- [Deploy on fhEVM native](getting_started/devnet.md)
- [Deploy on Ethereum](getting_started/ethereum.md)
- [Whitepaper](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper.pdf)

## Fundamentals

- Encrypted types
- [Supported types](fundamentals/types/README.md)
- [Operations on encrypted types](fundamentals/types/operations.md)
- [Branching in FHE](fundamentals/types/conditions.md)
- [Generate random number](fundamentals/types/random.md)
- [Encrypted inputs](fundamentals/inputs.md)
- [Access Control List](fundamentals/acl.md)
- [Decrypt and reencrypt](fundamentals/decrypt.md)
- [Contracts standard library](fundamentals/contracts.md)
- [Architecture overview](fundamentals/architecture_overview.md)
- [Encryption, decryption, re-encryption, and computation](fundamentals/d_re_ecrypt_compute.md)
- [Access control list](fundamentals/acl.md)
- [Configuration](fundamentals/first_step/configure.md)
- [First smart contract](fundamentals/first_step/start.md)
- [Supported types](fundamentals/first_step/types.md)
- [Operations on encrypted types](fundamentals/first_step/operations.md)
- [Encryption](fundamentals/first_step/inputs.md)
- [Decryption](fundamentals/first_step/decrypt.md)
- [Decryption in depth](fundamentals/first_step/decrypt_details.md)
- [Reencryption](fundamentals/first_step/reencryption.md)
- [ACL examples](fundamentals/first_step/acl_examples.md)

## Guides

- [Decryption](guides/decrypt.md)
- [Reencryption](guides/reencryption.md)
- [Build a web application](guides/webapp.md)
- [Build with Node](guides/node.md)
- [Common pitfalls and best practises](guides/pitfalls.md)
- [How can I break a loop ?](guides/loop.md)
- [Gas estimation on devnet](guides/gas.md)
- [Use the CLI](guides/cli.md)
- [Common webpack errors](guides/webpack.md)
- Smart Contracts
- [fhevm-contracts](guides/contracts.md)
- [If sentances](guides/loop.md)
- [Branching in FHE](guides/conditions.md)
- [Generate random numbers](guides/random.md)
- [Error handling](guides/error_handling.md)
- Frontend
- [Build a web application](guides/frontend/webapp.md)
- [Build with Node](guides/frontend/node.md)
- [Using the CLI](guides/frontend/cli.md)
- [Common webpack errors](guides/frontend/webpack.md)

## Tutorials

- [See all tutorials](tutorials/see-all-tutorials.md)
- [Write confidential smart contract with fhEVM](https://www.zama.ai/post/video-tutorial-how-to-write-confidential-smart-contracts-using-zamas-fhevm)

## References

- [API function specifications](references/functions.md)
- [fhevmjs function specifications](references/fhevmjs.md)
- [Repositories](references/repositories.md)
- [Smart contracts - fhEVM API](references/functions.md)
- [Frontend - fhevmjs lib](references/fhevmjs.md)

## Developer

- [Contributing](developer/contribute.md)
- [Development roadmap](developer/roadmap.md)
- [Release note](https://github.com/zama-ai/fhevm/releases)
- [Feature request](https://github.com/zama-ai/fhevm/issues/new)
- [Bug report](https://github.com/zama-ai/fhevm/issues/new)
- [Feature request](https://github.com/zama-ai/fhevm/issues/new?assignees=&labels=enhancement&projects=&template=feature-request.md&title=)
- [Bug report](https://github.com/zama-ai/fhevm/issues/new?assignees=&labels=bug&projects=&template=bug_report_fhevm.md&title=)
6 changes: 6 additions & 0 deletions docs/developer/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ There are two ways to contribute to the Zama fhEVM:
- Request to become an official contributor by emailing [hello@zama.ai](mailto:hello@zama.ai).

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!

## Bounty Program

Contribute and earn rewards:

- [bounty-program](https://github.com/zama-ai/bounty-program) - Zama's FHE Bounty Program
32 changes: 14 additions & 18 deletions docs/developer/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@

## Features

| name | description | ETA |
| -------------------- | ------------------------------------------ | ------ |
| 128bits (scalar) | Add euint128 for scalar operations | Q3 '24 |
| Proof for inputs | Generate a proof for every encrypted input | Q3 '24 |
| Threshold decryption | Use threshold decryption | Q3 '24 |
| name | description | ETA |
| ---------------- | ----------------------------------------------------------- | ------ |
| Foundry template | [ Forge ](https://book.getfoundry.sh/reference/forge/forge) | Q1 '25 |

## Operations

| name | function name | type | ETA |
| --------------------- | ------------------- | ------------------ | --------------- |
| Random unsigned int | `TFHE.randEuintX()` | Random | Q3 '24 |
| Add w/ overflow check | `TFHE.safeAdd` | Binary, Decryption | Coming soon (1) |
| Sub w/ overflow check | `TFHE.safeSub` | Binary, Decryption | Coming soon (1) |
| Mul w/ overflow check | `TFHE.safeMul` | Binary, Decryption | Coming soon (1) |
| Random signed int | `TFHE.randEintX()` | Random | - |
| Div | `TFHE.div` | Binary | - |
| Rem | `TFHE.rem` | Binary | - |
| Set inclusion | `TFHE.isIn()` | Binary | - |
| name | function name | type | ETA |
| --------------------- | ------------------ | ------------------ | ----------- |
| Signed Integers | `eintX` | | Coming soon |
| Add w/ overflow check | `TFHE.safeAdd` | Binary, Decryption | Coming soon |
| Sub w/ overflow check | `TFHE.safeSub` | Binary, Decryption | Coming soon |
| Mul w/ overflow check | `TFHE.safeMul` | Binary, Decryption | Coming soon |
| Random signed int | `TFHE.randEintX()` | Random | - |
| Div | `TFHE.div` | Binary | - |
| Rem | `TFHE.rem` | Binary | - |
| Set inclusion | `TFHE.isIn()` | Binary | - |

> **_NOTE 1:_** Methods prefixed with `safe` will do an overflow check by decrypting an overflow bit and revert if that bit is true.

> **_NOTE 2:_** Random encrypted integers that are generated fully on-chain. Currently, implemented as a mockup by using a PRNG in the plain.
> **_NOTE 1:_** Random encrypted integers that are generated fully on-chain. Currently, implemented as a mockup by using a PRNG in the plain.
> Not for use in production!
Loading