61 releases (37 major breaking)

new 39.1.0 Mar 27, 2025
38.0.2 Dec 20, 2024
38.0.0 Sep 26, 2024
37.0.1 Dec 12, 2024
2.0.0-alpha.5 Mar 24, 2020

#367 in Magic Beans

Download history 32552/week @ 2024-12-09 26743/week @ 2024-12-16 7754/week @ 2024-12-23 14154/week @ 2024-12-30 25607/week @ 2025-01-06 39677/week @ 2025-01-13 34371/week @ 2025-01-20 27873/week @ 2025-01-27 34237/week @ 2025-02-03 38726/week @ 2025-02-10 36826/week @ 2025-02-17 14073/week @ 2025-02-24 6836/week @ 2025-03-03 9861/week @ 2025-03-10 7007/week @ 2025-03-17 7282/week @ 2025-03-24

31,543 downloads per month
Used in 144 crates (48 directly)

Apache-2.0

3MB
49K SLoC

Transaction Payment Pallet

This pallet provides the basic logic needed to pay the absolute minimum amount needed for a transaction to be included. This includes:

  • weight fee: A fee proportional to amount of weight a transaction consumes.
  • length fee: A fee proportional to the encoded length of the transaction.
  • tip: An optional tip. Tip increases the priority of the transaction, giving it a higher chance to be included by the transaction queue.

Additionally, this pallet allows one to configure:

  • The mapping between one unit of weight to one unit of fee via Config::WeightToFee.
  • A means of updating the fee for the next block, via defining a multiplier, based on the final state of the chain at the end of the previous block. This can be configured via Config::FeeMultiplierUpdate

License: Apache-2.0

Release

Polkadot SDK Stable 2412


lib.rs:

Transaction Payment Pallet

This pallet provides the basic logic needed to pay the absolute minimum amount needed for a transaction to be included. This includes:

  • base fee: This is the minimum amount a user pays for a transaction. It is declared as a base weight in the runtime and converted to a fee using WeightToFee.
  • weight fee: A fee proportional to amount of weight a transaction consumes.
  • length fee: A fee proportional to the encoded length of the transaction.
  • tip: An optional tip. Tip increases the priority of the transaction, giving it a higher chance to be included by the transaction queue.

The base fee and adjusted weight and length fees constitute the inclusion fee, which is the minimum fee for a transaction to be included in a block.

The formula of final fee:

inclusion_fee = base_fee + length_fee + [targeted_fee_adjustment * weight_fee];
final_fee = inclusion_fee + tip;
  • targeted_fee_adjustment: This is a multiplier that can tune the final fee based on the congestion of the network.

Additionally, this pallet allows one to configure:

Dependencies

~20–34MB
~581K SLoC