Zama 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 3쪽

ithout any knowledge of cryptography. Developers simply need to import our library (called FHEVM) and write their logic using the provided operators. You can get started today for free by checking out the developer documentation [here](https://docs.zama.ai/protocol). The following example shows an example confidential token contract, which can be deployed on any supported chain such as Ethereum. ```solidity pragma solidity ^0.8.26; import "fhevm/lib/FHE.sol"; import { IConfidentialFungibleToken } from "./IConfidentialFungibleToken.sol"; abstract contract ConfidentialFungibleToken is IConfidentialFungibleToken { uint64 internal _totalSupply; string internal _name; string internal _symbol; // Balances are encrypted mapping(address account => euint64 balance) internal _balances; // Transfer an encrypted amount function transfer(address to, externalEuint64 encryptedAmount, bytes calldata inputProof) public virtual returns (euint64) { // Verify the input is correct and cast to euint64 euint64 amount = FHE.fromExternal(encryptedAmount, inputProof); // Check if the user has enough balance, otherwise set the transfer amount to zero euint64 transferValue = FHE.select(FHE.le(amount, _balances[msg.sender]), amount, FHE.asEuint64(0)); // Make the transfer _balances[to] = FHE.add(_balances[to], transferValue); _balances[from] = FHE.sub(_balances[from], transferValue); // Allow users to see their balances, and the contract to update it FHE.allow(_balances[to], to); FHE.allow(_balances[from], from); FHE.allowThis(_balances[to]); FHE.allowThis(_balances[from]); return transferValue; } } ``` Simply replace the integer operations by their FHE equivalent, then specify who can decrypt the balances. Of course, developers can build much more complicated applications, such as AMMs, lending, and more. On top of the smart contract library, we also provide a Javascript SDK that streamlines the encryption and decryption client-side, making it almost invisible to end-users. The access control system used by the Zama Protocol is extremely powerful. By allowing contracts to define who can decrypt which value in it, it makes confidentiality (and compliance) fully programmable. There is no assumption at the protocol or user level, everything is encoded in the application logic itself, allowing companies to choose whether they want to offer end-to-end encryption (aka nobody sees anything, not even the companies building the dapp), or onchain encryption (aka the web2 model: only the user and service provider see the data, but nobody else onchain). The FHEVM library used by the Zama Protocol supports the following encrypted types and operations: | **Type** | **Symbol** | **Logical** | **Arithmetic** | **Comparison** | **Shifts** | **Branching** | | ---------------------- | ----------- | ----------------- | --------------------------------------- | --------------------------------- | -------------------- | ------------- | | **Integer (unsigned)** | euint8…256 | and, or, xor, not | add, sub, mul, div, rem, neg, abs, sign | eq, neq, gt, lt, ge, le, min, max | shl, shr, rotl, rotr | select | | **Integer (signed)** | eint8…256 | and, or, xor, not | add, sub, mul, div, rem, neg, abs, sign | eq, neq, gt, lt, ge, le, min, max | shl, shr, rotl, rotr | select | | **Boolean** | ebool | and, or, xor, not | | eq, neq | | select | | **Bytes** | ebytes1…256 | and, or, xor, not | | eq, neq | shl, shr, rotl, rotr | select | | **Address** | eaddress | | | eq, neq | | select | To make deploying dapps easier, we are also building a “Zama Standard Library”: a set of audited, highly optimized smart contracts for common use cases such as: * confidential tokens and RWAs * confidential NFTs * wrappers to bridge between confidential assets and traditional ones * a confidential identity stack that enables DID/VC onchain * UniV2-style confidential AMMs * Confidential vesting * Confidential airdrops * Sealed-bid auctions * Confidential governance We will continue adding more over time as we see new use cases appearing. ## Technical details Blockchains typically only support limited computations, making it impossible to run FHE natively on Ethereum and other L1/L2s. To address this issue, we designed the Zama Protocol based on two core ideas: symbolic execution and threshold decryption. ### **‍Symbolic execution** The idea behind symbolic execution is that whenever a contract calls the Zama FHEVM Solidity library on the host chain (the L1/L2 where the confidential dapp is deployed) to perform an FHE operation, the host chain itself doesn’t do any actual FHE computation; instead, it produces a pointer to the result and emits an event to notify a network of coprocessors, who do the actual FHE computation. This has many advantages: * The host chain does not need to change anything, run expensive FHE operations or use specific hardware. * The host chain is not slowed down by FHE, so non-FHE transactions can be executed as fast as they always have been * FHE operations can be executed in parallel, rather than sequentially, dramatically increasing throughput. Since all ciphertexts on the host chain are simply pointers (the actual data is stored by coprocessors), FHE operations can be chained just like regular operations, without needing to wait for the previous ones to complete. The only time we need to wait for a ciphertext to be computed is when it has to be decrypted. From a security perspective, everything the coprocessors do is publicly verifiable, and anyone can just recompute the ciphertexts to verify the result. Initially, we use multiple coprocessors with a majority consensus, but longer term the goal is to enable anyone to compete to execute FHE operations, leveraging ZK-FHE to prove the correctness. ### **Threshold decryption** To maintain composability onchain, all ciphertexts need to be encrypted under the same public key. This means the private decryption key has to be secured in a way that prevents illegitimate decryption of ciphertexts. The Zama Protocol solves this by splitting the private key amongst multiple parties, using a dedicated threshold MPC protocol as its Key Management Service (KMS). In order for a user or contract to decrypt a value, they need to first have been explicitly allowed to do so by the contract that produced the value on the host chain. Decrypting the result is then a simple request to the Zama Gateway, which acts as an orchestrator for the protocol and forwards the request to the KMS parties. This again ensures that all decryption requests are publicly visible, and thus anyone can verify they match the access control logic defined by smart contracts. ### Components The Zama Protocol is composed of several core components: * **Host Chains**: the L1s and L2s that are supported by the Zama Protocol, and on which developers deploy their confidential dapps. * **FHEVM Library**: the library that developers use to create confidential smart contracts. * **FHEVM Executor**: the contract that is called by dapps to execute FHE operations on the Host Chain. Each time a contract uses an FHE operation, the Executor automatically emits an event to notify Coprocessors to compute it. * **Access Control List (ACL)**: a smart contract deployed on each Host Chain, which keeps tracks of who can decrypt what. The ACL is central to the operations of the Zama Protocol and is used both to verify a contract is allowed to compute on an encrypted value, and that an address is allowed to decrypt it. Each time a contract allows an address to use a ciphertext, an event is emitted and relayed by Coprocessors to the Gateway, enabling the aggregation of all Host Chain ACLs into a single Gateway ACL used by the KMS to authenticate decryption requests. * **$ZAMA token**: the native token of the Zama Protocol, used for payment of the fees and staking. * **Gateway**: a set of smart contracts used to orchestrate the Zama Protocol, and allow users to request verification of their encrypted inputs, decryption of ciphertexts and bridging of encrypted assets between Host Chains. Each of these operations is a transaction to the Gateway contracts, and requires paying a small fee in $ZAMA tokens. While the Gateway contracts could be deployed on any L1 or L2, we opted to run a dedicated Arbitrum rollup for the Zama Protocol, ensuring maximal performance and cost efficiency. Note that our rollup serves only the Zama Protocol and doesn’t allow third party contracts to be deployed on it. * **Coprocessors**: a set of nodes responsible for 1. verifying encrypted inputs from users, 2. running the actual FHE computations and storing the resulting ciphertexts, 3. relaying ACL events to the Gateway. The Zama Protocol uses multiple coprocessors, which each commit their results to the Gateway, which in turns runs a majority consensus. All tasks performed by the coprocessors are publicly verifiable. Coprocessors can be vertically and horizontally scaled based on throughput requirements of the various confidential dapps. * **Key Management Service (KMS)**: a set of nodes running various Multi-Party Computation (MPC) protocols for key generation, CRS generation and threshold decryption. The KMS ensures that no single party can ever access the decryption keys. KMS nodes are orchestrated by the Gateway, ensuring all operations are publicly visible. Furthermore, all KMS nodes must run the MPC software inside AWS Nitro Enclaves, making it harder for operators to leak their shares while providing some level of integrity on the MPC computation. Eventually, our goal will be to use ZK-MPC to enable verifiability without hardware assumptions. * **Operators**: a set of entities that run the Zama Protocol nodes. This includes Coprocessors and KMS nodes. The following diagram shows the lifecycle of a confidential token transfer across the various components. <figure><img src="https://1925969531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUdSYvSNa6t73FdFzbjGT%2Fuploads%2FfIVliW4oxQzPrCCVc9cZ%2F4.%20Dapp.png?alt=media&amp;token=d7b73070-db76-4928-ac2f-ecfc15c321f1" alt=""><figcaption></figcaption></figure> ### Performance The Zama Protocol is designed to be horizontally scalable, leveraging our cutting-edge [TFHE-rs](https://docs.zama.ai/tfhe-rs) library. Contrary to the sequential behavior of the EVM, the Zama Protocol parallelizes the computation of FHE operations. As long as a specific ciphertext isn’t used in a sequential chain of FHE operations, Coprocessors will be able to increase the throughput simply by adding more servers. Since we started working on the Zama Protocol, we have been able to increase throughput exponentially from 0.2 transactions per second to over 20 transactions per second on CPU, enough to make all of Ethereum encrypted.&#x20; By the end of 2026, we will migrate to GPUs, with an expected 500-1000 TPS per chain, enough to cover all L2s and most Solana use cases.&#x20; Finally, we are working on a dedicated hardware accelerator (ASIC) for FHE, which will enable 100,000+ tps / chain on a single server, enough to bring global payments confidentially onchain. The important point here is that FHE is no longer limited by underlying algorithms, and is now mostly driven by Moore’s law: the better the hardware, the better the throughput of the Zama Protocol. <figure><img src="https://1925969531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUdSYvSNa6t73FdFzbjGT%2Fuploads%2FkT3j4akDquDxKi0OdkPA%2FScreenshot%202025-10-23%20at%2009.11.59.png?alt=media&amp;token=79564459-615f-4f65-a906-bf995dba6b2a" alt=""><figcaption></figcaption></figure> ### Security The Zama Protocol uses a defense-in-depth approach, combining multiple techniques to ensure maximum security: * We use 128 bits of security and a p-fail of 2^-128 for all FHE operations. This is far more than any other FHE scheme used in blockchain currently. Furthermore, our FHE scheme is post-quantum, meaning it is secure even against quantum computers. * All the FHE operations are publicly verifiable, allowing anyone to recompute the result and identify malicious FHE nodes. This is akin to optimistic rollup security, but for FHE computation. Furthermore, we don’t run a single FHE node, but rather have 3 operators run FHE nodes and sign their outputs, allowing to have both optimistic security and consensus on the result. * We use 13 nodes with a 2/3 majority rule for all our MPC protocols, while most other projects only use 3 to 5 nodes. Furthermore, our MPC protocol is robust, meaning it will give a correct output with up to 1/3 malicious nodes. As far as we know, this is the first implementation in production of a robust MPC protocol. * Additionally, our MPC protocol runs inside AWS Nitro Enclaves, adding a layer of defense in depth and preventing access to the underlying share of the FHE private key from outside the protocol. The enclave also offers an attestation of the software version the MPC nodes are running, allowing the protocol to keep track of software updates. The combination of MPC and Nitro enclaves means recovering the shares and using them outside of the protocol would require AWS and multiple MPC nodes to collude. * Genesis operators are highly reputable organizations with billions at stake through their non-Zama activities, whether as professional validators, infrastructure providers, businesses, or other. As they are all doxxed, anyone can see if they misbehaved. This brings economic security beyond their on-chain stake, as being caught misbehaving in the Zama Protocol will likely impact their other activities. * Slashing is done via governance, allowing anyone to suggest a recourse if they identify bad behavior in an operator. This offers greater flexibility by allowing to capture edge cases and treat issues on a case per case basis. * The Zama Protocol is being audited by Trail of Bits and Zenith. This is one of the largest audits of a crypto protocol, with over 34 audit-weeks spent on it so far. ### Compliance Building confidential applications often requires complying with local regulations. For example, financial institutions need to know who their customers are, verify that they are eligible to access specific financial instruments, that they are not blacklisted etc. Similarly, token issuers could give themselves the right to see the balances and transactions of their users, and comply offchain with existing AML / compliance tools used by traditional finance today. Contrary to many blockchain confidentiality protocols that puts the burden of compliance on the end-users, the Zama Protocol enables applications to define their own compliance rules directly within their smart contracts. The ability to have “programmable compliance” is a key advantage offered by FHE, and means that the protocol itself has no say on who can access which encrypted value. Developers decide what is best for their applications, not the Zama Protocol. ### Future Improvements The Zama Protocol is the most advanced confidentiality protocol to date, and can already scale to address most blockchain use cases. Nonetheless, there are several areas of improvements we are working on to make it even more decentralized, secure and scalable. These typically rely on a combination of better hardware, better algorithms, and ZK-ifying everything: #### Reaching 100k tps * **New FHE techniques**: we are constantly inventing new FHE techniques that improve performance. We expect the base algorithms to improve by 10-20x over the coming years, similar to the performance gains ZK had in the past few years. * **FHE ASICs**: we are working with several companies on accelerating FHE with dedicated hardware. The goal is to make FHE 100x-1000x faster using ASICs, in the same way Bitcoin mining or AI has been improved with dedicated hardware. We expect the first accelerators to be available in 2027-2028. * **ZK-rollup Gateway**: the Gateway currently uses an optimistic rollup. Our goal is to move to a ZK rollup and improve the performance to support tens of thousands of transactions per second with a latency of less than 100ms. #### Making the KMS even more bullet-proof * **ZK-MPC**: currently, all MPC protocols require a majority assumption on the nodes running the protocol. While this is fine in practice, in theory it enables MPC nodes to collude and provide an incorrect result. Our current design relies of AWS Nitro Enclaves to ensures the MPC nodes run the correct software, but this makes verifiability dependent on hardware security, which is suboptimal. To address this, we are working on adding ZK proofs to the MPC protocols, allowing anyone to verify that the individual contributions of MPC nodes are correct. * **Large MPC committees**: MPC doesn’t scale well: the more parties are involved, the slower it gets. As a result, most MPC protocols run with less than 10 nodes. While the Zama Protocol already uses more (13 nodes), it would be preferable to increase that number to a hundred, ensuring even more robustness and decentralization. #### Enabling anyone to be an operator * **Running MPC inside HSMs**: a major issue with MPC protocols is the need to trust the nodes with not leaking their share of the private key. This is typically done by using TEEs and a trusted committee of nodes. However this does not enable permissionless participation, as malicious attackers could try to break the TEE and access the secret in it. As an alternative, we are exploring how to run MPC inside HSMs such as those used by banks and other critical infrastructure. * **ZK-FHE**: by proving the correctness of the FHE computation, it becomes possible to replace the Coprocessor consensus by a Proof-of-Work style protocol where anyone can compete to execute FHE operations, as long as they provide a proof that the result is correct. Right now, the overhead of ZK on top of the overhead of FHE makes this impractical, but our team is making good progress. #### Making the protocol fully post-quantum * **Post-quantum ZKPoK**: Zama’s FHE and MPC technologies are already resistant to quantum computers. However, the ZKPoK is not (similar to most ZK-SNARKs). We are working on replacing it with a lattice-based ZK scheme that is post-quantum. * **Post-quantum signatures**: while we can make the Zama Protocol components post-quantum, signature schemes used by Host Chains are **not** currently post-quantum. We unfortunately do not have control over this, as it is up to the Ethereum, Solana and other L1/L2s communities to migrate to post-quantum signatures. ## Operations and governance The Zama Protocol uses Delegated Proof-of-Stake, with 18 operators running the protocol: initially 13 KMS nodes and 5 FHE Coprocessors (then more over time). They are chosen according to the following rules: * genesis operators are selected based on reputation, DevOps experience and offchain value (equity, revenue, market cap, …). This enables bootstrapping security via reputation, as an operator with a large business value will likely lose customers if they get caught misbehaving in the Zama Protocol. * we will progressively allow anyone to become a KMS or Coprocessor operator. To do so, they will first need to demonstrate they can reliably run a node in testnet, then stake at least 0.5% of the circulating $ZAMA supply. Every epoch (eg 3 months), the top KMS and Coprocessor operators by stake are selected to run the protocol for the next epoch. * the active operators earn staking rewards in $ZAMA tokens, based on their role and stake. The 18 genesis operators at the time of mainnet launch are: * FHE nodes: Artifact, Blockscape, Luganodes, P2P and Zama * KMS nodes: Conduit, DFNS, Etherscan, Figment, Fireblocks, InfStones, Layer Zero, Ledger, Omakase, Open Zeppelin, Stake Capital, Unit 410 and Zama Updates to the Zama Protocol have to be adopted by a majority of operators to be effective. This includes sof
프로젝트로 돌아가기