pearl-research-labs/pearl
GitHub: pearl-research-labs/pearl
Pearl 是一个将挖矿算力转化为有用矩阵乘法的 PoW L1 区块链协议及其完整节点工具链的 monorepo。
Stars: 246 | Forks: 53
# Pearl
[](https://github.com/pearl-research-labs/pearl/actions/workflows/blockchain_ci.yml)
[](https://github.com/pearl-research-labs/pearl/actions/workflows/integration_tests_ci.yml)
[](https://github.com/pearl-research-labs/pearl/actions/workflows/miner_ci.yml)
[](https://github.com/pearl-research-labs/pearl/actions/workflows/miner_gpu_ci.yml)
[](https://github.com/pearl-research-labs/pearl/actions/workflows/pearl-desktop-wallet.yml)
[](https://github.com/pearl-research-labs/pearl/actions/workflows/plonky2_ci.yml)
[](https://github.com/pearl-research-labs/pearl/actions/workflows/rust_ci.yml)
[](http://copyfree.org)
Pearl 是一个基于 **Proof-of-Useful-Work** 协议的 L1 区块链,其中挖矿是作为任意矩阵乘法的副产品完成的,如[本文](https://arxiv.org/abs/2504.09971)所提出。
这个 monorepo 包含全节点、钱包、SPV 轻客户端、ZK 证明
系统、vLLM 矿工以及辅助工具。
## 仓库布局
| 目录 | 描述 |
|-----------|-------------|
| [`node/`](node/) | **pearld** — Pearl 协议的参考实现(全节点) |
| [`wallet/`](wallet/) | **Oyster** — 具有 JSON-RPC 和 gRPC 接口的 HD 钱包 daemon |
| [`spv/`](spv/) | **Pearl 轻客户端** — 使用紧凑区块过滤器的隐私保护 SPV 客户端 |
| [`dnsseeder/`](dnsseeder/) | Pearl 网络的 DNS seeder |
| [`coredns-dnsseed/`](coredns-dnsseed/) | CoreDNS 插件 — 生产级 DNS seeder |
| [`proxy/`](proxy/) | 用于 RPC TLS 终止和速率限制的 Caddy 反向代理 sidecar |
| [`xmss/`](xmss/) | XMSS 后量子签名方案 (C + Go FFI) |
| [`zk-pow/`](zk-pow/) | ZK 工作量证明电路和验证器 (Rust, Plonky2/STARKy) |
| [`pearl-blake3/`](pearl-blake3/) | Blake3 哈希工具 (Rust) |
| [`plonky2/`](plonky2/) | Plonky2 SNARK 证明系统 (Rust, vendored) |
| [`miner/`](miner/) | vLLM 矿工 — GPU 挖矿基础设施 (Python/CUDA, uv workspace) |
| [`py-pearl-mining/`](py-pearl-mining/) | Pearl 挖矿的 Python 绑定 (Rust/PyO3) |
| [`apps/`](apps/) | 前端应用(网站、桌面钱包 — pnpm/Turborepo) |
| [`tools/`](tools/) | Go 开发工具依赖 |
## 前置条件
- [Go](https://golang.org) 1.26 或更新版本
- [Rust](https://rustup.rs) 工具链(用于 ZK 和哈希 crate)
- C 编译器(用于 XMSS 库)
- [Python](https://python.org) 3.12 和 [uv](https://docs.astral.sh/uv/)(用于 vLLM 矿工包)
- [Task](https://taskfile.dev) runner
- [CUDA toolkit](https://developer.nvidia.com/cuda-toolkit)(用于 vLLM 矿工)
## 构建
```
task build # build everything (blockchain + vLLM miner)
task build:blockchain # pearld, prlctl, oyster → bin/
task build:miner # install vLLM miner Python packages
task build:pearld # pearld only
```
## 运行节点和 vLLM 矿工
设置流程:**构建** > **创建钱包** > **启动节点** > **启动 vLLM 矿工**。
### 1. 创建钱包并获取挖矿地址
```
./bin/oyster -u rpcuser -P rpcpass --create
```
按照提示设置密码并记录您的 seed。然后启动
钱包并生成一个 Taproot 挖矿地址:
```
./bin/oyster -u rpcuser -P rpcpass &
./bin/prlctl -u rpcuser -P rpcpass -s https://localhost:44207 getnewaddress
```
### 2. 启动节点
```
./bin/pearld \
--rpcuser=rpcuser \
--rpcpass=rpcpass \
--rpclisten=0.0.0.0:44107 \
--miningaddr= \
--txindex
```
关键标志:`--testnet` / `--simnet` 用于非主网,`--notls` 用于禁用 TLS,
`--debuglevel=debug` 用于详细日志。有关所有选项,请参见 `node/sample-pearld.conf`。
| 网络 | RPC | P2P | Wallet Server |
|----------|-------|-------|---------------|
| Mainnet | 44107 | 44108 | 44207 |
| Testnet | 44109 | 44110 | 44209 |
| Testnet2 | 44111 | 44112 | 44211 |
| Simnet | 18556 | 18555 | 18554 |
| Regtest | 18334 | 18444 | 18332 |
### 3. 启动 vLLM 矿工
vLLM 矿工有两个组件:**pearl-gateway**(到节点的桥接器)和
**vllm-miner**(通过 vLLM 进行 GPU 挖矿)。
```
export PEARLD_RPC_URL="http://localhost:44107"
export PEARLD_RPC_USER="rpcuser"
export PEARLD_RPC_PASSWORD="rpcpass"
export PEARLD_MINING_ADDRESS=""
pearl-gateway start
```
网关通过 JSON-RPC 连接到 pearld,并在 `/tmp/pearlgw.sock` (UDS)
或端口 8337 (TCP,设置 `MINER_RPC_TRANSPORT=tcp`) 上暴露挖矿接口。
使用 Docker 运行完整技术栈:
```
docker buildx build -t vllm_miner . -f miner/vllm-miner/Dockerfile
docker run --rm -it --gpus all --network host \
-e PEARLD_RPC_URL=http://localhost:44107 \
-e PEARLD_RPC_USER=rpcuser \
-e PEARLD_RPC_PASSWORD=rpcpass \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--shm-size 8g \
vllm_miner:latest \
pearl-ai/Llama-3.3-70B-Instruct-pearl \
--host 0.0.0.0 --port 8000
```
## 测试
```
task test # run all tests (Go + Python)
task test:go # Go tests with race detector
task test:python # full Python test suite
task test:python:basic # Python tests (excludes integration/perf/slow)
```
## 格式化和 Linting
```
task fmt # format all (Go + Rust + Python)
task lint:python # lint Python code with ruff
task tidy # tidy Go dependencies
```
还提供了限定范围的变体:`task fmt:go`、`task fmt:rust`、`task fmt:python`、
`task lint:go`、`task lint:rust`、`task lint:python`。
## 安全
参见 [SECURITY.md](SECURITY.md)。
## 许可证
Pearl 采用 [copyfree](http://copyfree.org) ISC 许可证授权。
详情请参见 [LICENSE](LICENSE)。
## 致谢
Pearl 的区块链基础设施最初是从以下
开源项目 fork 而来:
- [btcd](https://github.com/btcsuite/btcd) — 全节点实现
- [btcwallet](https://github.com/btcsuite/btcwallet) — 钱包 daemon
- [neutrino](https://github.com/lightninglabs/neutrino) — SPV 轻客户端
标签:EVTX分析, L1公链, Rust, Vectored Exception Handling, 加密货币钱包, 区块链, 可视化界面, 日志审计, 有用工作量证明, 矿工, 网络流量审计, 请求拦截, 逆向工具, 零知识证明