Skip to content

Commit caab9e3

Browse files
committed
Newsletters: add #41 (2019-04-09)
1 parent 0298a9b commit caab9e3

File tree

5 files changed

+735
-1
lines changed

5 files changed

+735
-1
lines changed

_includes/references.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,22 @@ place, put links here. -->{% endcomment %}
107107
[newsletter #30]: {{news30}}
108108
{% assign news31 = "/en/newsletters/2019/01/29/" %}
109109
[newsletter #31]: {{news31}}
110+
{% assign news33 = "/en/newsletters/2019/02/12/" %}
111+
[newsletter #33]: {{news33}}
110112
{% assign news34 = "/en/newsletters/2019/02/19/" %}
111113
[newsletter #34]: {{news34}}
112114
{% assign news36 = "/en/newsletters/2019/03/05/" %}
113115
[newsletter #36]: {{news36}}
114116
{% assign news37 = "/en/newsletters/2019/03/12/" %}
115117
[newsletter #37]: {{news37}}
116118
{% assign news38 = "/en/newsletters/2019/03/19/" %}
117-
[newsletter #37]: {{news38}}
119+
[newsletter #38]: {{news38}}
120+
{% assign news39 = "/en/newsletters/2019/03/26/" %}
121+
[newsletter #39]: {{news39}}
122+
{% assign news40 = "/en/newsletters/2019/04/02/" %}
123+
[newsletter #40]: {{news40}}
124+
{% assign news41 = "/en/newsletters/2019/04/09/" %}
125+
[newsletter #41]: {{news41}}
118126

119127
{% comment %}
120128
<!--REQUIRES PERIODIC UPDATE: update rpc_version below to latest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
---
2+
title: 'Bitcoin Optech Newsletter #41'
3+
permalink: /en/newsletters/2019/04/09/
4+
name: 2019-04-09-newsletter
5+
type: newsletter
6+
layout: newsletter
7+
lang: en
8+
---
9+
This week's newsletter requests testing for release candidates of
10+
Bitcoin Core and LND, describes a discussion about UTXO snapshots for
11+
fast initial syncing of nodes, and provides regular coverage of bech32
12+
sending support and notable merges in popular Bitcoin infrastructure
13+
projects.
14+
15+
## Action items
16+
17+
- **Help test Bitcoin Core 0.18.0 RC3:** The third Release Candidate
18+
(RC) for the next major version of Bitcoin Core has been [released][0.18.0].
19+
This may be the final test version, so we encourage organizations and
20+
expert users to test it promptly if they want to ensure any
21+
possible regressions are caught before release. Please use [this
22+
issue][Bitcoin Core #15555] for reporting feedback.
23+
24+
- **Help test LND 0.6-beta RC3:** the first, second, and third RCs for
25+
the next major version of LND were [released][lnd releases] this week.
26+
Testing by organizations and experienced LN users is encouraged to
27+
catch any regressions or serious problems that could affect users of
28+
the final release. [Open a new issue][lnd issue] if you discover any
29+
problems.
30+
31+
## News
32+
33+
- **Discussion about an assumed-valid mechanism for UTXO snapshots:**
34+
When Bitcoin Core developers are preparing a new major release,
35+
one developer selects the hash of a recent block on the best block
36+
chain. Other well-known contributors check their personal nodes and
37+
ensure that hash is indeed part of the best block chain, and then add
38+
that hash to the software as the "assumed valid" block. When new
39+
users start Bitcoin Core for the first time, the program then defaults
40+
to skipping verification of signatures on all transactions included
41+
in blocks before the assumed valid block. The program still keeps
42+
track of the bitcoin ownership changes produced by each transaction in
43+
a index called the Unspent Transaction Output (UTXO) set. Although
44+
reviewing each historic ownership change still takes time, simply
45+
skipping signature checking reduces initial sync time by about 80%
46+
according to [tests][0.14 tests]. Gregory Maxwell, who [implemented
47+
the assumed valid feature][Bitcoin Core #9484], has argued that,
48+
"Because the validity of a chain history is a simple objective fact,
49+
it is [easy] to review this setting."
50+
51+
This week James O'Beirne started a [thread][assumeutxo thread] on
52+
the Bitcoin-Dev mailing list about taking a hash of the UTXO set at
53+
a particular block, having multiple well-known contributors verify
54+
they get the same hash, and then having freshly installed Bitcoin
55+
Core nodes default to using that hash to download the exact same
56+
UTXO set. This would allow a newly-started node to skip not only
57+
signatures but all block chain data before the assumed valid block,
58+
perhaps reducing the bandwidth and time requirements to start a node
59+
today by 95% or more (and certainly more as the block chain
60+
continues to grow). This is an old idea, is currently implemented
61+
in some software that uses Bitcoin Core, and is part of the
62+
motivation for research into other techniques such as [fast
63+
updatable UTXO commitments][] and [automatic levelDB backups][].
64+
65+
Discussion mainly revolved around whether or not this is a good
66+
idea. Arguments in favor of it include it making starting a new
67+
node much easier and that it doesn't seem to change the trust model
68+
for anyone who already trusts the peer review of their development
69+
team or who is willing to disable the default option to have their
70+
node review the chainstate for validity itself. Arguments against
71+
it include a fear that fast initial syncs with an assumed valid UTXO
72+
set would disguise the fact that block size increases make complete
73+
initial syncing from scratch much more expensive; if block sizes
74+
increased too much, it could become impossible for anyone of modest
75+
means to ever trustlessly verify Bitcoin's UTXO state, forcing new
76+
users to trust existing users.
77+
78+
## Bech32 sending support
79+
80+
*Week 4 of 24. Until the second anniversary of the segwit soft
81+
fork lock-in on 24 August 2019, the Optech Newsletter will contain this
82+
weekly section that provides information to help developers and
83+
organizations implement bech32 sending support---the ability to pay
84+
native segwit addresses. This [doesn't require implementing
85+
segwit][bech32 easy] yourself, but it does allow the people you pay to
86+
access all of segwit's multiple benefits.*
87+
88+
<div class="hide-on-web" markdown="1">
89+
90+
**Note:** we're unable to correctly format multi-line code examples in
91+
the email edition of the newsletter. Please visit the [web
92+
edition][Newsletter #41] for better formatting. We apologize for the
93+
inconvenience.
94+
95+
</div>
96+
97+
In [last week's newsletter][Newsletter #40], we used the Python
98+
reference library for bech32 to decode an address into a scriptPubKey
99+
that you could pay. However, sometimes the user provides an address
100+
containing a typo. The code we suggested would detect the typo and
101+
ensure you didn't pay a wrong address, but bech32 is also able to help
102+
detect the location of typos for your users. This week, we'll
103+
demonstrate this capability using the [Javascript sample code][].
104+
105+
The code is written using Node.js-style module inclusion syntax, so the
106+
first step is to compile it into code we can use in the browser. For
107+
that, we install a [browserify][] tool:
108+
109+
```bash
110+
sudo apt install node-browserify-lite
111+
```
112+
113+
Then we compile it into a standalone file:
114+
115+
```bash
116+
browserify-lite ./segwit_addr_ecc.js --outfile bech32-demo.js --standalone segwit_addr_ecc
117+
```
118+
119+
Followed by including it in our HTML:
120+
121+
```html
122+
<script src="bech32-demo.js"></script>
123+
```
124+
125+
For convenience, we've included that file on the [web
126+
version][Newsletter #41] of this newsletter, so you can follow along
127+
with the rest of this example by simply opening the developer console in
128+
your web browser. Let's start by checking a valid address. Recall from
129+
last week that we provide the network identifier when checking an
130+
address (`bc` for Bitcoin mainnet):
131+
132+
```text
133+
>> segwit_addr_ecc.check('bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', 'bc')
134+
error: null
135+
program: Array(20) [ 117, 30, 118, … ]
136+
version: 0
137+
```
138+
139+
We see above that, just like last week, we get back the witness version
140+
and the witness program. The presence of the version field, plus the
141+
lack of an error, indicate that this program decoded without any
142+
checksum failure.
143+
144+
Now we replace one character in the above address with a typo and try
145+
checking that:
146+
147+
```text
148+
segwit_addr_ecc.check('bc1qw508d6qejxtdg4y5r4zarvary0c5xw7kv8f3t4', 'bc')
149+
error: "Invalid"
150+
pos: Array [ 21 ]
151+
```
152+
153+
This time we get back the description of the error (the address is
154+
invalid because it doesn't match its checksum) and a position. If we
155+
place the addresses above each other with each position marked, we see
156+
that this "21" identifies the location of the specific error:
157+
158+
```text
159+
1x 2x
160+
0123456789012345678901
161+
>> good='bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
162+
>> typo='bc1qw508d6qejxtdg4y5r4zarvary0c5xw7kv8f3t4'
163+
^
164+
```
165+
166+
What if we make an additional replacement to the typo address and try
167+
again?
168+
169+
```text
170+
>> segwit_addr_ecc.check('bc1qw508d6qejxtdg4y5r4zarvary0c5yw7kv8f3t4', 'bc')
171+
error: "Invalid"
172+
pos: Array [ 32, 21 ]
173+
```
174+
175+
We get two locations. Once again, when we compare the addresses to
176+
each other, we see this has identified both incorrect characters:
177+
178+
```text
179+
1x 2x 3x
180+
012345678901234567890123456789012
181+
>> good='bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
182+
>> typo='bc1qw508d6qejxtdg4y5r4zarvary0c5yw7kv8f3t4'
183+
^ ^
184+
```
185+
186+
Pieter Wuille's [interactive demo][] of this Javascript code includes
187+
a few lines of additional code (view source on that page to see the
188+
function) that uses the position of the typo characters to emphasize
189+
them in red:
190+
191+
![Screenshot of the bech32 interactive demo with the typo address above](/img/posts/2019-04-bech32-demo.png)
192+
193+
There's a limit to how many errors the `check()` function can specifically identify.
194+
After that it can still tell that an address contains an error, but it
195+
can't identify where to look in the address for the error. In that
196+
case, it'll still return the address as invalid but it won't return the
197+
position details:
198+
199+
```text
200+
>> segwit_addr_ecc.check('bc1qw508z6qejxtdg4y5r4zarvary0c5yw7kv8f3t4', 'bc')
201+
error: "Invalid"
202+
pos: null
203+
```
204+
205+
In the case where there are other problems with the address, the `error`
206+
field will be set to a more descriptive message that may or may not
207+
include a position of the error. For example:
208+
209+
```text
210+
>> segwit_addr_ecc.check('bc1zw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4yolo', 'bc')
211+
error: "Invalid character"
212+
pos: Array [ 43 ]
213+
```
214+
215+
You can review the [source][bech32 errors] for a complete list of
216+
errors.
217+
218+
Although we spent a lot of time looking at errors in this mini tutorial,
219+
we've hopefully shown how easy it is to provide nice interactive
220+
feedback to users entering bech32 addresses on a web-based platform. We
221+
encourage you to play around with the [interactive demo][] to get an
222+
idea of what your users might see if you make use of this bech32 address
223+
feature.
224+
225+
## Notable code and documentation changes
226+
227+
*Notable changes this week in [Bitcoin Core][bitcoin core repo],
228+
[LND][lnd repo], [C-Lightning][c-lightning repo], [Eclair][eclair repo],
229+
[libsecp256k1][libsecp256k1 repo], and [Bitcoin Improvement Proposals
230+
(BIPs)][bips repo]. Note: all merges described for Bitcoin Core and LND
231+
are to their master development branches; some may also be backported to
232+
their pending releases.*
233+
234+
- [Bitcoin Core #15596][] updates the `sendmany` RPC to remove the
235+
`minconf` parameter. For outputs received to your wallet, this
236+
parameter allowed you to specify how many confirmations they must have
237+
before you attempted to spend them. Now the wallet defaults are
238+
always used. Those defaults are not to spend outputs received from
239+
other people until they are confirmed and to optionally allow spending
240+
unconfirmed change outputs from yourself depending on the
241+
`spendzeroconfchange` configuration setting. This is the same way the
242+
more commonly used `sendtoaddress` RPC has always worked.
243+
244+
- [LND #2885][] changes how LND attempts to reconnect to all of its
245+
peers when coming back online. Previously it attempted to open
246+
connections to all its persistent peers at once. Now it spreads the
247+
connections over a 30 second window to reduce peak memory usage by
248+
about 20% and to also reduce the number of concurrent events later due
249+
to the events occurring on a regular interval, such as pings.
250+
251+
- [LND #2740][] implements a new gossiper subsystem which puts its peers
252+
into two buckets, active gossiper or passive gossiper. Active
253+
gossipers are peers communicating in the currently normal way of
254+
sharing all of their state with your node; passive gossipers are peers
255+
from which you will only request specific updates. Because most
256+
active gossipers will be sending you the same updates as all other
257+
gossipers, having more than a few of them is a waste of your
258+
bandwidth, so this code will ensure that you get a default of 3
259+
active gossipers and then put any other gossipers into the passive
260+
category. Furthermore, the new code will try to only request updates
261+
from one active gossiper at a time in [round-robin][] fashion to avoid
262+
syncing the same updates from different nodes. In one test described
263+
on the PR, this change reduced the amount of gossip data requested by
264+
97.5%.
265+
266+
- [LND #2313][] implements code and RPCs that allow LND nodes to use
267+
static channel backups. This is based on the Data Loss Protection
268+
(DLP) protocol implemented in [LND #2370][] to allow backing up a
269+
single file containing all of your current channel state at any point
270+
and then enabling restoring from that file at any later point to get
271+
your remote peer to help you to close any of those channels in their
272+
latest state (excluding unfinalized routed payments (HTLCs)). Note:
273+
despite the "static" in this feature's name, this is not like an HD
274+
wallet one-time backup. It's a backup that needs to be done at least
275+
as often as each time you open a new channel---but that's much better
276+
than the current state where you may not be able to recover any funds
277+
from any of your channels if you lose data. Further improvements to
278+
backup robustness are mentioned in the PR's description. See the
279+
description of LND #2370 in [Newsletter #31][] for more details on how
280+
DLP-based backup and recovery works. Getting this major improvement
281+
to backups merged was one of the major goals for upcoming LND version
282+
0.6-beta.
283+
284+
- [BIPs #772][] withdraws [BIP151][] at the request of its author, who
285+
has proposed an alternative scheme for [P2P protocol
286+
encryption][].
287+
288+
- [BIPs #756][] assigns [BIP127][] to a specification for the proof of
289+
reserves tool described in [Newsletter #33][]. Draft text for the BIP
290+
is merged.
291+
292+
<script src="/misc/bech32-demo.js"></script>
293+
294+
{% include references.md %}
295+
{% include linkers/issues.md issues="15555,9484,772,756,2313,15596,2885,2740,2370" %}
296+
[0.18.0]: https://bitcoincore.org/bin/bitcoin-core-0.18.0/
297+
[bech32 easy]: {{news38}}#bech32-sending-support
298+
[0.14 tests]: https://bitcoincore.org/en/2017/03/08/release-0.14.0/#ibd
299+
[p2p protocol encryption]: https://gist.github.com/jonasschnelli/c530ea8421b8d0e80c51486325587c52
300+
[browserify]: http://browserify.org/
301+
[lnd releases]: https://github.com/lightningnetwork/lnd/releases
302+
[lnd issue]: https://github.com/lightningnetwork/lnd/issues/new
303+
[assumeutxo thread]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2019-April/016825.html
304+
[fast updatable UTXO commitments]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-May/014337.html
305+
[automatic leveldb backups]: https://github.com/bitcoin/bitcoin/issues/8037
306+
[javascript sample code]: https://github.com/sipa/bech32/tree/master/ecc/javascript
307+
[interactive demo]: http://bitcoin.sipa.be/bech32/demo/demo.html
308+
[bech32 errors]: https://github.com/sipa/bech32/blob/master/ecc/javascript/segwit_addr_ecc.js#L54
309+
[round-robin]: https://en.wikipedia.org/wiki/Round-robin_scheduling

assets/css/main.scss

+4
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,7 @@ div.xoverflow {
141141
font-size: 80%;
142142
code { font-size: 80%; }
143143
}
144+
145+
.hide-on-web {
146+
display: none;
147+
}

img/posts/2019-04-bech32-demo.png

13 KB
Loading

0 commit comments

Comments
 (0)