Trying all address types in message signing verification (BIP)



Summary:

Ali Sherief, a developer, is proposing to create a Bitcoin Improvement Proposal (BIP) to address the lack of standardization for Segwit message signatures. Currently, wallets that support signing and verifying a bitcoin message can only sign legacy addresses. There is no generally-accepted standard for signing segwit messages. Ali's proposal will standardize the practice of placing the segwit address into the address field and set guidelines for writing a message signing and verification procedure.The BIP does not replace, supersede, or obsolete BIPs 173 or 322. In the verification part of the proposal, P2PKH (legacy address), P2WPKH-P2SH (nested segwit), and P2WPKH with version from 0 to MAX_WITNESS_VERSION will be tried in sequence in an attempt to reconstruct the address in the signed message. If any of these hashes yield the correct address, the verification procedure stops, and it fails if all of the above methods fail to reproduce the address in the signed message.In the signing procedure, the only modification is the insertion of the segwit address in place of the legacy address in the signed message. Ali plans to add a Python example for the signing and verification process, which can be translated to C++ without even minor interface/implementation difficulties. However, Bitcoin Core does not currently support verifying the message as its UX makes it look possible, but in effect, segwit features never got implemented to that depth in Core. Peter (Coinkite Inc) suggests that a "defacto" BIP is needed, and Core should be updated to support it.The author seeks advice from the mailing list on how to draft such a BIP, and clarifies that no auxiliary feature additions are needed for this proposal. The proposed BIP aims to standardize the practice of placing the segwit address into the address field, without requiring alterations to the message signing format. No changes are necessary to existing signed messages, and the original sign/verify algorithms will continue to interoperate with this improved sign/verify algorithm if the BIP is approved.


Updated on: 2023-06-15T23:00:46.610986+00:00