Skip to content

Commit

Permalink
code display
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoshiya authored Jun 1, 2024
1 parent 7b2417f commit b2bf7b5
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions docs/tutorial/earlyWin.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ displayed_sidebar: tutorialSidebar

In this short guide we’ll encrypt plaintext to ciphertext using FHE, demonstrating how simple it is to enable confidentiality in your smart contracts with Fhenix.

```solidity
- **Contract Example:**
```Javascript
pragma solidity ^0.8.17;

import "@fhenixprotocol/contracts/FHE.sol";
Expand Down Expand Up @@ -41,19 +42,8 @@ In this short guide we’ll encrypt plaintext to ciphertext using FHE, demonstra

First, FHE is imported directly into your contract with a single line of code. Next we establish two numbers or unsigned integers, withhowever the _cipherText number beingwill be encrypted. This means that it will not be publicly accessible from anyone other than the intended viewer. The standard _plaintext unit8 represents a number that is public for all to view. On line 11 we have a setter function that allows us to pass in a new encrypted number that will stay private. On line 21 we have a decrypt function that allows us to view the number that was written to state in the setCipherText function. As you can see there is no requirement for off-chain proof generation or storage.

```solidity
import "@fhenixprotocol/contracts/FHE.sol";
```
We are able to import the FHE precompiles directly into the smart contract with a single line of code. The power of FHE in one single line of copy pasta.

```solidity
function getSensitiveData(Permission calldata perm) public view onlySender(perm) returns (string memory) {
// Logic to return sensitive data
}
```Javascript
import "@fhenixprotocol/contracts/FHE.sol";

```

```solidity
function getSensitiveData(Permission calldata perm) public view onlySender(perm) returns (string memory) {
// Logic to return sensitive data
}
```

0 comments on commit b2bf7b5

Please sign in to comment.