You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/devdocs/Solidity API/Utilities.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
#### Encrypted Address
4
4
5
-
Encrypting address is not an easy task as we currently only support encrypted uint32s (4 bytes) and address are formed out of 20 bytes.
5
+
Encrypting an address is not an easy task as we currently only support encrypted uint32s (4 bytes) and address are formed out of 20 bytes.
6
6
We created a tool that implements `Eaddress` which is formed by 5 uint32s.
7
7
This utility allows you to do some operations on encrypted addresses.
8
8
The tool can be imported from: TBD
@@ -11,10 +11,10 @@ An example of how to use the tool can be found it: TBD
11
11
#### Random Number
12
12
13
13
Confidentiality is a crucial step in order to achieve on-chain randomness. Fhenix, as a chain that implements confidentiality, is a great space to implement and use on-chain random numbers and this is part of our roadmap.
14
-
We know that there are some #BUIDLers that are planning to implement dapps that leverage both confidentiality and random numbers so until we will have on-chain true random we are suggesting to use the following implementation as a MOCKUP.
14
+
We know that there are some #BUIDLers that are planning to implement dapps that leverage both confidentiality and random numbers so until we will have on-chain true random, we are suggesting to use the following implementation as a MOCKUP.
15
15
PLEASE NOTE THAT THIS RANDOM NUMBER IS VERY PREDICTABLE AND CAN'T BE REALLY TRUSTED
16
16
17
-
```javascript
17
+
```solidity
18
18
library RandomMock {
19
19
function getFakeRandom() internal returns (uint256) {
Copy file name to clipboardExpand all lines: docs/devdocs/Tips/Useful-Tips.md
+7-4
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,17 @@ When we are using `FHE.asEuint*(PLAINTEXT_NUMBER)` we are actually using a trivi
8
8
9
9
#### Default Value of a Euint
10
10
11
-
When having a `euint*` variable uninitialized it will be considered as 0. Every FHE function that will receive an unitialized euint* will assume it is `FHE.asEuint*(0)`.
12
-
You can assume now that `FHE.asEuint*(0)`is quite oftenly used - 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.
11
+
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)`.
12
+
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.
13
13
14
14
#### Re-encrypting a Value
15
15
16
16
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.
17
17
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.
18
18
An ideal solution for this issue is to change all keys no matter who we voted for, but how?!
19
-
In order to understand how we will first need to understand that FHE encryption is a non-determenisitic encryption means that encrypting (non-trivial encryption) a number twice will result with 2 different encrypted outputs.
19
+
20
+
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.
21
+
20
22
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!
21
23
22
24
#### FHE.req() in TXs
@@ -25,7 +27,8 @@ All of the operations are supported both in TXs and in Queries. That being said
25
27
26
28
#### Performance and Gas Usage
27
29
28
-
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.
30
+
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.
31
+
29
32
When writing FHE code we encourage you to use the operations wisely and choose what operation should be used.
30
33
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))`
Copy file name to clipboardExpand all lines: docs/devdocs/Tools and Utilities/Fhenix-Remix-Plugin.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,6 @@ After deploying the contract (The plugin is only aware of contracts that are dep
15
15
* Interact with the contract - On contract interaction you should use the values that were encrypted by the plugin for encrypted inputs. For contracts that are returning an output of a sealOutput function, the plugin will already generate a public address and it will decrypt the output for you.
16
16
17
17
#### Known Issues
18
-
* Sometimes the plugin isn't using the correct permit - You should open the `Permit Management` tab and choose another permit and then rechoose the right permit
18
+
* Sometimes the plugin isn't using the correct permit - You should open the `Permit Management` tab and choose another permit and then re-choose the right permit
19
19
* Sometimes the "Encrypt" button remains unclickable - You can right click on the frame and choose `Reload frame`
20
20
* On contract interaction when the contract receives a public key the plugin generate public key which starts with `0x0x` - Remove one of them
Copy file name to clipboardExpand all lines: docs/devdocs/Writing Smart Contracts/booleans.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,8 @@ description: Comparisons on FHE data
9
9
## Comparisons
10
10
11
11
Unlike other operations in FHE.sol, comparison operations do not support their respective operators (e.g. `>`, `<` etc.).
12
-
This is because solidity expects these operators to return a boolean value, which is not possible with FHE. Intuitively, this is because returning a boolean value would leak information about the encrypted data.
12
+
This is because solidity expects these operators to return a boolean value, which is not possible with FHE.
13
+
Intuitively, this is because returning a boolean value would leak information about the encrypted data.
13
14
14
15
Instead, comparison operations are implemented as functions that return an `ebool` type.
0 commit comments