When tsslib.aar is not found, the build script now automatically: 1. Checks if Go is installed 2. Installs gomobile if not present (go install golang.org/x/mobile/cmd/gomobile@latest) 3. Initializes gomobile if needed 4. Runs go mod tidy in the tsslib directory 5. Builds tsslib.aar using gomobile bind This allows building APKs on any machine with Go installed, without needing to manually compile the TSS library first. Requirements: - Go installed and in PATH - Android NDK (installed via Android SDK) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| app | ||
| gradle/wrapper | ||
| tsslib | ||
| .gitignore | ||
| README.md | ||
| build-apk.bat | ||
| build.gradle.kts | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| settings.gradle.kts | ||
README.md
TSS Party Android
Android 版本的 TSS (Threshold Signature Scheme) Party 应用,用于多方共管钱包的密钥生成和签名。
项目结构
service-party-android/
├── app/ # Android 应用模块
│ ├── src/main/
│ │ ├── java/com/durian/tssparty/
│ │ │ ├── data/ # 数据层
│ │ │ │ ├── local/ # 本地存储 (Room, TSS Bridge)
│ │ │ │ ├── remote/ # 远程通信 (gRPC)
│ │ │ │ └── repository/ # 数据仓库
│ │ │ ├── domain/model/ # 领域模型
│ │ │ ├── presentation/ # UI 层
│ │ │ │ ├── screens/ # Compose 屏幕
│ │ │ │ └── viewmodel/ # ViewModels
│ │ │ ├── di/ # Hilt 依赖注入
│ │ │ ├── ui/theme/ # Material Theme
│ │ │ └── util/ # 工具类
│ │ ├── proto/ # gRPC Proto 文件
│ │ └── res/ # Android 资源
│ └── libs/ # TSS 原生库 (.aar)
├── tsslib/ # Go TSS 库源码
│ ├── tsslib.go # gomobile 绑定
│ ├── go.mod
│ ├── build.sh # Linux/macOS 构建脚本
│ └── build.bat # Windows 构建脚本
└── gradle/ # Gradle Wrapper
技术栈
- UI: Jetpack Compose + Material 3
- 架构: MVVM + Repository Pattern
- 依赖注入: Hilt
- 数据库: Room
- 网络: gRPC (protobuf-lite)
- TSS 核心: Go + gomobile (BnB Chain tss-lib v2)
构建步骤
1. 构建 TSS 原生库 (可选,需要 Go 环境)
# 安装 gomobile
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
# 构建 Android AAR
cd tsslib
./build.sh # Linux/macOS
# 或
build.bat # Windows
这将在 app/libs/ 生成 tsslib.aar。
注意: 当前版本使用 Kotlin stub 实现,无需编译 Go 库即可构建 APK。 实际运行需要真正的
tsslib.aar。
2. 构建 APK
# Debug 版本
./gradlew assembleDebug
# Release 版本 (需要签名配置)
./gradlew assembleRelease
APK 输出路径: app/build/outputs/apk/debug/app-debug.apk
功能
- 加入 Keygen 会话 - 扫描/输入邀请码,参与多方密钥生成
- 查看钱包 - 显示已创建的共管钱包列表
- 签名交易 - 使用密钥份额参与多方签名
- 设置 - 配置 Message Router 服务器地址
配置
默认服务器配置:
- Message Router:
localhost:50051 - Kava RPC:
https://evm.kava.io
与 Electron 版本的对应关系
| Electron 版本 | Android 版本 |
|---|---|
electron/main.ts |
TssNativeBridge.kt + GrpcClient.kt |
electron/preload.ts |
TssRepository.kt |
src/pages/*.tsx |
presentation/screens/*.kt |
tss-party/ (Go 子进程) |
tsslib/ (gomobile .aar) |
| sql.js | Room Database |
许可证
MIT