Prioritization - Algorand Specifications
Keyboard shortcuts
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
- Auto
- Light
- Dark
Algorand Specifications
When the TxPool becomes congested, a fee prioritization algorithm determines which transactions are enqueued into the pool and which are rejected.
The key parameter in this process is feePerByte, which is calculated dynamically based on the number of pending blocks awaiting evaluation.
The pendingFullBlocks is an unsigned integer that represents the number of uncommitted full blocks present in the TxPool.
The function computeFeePerByte below demonstrates how this value is computed:
Algorithm 2: Compute Fee per Byte
1: function ComputeFeePerByte()
2: feePerByte ← feeThresholdMultiplier
3: if feePerByte = 0 ∧ TxPool.pendingFullBlocks > 1 then
4: feePerByte ← 1
5: end if
6: for i from 0 to TxPool.pendingFullBlocks do
7: feePerByte ← feePerByte ⋅ TxPool.expFeeFactor
8: end for
9: return feePerByte
10: end function
Important
IMPLEMENTATION:
Compute fee per byte reference implementation.
The computeFeePerByte function begins by setting feePerByte equal to the feeThresholdMultiplier. When there is no congestion in TxPool, this value is 0.
However, if there are any full blocks currently pending in TxPool, feePerByte is initially set to 1. This setup ensures that the subsequent multiplication step accumulates due to a non-zero base.
Next, for each of these full pending blocks, the expFeeFactor is multiplied by the current feePerByte value—causing feePerByte to grow exponentially with the level of congestion.
The resulting feePerByte is then:
feePerByte = max{1, feeThresholdMultiplier} × expFeeFactor ^ {TxPool.pendingFullBlocks}.