apply the required all sighash to the inputs of a psbt with silent payment outputs in the transaction tab, and check each input a card will sign before it signs any
What changed, and why it matters
This commit fixes how Sparrow Wallet handles Bitcoin transactions that use silent payments. Silent payments require every input to be signed with SIGHASH_ALL, meaning the signature covers the whole transaction. Previously, the wallet might have let a hardware card sign an input with a weaker signature type, or let the user pick a different one in the transaction tab. The patch forces SIGHASH_ALL on all inputs when silent payment outputs are present, and makes each card check that requirement before signing anything. A wrong sighash could let an attacker alter parts of the transaction after some inputs are signed, potentially redirecting funds or breaking the silent-payment protocol.
Users who create or sign silent payment transactions should upgrade to the release containing this commit. Developers should review the drongo subproject bump for related sighash/silent-payment changes and verify that verifySilentPaymentSigHash throws a clear exception when an incompatible sighash is present.
Security signals we found
silent payment sighash enforcement
SIGHASH_ALL coercion for silent payment outputs
pre-sign sighash verification in hardware card APIs
transaction tab sighash UI restriction
Evidence from the diff
The change updates the drongo subproject and four Java files. In the transaction tab (HeadersController), when a PSBT has silent payment outputs and is editable, every input’s sighash is coerced to SIGHASH_ALL (or SIGHASH_DEFAULT for taproot). In CkCardApi, KeycardApi, and SatoCardApi, before any input is signed the code now calls PSBTInput.verifySilentPaymentSigHash() on each signing input. This enforces the protocol rule that silent payment outputs require SIGHASH_ALL on every input. The fix prevents a partial or inconsistent sighash from being accepted by a hardware signing device.
Changed components
drongo subprojectcom.sparrowwallet.sparrow.io.ckcard.CkCardApicom.sparrowwallet.sparrow.io.keycard.KeycardApicom.sparrowwallet.sparrow.io.satochip.SatoCardApicom.sparrowwallet.sparrow.transaction.HeadersControllerInspect captured patch +12 / −1
### drongo
@@ -1 +1 @@
-Subproject commit 94f13d24eafa1a5df5b51813d67d5eacc2cb56ba
+Subproject commit 1162ab4e2f051813fda1091a82cf3bdf7f323cb5
### src/main/java/com/sparrowwallet/sparrow/io/ckcard/CkCardApi.java
@@ -194,6 +194,7 @@ void sign(Wallet wallet, PSBT psbt) throws CardException {
KeyDerivation cardKeyDerivation = cardKeystore.getKeyDerivation();
Map<PSBTInput, WalletNode> signingNodes = wallet.getSigningNodes(psbt);
+ signingNodes.keySet().forEach(PSBTInput::verifySilentPaymentSigHash);
for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
if(!psbtInput.isSigned()) {
WalletNode signingNode = signingNodes.get(psbtInput);
### src/main/java/com/sparrowwallet/sparrow/io/keycard/KeycardApi.java
@@ -234,6 +234,7 @@ public Service<PSBT> getSignService(Wallet wallet, PSBT psbt, StringProperty mes
void sign(Wallet wallet, PSBT psbt) throws CardException {
Map<PSBTInput, WalletNode> signingNodes = wallet.getSigningNodes(psbt);
+ signingNodes.keySet().forEach(PSBTInput::verifySilentPaymentSigHash);
for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
if(!psbtInput.isSigned()) {
WalletNode signingNode = signingNodes.get(psbtInput);
### src/main/java/com/sparrowwallet/sparrow/io/satochip/SatoCardApi.java
@@ -162,6 +162,7 @@ public Service<PSBT> getSignService(Wallet wallet, PSBT psbt, StringProperty mes
void sign(Wallet wallet, PSBT psbt) throws CardException {
Map<PSBTInput, WalletNode> signingNodes = wallet.getSigningNodes(psbt);
+ signingNodes.keySet().forEach(PSBTInput::verifySilentPaymentSigHash);
for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
if(!psbtInput.isSigned()) {
WalletNode signingNode = signingNodes.get(psbtInput);
### src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java
@@ -558,6 +558,14 @@ public LocalDate fromString(String value) {
SigHash psbtSigHash = silentPaymentOutput ? requiredSigHash : psbt.getPsbtInputs().stream().map(PSBTInput::getSigHash).filter(Objects::nonNull).findFirst().orElse(requiredSigHash);
sigHash.setItems(FXCollections.observableList(silentPaymentOutput ? List.of(requiredSigHash) : (taprootInput ? SigHash.TAPROOT_SIGNING_TYPES : SigHash.LEGACY_SIGNING_TYPES)));
sigHash.setValue(psbtSigHash);
+ //Silent payments require every input to sign with SIGHASH_ALL, so the only value offered replaces any other the PSBT requests
+ if(silentPaymentOutput && headersForm.isEditable()) {
+ for(PSBTInput psbtInput : psbt.getPsbtInputs()) {
+ if(psbtInput.getSigHash() != null && psbtInput.getSigHash() != SigHash.ALL && psbtInput.getSigHash() != SigHash.DEFAULT) {
+ psbtInput.setSigHash(requiredSigHash == SigHash.DEFAULT && !psbtInput.isTaproot() ? SigHash.ALL : requiredSigHash);
+ }
+ }
+ }
sigHash.setConverter(new StringConverter<>() {
@Override
public String toString(SigHash sigHash) {Why this scored 58/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.