btc-terminology
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBTC Terminology Rules
BTC 术语规则
🚨 CRITICAL: Bech32m vs Taproot
🚨 重要提示:Bech32m 与 Taproot
This is a common source of bugs. Do NOT confuse these terms:
| Term | What It Is | Where Used |
|---|---|---|
| bech32m | Encoding format (HOW address is serialized) | Bitcoin Core RPC, shell scripts |
| taproot | Address type (WHAT the address represents) | Config files, domain model |
Key Rule: ≠ — They are related but NOT interchangeable.
bech32mtaproot这是常见的bug来源。请勿混淆以下术语:
| 术语 | 定义 | 适用场景 |
|---|---|---|
| bech32m | 编码格式(地址的序列化方式) | Bitcoin Core RPC、Shell脚本 |
| taproot | 地址类型(地址代表的含义) | 配置文件、领域模型 |
核心规则: ≠ —— 二者相关但不可互换。
bech32mtaprootQuick Reference Table
快速参考表
| Context | Correct Term | Example |
|---|---|---|
| Config YAML/TOML files | | |
| Environment variables | | |
| Bitcoin Core CLI/RPC | | |
| Shell scripts (receiver addresses) | | |
Go domain code ( | | |
Go Bitcoin Core interface ( | | |
| 使用场景 | 正确术语 | 示例 |
|---|---|---|
| 配置文件(YAML/TOML) | | |
| 环境变量 | | |
| Bitcoin Core CLI/RPC | | |
| Shell脚本(接收方地址) | | |
Go 领域代码( | | |
Go Bitcoin Core 接口( | | |
Common Mistakes
常见错误
❌ WRONG
❌ 错误示例
yaml
undefinedyaml
undefinedConfig file - DON'T use bech32m
配置文件 - 请勿使用bech32m
address_type: "bech32m" # WRONG!
```bashaddress_type: "bech32m" # 错误!
```bashShell script - DON'T use taproot for Bitcoin Core RPC
Shell脚本 - 调用Bitcoin Core RPC时请勿使用taproot
bitcoin-cli getnewaddress "" taproot # WRONG!
undefinedbitcoin-cli getnewaddress "" taproot # 错误!
undefined✅ CORRECT
✅ 正确示例
yaml
undefinedyaml
undefinedConfig file - Use taproot
配置文件 - 使用taproot
address_type: "taproot" # CORRECT!
```bashaddress_type: "taproot" # 正确!
```bashShell script - Use bech32m for Bitcoin Core RPC
Shell脚本 - 调用Bitcoin Core RPC时使用bech32m
bitcoin-cli getnewaddress "" bech32m # CORRECT!
undefinedbitcoin-cli getnewaddress "" bech32m # 正确!
undefinedTechnical Background
技术背景
Why Two Different Terms?
为何会有两个不同术语?
- Taproot (BIP341) = SegWit version 1 address type (P2TR - Pay-to-Taproot)
- Bech32m (BIP350) = Encoding format that fixes checksum issues in original Bech32
All Taproot addresses are encoded using bech32m, but:
- User-facing config uses "taproot" (what you want)
- Bitcoin Core RPC uses "bech32m" (how it's encoded)
- Taproot(BIP341)= SegWit版本1地址类型(P2TR - 支付到Taproot)
- Bech32m(BIP350)= 修复了原始Bech32校验和问题的编码格式
所有Taproot地址都使用bech32m编码,但:
- 用户可见的配置使用"taproot"(代表所需的地址类型)
- Bitcoin Core RPC使用"bech32m"(代表地址的编码方式)
Address Format Comparison
地址格式对比
| Encoding | SegWit Version | Address Type | Prefix | Config Value |
|---|---|---|---|---|
| Base58 | N/A | P2PKH | | |
| Base58 | N/A | P2SH | | |
| Bech32 | v0 | P2WPKH | | |
| Bech32m | v1 | P2TR | | |
| 编码格式 | SegWit版本 | 地址类型 | 前缀 | 配置值 |
|---|---|---|---|---|
| Base58 | 无 | P2PKH | | |
| Base58 | 无 | P2SH | | |
| Bech32 | v0 | P2WPKH | | |
| Bech32m | v1 | P2TR | | |
Codebase Mapping
代码库对应关系
The project has two different type definitions:
go
// internal/domain/bitcoin/address_type.go
// For Bitcoin Core RPC communication
AddressTypeTaproot AddressType = "bech32m" // Bitcoin Core uses "bech32m"
// internal/domain/address/types.go
// For user-facing configuration
AddrTypeTaproot AddrType = "taproot" // User sees "taproot"Conversion between these is handled by mapper functions:
go
// internal/infrastructure/api/btc/btc/mapper.go
// FromAddressType: "bech32m" (Bitcoin Core) → "taproot" (user-facing)
// ToAddressType: "taproot" (user-facing) → "bech32m" (Bitcoin Core)项目中有两种不同的类型定义:
go
// internal/domain/bitcoin/address_type.go
// 用于与Bitcoin Core RPC通信
AddressTypeTaproot AddressType = "bech32m" // Bitcoin Core 使用 "bech32m"
// internal/domain/address/types.go
// 用于用户可见的配置
AddrTypeTaproot AddrType = "taproot" // 用户看到的是 "taproot"二者之间的转换由映射函数处理:
go
// internal/infrastructure/api/btc/btc/mapper.go
// FromAddressType: "bech32m"(Bitcoin Core)→ "taproot"(用户可见)
// ToAddressType: "taproot"(用户可见)→ "bech32m"(Bitcoin Core)Verification Checklist
验证检查清单
When working with Taproot/Bech32m code:
- Config files (YAML/TOML) use
address_type: "taproot" - Environment variables use
WALLET_ADDRESS_TYPE="taproot" - Bitcoin Core RPC calls in shell scripts use
bech32m - Shell scripts generating receiver addresses use
bech32m - Go code uses correct type for the layer:
- Domain/config layer: (value:
AddrTypeTaproot)"taproot" - Bitcoin Core interface: (value:
AddressTypeTaproot)"bech32m"
- Domain/config layer:
处理Taproot/Bech32m相关代码时:
- 配置文件(YAML/TOML)使用
address_type: "taproot" - 环境变量使用
WALLET_ADDRESS_TYPE="taproot" - Shell脚本中的Bitcoin Core RPC调用使用
bech32m - 生成接收方地址的Shell脚本使用
bech32m - Go代码根据层级使用正确的类型:
- 领域/配置层:(值:
AddrTypeTaproot)"taproot" - Bitcoin Core接口层:(值:
AddressTypeTaproot)"bech32m"
- 领域/配置层:
Related Files
相关文件
| File | Purpose |
|---|---|
| User-facing |
| Bitcoin Core |
| Type conversion functions |
| Taproot user guide |
| 文件 | 用途 |
|---|---|
| 用户可见的 |
| Bitcoin Core的 |
| 类型转换函数 |
| Taproot用户指南 |