Repository navigation
WizardConnect: sign P2PKH inputs with SIGHASH_UTXOS and honour broadcast:false - #784
Conversation
…ds broadcast:false
PR #784 Review:
|
PR #784 ReviewVerdict: Approve. The change is a minimal, spec-correct post-signing branch with no security regressions. Change reviewed —
|
…ures on broadcast failure - Sign P2PKH inputs with SIGHASH_ALL | SIGHASH_FORKID | SIGHASH_UTXOS (0x61) as the WizardConnect spec requires, replacing the stock P2PKH template compiler that emitted 0x41 - Return the signed transaction via sendSignResponse when signing succeeded even if the broadcast then fails, instead of reporting a signing error; run the address-buffer check only on a successful broadcast
PR #784 Review — WizardConnect signing changesVerdict: Approve. Both changes are correct; I verified the signature change functionally, not just by reading it. What I verified (beyond prior reviews)1. New P2PKH signing path (
2.
3. Hygiene
Minor observations (non-blocking)
|
…tConnect project id, and keep relayer errors from crashing the app
PR #784 Review — WizardConnect signing changesVerdict: Approve. All signing changes verified functionally (offline, against the installed Functionally verified1. P2PKH path (
2. Contract-input refusal (
3. 4. WalletConnect changes ( 5. Lint — zero new issues; all 8 errors across the 3 files exist identically at base (reproduced against base file versions). Findings
The core signing changes are correct and security-improving; recommend addressing findings 1–2 (revert the port change, update the PR description) before merge — neither is blocking. |
- Restore Quasar dev server port to 9000 (was accidentally set to 9001) - Drop unrelated package-lock.json peer-flag changes
|
All verification complete. Here is my review: PR #784 Review — WizardConnect signing changes (head
|





Description
Two changes to WizardConnect transaction signing, both requested by the ParyonUSD team.
1. Sign P2PKH inputs with
SIGHASH_UTXOS(0x61)WizardConnect requires every input to be signed with
SIGHASH_ALL | SIGHASH_FORKID | SIGHASH_UTXOS(0x61). The P2PKH branch insrc/wallet/bch-sign.jspreviously delegated to the stockwalletTemplateP2pkhNonHdcompiler, whose unlock script (key.schnorr_signature.all_outputs) producesSIGHASH_ALL | SIGHASH_FORKID(0x41). The contract-input branch already used the correct0x61flags — only the P2PKH branch diverged.The P2PKH branch now signs explicitly with
allOutputs | utxos | forkId, mirroring the contract branch, and the now-unused template compiler imports were removed. Both branches emit0x61.Note:
signBchTransactionis shared by the WizardConnect and WalletConnect v2 paths, so both now sign P2PKH inputs with0x61(valid and recommended for BCH).2. Honour
broadcast: falseWhen a sign request comes in with
broadcast: false(sent inside the transaction payload asrequest.transaction.broadcast), the wallet returns the signed transaction hex to the dapp viasendSignResponseand skips the Watchtower broadcast entirely. Requests without the flag default to true, so broadcast behavior for all existing integrations is unchanged.Additionally, if signing succeeds but the subsequent broadcast fails, the wallet now still returns the signed hex to the dapp (reporting the broadcast failure via a notification) instead of discarding the signature and returning a signing error. The address-buffer check after broadcast only runs on a successful broadcast.
Screenshots (if applicable):
(Include screenshots for UI-related changes)
Type of Change
Test Notes
1. Install & lint
src/wallet/bch-sign.js,src/store/wizardconnect/actions.js) show only pre-existing unused-var lint errors — this PR adds zero new lint issues.2. Signature verification (offline)
Signed a P2PKH transaction through
signBchTransactionand inspected the unlocking bytecode withbitauth-libauth-v3:0x61(previously0x41).secp256k1.verifySignatureSchnorrpasses against the0x61signing serialization and fails against0x41.3. Unit tests
No test files exist in the repo yet for these actions — nothing to update (N/A).
4. Manual end-to-end test
mandatory-script-verify-flag-failed) → error shown, signed hex discarded, dapp got nothing.Does this affect other areas?
No. The broadcast flag defaults to
true, so requests withoutbroadcast: falsebehave exactly as before (apart from the now-correct0x61hashtype). Normal payment flows, signing, and key handling are otherwise untouched.@mentions
@joemarct