From 4fd5225d7a95fe44e05d2180fcb56b93256b5b7f Mon Sep 17 00:00:00 2001 From: Eshel Date: Sun, 22 Sep 2024 23:33:33 +0300 Subject: [PATCH 01/19] fix broken link --- docs/devdocs/Writing Smart Contracts/FHE-sol.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Writing Smart Contracts/FHE-sol.mdx b/docs/devdocs/Writing Smart Contracts/FHE-sol.mdx index 3b6d55eb..267a5260 100644 --- a/docs/devdocs/Writing Smart Contracts/FHE-sol.mdx +++ b/docs/devdocs/Writing Smart Contracts/FHE-sol.mdx @@ -75,7 +75,7 @@ The currently supported types are `inEuint8`, `inEuint16`, `inEuint32`, `inEuint - **Purpose**: Converts a plaintext number, encrypted variable or an `inEaddress` encrypted input into an `eaddress` type. ### `decrypt` - Decrypt Encrypted Data -- **Purpose**: Decrypts `euint`, `ebool` or `eaddress` encrypted value back to its plaintext form. If the value should only be revealed to a specific address, the `sealoutput` function should be used instead. Learn more abut sealing [here](../Returning-Data). +- **Purpose**: Decrypts `euint`, `ebool` or `eaddress` encrypted value back to its plaintext form. If the value should only be revealed to a specific address, the `sealoutput` function should be used instead. Learn more abut sealing [here](./Returning-Data.md). ### Arithmetic Operations FHE.sol supports encrypted arithmetic operations like addition and subtraction. These operations can be performed directly on `euint` types, enabling encrypted computations. From 3951f14f07db1335882c5bec31015a9f58c94958 Mon Sep 17 00:00:00 2001 From: Eshel Date: Sun, 22 Sep 2024 23:39:44 +0300 Subject: [PATCH 02/19] fixing monospace --- docs/devdocs/Writing Smart Contracts/User-Inputs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/devdocs/Writing Smart Contracts/User-Inputs.md b/docs/devdocs/Writing Smart Contracts/User-Inputs.md index 5b3db3e6..7de8aafc 100644 --- a/docs/devdocs/Writing Smart Contracts/User-Inputs.md +++ b/docs/devdocs/Writing Smart Contracts/User-Inputs.md @@ -11,8 +11,8 @@ description: How to handle encrypted data coming from the user Fhenix’s Fully Homomorphic Encryption (FHE) smart contracts handle encrypted data input differently from standard Solidity smart contracts. First, Fhenix has different data types: boolean, integer and user input. -Second, inEuint and inEbool are used for handling input data, whereas euint and Ebool are used for already processed data within the contract. -Third, conversion is required from inEuint to euint to ensure that only correctly formatted encrypted user input is processed. This is done using a helper function: `FHE.asEuintxx`. +Second, `inEuint` and `inEbool` are used for handling input data, whereas `euint` and `ebool` are used for already processed data within the contract. +Third, conversion is required from `inEuint` to `euint` to ensure that only correctly formatted encrypted user input is processed. This is done using a helper function: `FHE.asEuintxx`. Finally, follow best practices. Try to minimize storing large quantities of encrypted data on-chain & optimize computation to lower gas costs; process data as needed. Also, use structured types, and avoid using raw bytes to handle encrypted data input. ## Encrypted Data Types @@ -78,7 +78,7 @@ Conversion from `inEuint` (or `inEbool`, `inEaddress`) to `euint` (`ebool`, `ead This is done using the `FHE.asEuintXX`, `FHE.asEbool` or `FHE.asEaddress` functions, where `XX` is the bit size of the encrypted data. The example above uses the `FHE.asEuint8` helper function. ### Gas Cost Implications -Attempting to store `inEuint`, `inEbool` or `inEaddress types directly in storage can lead to prohibitively high gas costs due to the large size of encrypted data. It's generally recommended to avoid storing these directly and instead process them as needed. +Attempting to store `inEuint`, `inEbool` or `inEaddress` types directly in storage can lead to prohibitively high gas costs due to the large size of encrypted data. It's generally recommended to avoid storing these directly and instead process them as needed. ### Best Practices – Use Structured Types Ensure data integrity and security of smart contract operation when handling encrypted input. Use the structured `inEuint`, `inEbool` or `inEaddress` types for clearer and safer code, and be mindful of gas costs when designing your contract's data handling strategies. Thorough testing and consideration of security implications are essential in maintaining the robustness and reliability of your FHE-based smart contracts. From 267b3f2151ca59afb65be7f0b7abf243f2421034 Mon Sep 17 00:00:00 2001 From: Eshel Date: Sun, 22 Sep 2024 23:48:33 +0300 Subject: [PATCH 03/19] minor typos in Useful-Tips page --- docs/devdocs/Writing Smart Contracts/Useful-Tips.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/devdocs/Writing Smart Contracts/Useful-Tips.md b/docs/devdocs/Writing Smart Contracts/Useful-Tips.md index a4da03ef..4b17a5e5 100644 --- a/docs/devdocs/Writing Smart Contracts/Useful-Tips.md +++ b/docs/devdocs/Writing Smart Contracts/Useful-Tips.md @@ -6,12 +6,12 @@ description: Tidbits of wisdom for working with FHE ## Trivial Encryption -When we are using `FHE.asEuint*(PLAINTEXT_NUMBER)` we are actually using a trivial encryption of our FHE scheme. Unlike normal FHE encryption trivial encryption is a deterministic encryption. The meaning is that if you will do it twice you will still get the same result +When we are using `FHE.asEuintX(plaintext_number)` we are actually using a trivial encryption of our FHE scheme. Unlike normal FHE encryption trivial encryption is a deterministic encryption. The meaning is that if you will do it twice you will still get the same result ## Default Value of a Euint -When having a `euint*` variable uninitialized it will be considered as 0. Every FHE function that will receive an uninitialized euint* will assume it is `FHE.asEuint*(0)`. -You can assume now that `FHE.asEuint*(0)`is used quite often - Luckily we realized this and decided to have the values of`FHE.asEuint*(0)`pre-calculated on node initialization so when you use`FHE.asEuint\*(0)` we will just return those values. +When having a `euintx` variable uninitialized it will be considered as 0. Every FHE function that will receive an uninitialized `euintx` will assume it is `FHE.asEuintX(0)`. +You can assume now that `FHE.asEuintX(0)`is used quite often - Luckily we realized this and decided to have the values of `FHE.asEuintX(0)` pre-calculated on node initialization so when you use`FHE.asEuintX(0)` we will just return those values. ## Re-encrypting a Value @@ -28,14 +28,14 @@ Now that we know that, we can add 0 (cryptographically with FHE.add) to all of t All the operations are supported both in TXs and in Queries. That being said we strongly advise to think twice before you use those operations inside a TX. `FHE.req` is actually exposing the value of your encrypted data. Assuming we will send the transaction and monitor the gas usage we can probably identify whether the `FHE.req` condition met or not and understand a lot about what the encrypted values represent. Example: -```javascript +```solidity function f(euint8 a, euint8 b) public { FHE.req(a.eq(b)); // Do some heavy logic } ``` -In this case, if `a` and `b` won't be equal it will fail immediately and take less gas than the case when `a` and `b` are equal which means that one who checks the gas can easily know the equality of `a` and `b` it won't leak their values but it will leak confidential data. +In this case, if `a` and `b` won't be equal it will fail immediately and take less gas than the case when `a` and `b` are equal which means that one who checks the gas can easily know the equality of `a` and `b` it won't leak their values, but it will leak confidential data. The rule of thumb that we are suggesting is to use `FHE.req` only in `view` functions while the logic of `FHE.req` in txs can be implemented using `FHE.select` ## FHE.decrypt() @@ -55,7 +55,7 @@ Currently, we support many FHE operations. Some of them might take a lot of time When writing FHE code we encourage you to use the operations wisely and choose what operation should be used. Example: Instead of `ENCRYPTED_UINT_32 * FHE.asEuint32(2)` you can use `FHE.shl(ENCRYPTED_UINT_32, FHE.asEuint32(1))` in some cases `FHE.div(ENCRYPTED_UINT_32, FHE.asEuint32(2))` can be replaced by `FHE.shr(ENCRYPTED_UINT_32, FHE.asEuint32(1))` -For more detailed benchmarks please refer to: [Gas-and-Benchmarks](./Gas-and-Benchmarks) +For more detailed benchmarks please refer to: [Gas and Benchmarks](./Gas-and-Benchmarks) ## Randomness From e432b07f9a5c7ff23e8794396c78c789640c4ff1 Mon Sep 17 00:00:00 2001 From: Eshel Date: Sun, 22 Sep 2024 23:53:13 +0300 Subject: [PATCH 04/19] fix broken links in gitpod page --- docs/devdocs/Setting Up Your Environment/Gitpod.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Setting Up Your Environment/Gitpod.mdx b/docs/devdocs/Setting Up Your Environment/Gitpod.mdx index 8c20d58c..f105b040 100644 --- a/docs/devdocs/Setting Up Your Environment/Gitpod.mdx +++ b/docs/devdocs/Setting Up Your Environment/Gitpod.mdx @@ -61,4 +61,4 @@ got unsealed result: 10 ## Next Steps -To learn more about the Fhenix Hardhat Plugin, please visit the [Fhenix Hardhat Plugin](/docs/fhenix-hardhat-plugin) or learn more about [Developing dApps with Fhenix](/docs/developing-dapps-with-fhenix). +To learn more about the Fhenix Hardhat Plugin, please visit the [Fhenix Hardhat Plugin](../Tools%20and%20Utilities/Fhenix-Hardhat-Plugin.md). From 0d600cdef4b6c3cb43dc917bc159fd4b9d9cee60 Mon Sep 17 00:00:00 2001 From: Eshel Date: Sun, 22 Sep 2024 23:58:12 +0300 Subject: [PATCH 05/19] fixing errors in foundry page --- docs/devdocs/Setting Up Your Environment/Foundry.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/devdocs/Setting Up Your Environment/Foundry.md b/docs/devdocs/Setting Up Your Environment/Foundry.md index f91ddfb4..39b74aaa 100644 --- a/docs/devdocs/Setting Up Your Environment/Foundry.md +++ b/docs/devdocs/Setting Up Your Environment/Foundry.md @@ -4,11 +4,12 @@ This tool will allow you to simulate development on the Fhenix network including The tool uses Foundry Cheatcodes to represent the execution of our Fhenix native precompiles. Please be aware that the operations performed by using this template only simulate the behavior of real FHE operations, and will probably not be a good representation of performance, gas, etc. -The code is pretty new, and may contain bugs or edge-cases that we have not tested, so your feedback is very important for us! If you have any issues, comments or requests please open an issue in the [Fhenix Hardhat Template Repository](https://github.com/FhenixProtocol/fhenix-foundry-template) +The code is pretty new, and may contain bugs or edge-cases that we have not tested, so your feedback is very important for us! If you have any issues, comments or requests please open an issue +in the Fhenix Foundry Template [Repository](https://github.com/FhenixProtocol/fhenix-foundry-template). ## Getting Started -To create a new repository using our [Fhenix Hardhat Template](https://github.com/FhenixProtocol/fhenix-foundry-template), click the +To create a new repository using our [Fhenix Foundry Template](https://github.com/FhenixProtocol/fhenix-foundry-template), click the [`Use this template`](https://github.com/fhenixprotocol/fhenix-foundry-template/generate) button. Alternatively, install the template manually as follows: @@ -29,7 +30,7 @@ If this is your first time using Foundry, refer to the testing without requiring a fully operational FHE network. - Permissions: The template includes utilities (PermissionHelper.sol) for creating permissions related to FHE operations. These utilities enable users to test and verify that contracts correctly implement access-controlled - actions, such as viewing balances of encrypted tokens. For more about permissions, see the [Fhenix Documentation] https://docs.fhenix.zone/docs/devdocs/Writing%20Smart%20Contracts/Permissions) + actions, such as viewing balances of encrypted tokens. For more about permissions, see the [Fhenix Documentation](../Writing%20Smart%20Contracts/Permissions.md) section. ## Writing Tests From 963757ae125cea5cb6ae9a2f8e49caba4d9f271a Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:09:02 +0300 Subject: [PATCH 06/19] various fixes + incorrect link --- docs/devdocs/FhenixJS/Decryption.md | 2 +- docs/devdocs/FhenixJS/Encryption.md | 2 +- docs/devdocs/Setting Up Your Environment/Foundry.md | 5 ++--- docs/devdocs/Writing Smart Contracts/Returning-Data.md | 2 +- docs/devdocs/Writing Smart Contracts/Types-and-Operators.md | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/devdocs/FhenixJS/Decryption.md b/docs/devdocs/FhenixJS/Decryption.md index f1162384..5ae28bf6 100644 --- a/docs/devdocs/FhenixJS/Decryption.md +++ b/docs/devdocs/FhenixJS/Decryption.md @@ -12,7 +12,7 @@ The data is returned to the user using [sealed box encryption ](https://bitbeans :::tip[Don't Want to Seal?] Fhenix supports standard decryption as well. Mostly suited for public data, an unsealed plaintext value can be returned from a contract. -You can read more about how to do this [here](#../). +You can read more about how to do this [here](../Writing%20Smart%20Contracts/FHE-sol#decrypt---decrypt-encrypted-data). ::: ### Encrypted Values & Permits diff --git a/docs/devdocs/FhenixJS/Encryption.md b/docs/devdocs/FhenixJS/Encryption.md index bf2972f3..9d9e2683 100644 --- a/docs/devdocs/FhenixJS/Encryption.md +++ b/docs/devdocs/FhenixJS/Encryption.md @@ -12,7 +12,7 @@ Encryption in Fhenix is done using the global chain key. This key is loaded when When we perform encryption, we specify the type of `euint` (Encrypted Integer) we want to create. This should match the expected type in the Solidity contract we are working with. -First, initialize the library - +First, initialize the library: ```Typescript import { FhenixClient } from 'fhenixjs'; diff --git a/docs/devdocs/Setting Up Your Environment/Foundry.md b/docs/devdocs/Setting Up Your Environment/Foundry.md index 39b74aaa..c01ced78 100644 --- a/docs/devdocs/Setting Up Your Environment/Foundry.md +++ b/docs/devdocs/Setting Up Your Environment/Foundry.md @@ -28,10 +28,9 @@ If this is your first time using Foundry, refer to the - Simulated FHE Operations: All FHE operations, including encryption, decryption, and encrypted data handling, are simulated to replicate their behavior in a network environment. This approach facilitates seamless development and testing without requiring a fully operational FHE network. -- Permissions: The template includes utilities (PermissionHelper.sol) for creating permissions related to FHE +- Permissions: The template includes utilities (`PermissionHelper.sol`) for creating permissions related to FHE operations. These utilities enable users to test and verify that contracts correctly implement access-controlled - actions, such as viewing balances of encrypted tokens. For more about permissions, see the [Fhenix Documentation](../Writing%20Smart%20Contracts/Permissions.md) - section. + actions, such as viewing balances of encrypted tokens. For more about permissions, see [here](../Writing%20Smart%20Contracts/Permissions.md). ## Writing Tests diff --git a/docs/devdocs/Writing Smart Contracts/Returning-Data.md b/docs/devdocs/Writing Smart Contracts/Returning-Data.md index 7be419a2..e59df278 100644 --- a/docs/devdocs/Writing Smart Contracts/Returning-Data.md +++ b/docs/devdocs/Writing Smart Contracts/Returning-Data.md @@ -49,7 +49,7 @@ This means that we can consume sealed data directly from Metamask, which provide Fetch an address's public key using the `eth_getEncryptionPublicKey` method, seal the data for that specific public key (either as a permit or by using the public key directly), and then use Metamask's `eth_decrypt` call to provide a guided decryption experience. -:::danger[Warning] +:::warning[Warning] Metamask's `eth_getEncryptionPublicKey` and `eth_decrypt` methods are deprecated. We provide these examples to demonstrate compatibility with native wallet encryption/decryption procedures. We aim to maintain compatibility as new standards emerge for encryption on Ethereum. ::: diff --git a/docs/devdocs/Writing Smart Contracts/Types-and-Operators.md b/docs/devdocs/Writing Smart Contracts/Types-and-Operators.md index 39db49cc..1755c9cd 100644 --- a/docs/devdocs/Writing Smart Contracts/Types-and-Operators.md +++ b/docs/devdocs/Writing Smart Contracts/Types-and-Operators.md @@ -131,7 +131,7 @@ Note that all functions are supported in both direct function calls and library | Decrypt | `decrypt` | n/a | | | | | | | | | | Seal Output | `sealOutput` | n/a | | | | | | | | | -:::danger +:::danger[Caveat] At the moment it is not possible to do `ebool result = (lhs == rhs)` and others that return a boolean result. This is because FHE.sol expects a `ebool`, while Solidity only allows overloading to return a regular boolean. Instead, we recommend `ebool result = lhs.eq(rhs)`. ::: From 01f5f60d904a917e5979855adfaec05ba3f3eb9b Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:09:59 +0300 Subject: [PATCH 07/19] broken link --- docs/devdocs/FhenixJS/Decryption.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/FhenixJS/Decryption.md b/docs/devdocs/FhenixJS/Decryption.md index 5ae28bf6..e78f0779 100644 --- a/docs/devdocs/FhenixJS/Decryption.md +++ b/docs/devdocs/FhenixJS/Decryption.md @@ -25,7 +25,7 @@ The main difference with inEuint* is that you can be explicit with what is the e A `Permit` is a data structure that helps contracts know who is trying to call a specific function. -The fhenix.js Javascript library includes methods to support creating parameters for values that require [Permits & Access Control](../Encryption and Privacy/Permits-Access-Control.md). These methods can help creating ephemeral transaction keys, which are used by the smart contract to create a secure encryption channel to the caller. +The fhenix.js Javascript library includes methods to support creating parameters for values that require [Permits & Access Control](../Encryption%20and%20Privacy/Permits-Access-Control.md). These methods can help creating ephemeral transaction keys, which are used by the smart contract to create a secure encryption channel to the caller. Similarly to decryption, this usage can be implemented by any compliant library, but we include direct support in fhenix.js. This is done in 3 steps: generating a permit, querying the contract and unsealing the data. From 81c23fcb762f57a8f9f9a834b476d12ec7b0196a Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:17:25 +0300 Subject: [PATCH 08/19] fix broken link again --- docs/devdocs/FhenixJS/Decryption.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/devdocs/FhenixJS/Decryption.md b/docs/devdocs/FhenixJS/Decryption.md index e78f0779..345c624b 100644 --- a/docs/devdocs/FhenixJS/Decryption.md +++ b/docs/devdocs/FhenixJS/Decryption.md @@ -12,7 +12,7 @@ The data is returned to the user using [sealed box encryption ](https://bitbeans :::tip[Don't Want to Seal?] Fhenix supports standard decryption as well. Mostly suited for public data, an unsealed plaintext value can be returned from a contract. -You can read more about how to do this [here](../Writing%20Smart%20Contracts/FHE-sol#decrypt---decrypt-encrypted-data). +You can read more about how to do this [here](../Writing%20Smart%20Contracts/Returning-Data.md). ::: ### Encrypted Values & Permits @@ -49,7 +49,7 @@ When you create a permit it gets stored in `localstorage`. This makes permits ea #### 2. Querying the Contract -We recommend that contracts implement the Permit/Permission interfaces (though this is not strictly required!). +We recommend that contracts implement the Permit/Permission interfaces (though this is not strictly required). In this case, we can easily inject our permit into the function call. ```javascript From 8bac4a8bbddb44d23a2c03577b22fa6229cfbec4 Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:28:36 +0300 Subject: [PATCH 09/19] added notes to example repos --- docs/devdocs/Examples and References/Examples-fheDapps.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/devdocs/Examples and References/Examples-fheDapps.md b/docs/devdocs/Examples and References/Examples-fheDapps.md index 3b25fc56..3bba885d 100644 --- a/docs/devdocs/Examples and References/Examples-fheDapps.md +++ b/docs/devdocs/Examples and References/Examples-fheDapps.md @@ -19,13 +19,13 @@ Here you can find a list of some cool apps that you can use as a reference FHERC-20 View on Github
FHERC-20 Demo - +A token in which balances are encrypted and viewable only to the holder. Blind Auction View on Github View on Github - +An auction in which is bid is kept encrypted until the Auction ends and the winner is revealed. [//]: # () @@ -43,13 +43,13 @@ Here you can find a list of some cool apps that you can use as a reference Confidential Voting View on Github - +A voting in which the individual votes are kept secret. Simple Lottery View on Github - +A very simple game leveraging the fact that you can pick a winning number and keep it private. Contract Playground From f858af2fd7c2e944e5e6af9312683b9f8a658779 Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:42:10 +0300 Subject: [PATCH 10/19] bring networkPublicKey page up-to-date --- docs/devdocs/FhenixJS/Network Keys.mdx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/devdocs/FhenixJS/Network Keys.mdx b/docs/devdocs/FhenixJS/Network Keys.mdx index 14af5919..4385eebe 100644 --- a/docs/devdocs/FhenixJS/Network Keys.mdx +++ b/docs/devdocs/FhenixJS/Network Keys.mdx @@ -18,22 +18,28 @@ If you're using fhenix.js you don't need to worry about this, as the public key ##### Fetching the Public Key Manually -However, if you're using interfacing with Fhenix directly, you'll need to fetch the public key from the network you're connecting to. This can be done by calling the `getPublicKey` function on the network you're connecting to. +However, if you're using interfacing with Fhenix directly, you'll need to fetch the public key from the network you're connecting to. This can be done by calling the `getNetworkPublicKey` function on the network you're connecting to. The Public Key is constant for the lifetime of the network, but still has to be fetched once by the user to be able to encrypt data. To do this, we use a special precompiled function that can be accessed programmatically in the following way: ```javascript +const networkPkAbi = new Interface(["function getNetworkPublicKey(int32 securityZone)"]); +const callData = networkPkAbi.encodeFunctionData("getNetworkPublicKey", [0]); // last param is the security zone, generally 0 let result = await provider.call({ to: "0x0000000000000000000000000000000000000080", + data: callData }); ``` ```javascript +const networkPkSig = web3.eth.abi.encodeFunctionSignature("function getNetworkPublicKey(int32 securityZone)"); +const param = web3.eth.abi.encodeParameter("int32", 0); // last param is the security zone, generally 0 let result = await web3.eth.call({ - to: "0x0000000000000000000000000000000000000080" + to: "0x0000000000000000000000000000000000000080", + data: networkPkSig + param }); ``` From 93a9c16835f0772b15c6ece255bbc085b260e959 Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:46:17 +0300 Subject: [PATCH 11/19] broken link --- docs/devdocs/Tutorials/Your-First-FHE-Contract.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Tutorials/Your-First-FHE-Contract.md b/docs/devdocs/Tutorials/Your-First-FHE-Contract.md index 8c6812e2..19a0ff01 100644 --- a/docs/devdocs/Tutorials/Your-First-FHE-Contract.md +++ b/docs/devdocs/Tutorials/Your-First-FHE-Contract.md @@ -97,4 +97,4 @@ If you want to learn more about working with Fhenix, please check out [docs for ### Have Questions? -Hop into our [Discord](#) and ask questions in the #dev-general or #tech-questions channels! +Hop into our [Discord](https://discord.gg/FuVgxrvJMY) and ask questions in the `#dev-general` or `#tech-questions` channels! From edc59162bab5bab25155d87bac3b81b2e754dc3e Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:52:03 +0300 Subject: [PATCH 12/19] two broken links --- docs/devdocs/Tutorials/Basic/Setting Up.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Tutorials/Basic/Setting Up.mdx b/docs/devdocs/Tutorials/Basic/Setting Up.mdx index a5a046bb..918b6a39 100644 --- a/docs/devdocs/Tutorials/Basic/Setting Up.mdx +++ b/docs/devdocs/Tutorials/Basic/Setting Up.mdx @@ -80,7 +80,7 @@ Change the directory into the repository and install the project dependencies ### I'm more of a Free Spirit -Alternative set up paths can be just cloning or forking the example repository, or starting from scratch using our [fhenix hardhat plugin](../../devdocs/docs/hardhat), [Gitpod environment](../../devdocs/docs/gitpod) or Github Workspaces +Alternative set up paths can be just cloning or forking the example repository, or starting from scratch using our [Fhenix hardhat plugin](../../Tools%20and%20Utilities/Fhenix-Hardhat-Plugin.md), [Gitpod environment](../../Setting%20Up%20Your%20Environment/Gitpod.mdx) or Github Workspaces ## Configuring and Starting Localfhenix In order for us to locally deploy and test contracts we will need to run our own node, for this specific use-case we have a docker image named `localfhenix`. From d971187aab982a82252695f7dce59fc58fda8143 Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 00:55:41 +0300 Subject: [PATCH 13/19] added header to link --- docs/devdocs/Tutorials/Basic/Deploying.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Tutorials/Basic/Deploying.mdx b/docs/devdocs/Tutorials/Basic/Deploying.mdx index 9be9003e..8975d835 100644 --- a/docs/devdocs/Tutorials/Basic/Deploying.mdx +++ b/docs/devdocs/Tutorials/Basic/Deploying.mdx @@ -9,7 +9,7 @@ import TabItem from '@theme/TabItem'; Now that we have our completed WrappingERC20 token, the next step is to see if our code actually works! -To do this, we'll be writing tests in typescript using hardhat, and deploying them on our [LocalFhenix](../../Setting%20Up%20Your%20Environment/Hardhat.md) environment which we set up earlier. +To do this, we'll be writing tests in typescript using hardhat, and deploying them on our [LocalFhenix](../../Setting%20Up%20Your%20Environment/Hardhat.md#start-localfhenix) environment which we set up earlier. :::tip[Note] At this stage, using hardhat network is not supported, as Fhenix uses custom extensions to the EVM that enable FHE operations From 84d06c5b9f6cc8fffdc628bd49857d9c256bde1f Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 01:00:21 +0300 Subject: [PATCH 14/19] updated note on un-support for foundry --- docs/devdocs/Tutorials/Basic/Testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Tutorials/Basic/Testing.md b/docs/devdocs/Tutorials/Basic/Testing.md index c0d139a0..7b892160 100644 --- a/docs/devdocs/Tutorials/Basic/Testing.md +++ b/docs/devdocs/Tutorials/Basic/Testing.md @@ -11,7 +11,7 @@ FhenixJS is injected by the Fhenix Hardhat plugin and can be used automatically We will break down each step, providing code snippets and explanations to ensure you understand how to test the contract effectively. :::note -At the moment, only Hardhat is supported as a full testing environment. Stay tuned for Foundry support in the future. +This section describes testing in a Hardhat project. For instructions on testing with Foundry, check [this](../../Setting%20Up%20Your%20Environment/Foundry.md#Writing-Tests). ::: ## Step-by-Step Guide From 1462b94dd5450cb8ce6d58b91fd3d4fee7fae47f Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 01:02:22 +0300 Subject: [PATCH 15/19] broken link --- docs/devdocs/Tools and Utilities/Fhenix-Hardhat-Plugin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Tools and Utilities/Fhenix-Hardhat-Plugin.md b/docs/devdocs/Tools and Utilities/Fhenix-Hardhat-Plugin.md index a42bd923..2263d83f 100644 --- a/docs/devdocs/Tools and Utilities/Fhenix-Hardhat-Plugin.md +++ b/docs/devdocs/Tools and Utilities/Fhenix-Hardhat-Plugin.md @@ -18,7 +18,7 @@ To use FhenixJS in your Hardhat project, first install the plugin via npm (or yo pnpm install fhenix-hardhat-plugin ``` -If you wish to run your own local dev environment, please install the [fhenix-hardhat-docker](https://github.com/fhenixprotocol/fhenix-hardhat-docker) plugin as well. +If you wish to run your own local dev environment, please install the [fhenix-hardhat-docker](https://www.npmjs.com/package/fhenix-hardhat-docker) plugin as well. ```sh pnpm install fhenix-hardhat-docker From e8b1494cc541c7a8f36bb1eda7fc528030f58043 Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 01:03:01 +0300 Subject: [PATCH 16/19] fixed link header --- docs/devdocs/Tutorials/Basic/Testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devdocs/Tutorials/Basic/Testing.md b/docs/devdocs/Tutorials/Basic/Testing.md index 7b892160..4ab35564 100644 --- a/docs/devdocs/Tutorials/Basic/Testing.md +++ b/docs/devdocs/Tutorials/Basic/Testing.md @@ -11,7 +11,7 @@ FhenixJS is injected by the Fhenix Hardhat plugin and can be used automatically We will break down each step, providing code snippets and explanations to ensure you understand how to test the contract effectively. :::note -This section describes testing in a Hardhat project. For instructions on testing with Foundry, check [this](../../Setting%20Up%20Your%20Environment/Foundry.md#Writing-Tests). +This section describes testing in a Hardhat project. For instructions on testing with Foundry, check [this](../../Setting%20Up%20Your%20Environment/Foundry.md#writing-tests). ::: ## Step-by-Step Guide From 0b7a0bcec2e3be443a1f1857583e2b0370ac9320 Mon Sep 17 00:00:00 2001 From: Eshel Date: Mon, 23 Sep 2024 14:19:52 +0300 Subject: [PATCH 17/19] fixing getNetworkPublicKey to not include securityZone param --- docs/devdocs/FhenixJS/Network Keys.mdx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/devdocs/FhenixJS/Network Keys.mdx b/docs/devdocs/FhenixJS/Network Keys.mdx index 4385eebe..d82ed896 100644 --- a/docs/devdocs/FhenixJS/Network Keys.mdx +++ b/docs/devdocs/FhenixJS/Network Keys.mdx @@ -25,22 +25,25 @@ The Public Key is constant for the lifetime of the network, but still has to be ```javascript -const networkPkAbi = new Interface(["function getNetworkPublicKey(int32 securityZone)"]); -const callData = networkPkAbi.encodeFunctionData("getNetworkPublicKey", [0]); // last param is the security zone, generally 0 +const networkPkAbi = new Interface(["function getNetworkPublicKey()"]) let result = await provider.call({ to: "0x0000000000000000000000000000000000000080", - data: callData + data: networkPkAbi.encodeFunctionData("getNetworkPublicKey"); }); ``` ```javascript -const networkPkSig = web3.eth.abi.encodeFunctionSignature("function getNetworkPublicKey(int32 securityZone)"); -const param = web3.eth.abi.encodeParameter("int32", 0); // last param is the security zone, generally 0 +const networkPkSig = web3.eth.abi.encodeFunctionSignature("getNetworkPublicKey()"); let result = await web3.eth.call({ to: "0x0000000000000000000000000000000000000080", - data: networkPkSig + param + data: networkPkSig }); ``` + +```shell +cast call 0x0000000000000000000000000000000000000080 --rpc-url "https://api.helium.fhenix.zone" "getNetworkPublicKey()" +``` + From 5cb9db85c4a22775ebae3de5446d6bc32f94ece5 Mon Sep 17 00:00:00 2001 From: Yonatan Erez <89041867+YonatanE22@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:46:31 +0300 Subject: [PATCH 18/19] Update Examples-fheDapps.md --- docs/devdocs/Examples and References/Examples-fheDapps.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/devdocs/Examples and References/Examples-fheDapps.md b/docs/devdocs/Examples and References/Examples-fheDapps.md index 3bba885d..4521c4bf 100644 --- a/docs/devdocs/Examples and References/Examples-fheDapps.md +++ b/docs/devdocs/Examples and References/Examples-fheDapps.md @@ -63,6 +63,11 @@ Here you can find a list of some cool apps that you can use as a reference https://dapps.zama.ai/
NOTE: These examples are not directly compatible with Fhenix and must be adapted +Unique Bid Auction +View on Github +Bids_Party
+A showcase of a blind bid auction using a unique bidding mechanism + [//]: # () From 4efa5c93bce63b0cea96ebbb22414ad3bce27cd2 Mon Sep 17 00:00:00 2001 From: Tom Langer <7473870+toml01@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:05:30 +0300 Subject: [PATCH 19/19] Fix yonatan's mistake --- docs/devdocs/Examples and References/Examples-fheDapps.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/devdocs/Examples and References/Examples-fheDapps.md b/docs/devdocs/Examples and References/Examples-fheDapps.md index 4521c4bf..dac01feb 100644 --- a/docs/devdocs/Examples and References/Examples-fheDapps.md +++ b/docs/devdocs/Examples and References/Examples-fheDapps.md @@ -63,6 +63,7 @@ Here you can find a list of some cool apps that you can use as a reference https://dapps.zama.ai/
NOTE: These examples are not directly compatible with Fhenix and must be adapted + Unique Bid Auction View on Github Bids_Party