Skip to content

Commit fff14ca

Browse files
authored
docs(common): gitbook (#368)
1 parent 76af33e commit fff14ca

14 files changed

Lines changed: 278 additions & 353 deletions

File tree

5.04 KB
Loading
63.3 KB
Loading
6.09 KB
Loading
5.74 KB
Loading

docs/protocol/README.md

Lines changed: 9 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
---
2-
description: >-
3-
FHEVM is a technology that enables confidential smart contracts on the EVM using Fully Homomorphic Encryption (FHE).
42
layout:
53
title:
64
visible: true
@@ -14,81 +12,20 @@ layout:
1412
visible: false
1513
---
1614

17-
# Welcome to FHEVM
15+
# Welcome
1816

19-
## Why FHEVM?
17+
Welcome to the Zama Protocol Documentation, your guide to building confidential applications on public blockchains using **Fully Homomorphic Encryption (FHE)**.
2018

21-
<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Guard Privacy</strong></td><td>Keep data encrypted during onchain computation.</td><td></td></tr><tr><td><strong>Build Fast</strong></td><td>Use Solidity, SDKs, templates, etc.</td><td></td></tr><tr><td><strong>Deploy Anywhere</strong></td><td>Compatible with all EVM chains.</td><td></td></tr></tbody></table>
19+
Zama Protocol enables developers to write smart contracts that compute on encrypted data without ever decrypting it. This means sensitive user inputs, interactions, and outcomes can remain private onchain.
2220

23-
<a href="./#path-to-build" class="button primary">Start Building</a>
21+
## Where to go next?
2422

25-
## Explore the doc
23+
\[To Update]
2624

27-
<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Solidity Guides</strong></td><td>Write encrypted logic with Solidity tools.</td><td><a href=".gitbook/assets/Zama-Gitbook_Cover_Test.png">Gitbook-cover.png</a></td><td><a href="https://docs.zama.ai/doc-ui/IoEzE96rh6dKmIRhgam5/solidity-guides">Solidity</a></td></tr><tr><td><strong>SDK Guides</strong></td><td>Build frontends with encrypted user data.</td><td><a href=".gitbook/assets/Zama-Gitbook_Cover_Test.png">Gitbook-cover.png</a></td><td><a href="https://docs.zama.ai/doc-ui/IoEzE96rh6dKmIRhgam5/sdk-guides">SDK</a></td></tr><tr><td><strong>Examples</strong></td><td>Explore real dApps and code templates.</td><td><a href=".gitbook/assets/Zama-Gitbook_Cover_Test.png">Gitbook-cover.png</a></td><td><a href="/examples">Examples</a></td></tr></tbody></table>
28-
29-
## Path to Build
30-
31-
{% stepper %} {% step %}
32-
33-
### **Set up your development environment**
34-
35-
Use the official Hardhat template from Zama that includes all necessary configurations and dependencies to start
36-
developing confidential smart contracts.
37-
38-
<a href="https://github.com/zama-ai/fhevm-hardhat-template" class="button secondary">Clone the template</a>
39-
{% endstep %}
40-
41-
{% step %}
42-
43-
### Write your first confidential smart contract
44-
45-
Use the provided contract examples, like `MyCounter`, to begin. A basic counter contract might look like this:
46-
47-
```solidity
48-
// SPDX-License-Identifier: BSD-3-Clause-Clear
49-
pragma solidity ^0.8.24;
50-
51-
import { FHE, euint64 } from "@fhevm/solidity/lib/FHE.sol";
52-
import { SepoliaConfig } from "@fhevm/solidity/config/ZamaConfig.sol";
53-
54-
contract MyCounter is ZamaConfig {
55-
euint64 counter;
56-
constructor() {
57-
counter = FHE.asEuint64(0);
58-
}
59-
60-
function add() public {
61-
counter = FHE.add(counter, 1);
62-
FHE.allowThis(counter);
63-
}
64-
}
65-
```
66-
67-
<a href="https://docs.zama.ai/doc-ui/IoEzE96rh6dKmIRhgam5/solidity-guides/get-started/overview" class="button primary">See
68-
the full Solidity guide</a> {% endstep %}
69-
70-
{% step %}
71-
72-
### Build your frontend with `@zama-ai/relayer-sdk`
73-
74-
Start from Zama's ready-to-use React template.
75-
76-
<a href="https://docs.zama.ai/doc-ui/IoEzE96rh6dKmIRhgam5/sdk-guides" class="button primary">See the full SDK guide</a>
77-
<a href="https://github.com/zama-ai/fhevm-react-template" class="button secondary">Clone the template</a> ;
78-
{% endstep %}
79-
80-
{% step %}
81-
82-
### To continue
83-
84-
<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Architecture</strong></td><td>Understand how the system fits together.</td><td></td><td><a href="https://docs.zama.ai/doc-ui/IoEzE96rh6dKmIRhgam5/architecture/architecture_overview">Broken link</a></td></tr><tr><td><strong>Dapps Demos</strong></td><td>Try real projects built with fhevm.</td><td></td><td></td></tr><tr><td><strong>White paper</strong></td><td>Dive deep into the cryptographic design.</td><td></td><td></td></tr></tbody></table>
85-
{% endstep %}
86-
{% endstepper %}
87-
88-
## Help Center
25+
## Help center
8926

9027
Ask technical questions and discuss with the community.
9128

92-
- [Community forum](https://community.zama.ai/c/fhevm/15)
93-
- [Discord channel](https://discord.com/invite/fhe-org)
94-
- [Telegram](https://t.me/+Ojt5y-I7oR42MTkx)
29+
* [Community forum](https://community.zama.ai/c/fhevm/15)
30+
* [Discord channel](https://discord.com/invite/fhe-org)
31+
* [Telegram](https://t.me/+Ojt5y-I7oR42MTkx)

docs/protocol/SUMMARY.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
- [Welcome](README.md)
1+
# Table of contents
2+
3+
* [Welcome](README.md)
24

35
## Protocol
46

5-
- [FHE on Blockchain](architecture/overview.md)
6-
- [FHE library](architecture/library.md)
7-
- [Host contracts](architecture/hostchain.md)
8-
- [Coprocessor](architecture/coprocessor.md)
9-
- [Gateway](architecture/gateway.md)
10-
- [KMS](architecture/kms.md)
11-
- [Relayer & Oracle](architecture/relayer_oracle.md)
12-
- [Roadmap](roadmap.md)
7+
* [FHE on Blockchain](architecture/overview.md)
8+
* [FHE library](architecture/library.md)
9+
* [Host contracts](architecture/hostchain.md)
10+
* [Coprocessor](architecture/coprocessor.md)
11+
* [Gateway](architecture/gateway.md)
12+
* [KMS](architecture/kms.md)
13+
* [Relayer & Oracle](architecture/relayer_oracle.md)
14+
* [Roadmap](roadmap.md)
1315

1416
## Developer
1517

16-
- [Contributing](contribute.md)
17-
- [Development roadmap](roadmap.md)
18-
- [Feature request](https://github.com/zama-ai/fhevm/issues/new?assignees=&labels=enhancement&projects=&template=feature-request.md&title=)
19-
- [Bug report](https://github.com/zama-ai/fhevm/issues/new?assignees=&labels=bug&projects=&template=bug_report_fhevm.md&title=)
20-
- [Status](https://status.zama.ai/)
21-
- [White paper](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper-v2.pdf)
22-
- [Release note](https://github.com/zama-ai/fhevm/releases)
18+
* [Contributing](contribute.md)
19+
* [Feature request](https://github.com/zama-ai/fhevm/issues/new?assignees=\&labels=enhancement\&projects=\&template=feature-request.md\&title=)
20+
* [Bug report](https://github.com/zama-ai/fhevm/issues/new?assignees=\&labels=bug\&projects=\&template=bug_report_fhevm.md\&title=)
21+
* [Status](https://status.zama.ai/)
22+
* [White paper](https://github.com/zama-ai/fhevm/blob/main/fhevm-whitepaper-v2.pdf)
23+
* [Release note](https://github.com/zama-ai/fhevm/releases)
Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,95 @@
11
# Coprocessor
22

3-
The Coprocessor is the FHEVM protocol’s off-chain computation engine. It performs the heavy cryptographic
4-
operations—specifically, fully homomorphic encryption (FHE) computations—on behalf of smart contracts that operate on
5-
encrypted data. Acting as a decentralized compute layer, the coprocessor bridges symbolic on-chain logic with real-world
6-
encrypted execution.
7-
8-
It works in tandem with the Gateway, verifying encrypted inputs, executing FHE instructions, and maintaining
9-
synchronization of access permissions.
3+
This document explains one of the key components of the Zama Protocol - Coprocessor, the Zama Protocol’s off-chain computation engine.
104

115
## What is the Coprocessor?
126

13-
The Coprocessor is an off-chain service that:
7+
Coprocessor performs the heavy cryptographic operations—specifically, fully homomorphic encryption (FHE) computations—on behalf of smart contracts that operate on encrypted data. Acting as a decentralized compute layer, the coprocessor bridges symbolic on-chain logic with real-world encrypted execution.
8+
9+
Coprocessor works together with the Gateway, verifying encrypted inputs, executing FHE instructions, and maintaining synchronization of access permissions, in particula
1410

15-
- Listens to events emitted by host chains and the Gateway.
16-
- Executes FHE computations (`add`, `mul`, `div`, `cmp`, etc.) on ciphertexts.
17-
- Validates encrypted inputs and ZK proofs of correctness.
18-
- Maintains and updates a replica of the host chain’s Access Control Lists (ACLs).
19-
- Stores and serves encrypted data for decryption or bridging.
11+
* Listens to events emitted by host chains and the Gateway.
12+
* Executes FHE computations (`add`, `mul`, `div`, `cmp`, etc.) on ciphertexts.
13+
* Validates encrypted inputs and ZK proofs of correctness.
14+
* Maintains and updates a replica of the host chain’s Access Control Lists (ACLs).
15+
* Stores and serves encrypted data for decryption or bridging.
2016

21-
Each coprocessor independently executes tasks and publishes verifiable results, enabling a publicly auditable and
22-
horizontally scalable confidential compute infrastructure .
17+
Each coprocessor independently executes tasks and publishes verifiable results, enabling a publicly auditable and horizontally scalable confidential compute infrastructure .
2318

2419
## Responsibilities of the Coprocessor
2520

26-
### Encrypted Input Verification
21+
### Encrypted input verification
2722

2823
When users submit encrypted values to the Gateway, each coprocessor:
2924

30-
- Verifies the associated Zero-Knowledge Proof of Knowledge (ZKPoK).
31-
- Extracts and unpacks individual ciphertexts from a packed submission.
32-
- Stores the ciphertexts under derived handles.
33-
- Signs the verified handles, embedding user and contract metadata.
34-
- Sends the signed data back to the Gateway for consensus.
25+
* Verifies the associated Zero-Knowledge Proof of Knowledge (ZKPoK).
26+
* Extracts and unpacks individual ciphertexts from a packed submission.
27+
* Stores the ciphertexts under derived handles.
28+
* Signs the verified handles, embedding user and contract metadata.
29+
* Sends the signed data back to the Gateway for consensus.
3530

3631
This ensures only valid, well-formed encrypted values enter the system .
3732

38-
### FHE Computation Execution
33+
### FHE computation execution
3934

40-
When a smart contract executes a function over encrypted values, the on-chain logic emits symbolic computation events.
35+
When a smart contract executes a function over encrypted values, the on-chain logic emits symbolic computation events.\
4136
Each coprocessor:
4237

43-
- Reads these events from the host chain node it runs.
44-
- Fetches associated ciphertexts from its storage.
45-
- Executes the required FHE operations using the TFHE-rs library (e.g., add, mul, select).
46-
- Stores the resulting ciphertext under a deterministically derived handle.
47-
- Optionally publishes a commitment (digest) of the ciphertext to the Gateway for verifiability.
38+
* Reads these events from the host chain node it runs.
39+
* Fetches associated ciphertexts from its storage.
40+
* Executes the required FHE operations using the TFHE-rs library (e.g., add, mul, select).
41+
* Stores the resulting ciphertext under a deterministically derived handle.
42+
* Optionally publishes a commitment (digest) of the ciphertext to the Gateway for verifiability.
4843

4944
This offloads expensive computation from the host chain while maintaining full determinism and auditability .
5045

51-
### ACL Replication
46+
### ACL replication
5247

5348
Coprocessors replicate the Access Control List (ACL) logic from host contracts. They:
5449

55-
- Listen to Allowed and AllowedForDecryption events.
56-
- Push updates to the Gateway.
50+
* Listen to Allowed and AllowedForDecryption events.
51+
* Push updates to the Gateway.
5752

58-
This ensures decentralized enforcement of access rights, enabling proper handling of decryptions, bridges, and contract
59-
interactions .
53+
This ensures decentralized enforcement of access rights, enabling proper handling of decryptions, bridges, and contract interactions .
6054

61-
### Ciphertext Commitment
55+
### Ciphertext commitment
6256

6357
To ensure verifiability and mitigate misbehavior, each coprocessor:
6458

65-
- Commits to ciphertext digests (via hash) when processing Allowed events.
66-
- Publishes these commitments to the Gateway.
67-
- Enables external verification of FHE computations.
59+
* Commits to ciphertext digests (via hash) when processing Allowed events.
60+
* Publishes these commitments to the Gateway.
61+
* Enables external verification of FHE computations.
6862

6963
This is essential for fraud-proof mechanisms and eventual slashing of malicious or faulty operators .
7064

71-
### Bridging & Decryption Support
65+
### Bridging & decryption support
7266

7367
Coprocessors assist in:
7468

75-
- Bridging encrypted values between host chains by generating new handles and signatures.
76-
- Preparing ciphertexts for public and user decryption using operations like Switch-n-Squash to normalize ciphertexts
69+
* Bridging encrypted values between host chains by generating new handles and signatures.
70+
* Preparing ciphertexts for public and user decryption using operations like Switch-n-Squash to normalize ciphertexts\
7771
for the KMS.
7872

79-
These roles help maintain cross-chain interoperability and enable privacy-preserving data access for users and smart
80-
contracts .
73+
These roles help maintain cross-chain interoperability and enable privacy-preserving data access for users and smart contracts .
8174

82-
## Security and Trust Assumptions
75+
## Security and trust assumptions
8376

84-
Coprocessors are designed to be minimally trusted and publicly verifiable. Every FHE computation or input verification
85-
they perform is accompanied by a cryptographic commitment (hash digest) and a signature, allowing anyone to
86-
independently verify correctness.
77+
Coprocessors are designed to be minimally trusted and publicly verifiable. Every FHE computation or input verification they perform is accompanied by a cryptographic commitment (hash digest) and a signature, allowing anyone to independently verify correctness.
8778

88-
The protocol relies on a majority-honest assumption: as long as more than 50% of coprocessors are honest, results are
89-
valid. The Gateway aggregates responses and accepts outputs only when a majority consensus is reached.
79+
The protocol relies on a majority-honest assumption: as long as more than 50% of coprocessors are honest, results are valid. The Gateway aggregates responses and accepts outputs only when a majority consensus is reached.
9080

91-
To enforce honest behavior, coprocessors must stake $ZAMA tokens and are subject to slashing if caught
92-
misbehaving—either through automated checks or governance-based fraud proofs.
81+
To enforce honest behavior, coprocessors must stake $ZAMA tokens and are subject to slashing if caught misbehaving—either through automated checks or governance-based fraud proofs.
9382

94-
This model ensures correctness through transparency, resilience through decentralization, and integrity through economic
95-
incentives.
83+
This model ensures correctness through transparency, resilience through decentralization, and integrity through economic incentives.
9684

9785
## Architecture & Scalability
9886

9987
The coprocessor architecture includes:
10088

101-
- Event listeners for host chains and the Gateway
102-
- A task queue for FHE and ACL update jobs
103-
- Worker threads that process tasks in parallel
104-
- A public storage layer (e.g., S3) for ciphertext availability
89+
* Event listeners for host chains and the Gateway
90+
* A task queue for FHE and ACL update jobs
91+
* Worker threads that process tasks in parallel
92+
* A public storage layer (e.g., S3) for ciphertext availability
10593

106-
This modular setup supports horizontal scaling: adding more workers or machines increases throughput. Symbolic
94+
This modular setup supports horizontal scaling: adding more workers or machines increases throughput. Symbolic\
10795
computation and delayed execution also ensure low gas costs on-chain .

0 commit comments

Comments
 (0)