Skip to content

Commit b8adf77

Browse files
hardingjnewbery
authored andcommitted
Xapo Consolidation: make text includable in multiple pages
Except for a couple extra invisible newline in the HTML source, renders identically to before. This will allow us to keep the article text synchronised with the text in the newsletter. - Moves text of article to _includes/ - Adds copyright statement to top, at least until we get permission to MIT license - Defines a variable that allows changing the subhead depth - Includes that file in the previous file
1 parent 9081a94 commit b8adf77

File tree

2 files changed

+84
-79
lines changed

2 files changed

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

_posts/en/2018-07-30-xapo-consolidation.md

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -12,82 +12,4 @@ version: 1
1212
*by [Anthony Towns](https://twitter.com/ajtowns)<br>Developer on Bitcoin Core
1313
at [Xapo][]*
1414

15-
As mentioned in [newsletter #3][newsletter 3], the past few months of low
16-
transaction fees makes it a great time to do UTXO consolidation!
17-
Consolidation has been one of a variety of activities [Xapo][Xapo] has been
18-
undertaking to be prepared for the next time fees spike like they did in the
19-
last few months of 2017.
20-
21-
{% assign img1_label = "Plot of total Bitcoin UXTOs, January - July 2018" %}
22-
23-
{:.center}
24-
![{{img1_label}}](/img/posts/utxo-consolidation-2018.png)<br>
25-
*{{img1_label}},
26-
source: [Statoshi](https://statoshi.info/dashboard/db/unspent-transaction-output-set?panelId=6&fullscreen&from=1514759562608&to=1532039707168)*
27-
28-
[newsletter 3]: https://bitcoinops.org/en/newsletters/2018/07/10/#dashboard-items
29-
[Xapo]: https://www.xapo.com/
30-
31-
The idea behind UTXO consolidation is essentially this: when your average
32-
outgoing payment is larger than your average incoming payment (or when they’re
33-
the same, but you’re batching outgoing payments), you’ll often have to combine
34-
many UTXOs in order to fund an outgoing transaction, which increases the size
35-
of your transactions and hence the fees you pay. By consolidating UTXOs in
36-
advance, you can combine inputs ahead of time, giving you more
37-
control over when most of those costs are incurred. If you can do it when
38-
fees are low, that lets you reduce those costs pretty substantially.
39-
40-
For example, if you would have spent a dozen 2-of-3 multisig inputs at 100 s/B
41-
(satoshis per byte), that would cost around 360,000 satoshis; while if you
42-
consolidated those inputs beforehand at 2 s/B, and then spent the single
43-
consolidated input later at 100 s/B, your total cost for the two transactions
44-
is only about 41,000 satoshis: i.e. 87% less paid in fees. And if fees don’t
45-
rise the risk isn’t huge: if fees just sat at 2 s/B, you’d be spending 7,900
46-
satoshis across two transactions if you consolidated, rather than spending
47-
7,200 satoshis in a single transaction if you did nothing.
48-
49-
Consolidation also gives an opportunity to update the addresses you use for
50-
your UTXOs, for example to roll keys over, switch to multisig, or switch to
51-
segwit or bech32 addresses. And reducing the number of UTXOs makes it easier to
52-
run a full node too, marginally improving Bitcoin’s decentralisation and
53-
overall security, which is always nice.
54-
55-
Of course, one thing you really don’t want to have happen is for your
56-
consolidation transactions to somehow fill up the blockchain and cause fees to
57-
immediately start rising! There are two metrics to watch to avoid this risk:
58-
one is whether the [mempool][mempool] is full (which causes the minimum
59-
acceptable fee to rise), and the other is how much empty space there has been
60-
in recent blocks (which gives an indication of whether miners will accept more
61-
transactions at the minimum fee). Both these metrics have been very promising
62-
most of the time over the past few months: the mempool has regularly been close
63-
to empty, meaning the transactions paying as little as 1 s/B have been
64-
propagated to miners; and many blocks have not been full, meaning cheap
65-
consolidation transactions will get mined reasonably quickly rather than
66-
creating a backlog that will cause fees to rise.
67-
68-
[mempool]: https://statoshi.info/dashboard/db/memory-pool?panelId=1&fullscreen&from=1509458400000&to=1531813659334&theme=dark
69-
70-
The approach we took to actually doing the consolidation was to have a script
71-
that would select groups of small UTXOs and create a consolidation transaction
72-
spending them to a single pool address at a fee rate of 1.01 satoshis per byte.
73-
The script gradually feeds consolidation transactions into the network, so it
74-
doesn’t cause too large a spike in the mempool, and perhaps more importantly so
75-
we don’t risk having our transactions get dropped because they have low fees
76-
and the mempool has filled up. We triggered this manually when we were
77-
comfortable it wouldn't interfere with our operations, and when there didn’t seem
78-
to be much load on the Bitcoin network in general.
79-
80-
All in all, this has worked out pretty well; we’ve reduced our UTXO count by
81-
something like [4 million UTXOs][4 million UTXOs] this year, and aside from
82-
some [concerned][redditors1] [redditors][redditors2], the cost to the network
83-
as a whole has been minimal, as has the cost to us.
84-
85-
[4 million UTXOs]: https://www.oxt.me/entity/Xapo
86-
[redditors1]: https://www.reddit.com/r/BitcoinDiscussion/comments/8ocyc9/massive_consolidation_currently_underway/
87-
[redditors2]: https://www.reddit.com/r/Bitcoin/comments/8p3y5b/does_xapo_spamming_the_blockchain/
88-
89-
## Additional resources
90-
91-
- [Techniques to reduce transaction fees: consolidation](https://en.bitcoin.it/wiki/Techniques_to_reduce_transaction_fees#Consolidation) - Bitcoin Wiki
92-
- [How to cheaply consolidate coins to reduce miner fees](https://en.bitcoin.it/wiki/How_to_cheaply_consolidate_coins_to_reduce_miner_fees) - Bitcoin Wiki
93-
- [What are some best practices regarding the usage of consolidations and fanouts?](https://bitgo.freshdesk.com/support/solutions/articles/27000044185-what-are-some-best-practices-regarding-the-usage-of-consolidations-and-fanouts-) - BitGo
15+
{% include articles/towns-xapo-consolidation.md hlevel='##' %}

0 commit comments

Comments
 (0)