For a transaction fee implementation, i would like to burn 40% of transaction fees, send 30% to treasury and 30% to collators. Which pallet do can i use to do this?

1 Answer 1


What you are looking for is the transaction-payment pallet.
The functions withdraw_fee and correct_and_deposit_fee of its CurrencyAdapter handle the fees.
These fees are then handed over to the OnUnbalanced handler. This handler is an injected trait function and can be configured by the runtime.
You see how this works when analyzing the on_unbalanceds function in the common Polkadot runtime.
It looks like this:

fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance<R>>) {
    if let Some(fees) = fees_then_tips.next() {
        // for fees, 80% to treasury, 20% to author
        let mut split = fees.ration(80, 20);
        if let Some(tips) = fees_then_tips.next() {
            // for tips, if any, 100% to author
            tips.merge_into(&mut split.1);
        use pallet_treasury::Pallet as Treasury;
        <Treasury<R> as OnUnbalanced<_>>::on_unbalanced(split.0);
        <ToAuthor<R> as OnUnbalanced<_>>::on_unbalanced(split.1);

The entry points for these functions is the signed extension ChargeTransactionPayment.
The pre_dispatch calls withdraw_fee and post_dispatch does correct_and_deposit_fee.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.