Skip to content

v3.8.5

Choose a tag to compare

@github-actions github-actions released this 15 Jun 09:31
· 87 commits to main since this release
670dcbc

MetroVault v3.8.5 - Release Notes

Silent Payments (BIP-352)

Full BIP-352 Silent Payments support: receive, send, and spend sp1q… payments entirely air-gapped. MetroVault can now act as a cold signer for Silent Payment wallets end-to-end.

  • Create & Import SP Wallets: Silent Payments is now a wallet type in both the create and import flows, for Mainnet (sp1q…) and Testnet (tsp1q…).
  • Receive: Derive BIP-352 scan (b_scan) and spend (b_spend) keys from the master key and present the wallet's silent-payment receive address with a QR code.
  • Send: Pay to sp1q…/tsp1q… addresses. MetroVault resolves the nominal SP address into the real on-chain Taproot (bc1p…) output before signing, so you can verify exactly where funds are going.
  • Spend Received Outputs: Sign PSBT inputs that spend previously received silent-payment outputs, computing the tweaked key-path signing key (d = b_spend + tweak) with validation that the tweak matches the input's Taproot output key.
  • Mixed Transactions: Transactions combining silent-payment and standard inputs (and SP sends alongside SP receives) are handled in a single signing flow.

Scan-Key Export (Watch-Only Setup)

Set up a watch-only Silent Payments wallet on your online coordinator without ever exposing spend authority:

  • Scan-Key Export Screen: Export BIP-352 scan keys and descriptors with QR generation and account-level derivation.
  • spscan/tspscan Codec: Bech32m encoding/decoding of scan-key export strings.
  • Cold-Signer Safety: The codec strictly rejects spend-key exports (spspend/tspspend), preserving the cold-signer security model — the spend key never leaves the device.

PSBT v2 Support (BIP-370)

Silent Payment sends from coordinators are PSBT v2 (like Sparrow), MetroVault now parses and serializes them.

  • Full v2 Read/Write: PsbtReader.readV2 synthesizes the transaction from per-input/output fields (PSBT_IN_PREVIOUS_TXID, PSBT_OUT_AMOUNT, locktime computation); PsbtWriter serializes v2 with global transaction counters.
  • Byte-for-Byte Round-Trips: Verified against real PSBT v2 fixtures exported from Sparrow, preserving unknown fields (e.g. PSBT_OUT_SP_V0_INFO) across read/write.
  • Backward Compatible: PSBT v0 (BIP-174) continues to work through the same reader/writer architecture.

DLEQ Proofs & Verification (BIP-374 / BIP-375)

So that watch-only wallets can independently verify the derived output scripts MetroVault produces:

  • DLEQ Proofs (BIP-374): New DleqProof utility generates and verifies Discrete Log Equality proofs.
  • BIP-375 Global Fields: SP resolution now authors PSBT_GLOBAL_SP_ECDH_SHARE and PSBT_GLOBAL_SP_DLEQ so coordinators can verify derived outputs.
  • Spec-Compliant Stripping: PsbtWriter strips global silent-payment proof fields from PSBT v0 serializations per BIP-375 constraints.

BIP-322 Message Signing

Modern message signing that works with Taproot and Silent Payment addresses:

  • BIP-322 Support: New Bip322 utility performs virtual-transaction signing and verification, enabling message signing for address types that legacy signing can't handle.
  • Unified Signer: WalletMessageSigner centralizes signing/verification across BIP-137 (Electrum/legacy), and BIP-322.
  • Air-Gapped SP Signing: BIP-322 message-signing PSBTs allow message signing for Silent Payment wallets over QR.

Change Script Type

Single-sig wallets can now switch script types while preserving their account structure:

  • Switch Anytime: Toggle a wallet between Taproot, Native SegWit, Nested SegWit, and Legacy.
  • Access: Wallet Details → Change Script Type.

Multisig Registration & Change-Address Validation

Multisig wallets must now be explicitly registered before they can sign, closing the change-address attack where a malicious or buggy coordinator routes "change" to an address it controls.

  • Verify & Register Ceremony: A dedicated screen (shown at import and reachable later from Wallet Details) that leads with the derived first receive address and the descriptor's BIP-380 #checksum to cross-check against your coordinator, lists every cosigner's full xpub (with QR), fingerprint, and derivation path, and registers the wallet with a single confirmation.
  • Enforced Before Signing: Signing a multisig PSBT is blocked until the wallet is registered. The verified state is bound to a checksum of the exact descriptor, so any descriptor change automatically re-arms verification.
  • Change-Output Validation: At sign time, the device derives the expected output scriptPubKey from the full registered descriptor at the PSBT-declared index. Any output that claims to be your change (carries a cosigner fingerprint) but does not match is refused — the descriptor, not the PSBT's hints, is the source of truth.
  • Migration: Previously-imported multisig wallets show a one-time explainer and a "Not yet verified" banner until re-registered.
  • Fixes: Corrected P2SH-P2WSH (nested-segwit) multisig address derivation (a double-SHA256 of the witness script) and the Wallet Details "Address Type" label for multisig wallets.

Additional Improvements

Silent Payments UX

  • Badges: A "Silent Payments" badge appears on wallet cards (Wallets screen) and in Wallet Details.
  • Addresses Tab: A "Silent Payments" tab in the Addresses screen lets you derive SP addresses (gated by a global toggle).
  • Discovery Toggle: Settings → Advanced adds a global toggle to enable Silent Payment features for standard wallets.
  • Smart Navigation: Home and Wallet Details route SP wallets to the dedicated SP address view automatically.
  • Key Exposure Warning: The SP address screen warns about key exposure and gates scan/spend key reveal behind password confirmation.

Transaction Confirmation

  • SP Output Display: Confirmation screens show both the recipient's sp1q… address and the derived on-chain bc1p… address for verification.
  • Self-Send Detection: Outputs are labeled CHANGE vs RECEIVE when they belong to the wallet, with a "Self-Send" notice and corrected net-amount math that excludes internal outputs.

QR & Scanning

  • Smarter Format Detection: AnimatedQRScanner distinguishes ur:crypto-psbt/ from ur:psbt/ and falls back to single (non-animated) QR codes.
  • Automatic Output Format: The detected source format now auto-selects the most compatible signing output format.
  • PSBT vs Plain Payloads: isPsbtFrame detection routes PSBT frames to the joiner while letting plain payloads (addresses/messages) pass through.
  • SeedQR Polish: Shared SeedQRContent component, quiet-zone border for reliable scanning, grid overlay off by default, and a double-tap-to-zoom hint.

Security

  • Logs Stripped from Release: New AppLog wrapper is compile-time gated on BuildConfig.DEBUG; log strings and lambdas are completely removed from release artifacts, with ProGuard rules stripping any residual android.util.Log calls.

Testing

  • Major Coverage Expansion: Granular crypto tests (SHA-1/256/512, RIPEMD-160, HMAC, PBKDF2), BIP-32/39 derivation, BIP-44/49/84/86 address vectors, Taproot (Schnorr, key-/script-path, OP_CHECKSIGADD), Bech32/Base58, and BIP-69 ordering.
  • SP & PSBT v2 Tests: BIP-352 reference vectors, scan-key codec round-trips, SP send/receive signing, PSBT v2 Sparrow fixtures, DLEQ vectors, BIP-375 round-trips, and BIP-322 interop.

Build & Tooling

  • Gradle 9.5.1 and compileSdk 37.
  • Build script cleanup (removed redundant plugins/flags), secp256k1-jvm added for JVM tests, and minor Compose performance fixes (lambda-based Modifier.offset).

Technical Details

Key Files Added / Modified

Silent Payments — Core Library (lib/bitcoin/)

  • SilentPayments.kt - shared-secret and Taproot output-key derivation; typed SilentPaymentMathException
  • SilentPaymentAddress.kt - sp1q…/tsp1q… bech32m encode/decode
  • SilentPaymentInputs.kt - eligible input classification (P2TR, P2WPKH, P2SH-P2WPKH, P2PKH; excludes NUMS script-path)
  • SilentPaymentSpending.kt - one-shot spending key derivation (d = (b_spend + tweak) mod n)
  • DleqProof.kt - BIP-374 DLEQ generation/verification
  • Bip322.kt - BIP-322 virtual-transaction message signing

Silent Payments — Services & Orchestration

  • SilentPaymentSender.kt - resolves SP placeholders into final Taproot outputs; authors BIP-375 fields
  • SilentPaymentReceiveSigner.kt - signs inputs spending received SP outputs
  • SilentPaymentManager.kt / SilentPaymentWalletService.kt - wallet-level SP operations, address resolution, scan-key export, descriptors
  • WalletSigningService.kt - resolveSilentPayments pre-stage and SP-aware signing flow
  • WalletMessageSigner.kt - unified BIP-137/BIP-322 signing
  • ScanAddressCodec.kt - spscan/tspscan export codec (rejects spend keys)

PSBT

  • PsbtReader.kt / PsbtWriter.kt / PsbtTypes.kt - modularized parsing/serialization, PSBT v2 (BIP-370) support
  • PsbtKeyResolver.kt - shared per-input key derivation extracted from PsbtSigner
  • Bip374Fields.kt - typed accessors for SP PSBT fields (PSBT_OUT_SP_V0_INFO, PSBT_IN_SP_TWEAK, labels)
  • PsbtAnalyzer.kt - SP recipient resolution for confirmation display

UI / Feature Screens

  • SPAddressScreen.kt - SP receive address with key-reveal dialog
  • SilentPaymentExportScreen.kt - scan-key/descriptor export
  • ScriptTypeScreen.kt - script-type switching for single-sig wallets
  • AddressesScreen.kt / WalletDetailsScreen.kt / WalletsScreen.kt - SP tabs, badges, gated options
  • TransactionConfirmation.kt - SP output rows and self-send handling
  • AppNavigation.kt - routes for SP address, SP export, and script type

Multisig Registration

  • MultisigChangeValidator.kt (new) - descriptor-based change-output validation at signing
  • MultisigAddressService.kt - generateMultisigScriptPubKey; P2SH-P2WSH address-derivation fix
  • VerifyMultisigScreen.kt (new) - Verify & Register ceremony, cross-checks, and receipt
  • WalletMetadata.kt - multisigVerified flag bound to a descriptor checksum
  • Wallet.kt - registration state, markMultisigVerified, and signing gates (WALLET_NOT_VERIFIED / CHANGE_OUTPUT_MISMATCH)
  • WalletDetailsScreen.kt / ScanPSBTScreen.kt / ImportMultisigScreen.kt - registration banner, pre-sign notice, and ceremony wiring

Data Model & Wallet

  • WalletMetadata.kt - isSilentPayment flag, cached B_scan/B_spend pubkeys, serialization
  • Wallet.kt - eager SP key derivation/caching, changeScriptType, SilentPaymentManager integration
  • DerivationPaths.kt - BIP-352 account/scan/spend path builders (m/352'/…)

Security & Build

  • AppLog.kt - compile-time-gated logging; proguard-rules.pro updates
  • app/build.gradle.kts, gradle.properties, lint.xml - Gradle 9.5.1, compileSdk 37, test config

What's Changed

  • Refactor and expand cryptographic unit tests and project configuration by @gorunjinian in #7
  • Implement BIP-352 Silent Payments support and PSBT v2 enhancements by @gorunjinian in #8

Full Changelog: v3.8.0...v3.8.5