Skip to content

Commit 7e88d23

Browse files
hardingbitschmidty
authored andcommitted
Newsletters: add 316 (2024-08-16)
1 parent cabdcca commit 7e88d23

15 files changed

Lines changed: 830 additions & 0 deletions
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
---
2+
title: 'Bitcoin Optech Newsletter #316'
3+
permalink: /en/newsletters/2024/08/16/
4+
name: 2024-08-16-newsletter
5+
slug: 2024-08-16-newsletter
6+
type: newsletter
7+
layout: newsletter
8+
lang: en
9+
---
10+
This week's newsletter describes a new time warp that's particularly
11+
consequential for the new testnet4, summarizes discussion about proposed
12+
mitigations for onion message denial-of-service concerns, seeks feedback
13+
on a proposal to allow LN payers to optionally identify themselves, and
14+
announces a major change to Bitcoin Core's build system that could
15+
affect downstream developers and integrators. Also included are our
16+
regular sections announcing new releases and release candidates and
17+
describing notable changes to popular Bitcoin infrastructure software.
18+
19+
## News
20+
21+
<!-- Note: confirmed via email that "Zawy" is how this person would like be attributed. -harding -->
22+
23+
- **New time warp vulnerability in testnet4:** Mark "Murch"
24+
Erhardt [posted][erhardt warp] to Delving Bitcoin to describe an
25+
attack [discovered][zawy comment] by developer Zawy for exploiting
26+
[testnet4][topic testnet]'s new difficulty adjustment algorithm.
27+
Testnet4 applied a solution from the [consensus cleanup][topic
28+
consensus cleanup] soft fork for mainnet that is intended to block the
29+
[time warp attack][topic time warp]. However, Zawy described an
30+
attack similar to time warp that could be used even with the new rule
31+
to reduce mining difficulty to 1/16th its normal value. Erhardt
32+
extended Zawy's attack to allow reducing difficulty to its minimum
33+
value. We describe several related attacks in simplified form below:
34+
35+
Bitcoin blocks are produced stochastically, with the difficulty
36+
intended to _retarget_ every 2,016 blocks to keep the average time
37+
between blocks at about 10 minutes. The following simplified
38+
illustration shows what is supposed to happen with a constant rate of
39+
block production, given a retarget every 5 blocks (reduced from every
40+
2,016 blocks to make the illustration legible):
41+
42+
![Illustration of honest mining with a constant hashrate (simplified)](/img/posts/2024-time-warp/reg-blocks.png)
43+
44+
A dishonest miner (or cabal of miners) possessing slightly more than 50%
45+
of hashrate can censor blocks produced by the other slightly-less-than
46+
50% of honest miners. That would naturally lead initially to only one
47+
block being produced every 20 minutes on average. After 2,016 blocks
48+
are produced using this pattern, difficulty will adjust to 1/2 its
49+
original value to return the rate of blocks being added to the
50+
mainchain to one block every 10 minutes on average:
51+
52+
![Illustration of block censorship by an attacker with slightly more than 50% of total network hashrate (simplified)](/img/posts/2024-time-warp/50p-attack.png)
53+
54+
A time warp attack occurs when the dishonest miners use their hashrate
55+
majority to force the timestamps in most blocks to use the minimum
56+
allowed value. At the end of each 2,016-block retarget period, they
57+
increase block header time to the current [wall time][] to make it
58+
seem like it took longer to produce the blocks than it actually did,
59+
leading to a lower difficulty in the subsequent period.
60+
61+
<!-- TODO:harding can probably integrate the illustration below into
62+
the time warp topic page -->
63+
64+
![Illustration of a classic time warp attack (simplified)](/img/posts/2024-time-warp/classic-time-warp.png)
65+
66+
The [new rule][testnet4 rule] applied to testnet4 fixes this by
67+
preventing the first block in a new retarget period from having a
68+
timestamp much earlier than its previous block (the last block in the
69+
previous period).
70+
71+
Like the original time warp attack, Erhardt's version of Zawy's attack
72+
increments most block's header time by the bare minimum. However, for
73+
two of every three retarget periods, it jumps forward the time for
74+
the final block in a period and the first block in the subsequent
75+
period. This decreases difficulty by the maximum allowed each period
76+
(1/4th the current value). For the third period, it uses the lowest
77+
time allowed for all blocks, plus the first block of the subsequent
78+
period, which increases difficulty by the maximum value (4x). In
79+
other words, difficulty decreases 1/4, decreases again to 1/16, and
80+
then increases to 1/4 of its original value:
81+
82+
![Illustration of Erhardt's version of Zawy's new time warp attack (simplified)](/img/posts/2024-time-warp/new-time-warp.png)
83+
84+
The three-period cycle can be repeated indefinitely to reduce
85+
difficulty by 1/4 each cycle, eventually reducing it to a level that
86+
allows miners to produce up to [6 blocks per second][erhardt se].
87+
88+
To reduce difficulty by 1/4 in a retarget period, the attacking miners
89+
need to set the time of the retarget blocks to 8 weeks further in the
90+
future than the block at the start of the current period. To do this
91+
twice in a row at the start of the attack requires eventually setting
92+
some block's time 16 weeks into the future. Full nodes will not
93+
accept blocks more than two hours into the future, preventing the
94+
malicious blocks from being accepted for 8 weeks for the first set of
95+
blocks and 16 weeks for the second set of blocks. While the attacking
96+
miners wait for their blocks to be accepted, they can create
97+
additional blocks at ever lower difficulties. Any blocks created by
98+
honest miners during the 16 weeks that attackers are preparing their
99+
attack will be reorganized out of the chain when full nodes begin
100+
accepting the attacker blocks; this could mark every transaction
101+
confirmed during that time as either unconfirmed or invalid
102+
(_conflicted_) on the current chain.
103+
104+
Erhardt suggests solving the attack with a soft fork that requires
105+
the timestamp of the last block in a retarget period be greater than
106+
the timestamp of the first block in that period. Zawy proposed
107+
several solutions, including forbidding block timestamps from
108+
decreasing (which could create problems if some miners create blocks near
109+
the two-hour future limit enforced by nodes), or at least forbidding
110+
them from decreasing by more than about two hours.
111+
112+
Overall, on mainnet, the new time warp attack is similar to the
113+
original attack in its requirements for mining equipment, its ability
114+
to be detected in advance, its consequences for users, and the
115+
relative simplicity of a soft fork to fix it. It depends on an
116+
attacker maintaining control over at least 50% of hashrate for
117+
at least a month, while likely signaling to users that an
118+
attack was impending and hoping they don't respond, which could be
119+
quite challenging on mainnet. As Zawy [notes][zawy testnet risk], the
120+
attack is much easier on testnet: a small amount of modern mining
121+
equipment is enough to achieve 50% of hashrate on testnet and set up
122+
the attack in stealth. An attacker could then, in theory, produce
123+
over 500,000 blocks per day. Only someone willing to dedicate a
124+
greater amount of hashrate to testnet could stop an attacker unless
125+
the attack is prevented using a soft fork.
126+
127+
At the time of writing, the tradeoffs between proposed solutions were
128+
being discussed.
129+
130+
- **Onion message DoS risk discussion:** Gijs van Dam [posted][vandam
131+
onion] to Delving Bitcoin to discuss a recent [paper][bk onion] by
132+
researchers Amin Bashiri and Majid Khabbazian about [onion
133+
messages][topic onion messages]. The researchers note each onion
134+
message can be forwarded across many nodes (481 hops by
135+
Van Dam's calculations), potentially wasting bandwidth for all of
136+
those nodes. They describe several methods for reducing the risk
137+
of bandwidth abuse, including a clever method of requiring an
138+
exponentially increasing amount of PoW for each additional hop, making
139+
short routes computationally cheap but long routes expensive.
140+
141+
Matt Corallo suggested first trying a previously proposed idea (see
142+
[Newsletter #207][news207 onion]) to provide back pressure on nodes
143+
sending too many onion messages before working on anything more
144+
complicated.
145+
146+
- **Optional identification and authentication of LN payers:** Bastien
147+
Teinturier [posted][teinturier auth] to Delving Bitcoin to propose
148+
methods for allowing spenders to optionally include extra data with
149+
their payments that would allow receivers to identify those payments
150+
as having come from a known contact. For example, if Alice generates
151+
an [offer][topic offers] that Bob pays, she may want
152+
cryptographic proof that the payment came from Bob and not from some
153+
third party pretending to be Bob. Offers are designed by default to
154+
hide the identities of the spender and receiver, so additional
155+
mechanisms are required to enable opt-in identification and
156+
authentication.
157+
158+
Teinturier starts by describing an opt-in _contact key_ distribution
159+
mechanism that Bob can use to disclose a public key of his to Alice.
160+
He then describes three potential candidates for an additional opt-in
161+
mechanism that Bob can use to sign his payments to Alice. If Bob uses
162+
that mechanism, Alice's LN wallet can authenticate that
163+
signature as belonging to Bob and display that information to her.
164+
In unauthenticated payments, fields set by the spender (such as the
165+
free-form `payer_note` field) can be marked as untrusted to discourage
166+
users from relying on information provided in them.
167+
168+
Feedback on which cryptographic methods to use is requested, with
169+
Teinturier planning to release [BLIP42][blips #42] with a
170+
specification for the methods selected.
171+
172+
- **Bitcoin Core switch to CMake build system:** Cory Fields
173+
[posted][fields cmake] to the Bitcoin-Dev mailing list to announce
174+
Bitcoin Core's impending switch from the GNU autotools build system to
175+
the CMake build system, which has been led by Hennadii Stepanov with
176+
contributions from Michael Ford for bug fixes and modernization, with
177+
reviews and contributions from several other developers (including
178+
Fields). This should not affect anyone who uses the pre-built
179+
binaries available from BitcoinCore.org---which is what we expect most
180+
people are using. However, developers and integrators who build their own
181+
binaries for testing or customization may be affected---especially
182+
those working on uncommon platforms or build configurations.
183+
184+
Fields's email provides answers to anticipated questions and asks
185+
anyone who builds Bitcoin Core themselves to test [PR #30454][bitcoin
186+
core #30454] and report any issues. That PR is expected to be merged
187+
in the next several weeks with anticipated release in version 29
188+
(anticipated about 7 months from now). The earlier you test, the more
189+
time Bitcoin Core developers will have to fix problems before the
190+
release of version 29---increasing the chance that they can prevent
191+
problems in the released code from affecting your configuration.
192+
193+
## Releases and release candidates
194+
195+
*New releases and release candidates for popular Bitcoin infrastructure
196+
projects. Please consider upgrading to new releases or helping to test
197+
release candidates.*
198+
199+
- [BDK 1.0.0-beta.1][] is a release candidate for this library for
200+
building wallets and other Bitcoin-enabled applications. The original
201+
`bdk` Rust crate has been renamed to `bdk_wallet` and lower layer
202+
modules have been extracted into their own crates, including
203+
`bdk_chain`, `bdk_electrum`, `bdk_esplora`, and `bdk_bitcoind_rpc`.
204+
The `bdk_wallet` crate "is the first version to offer a stable 1.0.0 API."
205+
206+
- [Core Lightning 24.08rc2][] is a release candidate for the next major
207+
version of this popular LN node implementation.
208+
209+
- [LND v0.18.3-beta.rc1][] is a release candidate for a minor bug fix
210+
release of this popular LN node implementation.
211+
212+
## Notable code and documentation changes
213+
214+
_Notable recent changes in [Bitcoin Core][bitcoin core repo], [Core
215+
Lightning][core lightning repo], [Eclair][eclair repo], [LDK][ldk repo],
216+
[LND][lnd repo], [libsecp256k1][libsecp256k1 repo], [Hardware Wallet
217+
Interface (HWI)][hwi repo], [Rust Bitcoin][rust bitcoin repo], [BTCPay
218+
Server][btcpay server repo], [BDK][bdk repo], [Bitcoin Improvement
219+
Proposals (BIPs)][bips repo], [Lightning BOLTs][bolts repo],
220+
[Lightning BLIPs][blips repo], [Bitcoin Inquisition][bitcoin inquisition
221+
repo], and [BINANAs][binana repo]._
222+
223+
<!-- FIXME:Gustavojfe -->
224+
225+
- [Bitcoin Core #29519][] p2p: For assumeutxo, download snapshot chain before background chain
226+
227+
- [Bitcoin Core #30598][] assumeutxo: Drop block height from metadata
228+
229+
- [Bitcoin Core #28280][] Don't empty dbcache on prune flushes: >30% faster IBD
230+
231+
- [Bitcoin Core #28052][] blockstorage: XOR blocksdir \*.dat files
232+
233+
- [Core Lightning #7528][] onchaind: Adjust the sweep target deadline for fee estimation
234+
235+
- [Core Lightning #7533][] bkpr: properly account for fees and channel closures if splice
236+
237+
- [Core Lightning #7517][] askrene
238+
239+
- [LND #8955][] yyforyongyu/cr-8516-240729-sendcoins
240+
241+
- [LND #8886][] bitromortac/buildroute-inbound-fees
242+
243+
- [LND #8967][] add wire messages for quiescence
244+
245+
- [LDK #3215][] tx-sync: Protect against Core's Merkle leaf node weakness
246+
247+
- [BIPs #1658][] BIP94: Change timewarp delta to 7200 seconds
248+
249+
- [BLIPs #27][] blip-0004: add experimental HTLC endorsement signaling
250+
251+
{% assign four_days_after_posting = page.date | date: "%s" | plus: 345600 | date: "%Y-%m-%d 14:30" %}
252+
{% include snippets/recap-ad.md when=four_days_after_posting %}
253+
{% include references.md %}
254+
{% include linkers/issues.md v=2 issues="29519,30598,28280,28052,7528,7533,7517,8955,8886,8967,3215,1658,27,30454,42" %}
255+
[BDK 1.0.0-beta.1]: https://github.com/bitcoindevkit/bdk/releases/tag/v1.0.0-beta.1
256+
[erhardt se]: https://bitcoin.stackexchange.com/a/123700
257+
[erhardt warp]: https://delvingbitcoin.org/t/zawy-s-alternating-timestamp-attack/1062
258+
[zawy comment]: https://github.com/bitcoin/bitcoin/pull/29775#issuecomment-2276135560
259+
[wall time]: https://en.wikipedia.org/wiki/Elapsed_real_time
260+
[testnet4 rule]: https://github.com/bitcoin/bips/blob/master/bip-0094.mediawiki#time-warp-fix
261+
[news36 warp rule]: /en/newsletters/2019/03/05/#the-time-warp-attack
262+
[zawy testnet risk]: https://delvingbitcoin.org/t/zawy-s-alternating-timestamp-attack/1062/5
263+
[vandam onion]: https://delvingbitcoin.org/t/onion-messaging-dos-threat-mitigations/1058
264+
[bk onion]: https://fc24.ifca.ai/preproceedings/104.pdf
265+
[news207 onion]: /en/newsletters/2022/07/06/#onion-message-rate-limiting
266+
[teinturier auth]: https://delvingbitcoin.org/t/bolt-12-trusted-contacts/1046
267+
[fields cmake]: https://mailing-list.bitcoindevs.xyz/bitcoindev/6cfd5a56-84b4-4cbc-a211-dd34b8942f77n@googlegroups.com/
268+
[Core Lightning 24.08rc2]: https://github.com/ElementsProject/lightning/releases/tag/v24.08rc2
269+
[LND v0.18.3-beta.rc1]: https://github.com/lightningnetwork/lnd/releases/tag/v0.18.3-beta.rc1

0 commit comments

Comments
 (0)