Closed RohanKapurDEV closed 4 years ago
Also is there a specific order in which I have to add inputs, outputs and sign?
For example, can I do the following?
txb.addInput('xxxx', 0, null, p2wpkh.output);
txb.sign(vin: 0, keyPair: alice, witnessValue: 100);
txb.addInput('xxxx', 0, null, p2wpkh.output);
txb.sign(vin: 0, keyPair: bob, witnessValue: 29);
txb.addInput('xxxx', 0, null, p2wpkh.output);
txb.sign(vin: 0, keyPair: charles, witnessValue: 29383);
txb.addOutput("xxxx", 324232);
txb.addOutput("xxxx", 43242323);
txb.build().toHex()
Or do I have to do it like this?:
txb.addInput('xxxx', 0, null, p2wpkh.output);
txb.addInput('xxxx', 0, null, p2wpkh.output);
txb.addInput('xxxx', 0, null, p2wpkh.output);
txb.addOutput("xxxx", 324232);
txb.addOutput("xxxx", 43242323);
txb.sign(vin: 0, keyPair: alice, witnessValue: 100);
txb.sign(vin: 0, keyPair: bob, witnessValue: 100);
txb.sign(vin: 0, keyPair: charles, witnessValue: 100);
txb.build().toHex()
Any clarity would be much appreciated!
Cleared out my issues with this. If anyone else reading this has similar questions, feel free to ask and mention for me and I'll explain.
@RohanKapurDEV could you please explain how you resolved this?
解决了我与此有关的问题。如果其他人也有类似的问题,请随时为我提问和提起,我将进行解释。
how you resolved this???
I noticed that in the transaction building example for P2WPKH inputs, you put the following code:
I have a question specifically about this part of the code:
I know that the first parameter is the transactionID, the second represents the output that we want to spend from the transaction. But what are the third and fourth parameters? They just say
null
and I don't know what the 4th refers to exactly. Can anyone help me clarify what that is?I would also like to know what
witnessValue
refers to exactly. Is it just the value of the output we're trying to spend?