# Bitcoin Transaction Fees

Since the TON Teleport BTC is designed as a trustless system, it cannot rely on an external oracle to determine the current average transaction fee in the Bitcoin network. While the system is capable of monitoring Bitcoin blocks, calculating the average fee independently would require accessing and transmitting all Bitcoin transactions within each block. This would mean processing thousands of transactions per block, making it computationally expensive and impractical. Therefore, the system employs two concepts to optimize transaction fees: Child- Pays-For-Parent (CPFP) and a Progressive Fee Model (PFM).

In Bitcoin, every transaction is linked to a previous UTXO, which it references. If the initial transaction has an insufficient fee, and a subsequent transaction (its child) has a higher fee, miners are incentivized to mine both transactions together to collect the higher combined fee. This effectively raises the average fee for both transactions, increasing the likelihood that miners will include them in a block. The CPFP strategy leverages this behavior, allowing for efficient fee management without relying on external data.

In the context of TON Teleport BTC, each Bitcoin peg-out transaction is linked to a previous UTXO that was locked in the system’s bank. If a new peg-out transaction sets a higher fee than the previous one, the miner will be incentivized to process the previous transaction as well, even if its fee was initially lower. This dynamic naturally balances the fees and prevents long delays due to low initial fees. As a result, users benefit from a self-regulating mechanism that optimizes transaction inclusion without external intervention.

In addition to CPFP, the system implements a PFM that automatically adjusts transaction fees based on the number of peg-outs within a given frame. This ensures that transactions are processed efficiently, even as network conditions change. The PFM is defined by a base coefficient b, which serves as the minimum fee in satoshis per vByte. TON validators can adjust b to match the current average fee in the Bitcoin network, providing flexibility for varying conditions.

The progressive fee an increases linearly for the first few peg-outs and quadratically for subsequent peg-outs. The formula is defined as:

$$
a_n = b + (n - 1) \cdot 2, \quad \text{for } n = 1, 2, 3, 4, 5
$$

$$
a_n = a_5 + (n - 5) \cdot 2, \quad \text{for } n \geq 6
$$

Where:

* aₙ — fee in satoshis per vByte for peg-out number n.
* b — base fee coefficient (e.g., 2 sat/vB).
* n — current peg-out transaction number.

Example of Fee Calculation:

$$
a_1 = b = 2
$$

$$
a_2 = 2 + (2 − 1) · 2 = 4
$$

$$
a_3 = 2 + (3 − 1) · 2 = 6
$$

$$
a_4 = 2 + (4 − 1) · 2 = 8
$$

$$
a_5 = 2 + (5 − 1) · 2 = 10
$$

$$
a_6 = 10 + (6 − 5)^2 = 11
$$

$$
a_7 = 10 + (7 − 5)^2 = 14
$$

$$
a_8 = 10 + (8 − 5)^2 = 19
$$

$$
a_n = a_5 + (n − 5)^2
$$

The progressive nature of the fee ensures that initial peg-outs are relatively inexpensive, while later peg-outs within the same period become progressively more costly. This discourages excessive peg-outs in quick succession and helps balance transaction flow.

The progressive fee model includes a maximum fee threshold am, which prevents fees from rising indefinitely. This ensures that fees remain within reasonable bounds, even during periods of high activity. Additionally, the system supports a self-regulating mechanism where the fee rate can decrease once a previously executed peg-out transaction is confirmed in the Bitcoin blockchain.&#x20;

Once a peg-out transaction is confirmed, any participant (usually a relayer) can submit the executed transaction and prove its inclusion in a Bitcoin block. The system tracks the highest fee peg-out within the current series and, upon confirmation, reduces the fee index n by one. This means that if the most expensive peg-out is confirmed, the subsequent peg-out will start from a lower

fee, automatically balancing fees over time.

The system also provides users with flexibility in managing their fees. Users have two options:

<figure><img src="https://2322428612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDZHm4kD4WG4CcwPh2dZ%2Fuploads%2Fj1DZaRP28Hbk55K9mxEk%2FImage-6.png?alt=media&#x26;token=370b1daf-ca54-4f5d-a31f-bb4c0cf44d30" alt=""><figcaption></figcaption></figure>

By combining CPFP and a PFM, the TON Teleport BTC system ensures that transactions are processed efficiently and fairly, without relying on centralized control or external data sources. This approach maintains the trustless nature of the system while optimizing transaction processing in the Bitcoin network.
