Estimating digital bytes of a transaction turns out round






I am sorry if this has been responded sooner than, however I have not discovered somebody in reality deliver this up.

I’m looking to assemble a PSBT, which assumes a hard and fast feerate and a hard and fast quantity to ship to a couple cope with. Any additional sats is trade again to the sender. One thing like:

const psbt = new Psbt({ community: bitcoin.networks.bitcoin });
psbt.addInput({hash, index, witnessUtxo: {...}});
psbt.addOutput({cope with: recipient, worth: amountToSend});
psbt.addOutput({cope with: sender, worth: changeAmount}); // general inputs - amountToSend - charges

Alternatively, growing that final trade output turns out like a round workout:

  • To decide the final output so as to add to the PSBT, we want to know the precise rate in satoshis we are keen to spend.
  • To understand the precise rate in satoshis, we want to know the digital bytes that the tx will devour, which calls for us having an absolutely built and signed PSBT i.e. signedPsbt.extractTransaction().virtualSize();.

Am I lacking one thing obtrusive right here? Is there one thing to lend a hand estimate vsize sooner than signing a PSBT (by way of estimating the dimensions of signatures)? Or one thing to lend a hand estimate charges given selection of inputs and outputs?

Any lend a hand is liked. Thanks prematurely!

Share this


Tesla Govt Says Repair For Vampire Drain In Sentry Mode Coming In Q2: ‘Energy Intake Wishes Development’ – Tesla (NASDAQ:TSLA)

Tesla Inc TSLA govt, Drew Baglino, on Thursday printed that the corporate is operating on liberating a device replace for decreasing energy intake...

Dividend Kings In Focal point: Phone & Information Techniques

Printed on February twenty second, 2024 through Bob Ciura The Dividend Kings consist of businesses that experience raised their dividends for a minimum of...

Tyler Perry Calls On Leisure Trade, Executive To Corral AI Prior to Everybody Is Out Of Trade

Tyler Perry has observed demonstrations of what AI can do. Whilst he's astonished, he’s additionally sounding an alarm. Perry is already balloting together...

Recent articles

More like this


Please enter your comment!
Please enter your name here