NethermindEth/latticefold

GitHub: NethermindEth/latticefold

基于格的非交互式折叠方案的 Rust 概念验证实现,将 LatticeFold 与 LatticeFold+ 两篇密码学论文转化为可运行的零知识证明原型。

Stars: 129 | Forks: 23

# LatticeFold 由 [Nethermind](https://nethermind.io) 基于以下研究设计的 LatticeFold 和 LatticeFold+ 折叠方案的概念验证实现: 由 Dan Boneh 和 Binyi Chen 撰写的 [LatticeFold: A Lattice-based Folding Scheme and its Applications to Succinct Proof Systems](https://eprint.iacr.org/2024/257) 以及 [LatticeFold+: Faster, Simpler, Shorter Lattice-Based Folding for Succinct Proof Systems](https://eprint.iacr.org/2025/247)。 **免责声明:** 这是一个概念验证原型,特别说明其尚未经过仔细的代码审查。本实现按“原样”提供,尚未准备好用于生产环境。使用风险自负。 ## 基准测试 要在您的本地计算机上运行基准测试,只需执行 `cargo bench`。这大约需要 48 小时。 使用 `cargo bench --bench` 可以测量协议的相关部分以及 Ajtai 承诺方案,并注释掉您不想测量的素数域。 ## 构建 [rust-toolchain](https://github.com/NethermindEth/latticefold/blob/main/rust-toolchain) 文件将 LatticeFold 库构建时使用的 Rust 工具链版本固定为特定版本 `nightly-2025-03-06`。 可以通过调用以下命令来安装 `nightly-2025-03-06` 工具链: ``` rustup install nightly-2025-03-06 ``` 之后,使用标准的 Rust 构建工具 `cargo` 来构建该库: ``` git clone https://github.com/NethermindEth/latticefold.git cd latticefold cargo build --release ``` ## 用法 导入该库: ``` [dependencies] latticefold = { git = "https://github.com/NethermindEth/latticefold.git", package = "latticefold" } ``` 可用的包: - `latticefold`:主 crate,包含非交互式折叠方案的实现,以及 Ajtai 承诺方案、R1CS/CCS 结构、Fiat-Shamir transcript 机制等。 - `latticefold-plus`:LatticeFold 的改进版本。目前为进行中的实现。查看[更多](latticefold-plus/README.md)。 - `cyclotomic-rings`:包含适合在 LatticeFold 协议中使用的环的 trait 定义、一些现成的环以及简短的挑战集机制。 ## 性能报告 本库的性能报告可以在[这里](https://nethermind.notion.site/Latticefold-and-lattice-based-operations-performance-report-153360fc38d080ac930cdeeffed69559)找到。 ## 示例 查看 [latticefold/examples/README.md](latticefold/examples/README.md) 获取示例。 ## Frontends 目前,定义要折叠的电路的唯一方法是将其指定为 [rank-1 constraint system (R1CS)](https://github.com/NethermindEth/latticefold/blob/main/latticefold/src/arith/r1cs.rs) 或 [customizable constraint system (CCS)](https://github.com/NethermindEth/latticefold/blob/main/latticefold/src/arith.rs)。 ## License 本仓库中的 crate 可根据以下任一许可证进行授权,由您自行选择。 * Apache License Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE)) * MIT license ([LICENSE-MIT](LICENSE-MIT)) 除非您明确声明,否则您提交以包含在本库中的任何贡献均应按上述方式获得双重许可(如 Apache v2 License 中所定义),无需任何附加的条款或条件。 ## 致谢 - 本项目建立在 [lattirust 库](https://github.com/cknabs/lattirust)的[我们的分支](https://github.com/NethermindEth/stark-rings)之上,该库最初由 [Christian Knabenhans](https://github.com/cknabs) 和 [Giacomo Fenzi](https://github.com/WizardOfMenlo) 开发。 - 我们将 [来自 Jolt 的 sumcheck 协议](https://github.com/a16z/jolt/blob/fa45507aaddb1815bafd54332e4b14173a7f8699/jolt-core/src/subprotocols/sumcheck.rs#L35) 适配到了环设置中。 - 许多定义直接移植自 [sonobe](https://github.com/privacy-scaling-explorations/sonobe) 库。 - 该实现得到了以太坊基金会 [ZK Grant](https://blog.ethereum.org/2024/06/25/zk-grants-round-announce) 的支持。
标签:Rust, 加密算法库, 可视化界面, 密码学, 手动系统调用, 折叠方案, 格密码学, 网络流量审计, 通知系统, 零知识证明