Skip to content

Commit c63d21a

Browse files
authored
docs(common): solidity config files (#319)
* docs(common): solidity config files * fix(common): invalid doc references
1 parent 1795578 commit c63d21a

1 file changed

Lines changed: 9 additions & 41 deletions

File tree

docs/solidity-guides/configure.md

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,27 @@ This document explains how to enable encrypted computations in your smart contra
44

55
## Core configuration setup
66

7-
To utilize encrypted computations in Solidity contracts, you must configure the **FHE library** and **Relayer addresses**. The `fhevm` package simplifies this process with prebuilt configuration contracts, allowing you to focus on developing your contract’s logic without handling the underlying cryptographic setup.
7+
To utilize encrypted computations in Solidity contracts, you must configure the **FHE library** and **Oracle addresses**. The `fhevm` package simplifies this process with prebuilt configuration contracts, allowing you to focus on developing your contract’s logic without handling the underlying cryptographic setup.
8+
9+
This library and its associated contracts provide a standardized way to configure and interact with Zama's FHEVM (Fully Homomorphic Encryption Virtual Machine) infrastructure on different Ethereum networks. It supplies the necessary contract addresses for Zama's FHEVM components (`ACL`, `FHEVMExecutor`, `KMSVerifier`, `InputVerifier`) and the decryption oracle, enabling seamless integration for Solidity contracts that require FHEVM support.
810

911
## Key components configured automatically
1012

1113
1. **FHE library**: Sets up encryption parameters and cryptographic keys.
12-
2. **Relayer**: Manages secure cryptographic operations, including user decryption and public decryption.
14+
2. **Oracle**: Manages secure cryptographic operations such as public decryption.
1315
3. **Network-specific settings**: Adapts to local testing, testnets (Sepolia for example), or mainnet deployment.
1416

1517
By inheriting these configuration contracts, you ensure seamless initialization and functionality across environments.
1618

1719
## ZamaConfig.sol
1820

19-
This configuration contract initializes the **fhevm environment** with required encryption parameters.
20-
21-
**Import based on your environment:**
21+
The `ZamaConfig` library exposes functions to retrieve FHEVM configuration structs and oracle addresses for supported networks (currently only the Sepolia testnet).
2222

23-
```solidity
24-
// For Ethereum Sepolia
25-
import { SepoliaConfig } from "@fhevm/solidity/config/ZamaConfig.sol";
26-
```
23+
Under the hood, this library encapsulates the network-specific addresses of Zama's FHEVM infrastructure into a single struct (`FHEVMConfigStruct`).
2724

28-
**Purpose:**
25+
## SepoliaConfig
2926

30-
- Sets encryption parameters such as cryptographic keys and supported ciphertext types.
31-
- Ensures proper initialization of the FHEVM environment.
27+
The `SepoliaConfig` contract is designed to be inherited by a user contract. The constructor automatically sets up the FHEVM coprocessor and decryption oracle using the configuration provided by the library for the respective network. When a contract inherits from `SepoliaConfig`, the constructor calls `FHE.setCoprocessor` and `FHE.setDecryptionOracle` with the appropriate addresses. This ensures that the inheriting contract is automatically wired to the correct FHEVM contracts and oracle for the target network, abstracting away manual address management and reducing the risk of misconfiguration.
3228

3329
**Example: using Sepolia configuration**
3430

@@ -45,34 +41,6 @@ contract MyERC20 is SepoliaConfig {
4541
}
4642
```
4743

48-
## ZamaConfig.sol
49-
50-
To perform public decryption or user decryption, your contract must interact with the **Relayer**, which acts as a secure bridge between the blockchain, coprocessor, and Key Management System (KMS).
51-
52-
**Import based on your environment**
53-
54-
```solidity
55-
// For Sepolia
56-
import { SepoliaConfig } from "@fhevm/solidity/config/ZamaConfig.sol";
57-
```
58-
59-
**Purpose**
60-
61-
- Configures the relayer for secure cryptographic operations.
62-
- Facilitates public and user decryption requests.
63-
64-
**Example: Configuring the relayer with Sepolia settings**
65-
66-
```solidity
67-
import "@fhevm/solidity/lib/FHE.sol";
68-
import { SepoliaConfig } from "@fhevm/solidity/config/ZamaConfig.sol";
69-
70-
contract Test is SepoliaConfig {
71-
constructor() {
72-
// Relayer and FHEVM environment initialized automatically
73-
}
74-
}
75-
```
7644

7745
## Using `isInitialized`
7846

@@ -97,4 +65,4 @@ require(FHE.isInitialized(counter), "Counter not initialized!");
9765

9866
## Summary
9967

100-
By leveraging prebuilt a configuration contract like `ZamaConfig.sol`, you can efficiently set up your smart contract for encrypted computations. These tools abstract the complexity of cryptographic initialization, allowing you to focus on building secure, confidential smart contracts.
68+
By leveraging prebuilt a configuration contract like `SepoliaConfig` in `ZamaConfig.sol`, you can efficiently set up your smart contract for encrypted computations. These tools abstract the complexity of cryptographic initialization, allowing you to focus on building secure, confidential smart contracts.

0 commit comments

Comments
 (0)