Good morning, for the last few months I have been using the following formula to calculate transaction fee based on the transaction size when sending BTC from one address to multiple addresses(or batch transaction). Currently I would like to reverse this and collect my BTC from multiple different addresses and send it to my cold wallet(which is one address that will purposely collect BTC). So instead of sending from 1 to many I would like to send BTC from many to 1.
var transactionSizeBytes = _regularInputBytes + (countOfOutputsForThisTransactionWithoutChange * _regularOutputBytes) + (_regularOutputBytes/* bytes for change output*/) + _regularOverheadBytes;
logger.LogInformation($"Transaction size is : {transactionSizeBytes} bytes");
logger.LogInformation($"Transaction speed {_satoshiPerByteMedium} satoshi per byte ");
var transactionFeeSatoshi = transactionSizeBytes * _satoshiPerByteMedium;
var transactionFeeBtc = transactionFeeSatoshi * _satoshiInBtc;
return transactionFeeBtc;
This is the way I am calculating my fee and transaction size for the batch transaction 1 to many. I am assuming that if I want to instead send BTC from many to 1 the formula will be changed to:
var transactionSizeBytes = (countOfInputsForThisTransactionWithoutChange * _regularInputBytes) + (_regularOutputBytes/* only one output for collection*/) + _regularOverheadBytes;
where countOfInputsForThisTransactionWithoutChange will be pretty much the count of addresses I want BTC to collect from. Please correct me if this is wrong.