Closed cygnet3 closed 1 year ago
Decided that ScriptPubKey
is too high level for this library. This requires rust-bitcoin
library, which I don't want as a dependency. Instead, #25 adds an endpoint from which you can get a X-only taproot output, from that you can calculate the ScriptPubKey
in the following way:
let taproot_output = bob.get_taproot_output_from_tweak_data(&recipient_tweak_data).unwrap();
let scriptpubkey = Payload::p2tr(&secp, taproot_output, None).script_pubkey();
For BIP158, we would need to scan for the presence of a certain
ScriptPubKey
in a block. In order to do so, we would need a function that takestweak_data
as an argument and computes thisScriptPubKey
.This is slightly different from the
scan_transaction
function: in this function, we provide the outputs aspub_keys_to_check
as an argument and see if any of our calculated outputs matches any of our createdScriptPubKey
s.For this function, we would not need to implement label support, as BIP158 will primarily be used by mobile clients. However, we would need to handle change addresses (which is essentially a label).