Summary
detect_address_type() uses case-sensitive startswith('bc1q') / startswith('bc1p') checks. Valid BIP-173 bech32 addresses may be encoded in all-uppercase; these are classified as unknown, so sign_from_proof() / verify_from_proof() fail before any cryptographic verification.
Affected code
allways/chain_providers/bitcoin.py — detect_address_type() (lines ~26-45), used by reserve/confirm proof flows.
Reproduction
from allways.chain_providers.bitcoin import detect_address_type
detect_address_type('bc1qw508d6qejxtdg4y5r3zarvvary0c5xw7kv8f3t4') # -> 'unknown'
Lowercase equivalent correctly returns p2wpkh.
Impact
Users or wallets emitting uppercase bech32 cannot complete BTC-sourced swap reserve/confirm proofs via external BIP-137 signing.
Suggested fix
Normalize with address.lower() before prefix checks (reject mixed-case per BIP-173).
Environment
mainnet P2WPKH/P2TR uppercase bech32 strings; observed in verify_from_proof path.
Summary
detect_address_type()uses case-sensitivestartswith('bc1q')/startswith('bc1p')checks. Valid BIP-173 bech32 addresses may be encoded in all-uppercase; these are classified asunknown, sosign_from_proof()/verify_from_proof()fail before any cryptographic verification.Affected code
allways/chain_providers/bitcoin.py—detect_address_type()(lines ~26-45), used by reserve/confirm proof flows.Reproduction
Lowercase equivalent correctly returns
p2wpkh.Impact
Users or wallets emitting uppercase bech32 cannot complete BTC-sourced swap reserve/confirm proofs via external BIP-137 signing.
Suggested fix
Normalize with
address.lower()before prefix checks (reject mixed-case per BIP-173).Environment
mainnet P2WPKH/P2TR uppercase bech32 strings; observed in
verify_from_proofpath.