btc-terminology

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

BTC Terminology Rules

BTC 术语规则

🚨 CRITICAL: Bech32m vs Taproot

🚨 重要提示:Bech32m 与 Taproot

This is a common source of bugs. Do NOT confuse these terms:
TermWhat It IsWhere Used
bech32mEncoding format (HOW address is serialized)Bitcoin Core RPC, shell scripts
taprootAddress type (WHAT the address represents)Config files, domain model
Key Rule:
bech32m
taproot
— They are related but NOT interchangeable.
这是常见的bug来源。请勿混淆以下术语:
术语定义适用场景
bech32m编码格式(地址的序列化方式)Bitcoin Core RPC、Shell脚本
taproot地址类型(地址代表的含义)配置文件、领域模型
核心规则:
bech32m
taproot
—— 二者相关但不可互换。

Quick Reference Table

快速参考表

ContextCorrect TermExample
Config YAML/TOML files
taproot
address_type: "taproot"
Environment variables
taproot
WALLET_ADDRESS_TYPE="taproot"
Bitcoin Core CLI/RPC
bech32m
bitcoin-cli getnewaddress "" bech32m
Shell scripts (receiver addresses)
bech32m
getnewaddress "" bech32m
Go domain code (
internal/domain/address/
)
taproot
AddrTypeTaproot
Go Bitcoin Core interface (
internal/domain/bitcoin/
)
bech32m
AddressTypeTaproot = "bech32m"
使用场景正确术语示例
配置文件(YAML/TOML)
taproot
address_type: "taproot"
环境变量
taproot
WALLET_ADDRESS_TYPE="taproot"
Bitcoin Core CLI/RPC
bech32m
bitcoin-cli getnewaddress "" bech32m
Shell脚本(接收方地址)
bech32m
getnewaddress "" bech32m
Go 领域代码(
internal/domain/address/
taproot
AddrTypeTaproot
Go Bitcoin Core 接口(
internal/domain/bitcoin/
bech32m
AddressTypeTaproot = "bech32m"

Common Mistakes

常见错误

❌ WRONG

❌ 错误示例

yaml
undefined
yaml
undefined

Config file - DON'T use bech32m

配置文件 - 请勿使用bech32m

address_type: "bech32m" # WRONG!

```bash
address_type: "bech32m" # 错误!

```bash

Shell script - DON'T use taproot for Bitcoin Core RPC

Shell脚本 - 调用Bitcoin Core RPC时请勿使用taproot

bitcoin-cli getnewaddress "" taproot # WRONG!
undefined
bitcoin-cli getnewaddress "" taproot # 错误!
undefined

✅ CORRECT

✅ 正确示例

yaml
undefined
yaml
undefined

Config file - Use taproot

配置文件 - 使用taproot

address_type: "taproot" # CORRECT!

```bash
address_type: "taproot" # 正确!

```bash

Shell script - Use bech32m for Bitcoin Core RPC

Shell脚本 - 调用Bitcoin Core RPC时使用bech32m

bitcoin-cli getnewaddress "" bech32m # CORRECT!
undefined
bitcoin-cli getnewaddress "" bech32m # 正确!
undefined

Technical Background

技术背景

Why Two Different Terms?

为何会有两个不同术语?

  1. Taproot (BIP341) = SegWit version 1 address type (P2TR - Pay-to-Taproot)
  2. 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)
  1. Taproot(BIP341)= SegWit版本1地址类型(P2TR - 支付到Taproot)
  2. Bech32m(BIP350)= 修复了原始Bech32校验和问题的编码格式
所有Taproot地址都使用bech32m编码,但:
  • 用户可见的配置使用"taproot"(代表所需的地址类型)
  • Bitcoin Core RPC使用"bech32m"(代表地址的编码方式)

Address Format Comparison

地址格式对比

EncodingSegWit VersionAddress TypePrefixConfig Value
Base58N/AP2PKH
1...
legacy
Base58N/AP2SH
3...
p2sh-segwit
Bech32v0P2WPKH
bc1q...
bech32
Bech32mv1P2TR
bc1p...
taproot
编码格式SegWit版本地址类型前缀配置值
Base58P2PKH
1...
legacy
Base58P2SH
3...
p2sh-segwit
Bech32v0P2WPKH
bc1q...
bech32
Bech32mv1P2TR
bc1p...
taproot

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:
      AddrTypeTaproot
      (value:
      "taproot"
      )
    • Bitcoin Core interface:
      AddressTypeTaproot
      (value:
      "bech32m"
      )
处理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

相关文件

FilePurpose
internal/domain/address/types.go
User-facing
AddrType
definitions
internal/domain/bitcoin/address_type.go
Bitcoin Core
AddressType
definitions
internal/infrastructure/api/btc/btc/mapper.go
Type conversion functions
docs/crypto/btc/taproot/user-guide.md
Taproot user guide
文件用途
internal/domain/address/types.go
用户可见的
AddrType
定义
internal/domain/bitcoin/address_type.go
Bitcoin Core的
AddressType
定义
internal/infrastructure/api/btc/btc/mapper.go
类型转换函数
docs/crypto/btc/taproot/user-guide.md
Taproot用户指南

Related Documentation

相关文档

  • BIP350 - Bech32m specification
  • BIP341 - Taproot specification
  • BIP86 - Taproot key derivation (m/86'/...)
  • BIP350 - Bech32m 规范
  • BIP341 - Taproot 规范
  • BIP86 - Taproot 密钥派生(m/86'/...)