On May 15th 2023 we launched Surge Cycles on the Whirlpool CoinJoin coordinator.
Background: Whirlpool Transaction Size and Miner Fees
To date all Whirlpool CoinJoin transactions have been composed of 5 inputs and 5 outputs
To pay for this transaction to be mined into a block we need to consider the size of the transaction, and the current miner fee rate. Using both we can determine the total amount of miner fees which are required to be paid for this transaction to get confirmed in a timely manner.
The size of a transaction, in terms of how much data it takes up on the blockchain, is determined by the type and number of inputs/outputs. The size of a 5-input/5-output Whirlpool CoinJoin transaction is 510 virtual bytes (vB).
Observing on-chain, if for example the fee rate for a transaction to be mined into the next block is 20 satoshis per virtual byte (sats/vB), we would have to pay 10,200 sats (510 x 20) for a 5-input/5-output CoinJoin transaction to be confirmed in a timely manner.
User Selection of Miner Fee Rate
When a user proceeds to Whirlpool their coins, they are prompted to select a cycle priority of low, normal, or high.
Cycle Priority Selection:
- LOW = 24 block moving average
- NORMAL = 6 block moving average
- HIGH = 2 block moving average
This selection allows a user to dictate the speed at which they wish for their first mix to occur/confirm-on chain. This in turn dictates the miner fee portion of a user’s Premix UTXO/s. The higher the cycle priority selected, the larger the miner fee portion will be in the Premix UTXO/s.
CoinJoin Transaction: Inputs
Historically all Whirlpool Coinjoins have been constructed with
- 2 x Premixer UTXOs from separate wallets*
- 3 x Remixing UTXOs from separate wallets
Premixers are new entrants into Whirlpool, and are those who cover the miner fee for the CoinJoin transaction. Remixers are those who have already entered Whirlpool, completed their first mix already, and are now “freeriding” to obtain more mixes.
Whirlpool Coordinator: Trigger Fee Rate
The Whirlpool Coordinator is the arbitrator of which 2 x Premix UTXOs are selected to participate in a CoinJoin, and bases this decision on the current state of the Bitcoin network with what miner fee rates are likely to confirm within a timely manner. It would be inefficient for the service in which the Whirlpool Coordinator provides to organise and broadcast a CoinJoin transaction if said transaction is of a low fee rate and not likely to get mined into a block.
The Whirlpool Coordinator does this by dynamically changing the Coordinator trigger fee rate based on Bitcoin network activity. When on-chain fees are expensive, a high trigger fee rate is set (e.g. 95 sats/vB). A low trigger fee rate is set when on-chain fees are cheaper (e.g. 5 sats/vB). When 2 x Premixers can satisfy the miner fee cost of the 5-input/5-output CoinJoin at the Coordinator trigger fee rate, a CoinJoin will then be organised and broadcasted to the Bitcoin network.
On-Chain Fees Suddenly Decrease, now what?
Previous to Surge Cycles, if on-chain fees were to have suddenly decreased and there were Premix UTXOs submitted for mixing with a normal cycle priority in mind, this would have lead to a 5-input/5-output CoinJoin being created with an over payment in miner fees.
Consider the following:
- There are many unconfirmed transaction in the mempool. Miner fee rates are high.
- Whirlpool Coordinator trigger fee rate is set to 30 sats/vB.
- There are Premix UTXOs waiting to carry out their first coinjoin. They entered Whirlpool with a normal priority cycle set by the user. It is only possible for the currently registered Premix UTXOs to support a CoinJoin transaction broadcasted at a fee rate of 20 sats/vB.
- The weekend has arrived, and as usually seen there less activity on the Bitcoin network. The mempool starts to clear out and on-chain fee rates drop quickly to 10sats/vB.
- Whirlpool Coordinator trigger fee rate decreases to 10sats/vB.
- The normal priority cycle Premix UTXOs are now eligible for their first mix, and a 5-input/5-output CoinJoin transaction is broadcast at a fee rate of 20 sats/vB.
The broadcasted coinjoin transaction has however paid double what it needed to due to the sharp decrease in on-chain fees. An efficiency gain is to be had here. Enter Surge Cycles…
Introducing Surge Cycles
Where miner fee over payment may have been previously seen given certain on-chain conditions, Surge Cycles now makes use of this surplus to allow for larger, more fee efficient CoinJoin transactions without compromising the already strong architecture of Whirlpool and privacy gains it provides. This comes with the introduction of the following additional Whirlpool CoinJoin transactions:
If the Whirlpool Coordinator trigger fee decreases, rather than a 5-input/5-output CoinJoin being organised and broadcasted, a 6-input/6-output, 7-input/7-output, or 8-input/8-output CoinJoin may take place instead. This is achieved by the Whirlpool Coordinator selecting additional Remixer UTXOs to participate in the CoinJoin thereby increasing the size of the transaction, in terms of virtual bytes (vB), and decreasing the transaction miner fee rate, in terms of satoshis per virtual byte (sats/vB).
Examples For When A Surge Cycles Could Be Triggered
A 5-input/5-output CoinJoin broadcasted at a fee rate of 12 sats/vB would pay a total miner fee of 6,120 sats. With the same amount of miner fees paid by the Premix UTXOs it would be possible to broadcast a 6-input/6-output CoinJoin transaction at a fee rate of 10 sats/vb, costing 6,120 sats.
Let’s explore some more scenarios.
This table and side annotations show the potential surge cycles that could occur if the Whirlpool Coordinator trigger fee rate decreases due to a drop in on-chain miner fee rates.
- Trigger fee rate decreasing from 20 sats/vB to 10 sats/vB.
Surge Cycle constituting 10-inputs/10-outputs would be possible.
- Trigger fee rate decreasing from 18 sats/vB to 10 sats/vB.
Surge Cycle constituting 9-inputs/9-outputs would be possible
- Trigger fee rate decreasing from 16 sats/vB to 10 sats/vB.
Surge Cycle constituting 8-inputs/8-outputs would be possible.
- Trigger fee rate decreasing from 14 sats/vB to 10 sats/vB.
Surge Cycle constituting 7-inputs/7-outputs would be possible.
- Trigger fee rate decreasing from 12 sats/vB to 10 sats/vB.
Surge Cycle constituting 6-inputs/6-outputs would be possible.
This can be easier visualised by plotting miner fee rates against the required transaction miner fee for each “Surge Cycle”.
Maximum Size Surge Cycles
For now we have limited Surge Cycles to a maximum of 8-inputs/8-outputs. While the introduction of Surge Cycles is exciting, we have a responsibility to ensure all transactions are broadcasted with a realistic miner fee rate to ensure successful on-chain transaction confirmation.
Surge Cycle Benefits
- Increase to the miner fee efficiency for Whirlpool transactions, and more bang for the user’s buck. Those who paid a relative high miner fee rate at the time of broadcasting their Transaction Zero (Tx0) when entering Whirlpool, if the Whirlpool Coordinator trigger fee rate decreases, the miner fee paying Premixers are rewarded immediately with greater privacy; prior to Surge Cycles, the forward-looking anonymity for a user’s first mix was always 5, but now has the potential to be greater than 5.
- For those who remain in postmix pool size denominations, a quicker increase to forward-looking anonymity; Remixers will now see an increase in their remixing cycle frequency, and forward-looking anonymity will in turn increase quicker for non-remixers, but for who their forward-looking anonymity can be traced to those UTXOs actively remixing.
- A quicker increase to backward-looking anonymity for those additional Remixers who are added to a Whirlpool CoinJoin due to the triggering of a Surge Cycle.
- Increase in the number of ways Whirlpool CoinJoins can be interpreted on-chain:
5-input/5-output = 1,496 interpretations (existing)
6-input/6-output = 22,482 interpretations
7-input/7-output = 426,833 interpretations
8-input/8-output = 9,934,563 interpretations
- Deterministic links between inputs and outputs remain 100% broken.
- No client update required. The ability of Surge Cycles has been been introduced into the Whirlpool Coordinator. For existing users the Whirlpool experience does not change — though you may see an uptick in your remixes ;)
We have launched Surge Cycles during a period of high fee on-chain activity of which internally we saw the Whirlpool Coordinator trigger fee rate increase to 150 sats/vB; the highest we have ever seen!
Whirlpool will continue to remain geared around 5-input/5-output CoinJoin transactions, and though the benefits to Surge Cycles are very much welcomed, we will be continuing to ensure Whirlpool remains just as performant as prior to its introduction.