substratepolkadot

Is Polkadot transaction priority only based on fees?


The Polkdadot wiki says in Learn > Basics > Transaction Fees:

Block producers prioritize transactions based on each transaction's total fee. Since a portion of the fee will go to the block producer, producers will include the transactions with the highest fees to maximize their reward.

Does the weight of the transaction (or any other factor) play any role in prioritization? It seems counterintuitive that a large batch transaction (which naturally produces higher fees) is prioritized over smaller transactions regardless of their weight.


Solution

  • You can decide entirely on your own how transactions are prioritized. If you are using the default ChargeTransactionPayment signed extension you will use the following formula to calculate the priority: https://github.com/paritytech/substrate/blob/fb24fda76d613305ebb2e5728c75362c94b64aa1/frame/transaction-payment/src/lib.rs#L614-L681