Skip to content

Commit 7a54a31

Browse files
committed
Add Xapo consolidation article
1 parent 62dec8f commit 7a54a31

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: 'Field Report: Xapo UTXO Consolidation'
3+
permalink: /en/xapo-utxo-consolidation
4+
name: 2018-07-30-xapo-utxo-consolidation
5+
type: posts
6+
layout: page
7+
lang: en
8+
version: 1
9+
---
10+
11+
12+
---
13+
14+
As mentioned in [newsletter #3][newsletter 3], the past few months of low
15+
transaction fees has made it a great time to do UTXO consolidation!
16+
Consolidation has been one of a variety of activities [Xapo][Xapo] has been
17+
undertaking to be prepared for the next time fees spike like they did in the
18+
last few months of 2017.
19+
20+
[newsletter 3]: https://bitcoinops.org/en/newsletters/2018/07/10/#dashboard-items
21+
[Xapo]: https://www.xapo.com/
22+
23+
The idea behind UTXO consolidation is essentially this: when your average
24+
outgoing payment is larger than your average incoming payment (or when they’re
25+
the same, but you’re batching outgoing payments), you’ll often have to combine
26+
many UTXOs in order to fund an outgoing transaction, which increases the size
27+
of your transactions and hence the fees you pay. By consolidating UTXOs in
28+
advance, you can move most of that data forward in time, giving you more
29+
control over when most of those costs are incurred, and if you can do it when
30+
fees are low, that lets you reduce those costs pretty substantially. For
31+
example, if you would have spent a dozen 2-of-3 multisig inputs at 100 s/B
32+
(satoshis per byte), that would cost around 360,000 satoshis; while if you
33+
consolidated those inputs beforehand at 2 s/B, and then spent the single
34+
consolidated input later at 100 s/B, your total cost for the two transactions
35+
is only about 41,000 satoshis. And if fees don’t rise the risk isn’t huge: if
36+
fees just sat at 2 s/B, you’d be spending 7,900 satoshis across two
37+
transactions if you consolidated, rather than spending 7,200 satoshis in a
38+
single transaction if you did nothing.
39+
40+
Consolidation also gives an opportunity to update the addresses you use for
41+
your UTXOs, for example to roll keys over, switch to multisig, or switch to
42+
segwit or bech32 addresses. And reducing the number of UTXOs makes it easier to
43+
run a full node too, marginally improving Bitcoin’s decentralisation and
44+
overall security, which is always nice.
45+
46+
Of course, one thing you really don’t want to have happen is for your
47+
consolidation transactions to somehow fill up the blockchain and cause fees to
48+
immediately start rising! There are two metrics to watch to avoid this risk:
49+
one is whether the [mempool][mempool] is full (which causes the minimum
50+
acceptable fee to rise), and the other is how much empty space there has been
51+
in recent blocks (which gives an indication of whether miners will accept more
52+
transactions at the minimum fee). Both these metrics have been very promising
53+
most of the time over the past few months: the mempool has regularly been close
54+
to empty, meaning the transactions paying as little as 1 s/B have been
55+
propagated to miners, and many blocks have not been full, meaning cheap
56+
consolidation transactions will get mined reasonably quickly, rather than
57+
creating a backlog that will cause fees to rise.
58+
59+
[mempool]: https://statoshi.info/dashboard/db/memory-pool?panelId=1&fullscreen&from=1509458400000&to=1531813659334&theme=dark
60+
61+
The approach we took to actually doing the consolidation was to have a script
62+
that would select groups of small UTXOs, and create a consolidation transaction
63+
spending them to a single pool address at a fee rate of 1.01 satoshis per byte.
64+
The script gradually feeds consolidation transactions into the network, so it
65+
doesn’t cause too large a spike in the mempool, and perhaps more importantly so
66+
we don’t risk having our transactions get dropped because they have low fees
67+
and the mempool has filled up. We triggered this manually when we were
68+
comfortable it won’t interfere with our operations, and when there doesn’t seem
69+
to be much load on the Bitcoin network in general.
70+
71+
All in all, this has worked out pretty well; we’ve reduced our UTXO count by
72+
something like [4 million UTXOs][4 million UTXOs] this year, and aside from
73+
some [concerned][redditors1] [redditors][redditors2], the cost to the network
74+
as a whole has been minimal, as has the cost to us.
75+
76+
[4 million UTXOs]: https://www.oxt.me/entity/Xapo
77+
[redditors1]: https://www.reddit.com/r/BitcoinDiscussion/comments/8ocyc9/massive_consolidation_currently_underway/
78+
[redditors2]: https://www.reddit.com/r/Bitcoin/comments/8p3y5b/does_xapo_spamming_the_blockchain/
79+

0 commit comments

Comments
 (0)