Annehuqr0Craft96/miden-faucet

GitHub: Annehuqr0Craft96/miden-faucet

Miden Console 是一款用于简化 Polygon Miden 密码学原语库构建、测试和模糊测试的交互式 Python CLI 工具。

Stars: 0 | Forks: 0

``` ____ ____ _____ ______ ________ ____ _____ |_ \ / _| |_ _| |_ _ `. |_ __ | |_ \|_ _| | \/ | | | | | `. \ | |_ \_| | \ | | | |\ /| | | | | | | | | _| _ | |\ \| | _| |_\/_| |_ _| |_ _| |_.' / _| |__/ | _| |_\ |_ |_____||_____| |_____| |______.' |________| |_____|\____| ``` # Miden Console **用于构建、测试和模糊测试 Polygon Miden Crypto 的 CLI 菜单 —— Miden zk-rollup 的密码学原语。** [![Python](https://img.shields.io/badge/Python-3.10+-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/) [![Rich](https://img.shields.io/badge/Rich-13+-000000?style=for-the-badge&logo=readthedocs&logoColor=white)](https://github.com/Textualize/rich) [![License](https://img.shields.io/badge/License-MIT%20%7C%20Apache--2.0-blue?style=for-the-badge)](LICENSE) [功能特性](#features) • [快速开始](#getting-started) • [配置](#configuration) • [使用说明](#usage) • [项目结构](#project-structure) • [常见问题](#faq)
## 官方链接 | 资源 | URL | |----------|-----| | **Polygon Miden** | https://polygon.technology/polygon-miden | | **Miden 文档** | https://docs.miden.xyz/intro | | **Polygon Miden 概览** | https://docs.polygon.technology/learn/miden/overview/ | | **Miden Crypto (GitHub)** | https://github.com/0xMiden/crypto | | **Miden Base** | https://github.com/0xMiden/miden-base | | **Miden 开发者** | https://miden.xyz/developers | ## 功能特性
| 功能 | ✓ | |---------|---| | 交互式菜单 | ✓ | | Rich 面板、表格、Markdown | ✓ | | 安装依赖 (cargo fetch) | ✓ | | Release 构建 (cargo build --release) | ✓ | | no_std 构建 (嵌入式/WebAssembly) | ✓ | | AVX2 / AVX-512 / SVE 加速 | ✓ | | 原生 CPU 构建 (target-cpu=native) | ✓ | | 基于 RocksDB 的 LargeSmt 构建 | ✓ | | 功能 | ✓ | |---------|---| | Make 测试 (release + debug assertions) | ✓ | | Cargo 测试 (简单) | ✓ | | cargo-fuzz 安装 | ✓ | | SMT 模糊测试目标 (make fuzz-smt) | ✓ | | 列出 make targets | ✓ | | 设置 (路径、features、环境变量) | ✓ | | 关于 (模块、许可证、标签) | ✓ | | MIDEN_PROJECT_ROOT 覆盖 | ✓ |
## 快速开始 ### 前置条件 | 需求 | 版本 / 说明 | |-------------|-----------------| | **Python** | 3.10+ | | **Rust** | 最新稳定版 | | **Cargo** | 随 Rust 附带 | | **Make** | GNU Make (Linux/macOS) 或兼容工具 | | **Miden Crypto 仓库** | 克隆到 `miden-console` 的父目录或设置 `MIDEN_PROJECT_ROOT` | ### 安装 ``` # 克隆 Miden Crypto(如果尚未存在) git clone https://github.com/0xMiden/crypto.git cd crypto # 克隆或将 miden-console 放置在 repo 中 # 结构:crypto/miden-console/ 或 crypto/../miden-console/ # 安装 Python 依赖项 cd miden-console pip install -r requirements.txt # 运行 python main.py ``` ### 依赖表 | 包 | 版本 | 用途 | |---------|---------|---------| | rich | ≥13.0.0 | 终端 UI (面板、表格、Markdown) | ## 配置 CLI 使用环境变量,并需要 Miden Crypto crate 的根目录(包含 `Cargo.toml` 和 `Makefile` 的文件夹)。 ### 环境变量 | 变量 | 默认值 | 描述 | |----------|---------|-------------| | `MIDEN_PROJECT_ROOT` | `miden-console` 的父目录 | Miden Crypto 仓库根目录的路径 | | `LDFLAGS` | (空) | 用于 RocksDB 构建的链接器标志 | | `CPPFLAGS` | (空) | 用于 RocksDB 构建的 C 预处理器标志 | ### 配置示例 **Linux/macOS —— 使用自定义 LLVM 的 RocksDB:** ``` export MIDEN_PROJECT_ROOT="/opt/miden-crypto" export LDFLAGS="-L/usr/local/llvm/lib" export CPPFLAGS="-I/usr/local/llvm/include" ``` **Windows —— 默认布局 (miden-console 位于 crypto 内部):** ``` $env:MIDEN_PROJECT_ROOT = "C:\repos\crypto" ``` **配置解析 (config.py):** ``` # 默认:miden-console 的父目录 = crate root DEFAULT_PROJECT_ROOT = Path(__file__).resolve().parent.parent PROJECT_ROOT = Path(os.environ.get("MIDEN_PROJECT_ROOT", str(DEFAULT_PROJECT_ROOT))) CRATE_ROOT = PROJECT_ROOT FEATURES = ["concurrent", "std", "no_std", "rocksdb"] ``` ## 使用说明 ### CLI 菜单模型 ``` ╔══════════════════════════════════════════════════════════════╗ ║ Menu ║ ╠══════════════════════════════════════════════════════════════╣ ║ 1 Install Dependencies (cargo fetch) ║ ║ 2 Build (cargo build --release) ║ ║ 3 Build no_std (make build-no-std) ║ ║ 4 Build AVX2 (make build-avx2) ║ ║ 5 Build AVX-512 (make build-avx512) ║ ║ 6 Build SVE (make build-sve) ║ ║ 7 Build fastest (target-cpu=native) ║ ║ 8 Build with RocksDB (--features rocksdb) ║ ║ 9 Run tests (make test) ║ ║ 10 Run tests (cargo test) ║ ║ 11 Install cargo-fuzz ║ ║ 12 Fuzz SMT (make fuzz-smt) ║ ║ 13 List make targets (make) ║ ║ s Settings (paths & features) ║ ║ a About ║ ║ q Quit ║ ╚══════════════════════════════════════════════════════════════╝ Choice: _ ``` ## 项目结构 ``` miden-console/ ├── main.py # Entry point, menu loop, Rich UI ├── actions.py # Build, test, fuzz actions (cargo/make) ├── config.py # PROJECT_ROOT, CRATE_ROOT, FEATURES, env ├── requirements.txt # rich>=13.0.0 ├── README.md ├── tags.txt # GitHub topics └── about/ ├── about.md # Miden Crypto modules (AEAD, Hash, Merkle, etc.) ├── license.txt # Apache-2.0, MIT ├── modules.txt # Module tags └── TAGS.txt # Extended tags (legacy) ``` ## 常见问题
什么是 Polygon Miden? Polygon Miden 是一个用于高吞吐量、隐私应用的 zk-rollup。它使用带有 STARK 证明的 Miden VM,支持私有和公共账户/票据,并由 Ethereum 和 Agglayer 提供安全保障。主网计划于 2026 年上线。
Miden Crypto 包含什么? Miden Crypto 提供密码学原语:AEAD (AEAD-Poseidon2, XChaCha20Poly1305)、Hash (BLAKE3, Keccak256, RPO, RPX, Poseidon2)、Merkle 结构、签名 (ECDSA k256, Ed25519, Falcon512-Poseidon2)、ECDH (k256, X25519)、IES (密封盒) 和 STARK (Plonky3)。
我应该把 miden-console 放在哪里? 将 `miden-console` 放置在 Miden Crypto 仓库内(例如 `crypto/miden-console/`),或作为同级目录。默认情况下,`miden-console` 的父目录被用作 crate 根目录。如有需要,可通过 `MIDEN_PROJECT_ROOT` 进行覆盖。
如何使用 RocksDB 构建? 使用菜单选项 **8**。确保已安装 `clang` 和 `libclang`。在 Linux/macOS 上,如果您的 LLVM 位于非标准路径,请设置 `LDFLAGS` 和 `CPPFLAGS`。RocksDB 功能启用 `LargeSmt` 磁盘后备存储。
make test 和 cargo test 有什么区别? **make test** 以 release 模式运行测试,并启用调试断言和溢出检查(如同官方 Makefile 中的设置)。**cargo test** 运行更简单的 debug 构建。请使用 `make test` 进行完整验证。
如何在 CPU 上启用 AVX2/AVX-512? 使用菜单选项 **4** (AVX2)、**5** (AVX-512) 或 **7** (native —— 自动检测所有支持的功能)。AVX2/AVX-512 加速 RPO 和 RPX 哈希运算。在 Apple Silicon (aarch64) 上,使用 **6** (SVE) 或 **7** (native)。
我可以在 Windows 上使用吗? 可以。CLI 可在 Windows 上运行。Cargo 命令可正常工作;Make 目标 (3–6, 9, 12, 13) 需要 Make 实现(例如 MinGW、WSL,或手动运行等效的 `make` 命令)。选项 1、2、7、8、10、11 可原生运行。
## 免责声明 本工具用于配合 Miden Crypto crate 进行**教育和开发用途**。Polygon Miden 仍在开发中;请适当使用测试网资源。不提供任何担保。请务必在您的环境中验证构建和测试。
**如果这个项目对您有帮助,请考虑支持 Ethereum 开发:** `0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1` [![在 GitHub 上加星](https://img.shields.io/badge/⭐_Star_on_GitHub-181717?style=for-the-badge&logo=github)](https://github.com)
标签:AVX-512, CLI 工具, Polygon Miden, Python, Rust, WebAssembly, zk-Rollup, 便携式工具, 加密库, 区块链, 可视化界面, 命令行界面, 威胁情报, 密码学原语, 开发者工具, 无后门, 测试网, 测试网水龙头, 网络流量审计, 逆向工具, 零知识证明