LTC - How Fee Estimate Works

A Litecoin transaction fee equals the fee rate multiplied by the transaction size, which is about (inputs × 148) + (outputs × 34) + 10 bytes.

Litecoin (LTC) operates on a UTXO (Unspent Transaction Output) model, where the transaction fee is estimated based on two primary parameters:

  1. Approximate fee per byte (fee rate)
  2. Transaction size

LTC Fee Estimate Formula

The Formula

Estimated Fee == "approximate fee per byte" x "transaction size in bytes"

Step_1: Calculating the approximate fee per byte

To estimate the fee for a LTC transaction, you can use the Tatum endpoint for LTC "fee estimate":

Example request:

curl --request GET \
     --url https://api.tatum.io/v3/blockchain/fee/LTC \
     --header 'accept: application/json' \
     --header 'x-api-key: {YOUR_API_KEY}'
{
    "fast": 13.597,
    "medium": 8.461,
    "slow": 4.577,
    "block": 2701104,
    "time": "2024-06-11T11:31:08.697675402Z",
    "weight": 1
}

The Tatum endpoint returns the fee rate in litoshi per byte (1 LTC = 100,000,000 litoshi).

There's also the option to make a RPC node request. The RPC method estimatesmartfee returns feerate in LTC per kilobyte.

Example RPC request:

  • params sets the confirmation target in blocks, here 2.
curl --location 'https://litecoin-mainnet.gateway.tatum.io' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
    "jsonrpc":"1.0",
    "id":"curltext",
    "method":"estimatesmartfee",
    "params":[2]
}'
{
    "result": {
        "feerate": 0.00001,
        "blocks": 2
    },
    "error": null,
    "id": "curltext"
}

Step_2: Calculating the Transaction Size

Transaction Size (in bytes) = (Number of Inputs x 148) + (Number of Outputs x 34) + 10

  • Number of Inputs: The number of transaction inputs (unspent transaction outputs or UTXOs) that your transaction is spending.
  • Number of Outputs: The number of transaction outputs, including the recipient's address and any change addresses.
  • 10 bytes: A fixed overhead for the transaction header.

Let's break it down:

  • Number of Inputs x 148 bytes: Each input typically takes 148 bytes. This includes the previous transaction's reference (36 bytes: the 32-byte transaction hash and the 4-byte output index), 1 byte for the length of the scriptSig, the scriptSig that unlocks the UTXO (typically about 107 bytes: a signature and a compressed public key), and 4 bytes for the sequence number.
  • Number of Outputs x 34 bytes: Each output typically takes 34 bytes. This includes 8 bytes for the amount in litoshis, 1 byte for the length of the locking script, and 25 bytes for the locking script that pays to the recipient's address (P2PKH).

Example LTC transaction

Parameters

  • Number of Inputs = 2
  • Number of Outputs = 2

Using the formula

  1. Transaction Size (in bytes) = (2 x 148) + (2 x 34) + 10
  2. Transaction Size (in bytes) = 296 + 68 + 10
  3. Transaction Size (in bytes) = 374 bytes

So, the transaction size in this example is 374 bytes.

Baseline feerate vs Estimate Fee by Tatum

There is a difference between the baseline fee rate (from RPC call) and the estimates from the Tatum endpoint.

Baseline Fee Rate

The baseline fee rate (0.00001 Litecoins per kilobyte, or 1 litoshi per byte) is a standard minimum rate often used as a reference. This represents a minimal fee that might be accepted by the network during very low traffic times, but it doesn't guarantee timely inclusion in a block, especially during high network congestion.

Estimated Fee (Tatum)

The fee estimates (fast, medium, slow) provided by the Tatum endpoint are dynamic and reflect the current network conditions.

  • Fast: This rate (13.597 litoshi per byte or 0.00013597 Litecoins per kilobyte) is for transactions that need to be confirmed quickly, often within the next block or two.
  • Medium: This rate (8.461 litoshi per byte or 0.00008461 Litecoins per kilobyte) balances cost and confirmation time, suitable for transactions that can wait a few blocks.
  • Slow: This rate (4.577 litoshi per byte or 0.00004577 Litecoins per kilobyte) is the lowest among the estimates and is used for transactions that are not time-sensitive, potentially taking longer to confirm.

Did this page help you?