diff --git a/docs/devdocs/Encryption and Privacy/Permits-Access-Control.md b/docs/devdocs/Encryption and Privacy/Permits-Access-Control.md index 296ebcb5..8f0f5504 100644 --- a/docs/devdocs/Encryption and Privacy/Permits-Access-Control.md +++ b/docs/devdocs/Encryption and Privacy/Permits-Access-Control.md @@ -37,7 +37,7 @@ In the context of Fhenix and blockchain, a permit refers to a signed JSON object #### How to Generate a Permit -Permits are generated using the `getPermit` method. This method requires a the following parameter: +Permits are generated using the `getPermit` method. This method requires the following parameter: * `contractAddress` (required, string): The address of the contract. * `provider` (required): Note that if you want to unseal data using your wallet's encryption key you can't use "JsonRpcProvider" you will need to use a provider that can sign. @@ -55,7 +55,7 @@ In the context of Fhenix, a permission is the part of a permit that supplies the const permission = client.extractPermitPermissions(permit); ``` -#### Using an Permission +#### Using a Permission Once generated, you can use the permission and send it to the contract. You can also unseal the outputs of "sealoutput" assuming it was sealed using your permission. @@ -70,4 +70,4 @@ const permission = client.extractPemitPermissions(permit); client.storePermit(permit); // Stores a permit for a specific contract address. const response = await contract.connect(owner).getValue(permission); // Calling "getValue" which is a view function in "contract" const plaintext = await client.unseal(contractAddress, response); -``` \ No newline at end of file +``` diff --git a/docs/devdocs/Tips/Useful-Tips.md b/docs/devdocs/Tips/Useful-Tips.md index 8e08a4e5..f6f8f489 100644 --- a/docs/devdocs/Tips/Useful-Tips.md +++ b/docs/devdocs/Tips/Useful-Tips.md @@ -16,17 +16,20 @@ You can assume now that `FHE.asEuint*(0)`is used quite often - Luckily we realiz To explain this tip we will use an example. Let's assume we want to develop a confidential voting and let's say we have 4 candidates. Assuming that on each vote we increase (cryptographically with FHE.add) the tally, one can just monitor the key in the DB that represents this specific tally and once the key was changes he will know who we voted for. An ideal solution for this issue is to change all keys no matter who we voted for, but how?! + In order to understand how we will first need to understand that FHE encryption is a non-deterministic encryption means that encrypting (non-trivial encryption) a number twice will result with 2 different encrypted outputs. + Now that we know that, we can add 0 (cryptographically with FHE.add) to all of those tallies that shouldn't be changed and they will be changed in the DB! #### FHE.req() in TXs -All of the operations are supported both in TXs and in Queries. That being said we strongly advice 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 +All of 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. #### Performance and Gas Usage -Currently, we are supporting a lot of FHE operations. Some of them might take a lot of time to compute, some good examples are: Div (5 seconds for euint32), Mul, Rem, and the time will grow depends on the value types you are using. +Currently we support many FHE operations. Some of them might take a lot of time to compute, some good examples are: Div (5 seconds for euint32), Mul, Rem, and the time will grow depends on the value types you are using. + When writing FHE code we encourage you to use the operations wisely and choose what operation should be used. Example: Instead of `FHE.mul(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 banchmarks please refer to: TBD +For more detailed benchmarks please refer to: TBD diff --git a/docs/tutorial/Basic/Deploying.mdx b/docs/tutorial/Basic/Deploying.mdx index e7074988..d308c833 100644 --- a/docs/tutorial/Basic/Deploying.mdx +++ b/docs/tutorial/Basic/Deploying.mdx @@ -8,7 +8,7 @@ Now that we have our completed WrappingERC20 token, the next step is to see if o To do this, we'll be writing tests in typescript using hardhat, and deploying them on our [LocalFhenix ](../../devdocs/Setting%20Up%20Your%20Environment/Hardhat.md) environment which we set up earlier :::tip[Note] -At this stage, using hardhat network is not supported, as Fhenix uses extentions to the EVM that enable FHE operations +At this stage, using hardhat network is not supported, as Fhenix uses extensions to the EVM that enable FHE operations ::: ### Compiling the Contract