Transaction fees

From Litecoin Wiki
Revision as of 05:32, 12 February 2018 by Admin (talk | contribs) (Created page with "==Reference Implementation== The following sections describe the transaction fee rules in Litecoin-Qt and Litecoind as of 0.8.6.1. Earlier versions may have different rules....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Reference Implementation

The following sections describe the transaction fee rules in Litecoin-Qt and Litecoind as of 0.8.6.1. Earlier versions may have different rules.

Settings

Setting Default Value (Units) Description
limitfreerelay 15,000 (Bytes) Limit of free transactions the client will relay to other nodes per minute
mintxfee 0.001 (LTC) Minimum fee per KB for non free transactions (creating)
minrelaytxfee 0.001 (LTC) Minimum fee per KB for non free transactions (relaying)
mininput 0.00001 (LTC) Wallet ignores smaller inputs
DUST_THRESHOLD 0.001 (LTC) Minimum output to avoid an additional mintxfee charge per smaller output
blockmaxsize 1,000,000 (Bytes) Maximum block size
blockminsize 0 (Bytes) Minimum block size
blockprioritysize 17,000 (Bytes) Size of the block reserved for highest-priority transactions (regardless the fee)
maxhighprioritytxsize 12,000 (Bytes) Maximum size of a transaction to be eligible for highest-priority


Fee and Change Handling

Once you've calculated the size of your inputs and outputs, you need to use the minimum fee per kilobyte to figure out the fee.

Example: If your inputs and outputs add up to 560 bytes, that is under 1 kilobyte, meaning the fee is (mintxfee * 1) (currently that is 0.001 LTC).

Important Note: Because of Litecoin's dust mitigation, if you have any outputs that are under 0.001 LTC (DUST_THRESHOLD), you will be penalised with an extra 0.001 fee for each output.

Example Transaction

   Input 1: 5 LTC to Address A (60 bytes)
   Input 2: 5 LTC to Address A (60 bytes)
   Output 1: 4 LTC to Address B
   Output 2: 0.0005 LTC to Address C
   
   Size: 200 bytes (Note: these are all made-up numbers just for an example)

Now that we know where the coins are going, and the values of those, we can calculate the fee and change:

1. The transaction gave us 0.9995 remaining Litecoins

2. The size was 200 bytes. That adds 0.001 to the fee because it's within 1 kilobyte.

3. There was an output below the 0.001 threshold. This adds another 0.001 LTC penalty fee.

4. 0.9995 (Change) - (0.001 * 2) (Fee) = 0.9975 Change

All we have to do now, is add another output to the change address, that could be Address A, or another address the user owns/wants the coins to go to.

New Transaction with Change

   Input 1: 5 LTC to Address A (60 bytes)
   Input 2: 5 LTC to Address A (60 bytes)
   Output 1: 4 LTC to Address B
   Output 2: 0.0005 LTC to Address C
   Output 3: 0.9975 LTC to Address A (CHANGE)

The remaining unspent coins (0.002) will become the miners fee, as they were not spent in the transaction.

What do I do if I have change that is below 0.001 (current dust threshold)?

The recommended way (which is used in the official client for desktop and mobile devices), is to drop the change as a miners fee. Because you're penalised for outputs under 0.001, it's highly recommended to simply drop the change and allow it to become part of the miner fee.