Calculating LiteCoin Transaction Fee before sending is seriously headache

I want to calculate possible transaction fee X amount of LTC.
I read it online on different forums. They talk about Inputs and Outputs.
Again. I don`t know where to get inputs of a transaction which is not even generated.
If i use “sendtoaddress” then we know that this will be transmitted to network and fee will be deducted either from HD wallet or from transaction amount.
So how can we estimate amount of fee? e.g fee for 0.01 LTC?

2 Likes

the standard is 0.001LTC per byte
check this out:

Note: less for segwit tx’s

2 Likes

So if your transaction has in inputs and out outputs, the transaction size, in bytes will be:
in180 + out34 + 10 plus or minus ‘in’

Where to get IN and OUT??

How many bytes are there in an LTC?

1 Like

if you check out the link it will tell you:

Assuming all the inputs you are spending are from regular “pay to address” transactions, each input will contribute 180 (plus or minus 1) bytes to the transaction. Each output adds 34 bytes to the transaction. And there’s a fixed extra 10 bytes which are always present.
Assuming all the inputs you are spending are from regular “pay to address” transactions, each input will contribute 180 (plus or minus 1) bytes to the transaction. Each output adds 34 bytes to the transaction. And there’s a fixed extra 10 bytes which are always present.

The “plus or minus 1” comes from the fact that each input needs a signature to be claimed. The signature contains two 32 byte values, but if either of the values has a first byte of 0x80 or more, it has a 0x00 byte prepended to it. So I’m assuming one of the two is high and the other is low. That way I’m off by at most one byte per input.

So if your transaction has in inputs and out outputs, the transaction size, in bytes will be:

in*180 + out*34 + 10 plus or minus 'in'

For example, this transaction has 40 inputs and 16 outputs. That gives us a transaction size of

40*180 + 16*34 + 10 +- 40

i.e. 7754 +- 40 bytes. The actual size is 7761 bytes.

If the inputs are from “pay to pubkey” transactions then the inputs are smaller than for “pay to address” transactions. And this will be different also for “pay to script hash” inputs too, depending on how/if that’s implemented.

2 Likes

each input will contribute 180 …
I read that ■■■■ before posting in the forum. And where i am confused that what the ■■■■ is this “EACH” because. I have to preview cost of a transaction before submitting it so user will know how much he/she has to pay for this transaction.
My point is how can i know how many bytes are in a transaction which does not even exist. This is a holy ■■■■ bitcoin derived currencies have.
XRP (Ripple) provides a an easy method to calculate fee. but here in Litecoin and bitcoin you have to semi-God and should be knowing future.
And transaction as a reference which i see everywhere is a transaction which fucking networking submitted transaction which got inputs and outputs from network. WTF…?

if you are spending a single input as a singe out put then it would be 180 + or - the input value of …
so lets say you have a singe input you want to send to a single address…
1* 180 = 180 ± 40 = 210 bytes…

why dont you just use the calculator in the qt wallet?
if you have “coin control features” enabled then just select the fee you want to spend…
that calculator works just fine…
not sure why your trying to do it manually anyway…

exactly…the input is the transaction you received…the output is the transaction you are creating