Closed educob closed 4 years ago
Is the address generated by const bitcoin.payments.p2sh({ redeem: { output: complexCsvOutput( ... segwit?
No. There is no p2wsh or p2wpkh anywhere, so it is not segwit.
If not what would be the code?
change p2sh with p2wsh for native segwit and wrap p2wsh in p2sh for backwards compatibility.
Is it possible to use segwit when using new bitcoin.Transaction(); or only with new bitcoin.Psbt()?
Transaction is literally a bitcoin transaction. Anything is possible. You just need to code the logic for adding whatever inputs / witnesses / outputs you need.
In this line: .finalizeInput(0, csvGetFinalScripts) I don't see where the function parameters are passed. Could you please explain?
They are passed in here:
In the return in function csvGetFinalScripts, where is payment.input defined?
The Payment API is a lazy-loading generator that takes inputs and generates outputs based on info it has already been passed.
ie. If I make a p2pkh payment with only output
I can read the payment.address
attribute and as soon as I read it the getter will grab the pubkeyhash out of the output and base58check encode it, cache it, then return it. So by "using" the input, it will throw an error if it doesn't have enough info to generate the input. Example:
Hi.
Is the address generated by const
bitcoin.payments.p2sh({ redeem: { output: complexCsvOutput( ...
segwit? If not what would be the code?Is it possible to use segwit when using
new bitcoin.Transaction();
or only withnew bitcoin.Psbt()
?In this line:
.finalizeInput(0, csvGetFinalScripts)
I don't see where the function parameters are passed. Could you please explain?In the return in function
csvGetFinalScripts
, where ispayment.input
defined?Thanks.