TL;DR: Spending the whole UTXO set would take the blockspace of about 11 500 blocks.
What follows is some very rough napkin math that is almost certainly off by a few percent points. I've roughly estimated a few values, that could probably be collected more exactly, feel free to suggest concrete improvements where you would expect to see a significant change by estimating more exactly with reasonable effort.
These are the easiest to estimate. We known basically exactly how much it'll weigh to spend them.
- A P2PKH input weighs 148 B.
51.9M × 148 B = 7 681 200 000 B
- A P2WPKH input weighs 68 vB.
13.6M × 68 vB = 924 800 000 vB
- Let's assume all P2TR UTXO are spent via keypath. An input weighs 57.5 vB.
89K × 57.5 vB = 5 117 500 vB
- A P2PK input only has a signature in the scriptsig and therefore should weigh 113 B.
49K × 113 B = 5 537 000 B
For P2SH UTXOs it gets more complicated. We know the redeemscripts only for about a third of the UTXOs per this P2SH breakdown:
- unknown: 9.24M
- P2WPKH: 3.18M (91 vB)
- 2-of-3: 1.48M (297 vB)
- wrapped 2-of-3: 778K (139.5 vB)
- various non-segwit multisigs¹: 607K
- other non-multisig: 24K
¹ 3-of-4, 2-of-2 and 3-of-5 are the most common known output type after the explicitly listed. I'm assuming that "other multisigs" and "other non-multisigs" are smaller than 3-of-4, but it seems reasonable to estimate all the remaining non-segwit multisigs and non-multisigs as approximately the average of 2-of-2, 3-of-4, and 3-of-5: 360 B
3.18M × 91 vB + 1.48M × 297 B + 778K × 139.5 vB + 631K × 360 B =
1 064 631 000 vB
Assuming the average input virtualsize of 175.5 vB applies also to the unknown P2SH UTXOs: 9.24M × 175.4 vB = 1 620 696 000 vB
I haven't found a breakdown of P2WSH outputs. Since more than 3/4 of the multisig in P2SH was 2-of-3, we're just going to estimate with the size of a 2-of-3: 881K × 104.5 vB =
92 064 500 vB
Bare multisig only needs the signatures in the input as the scriptPubKey already contains the condition script itself. Let's assume a 2-of-3 multisig. From the top of my head, an input should be roughly 168 B. (32+4+1+1+1+64+1+64)
435K × 274 B = 73 080 000 B
Probably the 9K unknown are mostly unspendable trash, but they're such a small portion of the total UTXOs, that we won't bother being too exact and just assume they were the most common type, P2PKH. 9K × 148 B = 1 332 000 B
All inputs in sum
- P2PKH: 7 681 200 000 B
- P2WPKH: 924 800 000 vB
- P2TR: 5 117 500 vB
- P2PK: 5 537 000 B
- P2SH: Known: 1 064 631 000 vB, Unknown: 1 620 696 000 vB
- P2WSH: 92 064 500 vB
- Bare Multi: 73 080 000 B
- Unknown: 1 332 000 B
Sum: 11 468 458 000 vB
Glossing over the size of coinbase transactions and block headers, the inputs would therefore require about 11 470 blocks.
Assuming we only use standard transactions, we'd need to create 11 outputs per block. Adding the creation and spending of these transaction outputs assuming P2WPKH adds 11 × 11470 × 99 vB = 12 490 830 vB.
Adding the block headers, coinbase transactions, and the new outputs of the consolidation transactions, it should be possible to spend the whole UTXO set in fewer than 11 500 blocks which is less than three months worth of blockspace.