Files
bridge/internal
zeekay 0e1ad73ace feat(mchain): BTC P2WPKH derivation from keygen ECDSAPubKey
Extend the MPC keygen client to surface the compressed secp256k1
public key alongside the chain-appropriate address, and derive a
bech32 P2WPKH locally for BITCOIN_* networks instead of relying on
mpcd's legacy P2PKH "1..." output.

Why: bridge release on BTC needs P2WPKH (witness-discount fees,
direct btcsuite/txscript compatibility, broader wallet support).
mpcd's pubKeyToBtcAddress emits Base58Check P2PKH; rather than
round-tripping a fix through mpcd, the bridge re-derives locally
from the same ECDSAPubKey the keygen already returns.

Changes:
- Wallet gains ECDSAPubKey []byte; 33-byte compressed form preferred,
  uncompressed (65/64) and x-only (32) inputs all compress canonically
- keygenResult parses both eth_address and evm_address (mpcd renamed)
- pickAddress() takes the network internal_name so BITCOIN_MAINNET vs
  BITCOIN_TESTNET selects the right bech32 hrp (bc / tb)
- new btc_address.go: deriveBTCBech32Address + compressSecp256k1Pubkey
  + bitcoinChainParams; uses btcd/btcutil for canonical HASH160 +
  segwit-v0 encoding
- 11 new tests covering mainnet/testnet hrp selection, 32/33/64/65
  byte pubkey shapes, empty/malformed input, keygen integration
2026-05-27 18:07:03 -07:00
..
2026-05-27 14:49:55 +02:00
2026-05-27 14:49:55 +02:00