-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Taproot keysigning is confusing and the API is unhelpful #744
Comments
Can you elaborate on this? I feel that this logic belongs outside the satisfier API? There is only one internal key signature and it is the responsibility of implementer to provide it. Internal keys are treated differently signers anyways because the sighash message algorithm is different keyspend and script spend. |
Where does it then belong? Maybe the placeholder objects from the planning API should have a richer API that explains how to construct non-placeholder versions? One use case (aside from testing) is to implement a wallet that is willing to sign a given transaction. It has a |
@apoelstra // Create an unsigned tx -- CREATOR
let mut psbt = Psbt::from_unsigned_tx();
// Updator role
pbst.witness_utxo : TxOut = ...; // Spending utxo information
psbt.update_input_with_descriptor(input_idx, desc);
// SIGNER:
let master_xprivs : BtreeSet<bitcoin::bip32::XPriv> = todo!(); // set of all private keys that we want to sign with
psbt.sign(&master_xprivs, &secp); // Works for all types of outputs, tr, wsh etc..
// FINALIZER:
psbt.finalize_mut(&secp); The API will figure out whether it is the internal key or script spend etc and fill everything as required. |
I'm aware that the PSBT API exists but (a) you then need to learn to use the Amusingly the closest one is the "big" example which Antoine wrote as a For specific API improvements:
I appreciate that the latter is basically a poor man's PSBT but it's way easier to find and get working than PSBT since it has fewer moving parts. |
I also think we could do better with the type system to distinguish between taproot and non-taproot keys, but it's hard and I won't try to make specific proposals here. Maybe once my But one thing that comes to mind now, so I might not forget, is to replace the |
Right now in our
Satisfier
API we have alookup_tap_key_spend_sig
method which takes no arguments and returns anOption<Signature>
.The premise, I guess, is that there is only one valid key that can sign a keyspend and the satisfier should know this so there's no need to pass in any extra context.
Well, when developing software you might not know the key, at least initially, because
This would be greatly improved by the API providing a
Pk
and maybe also aTweakedPublicKey
and maybe even the taptweak? And the docs should be improved to explain these things.In general I feel the satisfier API could be greatly improved to provide more context and information to the satisfier.
Related to #742
The text was updated successfully, but these errors were encountered: