The Interfold 백서

The Interfold

원문

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

members that collude can decrypt any ciphertext under the committee key. This limit applies to every threshold scheme. Larger committees raise T. Publicly verifiable threshold BFV Publicly verifiable threshold BFV (PV-TBFV) adds a ZK proof to each sensitive step. Anyone can check the proofs without the private values. The DKG part is publicly verifiable DKG (PVDKG). The steps form four phases: Phase What happens Circuits P1: Key generation Members make keys and shares, encrypt the shares, and decrypt them C0, C1, C2a, C2b, C3a, C3b, C4a, C4b P2: Public key aggregation The aggregator adds the H roster contributions into one key C5 P3: User encryption A data provider proves that an input is a valid BFV encryption user_data_encryption_ct0 , _ct1 , and the user_data_encryption wrapper P4: Threshold decryption Members make decryption shares, and the aggregator combines T + 1 C6, C7 The FHE computation runs between P3 and P4. The compute provider proves it with its own proof system (the OpenVM zkVM in the current code), not with these circuits. A failed proof is attributable to one member. Other members then start an accusation, which can lead to a slash. See Commitment consistency and Exits and slashing . Circuit map The circuit IDs match the CircuitName enum in crates/events/src/interfold_event/proof.rs . The directories are under circuits/bin/ . ID Directory CircuitName What the proof shows C0 dkg/pk PkBfv The member's individual BFV public key is valid, with a commitment to it C1 threshold/pk_generation PkGeneration The public key share follows BFV key generation from the committed secret contribution C2a dkg/sk_share_computation SkShareComputation The Shamir shares of the secret contribution are valid (a Reed–Solomon parity check) C2b dkg/e_sm_share_computation ESmShareComputation The Shamir shares of the smudging noise are valid C3a, C3b dkg/share_encryption ShareEncryption Each share is encrypted under the recipient's committed C0 key C4a, C4b dkg/share_decryption DkgShareDecryption The shares from the roster match the C2 commitments, with a commitment to their sum C5 threshold/pk_aggregation PkAggregation The threshold public key is the sum of the H roster contributions P3 threshold/user_data_encryption* None A user ciphertext is a valid BFV encryption under the threshold key C6 threshold/share_decryption ThresholdShareDecryption The decryption share uses the member's committed key share and smudging noise C7 threshold/decrypted_shares_aggregation DecryptedSharesAggregation T + 1 shares combine and decode to the claimed plaintext Config config None The preset constants (CRT moduli, bounds, parity matrices) are consistent The "a" and "b" suffixes are the secret-key track and the smudging-noise track. C3 and C4 use one circuit for both tracks. Proof aggregation Members exchange their proofs over libp2p gossip and verify each other's proofs. Recursive circuits in circuits/bin/recursive_aggregation/ then fold the proofs: Circuit CircuitName What it folds c2ab_fold C2abFold C2a and C2b c3_fold , c3_fold_kernel C3Fold , C3FoldKernel The C3 proofs, in sequence c3ab_fold C3abFold The final secret-key and smudging-noise C3 folds c4ab_fold C4abFold C4a and C4b node_fold NodeFold One member's chain from C0 to C4 nodes_fold , nodes_fold_kernel NodesFold , NodesFoldKernel The H node_fold proofs, in sequence dkg_aggregator DkgAggregator nodes_fold and C5 c6_fold , c6_fold_kernel C6Fold , C6FoldKernel The T + 1 C6 proofs, in sequence decryption_aggregator DecryptionAggregator c6_fold and C7 Only two proofs go on-chain for each E3: The DKG proof from dkg_aggregator . The registry verifies it at publishCommittee through BfvPkVerifier . The registry also checks one signed fold attestation from each roster member with DkgFoldAttestationVerifier . It then stores the DKG anchors: the party IDs and the commitments to each member's aggregated key share and smudging noise. The decryption proof from decryption_aggregator . The Interfold contract verifies it at publishPlaintextOutput through BfvDecryptionVerifier . The verifier compares the commitments in the proof with the stored DKG anchors. Both proofs bind the committee hash. CommitteeHashLib computes it as the Keccak-256 hash of the committee addresses in ascending order. The decryption proof also binds a decryption domain: the hash of the chain ID, the Interfold address, the e3Id , the committee hash, the ciphertext output hash, and the committee public key. A decryption proof for one E3 therefore fails for any other E3. Commitments link the circuits BFV polynomials are too large to publish for every step. Each circuit hashes its polynomials into a short commitment with the SAFE sponge. A later circuit takes the earlier commitment as a public input. It recomputes the commitment from its private inputs and checks that the two values are equal. These links form one chain from key generation to decryption: C1 to C2: the committed secret contribution and smudging noise. C2 to C3: the shares that each ciphertext encrypts. C1 to C5: the public key shares that form the threshold key. C4 to C6: the aggregated key share and smudging noise of each member. C6 to C7: the decryption shares. The recursive circuits check most links inside the proofs. node_fold checks the links in one member's chain. dkg_aggregator checks the links between members and from C5 to C1. decryption_aggregator checks the link from C6 to C7. The C4 to C6 link goes through the DKG anchors, which the on-chain decryption verifier compares. Domain-separation labels ( DS_* in circuits/lib/src/math/commitments.nr ) keep different kinds of commitments apart. Recursive verification also binds the complete VK tree. Each sequential fold carries fixed leaf, fold, and genesis key hashes. The final proof commits to every nested key at public input zero. Deployment pins that commitment from the matching artifact pair's .vk_tree_hash , so a prover cannot substitute another circuit within the proof tree. BFV presets Two BFV presets exist. Each preset has a threshold parameter set for user data and a DKG parameter set for the individual keys. The values come from crates/fhe-params/src/constants.rs . Preset paramSet Threshold degree Threshold CRT moduli Plaintext modulus t t t DKG degree DKG CRT moduli insecure-512 0 512 2 100 512 1 secure-8192 2 8192 3 17,000,000 8192 2 insecure-512 is for development and tests only. The code marks it as not for production. The deployment script refuses to deploy it on a chain that is not a known test or local chain. Presets by chain ActiveCryptoConfig.sol selects the supported presets from block.chainid : Chain Chain ID Presets Committee sizes in the circuit build Ethereum mainnet 1 secure-8192 Minimum , Micro , Small Sepolia 11155111 insecure-512 , secure-8192 Minimum , Micro , Small Local 31337, 1337 insecure-512 , secure-8192 Minimum , Micro , Small Any chain that is not Sepolia or local gets the mainnet rules. The mainnet launch pricing configuration sets minCommitteeSize to 19. With that value, getE3Quote rejects Minimum and Micro requests on mainnet, so only Small can be requested. Each request must name the expected circuit configuration in expectedCryptoConfigId . The ID binds the scheme, the parameter hash, and the circuit version ( keccak256("interfold-bfv-v5") ). Next steps PVDKG and ZK proofs The DKG state machine, proof counts, and the on-chain anchors in full detail. Internals Noir circuits Build and test the circuits, and connect the prover from Rust. Build E3 lifecycle Where each proof enters the lifecycle, with deadlines and events. Learn E3 Lifecycle Use Cases ## /learn/use-cases Learn Use Cases Use Cases This page describes tasks that fit an E3 and the limits that apply to them. It is for developers who want to know if the Interfold fits their application. At the end, you can compare your task with a working example and with the checks in Limits to check . What fits an E3 An E3 fits a task that has these properties: Several independent parties contribute inputs that must stay private. The application needs one result from all inputs, and the result can be public. The result is a computation that BFV supports well, for example a sum, a count, or a tally. No single operator is acceptable as the custodian of the inputs. The application can wait for the E3 stages. An E3 does not give a real-time result. Private voting (CRISP) CRISP (Coercion-Resistant Impartial Selection Protocol) is the reference application in examples/CRISP . It is a complete, working E3 program for secret ballots. Part of the E3 What CRISP does Request The CRISP command-line tool requests one E3 for each voting round. Inputs Each voter encrypts a ballot in the browser under the committee key. Input proof The client generates a Noir proof that the ballot is valid. CRISPProgram.sol verifies it. Data availability The ciphertext bytes go to Avail. The program checks the VectorX receipt. Secure process An OpenVM program adds the encrypted ballots into an encrypted tally. Output The committee decrypts only the tally. Individual ballots stay encrypted. CRISP has its own contracts, Noir circuits, a Rust coordination server, and a React client. Start with the CRISP introduction , then follow Setup to run it. Sealed-bid auctions and private markets Bidders submit encrypted bids, and only the auction result is decrypted. This pattern matches the E3 model. The limit is the computation. The template and CRISP use only homomorphic addition. Other operations cost more and use the limited noise budget of the BFV parameter set. Before you build an auction, confirm that your secure process can compute the result within that budget. A design can also decrypt an aggregate, for example the number of bids at each price level. The contract can then compute the result from the aggregate. This design reveals the aggregate, but not the individual bids. Aggregate statistics over private data Several organizations can compute a total, a count, or a histogram over records that they do not share. Each organization encrypts its values, and the secure process adds them. Only the aggregate is decrypted. This pattern uses the same addition as the default template, which sums all inputs. Limits to check Check these limits before you design an E3 program: The output is public. The plaintext output goes on-chain. A small number of inputs can reveal an individual value, for example a tally with one vote. The program must enforce a minimum input count or other rules where this matters. The committee is the trust boundary. T + 1 committee members that collude can decrypt any ciphertext under the committee key. A larger committee raises T. On mainnet, only Small (T = 9) can be requested at launch. Inputs need validation. The E3 program decides which inputs to accept. Without an input proof, a malformed ciphertext can corrupt the result or stop the E3. Time matters. Committee setup, the input window, computation, and decryption each have a deadline. The E3 lifecycle page lists the values. Costs grow with the committee. The fee pays for the committee work, and it grows with N. Use getE3Quote to get the fee before you request. Data protection The design can help an application meet data-protection goals. No single operator holds a plaintext input, and the committee decrypts only the output. The design does not by itself make an application compliant with a regulation. The application owner is responsible for that assessment. Next steps CRISP The complete private voting application, from circuits to client. Example Quick Start Make a project from the template and run a complete E3 on your computer. Build Best practices Design rules for secure E3 programs. Build Cryptography Installation ## /build/installation Build Installation Installation This page is for developers who build E3 programs. It shows how to install the interfold CLI, which other tools the default project template needs, and how to verify the installation. At the end, you have a working interfold command and a computer that is ready for the Quick Start . To run a ciphernode for the network, read Operator requirements instead. Supported platforms Each release publishes prebuilt archives for two platforms. Operating system Architecture CLI archive Installer archive Linux x86_64 interfold-linux-x86_64.tar.gz interfoldup-linux-x86_64.tar.gz macOS Apple silicon (arm64) interfold-macos-aarch64.tar.gz interfoldup-macos-aarch64.tar.gz The releases do not include archives for other platforms, for example Linux on arm64 or macOS on Intel. On these platforms, build the CLI from source . Developer tools interfold init needs Git and pnpm. The default project template also starts a local chain, compiles Rust code, and runs a web client, so it needs more tools. Tool Version The template uses it to Git (opens in a new tab) Any recent version Clone the template and make the project repository. Node.js (opens in a new tab) 22 Run the client, the coordination server, and Hardhat. The repository CI uses Node.js 22. pnpm (opens in a new tab) 10.7.1 Install packages and run scripts. The packageManager field in package.json pins 10.7.1. Rust (opens in a new tab) (with rustup ) 1.91.1 Build and run the program server. rust-toolchain.toml in the template pins this version. Foundry (opens in a new tab) Current release Run anvil , the local chain that pnpm dev:all starts on port 8545. A browser wallet, for example MetaMask (opens in a new tab) Any Sign the transactions that the client sends to the local chain. Some tools are necessary only for specific tasks. Tool When you need it cargo-openvm (opens in a new tab) v2.0.2 Real proofs ( program.dev: false ). interfold program compile builds the guest with it. See Compute provider . The CUDA toolkit and an NVIDIA GPU Optional. The CUDA build of the OpenVM worker proves on the GPU; without it, the CPU worker proves. tmux (opens in a new tab) pnpm dev:all --tmux , which opens each process in its own tmux pane. Noir (opens in a new tab) ( nargo ) Only to write your own circuits. The repository CI uses v1.0.0-beta.26 . See Noir circuits . For a released node, the setup commands install these components: Barretenberg ( bb ) and the protocol circuits. interfold noir setup downloads the versions pinned in the CLI. Source builds pin bb 5.2.0. The template scripts run this command for you. The OpenVM guest toolchain. cargo-openvm installs the toolchain it needs. The local scripts run in dev mode by default, so they do not use OpenVM. Source builds need circuit artifacts that match the checkout and its bb 5.2.0 pin. Pull matching artifacts with pnpm store:circuits pull , or rebuild them. Do not reuse an archive from an older toolchain. See the source toolchain instructions . When you run cargo in a folder that has a rust-toolchain.toml file, rustup uses the Rust version in that file. With Corepack enabled ( corepack enable ), pnpm uses the version in the packageManager field. Install the CLI Select an installation method. The interfoldup installer is the recommended method. interfoldup Release archive From source Install interfoldup Run the install script: curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash If curl is not available, use wget : wget -qO- https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash The script detects your platform, downloads the interfoldup archive for the latest release, and installs interfoldup to ~/.local/bin . If ~/.local/bin is not in your PATH , the script prints the commands to add it for bash, zsh, and fish. Install the CLI interfoldup install interfoldup downloads the interfold archive for the latest release and installs the binary to ~/.local/bin/interfold . Download the archive Open the releases page (opens in a new tab) . Download the interfold archive for your platform from the Assets list, for example interfold-linux-x86_64.tar.gz . Verify the checksum Calculate the SHA-256 checksum of the archive: # Linux sha256sum interfold-linux-x86_64.tar.gz # macOS shasum -a 256 interfold-macos-aarch64.tar.gz Compare the result with the Checksums section of the release notes. The two values must be identical. Extract the binary tar -xzf interfold-linux-x86_64.tar.gz The archive contains one file, interfold . Install the binary Move the binary to a folder in your PATH . interfoldup uses ~/.local/bin by default. mkdir -p ~/.local/bin mv interfold ~/.local/bin/interfold chmod 755 ~/.local/bin/interfold A source build needs Rust 1.91.1 and the Solidity compiler solc in your PATH . The build script of the e3-evm crate calls solc , and the build stops if solc is not available. Clone the repository git clone https://github.com/theinterfold/interfold.git cd interfold To build a specific release, check out its tag, for example git checkout v0.18.0 . Build and install the CLI cargo install --locked --path ./crates/cli --bin interfold -f Cargo installs the binary to ~/.cargo/bin/interfold . The template integration test ( pnpm test:integration ) needs a CLI that is built with the test-only-skip-proof-aggregation Cargo feature. Release binaries do not include this feature. To build it, add --features test-only-skip-proof-aggregation to the cargo install command. Manage versions with interfoldup interfoldup has three commands. Each command uses ~/.local/bin by default. The --system flag selects /usr/local/bin instead. If your user cannot write to /usr/local/bin , run the command with sudo . Command Result interfoldup install Installs the latest release of interfold . interfoldup install --version v0.18.0 Installs the release with that tag. A tag without the v prefix, for example 0.18.0 , also works. interfoldup install --version dev Installs the most recently published release, stable or pre-release (the dev channel). interfoldup update Moves to the latest release. If interfold is not installed, this command installs it. interfoldup update --version v0.18.0 Moves to the release with that tag, forward or backward. interfoldup uninstall Removes the interfold binary. interfoldup update reads the installed version from interfold --version . When the installed version and the target release are the same, it prints interfold is already at <version> and makes no change. An older interfoldup does not accept dev . To get an interfoldup that accepts it, give the tag of a dev release to the install script, for example --version v0.19.0-dev.1 . Pin the installer version The install script installs interfoldup from the latest release. To install interfoldup from a specific release, set INTERFOLDUP_VERSION or give the --version option to the script: # With the environment variable curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | INTERFOLDUP_VERSION = v0.18.0 bash # With the script option curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash -s -- --version v0.18.0 INTERFOLDUP_VERSION selects the release of the installer only. To select the release of the CLI, use interfoldup install --version . To update interfoldup itself, run the install script again. Verify the installation Check the version interfold --version The command prints the CLI version, for example interfold 0.18.0 . Check the build revision interfold rev The command prints the short Git commit hash that the binary was built from. Run it in a folder that is not an Interfold project. Check the compiled features interfold rev --features A release binary prints nothing. A binary built with test-only-skip-proof-aggregatio
프로젝트로 돌아가기