delvingbitcoin

Taxonomy of Transaction Fees in Smart Contracts

Taxonomy of Transaction Fees in Smart Contracts

Original Postby ajtowns

Posted on: February 2, 2024 14:09 UTC

In the exploration of Bitcoin transaction diagrams, a series of visual representations are provided to illustrate different scenarios involving Replace-By-Fee (RBF) and Child-Pays-For-Parent (CPFP) mechanisms.

These diagrams aim to clarify the flow of fees and changes in transaction states.

The first scenario depicts an endogenous fee structure using a single transaction RBF. The diagram shows a contract paying to state x with the RBF option indicated by an orange highlight. This transaction conflicts with another that pays to state y. Fees are subtracted from the balance of state x, as shown in the output.

The second scenario also involves a single transaction RBF but with exogenous fees. Similar to the previous case, there is a conflict between transactions paying to states x and y. However, here an additional input for the fee is included, which leads to the generation of change alongside the state x balance in the outputs.

In the third scenario, the focus shifts to a CPFP situation with endogenous fees. It resembles the "endogenous fees, package rbf" scenario, where two transactions conflict: one paying to state x and another to state y from the same contract. The endogenous fees are paid from the contract's state x balance, resulting in a reduced amount after fees are accounted for.

The fourth and final scenario also outlines a CPFP model but with exogenous fees. Here, a separate fee input is introduced, which affects the final output, combining the change with the state x balance.

Each diagram uses rounded boxes to represent unspent transaction outputs (UTXOs), square boxes for transactions, green lines to emphasize sources of fees or changes, and dashed lines to indicate conflicting transactions due to attempts to spend the same UTXO. Transactions eligible for RBF are highlighted in orange, with the color-coding indicating whether the current system supports the RBF or if it requires the forthcoming package RBF feature for state conflicts.