-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update sending #9
Conversation
Get latest test vectors from BIP352. New test vectors follow a different format and also include new tests cases.
Add UTXOType field for determining if a UTXO is eligible for shared secret derivation. Add tests/utils.ts for parsing BIP352 test vectors. These utils are used to determine the UTXOType of the input. The utilities are only added for the tests and not the general library since in normal usage the sending wallet already knows the UTXOType and can set it directly.
BIP352 specifies tagged hashes for: * the outpointHash (BIP0352/Inputs) * the shared secret (BIP0352/SharedSecret) This also involves updating the output hash function to now: * Use the smallest outpoint (as opposed to all outpoints) * Commit to the public key A (the sum of the eligible input pubkeys)
adds functions for checking that the generated sending outputs matches exactly one of the expected.outputs candidate sets.
// The following utilities are provided to determine the UTXOType of a transaction input. | ||
// This is necessary for parsing the test vectors from BIP352, but in practice a sending | ||
// wallet will already know the UTXOType for each UTXO it indends to spend and can set the | ||
// UTXOType field directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how complete (albeit inefficient) this code is? is it worth exporting it and makign it apart of the lib so poor souls who implement wallets but dont know their input types can throw it in and use it when using this js lib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, not sure it makes sense for a sending wallet. A sending wallet will always know what kind of UTXOs it has based on what kind of addresses the wallet hands out, i.e. a wallet that only hands out native segwit and taproot addresses will only have native segwit and taproot UTXOs. It also needs to know the UTXO type to know how sign for it.
Also, for a sending wallet to use this function, they would need extra data that I'm pretty sure they won't have (like the prevout scriptPubKey).
@limpbrains would you like to join the fun? |
Updates to align with BIP0352 spec, specifically:
Also updates tests to handle new test cases, specifically:
I added a
tests/utils.ts
for parsing theUTXOType
which is the minimal code I need for deserializing witness stacks and checking the scriptPubKey template. This file is only necessary for the BIP352 test vectors since in normal usage it is expected that the sending wallet can set this field directly.