wallet-mpc-node

module
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: MIT

README

wallet-mpc-node

English · 简体中文 · 繁體中文

Open-source MPC signing node (GPL-3.0). Connects to wallet-mpc-broker (closed source), runs threshold Keygen / Refresh / Sign locally (ECDSA · CGGMP or Ed25519 · FROST), encrypts protocol traffic with ML-KEM-1024, and persists encrypted shards on disk.

[!CAUTION] Do NOT build or run binaries from third-party, forked, or unverified source. This process holds MPC key shards; a tampered build can exfiltrate secrets or break threshold security. Use official wallet-mpc-broker builds only (closed source — not from a public repo).

Node vs broker

wallet-mpc-node (this repo) wallet-mpc-broker
Role Signing node; holds and computes shards Coordinator / CLI; orchestrates Keygen / Sign
License GPL-3.0 · open source Proprietary · closed source
Build go build from this repository Official distribution only

Signing algorithms

Keygen and Sign are routed by the algorithm field on broker session types (ecdsa | ed25519):

ID On-chain Protocol Package
ecdsa secp256k1 ECDSA CGGMP mpc/alg_ecdsa/
ed25519 Ed25519 (EdDSA) FROST mpc/alg_ed25519/
  • Root pubkey hex infers algorithm: 65-byte uncompressed → ecdsa; 32-byte → ed25519.
  • HD derivation for both curves: mpc/hd/.
  • Wallet algorithm comes from broker KeyMeta; nodes do not choose it locally.
  • ML-KEM end-to-end encryption applies to both stacks; the broker cannot decrypt WireBytes.

Deployment: broker and all nodes must run the same version (ML-KEM-1024 wire protocol).

Directory layout

.
├── cmd/wallet-mpc-node/             # process entry
├── internal/
│   ├── app/                         # CLI, launch, genkey
│   ├── broker/                      # WebSocket client to broker
│   ├── config/                      # JSON + TEE env + shard paths
│   ├── log/                         # node logging
│   ├── protocol/                    # keygen/sign orchestration + CGGMP/FROST adapters
│   └── tempkey/                     # ML-KEM temporary keys
├── connect/                         # shared connection JSON schema
├── types/                             # protocol types (broker ↔ node)
├── integration/                     # integration tests
├── examples/                        # cli_node*.example.json
├── pqc-keypair.md                   # PQC (ML-DSA-87) key pair provisioning
├── mpc/
│   ├── alg_ecdsa/                   # CGGMP
│   ├── alg_ed25519/                 # FROST
│   ├── hd/                          # HD derivation
│   ├── ecdsa/, ed25519/             # on-chain verify helpers
├── build_release.bat, build_release.sh
├── build_mobile.sh                  # gomobile → single-ABI AAR
├── build_mobile_all.sh              # arm64 + x86_64 AARs (CI / release)
└── .github/workflows/release.yml   # tag → Release + SHA256SUMS + AAR

Official releases

Download pre-built binaries only from GitHub Releases. Pushing a tag v* runs build_release.sh via Actions (CGO_ENABLED=0, -trimpath, -ldflags="-s -w" — stripped static binaries, smaller than a plain go build):

Asset Platform
wallet-mpc-node-linux-amd64 Linux x86_64
wallet-mpc-node-linux-arm64 Linux ARM64
wallet-mpc-node-darwin-amd64 macOS Intel (x86_64)
wallet-mpc-node-darwin-arm64 macOS Apple Silicon (ARM64)
wallet-mpc-node-windows-amd64.exe Windows x86_64
wallet-mpc-node-arm64.aar Android arm64-v8a (physical devices)
wallet-mpc-node-x86_64.aar Android x86_64 (emulators)
SHA256SUMS SHA-256 checksums for all binaries above

Verify before deployment:

# Linux / macOS — check files present in the download folder
sha256sum -c --ignore-missing SHA256SUMS
# Windows — compare with the matching line in SHA256SUMS
Get-FileHash .\wallet-mpc-node-windows-amd64.exe -Algorithm SHA256
Get-FileHash .\wallet-mpc-node-arm64.aar -Algorithm SHA256
Get-FileHash .\wallet-mpc-node-x86_64.aar -Algorithm SHA256

Maintainers — publish a release:

git tag v1.0.0
git push origin v1.0.0

Build and run

ℹ️ Production deployments: use pre-built binaries from Official releases above. The steps below are for local development and debugging.

Requirements: Go 1.26+

Quick build:

go build -o wallet-mpc-node ./cmd/wallet-mpc-node

Cross-compile (static, CGO_ENABLED=0output/):

build_release.bat          REM Windows
chmod +x build_release.sh && ./build_release.sh   # Linux / macOS
Platform Output
linux/amd64 output/wallet-mpc-node-linux-amd64
linux/arm64 output/wallet-mpc-node-linux-arm64
darwin/amd64 output/wallet-mpc-node-darwin-amd64
darwin/arm64 output/wallet-mpc-node-darwin-arm64
windows/amd64 output/wallet-mpc-node-windows-amd64.exe

Manual example (linux/amd64):

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o output/wallet-mpc-node-linux-amd64 ./cmd/wallet-mpc-node

Android AAR (gomobile, for Flutter / native Android):

# Requires Android SDK + NDK, Java 17+ (gomobile -androidapi 34 with NDK r26+)
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/26.1.10909125"
chmod +x build_mobile.sh build_mobile_all.sh

# Both variants (CI / release)
./build_mobile_all.sh
# -> output/wallet-mpc-node-arm64.aar      (devices)
# -> output/wallet-mpc-node-x86_64.aar     (emulators)

# Single ABI
ANDROID_TARGETS=android/arm64 ./build_mobile.sh   # -> wallet-mpc-node-arm64.aar
ANDROID_TARGETS=android/amd64 ./build_mobile.sh   # -> wallet-mpc-node-x86_64.aar

Tag releases publish two AARs (one ABI each). Pick by target:

AAR gomobile target Use when
wallet-mpc-node-arm64.aar android/arm64 Physical phones / tablets
wallet-mpc-node-x86_64.aar android/amd64 Android emulator (x86_64)

32-bit arm / 386 are omitted because freego v1.1.30 does not compile on 32-bit Android.

Run (one config per node, e.g. cli_node0.json; instance count = broker walletMode: 1 / 2 (2-of-2) / 3 (2-of-3) / 5 (3-of-5)):

./wallet-mpc-node -config=cli_node0.json
./wallet-mpc-node -config=cli_node0.json -keysdir=./data/shards -logdir=./logs

Production TEE (override secrets via env, not JSON):

export MPC_NODE_CLIENT_PRK=<tee-unsealed>   # Windows cmd: set MPC_NODE_CLIENT_PRK=...
export MPC_KEYSTORE_KEY=<tee-unsealed>
./wallet-mpc-node -config=cli_node0.json

PQC key pair provisioning

Before filling clientPrk in node config, generate the node PQC identity key pair (ML-DSA-87) with -genkey. Full workflow, file format, and security checklist: pqc-keypair.md.

# Development (plaintext private.key — not for production)
./wallet-mpc-node -genkey

# Production (encrypted private.key)
export MPC_PLAN2_WRAP_KEY='<strong passphrase>'
./wallet-mpc-node -genkey -enc -outdir /secure/path/node0-pqc

Map private.keyclientPrk or MPC_NODE_CLIENT_PRK; register public.pem with broker nodeBindings.

Configuration

Copy examples/cli_node0.example.json to cli_node0.json (gitignored) and fill in values from broker nodeBindings. For production TEE, omit clientPrk / keystoreKey from JSON and inject via env — see examples/cli_node.prod.example.json.

Field Required Description
domain yes Broker node WebSocket host (host:port, broker port+100)
source yes Node ID (node0, node1, …) — must match broker nodeBindings
keyPath yes WS route after login (default /ws/key)
loginPath yes PQC identity login route (default /ws/login)
clientNo yes Broker-assigned client number in nodeBindings
serverPub yes Broker ML-DSA-87 public key
clientPrk yes* Node ML-DSA-87 private key (*prod: MPC_NODE_CLIENT_PRK env)
broadcastKey yes Push signature key (hex); must match broker
keystoreKey yes* Shard at-rest encryption key (*prod: MPC_KEYSTORE_KEY env)
shardKeysDir no Shard directory (default keys; overridden by -keysdir)
cli_node0.json — minimum example
{
  "domain": "127.0.0.1:9522",
  "source": "node0",
  "keyPath": "/ws/key",
  "loginPath": "/ws/login",
  "clientNo": 0,
  "clientPrk": "REPLACE_WITH_ML-DSA-87_PRIVATE_KEY",
  "serverPub": "REPLACE_WITH_BROKER_NODEBINDING_PUBLIC_KEY",
  "broadcastKey": "REPLACE_WITH_BROKER_PUSH_BROADCAST_KEY_HEX",
  "keystoreKey": "REPLACE_WITH_SHARD_ENCRYPTION_KEY",
  "shardKeysDir": "keys"
}

Dependencies

Direct dependencies (per go.mod). All listed licenses are compatible with GPL-3.0 distribution of this project.

Repository License Purpose
getamis/alice Apache-2.0 CGGMP (ECDSA) · FROST (Ed25519)
godaddy-x/eccrypto MIT ML-KEM-1024 · ML-DSA-87
godaddy-x/freego MIT WebSocket / utilities
godaddy-x/wallet-adapter MIT HD derivation types

License

GPL-3.0

Directories

Path Synopsis
cmd
wallet-mpc-node command
Package connect holds broker connection settings shared by MPC nodes and clients.
Package connect holds broker connection settings shared by MPC nodes and clients.
internal
app
Package app bootstraps the MPC node CLI and process lifecycle.
Package app bootstraps the MPC node CLI and process lifecycle.
broker
Package broker connects the MPC node to wallet-mpc-broker over WebSocket.
Package broker connects the MPC node to wallet-mpc-broker over WebSocket.
config
Package config loads node deployment settings and runtime paths.
Package config loads node deployment settings and runtime paths.
log
Package log provides MPC node process logging helpers.
Package log provides MPC node process logging helpers.
protocol
????Alice CGGMP ECDSA ?? WS ?????? keygen/sign ???
????Alice CGGMP ECDSA ?? WS ?????? keygen/sign ???
tempkey
Package tempkey manages ML-KEM-1024 temporary keys for MPC protocol encryption.
Package tempkey manages ML-KEM-1024 temporary keys for MPC protocol encryption.
testhold
Package testhold 提供联调/集成测试用的任务处理延迟(仅通过环境变量开启)。
Package testhold 提供联调/集成测试用的任务处理延迟(仅通过环境变量开启)。
Package mobile exposes wallet-mpc-node for gomobile (Android/iOS).
Package mobile exposes wallet-mpc-node for gomobile (Android/iOS).
mpc
Package mpc 提供 MPC 多算法支持的公共类型与常量。
Package mpc 提供 MPC 多算法支持的公共类型与常量。
alg_ecdsa
Package alg_ecdsa ?? getamis/alice CGGMP ? ECDSA (t,n) ?????
Package alg_ecdsa ?? getamis/alice CGGMP ? ECDSA (t,n) ?????
alg_ed25519
Package alg_ed25519 基于 getamis/alice FROST 的 Ed25519 (t,n) 门限签名。
Package alg_ed25519 基于 getamis/alice FROST 的 Ed25519 (t,n) 门限签名。
alg_single
Package alg_single 提供 1-of-1 单签模式的密钥生成、存储与签名(非 MPC)。
Package alg_single 提供 1-of-1 单签模式的密钥生成、存储与签名(非 MPC)。
ecdsa
Package ecdsa 提供链上 ECDSA 验签工具(与 CGGMP 签名输出格式一致)。
Package ecdsa 提供链上 ECDSA 验签工具(与 CGGMP 签名输出格式一致)。
ed25519
Package ed25519 提供链上 Ed25519 验签与 FROST 签名编码。
Package ed25519 提供链上 Ed25519 验签与 FROST 签名编码。
hd
Package hd 提供 MPC 钱包的公钥 HD 派生(无 seed、仅非硬化路径),与 TSS 库无关。
Package hd 提供 MPC 钱包的公钥 HD 派生(无 seed、仅非硬化路径),与 TSS 库无关。
keystore
Package keystore 提供 MPC 分片文件 at-rest 加密封装(K3)。
Package keystore 提供 MPC 分片文件 at-rest 加密封装(K3)。
Package types defines broker/node WebSocket protocol request and response structs (easyjson in *_easyjson.go).
Package types defines broker/node WebSocket protocol request and response structs (easyjson in *_easyjson.go).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL