LedgerHQ / app-bitcoin-new

Modern Bitcoin Application based on PSBT and Descriptors
Apache License 2.0
94 stars 72 forks source link

Support for SIGHASH flags #9

Closed Lldenaurois closed 2 years ago

Lldenaurois commented 2 years ago

Does the new bitcoin app support ANYONECANPAY SigHashType?

bigspider commented 2 years ago

Not yet, but definitely in the roadmap to support the sighash types.

bigspider commented 2 years ago

Adding some context to help with future specs.

Advanced application might need to use other SIGHASH flags other than the default one. For maximum flexibility, we should support all the valid combinations of sighash flags (NONE, ANYONECANPAY, SINGLE).

It is enough to support them for segwit/taproot inputs only.

Implications to security of each flag should be assessed; as an advanced feature, showing a clear warning whenever any input is signed with a sighash different than SIGHASH_ALL (or the default 0) would be good enough for a first version. Specifically, for SIGHASH_SINGLE, there is a known old bug in Bitcoin's consensus rules that warrants special attention (the app should probably refuse to sign any input with SIGHASH_SINGLE if there is no correspondent output with the same index; that is, it should fail if the input index with SINGLE is larger than or equal to the number of outputs).

bigspider commented 2 years ago

Closing this, as this feature is already added in the experimental branch and will be part of the miniscript release.