|
| 1 | +--- |
| 2 | +title: 'Bitcoin Optech Newsletter #32' |
| 3 | +permalink: /en/newsletters/2019/02/05/ |
| 4 | +name: 2019-02-05-newsletter |
| 5 | +type: newsletter |
| 6 | +layout: newsletter |
| 7 | +lang: en |
| 8 | +--- |
| 9 | +This week's newsletter includes an announcement of the 2019 Chaincode |
| 10 | +Residency program, summarizes a few talks from the Stanford Blockchain |
| 11 | +Conference, and provides the usual list of notable code changes in |
| 12 | +popular Bitcoin infrastructure projects. |
| 13 | + |
| 14 | +## Action items |
| 15 | + |
| 16 | +- **Apply to the Chaincode Residency:** Bitcoin Optech encourages any |
| 17 | + engineer who is interested in spending summer contributing to open source |
| 18 | + Bitcoin and Lightning projects to apply to the Chaincode Residency. Full |
| 19 | + details of the residency are in the *News* section below. |
| 20 | + |
| 21 | +## News |
| 22 | + |
| 23 | +- **2019 Chaincode Residency:** Chaincode Labs opened applications for its |
| 24 | + [fourth residency program][residency] to be held in New York over |
| 25 | + summer 2019. The program combines a 3 week seminar and discussion series |
| 26 | + covering Bitcoin and Lightning protocol development with a two month period for |
| 27 | + working on an open source Bitcoin or Lightning project under the guidance of an |
| 28 | + established protocol developer. The list of [confirmed speakers and |
| 29 | + mentors][residency speakers] includes some of the most prolific contributors to |
| 30 | + Bitcoin and Lightning. The previous Chaincode Residency (focused on Lightning |
| 31 | + Network applications) was covered in [Newsletter #21][]. |
| 32 | + |
| 33 | + Chaincode is inviting developers who want to contribute to open source |
| 34 | + Bitcoin and Lightning protocol projects to [apply to the |
| 35 | + residency][residency apply]. Applicants from all backgrounds are welcomed, |
| 36 | + and Chaincode will cover travel and accommodation costs and provide a stipend |
| 37 | + to support living expenses. |
| 38 | + |
| 39 | +[residency]: https://residency.chaincode.com |
| 40 | +[residency speakers]: https://residency.chaincode.com/#mentors |
| 41 | +[residency apply]: https://residency.chaincode.com/#apply |
| 42 | + |
| 43 | +## Notable talks from the Stanford Blockchain Conference |
| 44 | + |
| 45 | +The [third edition][sbc] of this annual conference (formerly named BPASE) |
| 46 | +included more than two dozen presentations across three days. We found |
| 47 | +the following topics especially interesting from a Bitcoin perspective, |
| 48 | +although we encourage anyone who wants to learn more to look at the |
| 49 | +[transcripts][] provided by Bryan Bishop or the videos provided by |
| 50 | +the organizers ([day 1][], [day 2][], [day 3][]). |
| 51 | + |
| 52 | +- **Accumulators for blockchains** presented by Benedickt Bünz |
| 53 | + ([transcript][accumulators txt], [video][accumulators vid]). Bitcoin |
| 54 | + full nodes maintain a ledger (called the UTXO set) that stores the |
| 55 | + ownership information for every currently-spendable grouping of |
| 56 | + bitcoins. Currently, that ledger contains over 50 million entries |
| 57 | + and uses about three gigabytes of disk space. This allows nodes who |
| 58 | + receive a transaction to ensure the bitcoins being spent exist in |
| 59 | + the UTXO set, retrieve the ownership information for those bitcoins, |
| 60 | + and verify that information against the signature and other witness |
| 61 | + data provided in the transaction. |
| 62 | + |
| 63 | + But what if we also asked the spender to provide a copy of the |
| 64 | + ownership information in their transaction along with a |
| 65 | + cryptographic proof that the the information is actually in the UTXO |
| 66 | + set? In that case, we wouldn't need to store the whole set, we'd |
| 67 | + only need to store a commitment to a set we knew was accurate and |
| 68 | + that could be referenced by accurate proofs. RSA accumulators are |
| 69 | + one idea (among several others) for how to create that commitment |
| 70 | + and its related proofs. Using an accumulator, the size of the UTXO |
| 71 | + commitment that nodes would store on disk would be tiny compared to |
| 72 | + the full state. Transactions would increase in size due to needing |
| 73 | + to provide ownership data and a proof that they were part of the |
| 74 | + current UTXO set, but the size increase would be modest (assuming |
| 75 | + current typical transactions, about 70 bytes of ownership |
| 76 | + information per input plus a proof that could be aggregated down to |
| 77 | + about 325 bytes per block). |
| 78 | + |
| 79 | + Other considerations affect the suitability of accumulators to |
| 80 | + the task, including being relatively new to cryptography, |
| 81 | + requiring either a well-studied trusted setup or a |
| 82 | + more novel untrusted setup, and potentially making blocks take |
| 83 | + longer to verify than the current system given that accumulator |
| 84 | + verification is about 100x slower than alternative systems using |
| 85 | + merkle trees. In a new development compared to a previous |
| 86 | + version of this talk given at Scaling Bitcoin 2018, the speaker |
| 87 | + describes a potential major speedup to practical verification. |
| 88 | + |
| 89 | + In summary, RSA accumulators remain an interesting area of investigation |
| 90 | + into how to reduce full node requirements for storing and quickly |
| 91 | + accessing the UTXO set. This may not be particularly important now, |
| 92 | + when the UTXO set is relatively small and fast, but it could make it |
| 93 | + easier to support initiatives that would change how people use the |
| 94 | + UTXO set in the future. For example: |
| 95 | + |
| 96 | + - If accumulator-based proofs can indeed be verified quickly, they |
| 97 | + could allow the UTXO set size to grow considerably (perhaps |
| 98 | + because of a block size increase) while still ensuring that miners |
| 99 | + can verify transaction inputs quickly enough to minimize the use of |
| 100 | + spy mining or the production of stale blocks. |
| 101 | + |
| 102 | + - Software that uses trusted UTXO sets with newly-started nodes to |
| 103 | + avoid the cost and delay of downloading and verifying the full |
| 104 | + block chain (an option [some software][btcpay utxo] already |
| 105 | + provides) could reduce those costs and delays even further by |
| 106 | + replacing the multi-gigabyte UTXO set with an accumulator a |
| 107 | + million times smaller. |
| 108 | + |
| 109 | + It should |
| 110 | + be possible for eager experimenters to explore the use of |
| 111 | + accumulators in Bitcoin without changing any consensus rules, such |
| 112 | + as Tadge Dryja has been doing with his similar [Utreexo][] system |
| 113 | + based on merkle trees. |
| 114 | + |
| 115 | +- **Miniscript** presented by Pieter Wuille ([transcript][miniscript |
| 116 | + txt], [video][miniscript vid], [slides][miniscript slides]). |
| 117 | + Imagine you had a Bitcoin script that gave control over your bitcoins |
| 118 | + to your lawyer a year after you last moved them, in case he needed to |
| 119 | + distribute them to your heirs. That's an easy script to write. But |
| 120 | + what if someone then asked you to join a 3-of-4 multisig contract |
| 121 | + where you'd be one of parties holding some funds. How hard would it |
| 122 | + be for you to insert your existing policy into their generic multisig |
| 123 | + contract and be sure you haven't broken anything? That's the question |
| 124 | + asked by this speaker, and his answer is the composable policy |
| 125 | + language *miniscript*. |
| 126 | + |
| 127 | + Miniscript is a subset of the full Bitcoin Script language that |
| 128 | + focuses on just a few features such *signatures*, *times*, and |
| 129 | + *hashes* plus operators for combining them, such as *and*, *or*, or |
| 130 | + *threshold*. It's compact, easy to read, and will compile down to |
| 131 | + the most efficient script implementing a given policy. From an |
| 132 | + existing script compatible with its operations, it will also reverse |
| 133 | + it back into a policy for easy review. By design, it uses a |
| 134 | + similar vocabulary to the [output script descriptors][] Wuille has |
| 135 | + been implementing in Bitcoin Core and it can help the updater or |
| 136 | + finalizer in a [BIP174][] PSBT workflow figure out who needs to sign |
| 137 | + next or whether all data for finalizing the script has been |
| 138 | + received. |
| 139 | + |
| 140 | + Looking at the problem posed in the introduction paragraph, we can |
| 141 | + define the example personal spending policy as either you providing a |
| 142 | + signature for your compressed pubkey, `pk(C)`, or your lawyer |
| 143 | + waiting for a year, `time(<seconds>)`, and then providing a |
| 144 | + signature for his own compressed pubkey. We combine these branches |
| 145 | + with an asymmetric "or," `aor`, to reduce the witness data required |
| 146 | + when following the first branch. |
| 147 | + |
| 148 | + aor(pk(C),and(time(31536000),pk(C))) |
| 149 | + |
| 150 | + We can define the generic 3-of-4 multisig policy similarly using |
| 151 | + compressed pubkeys (`C`): |
| 152 | + |
| 153 | + multi(3,C,C,C,C) |
| 154 | + |
| 155 | + A functionally equivalent policy that allows more flexibility would |
| 156 | + use the threshold operation: |
| 157 | + |
| 158 | + thres(3,pk(C),pk(C),pk(C),pk(C)) |
| 159 | + |
| 160 | + This allows you to just replace one of the public keys with your personal |
| 161 | + policy: |
| 162 | + |
| 163 | + thres(3,pk(C),pk(C),pk(C),aor(pk(C),and(time(31536000),pk(C)))) |
| 164 | + |
| 165 | + When compiled, the result is the following script: |
| 166 | + |
| 167 | + [pk] CHECKSIG SWAP [pk] CHECKSIG ADD SWAP [pk] CHECKSIG ADD |
| 168 | + TOALTSTACK IF [pk] CHECKSIGVERIFY 0x8033e101 CHECKSEQUENCEVERIFY |
| 169 | + 0NOTEQUAL ELSE [pk] CHECKSIG ENDIF FROMALTSTACK ADD 3 EQUAL |
| 170 | + |
| 171 | + A final benefit of miniscript is that it should allow a policy |
| 172 | + written today to be automatically translated into a structure that |
| 173 | + makes optimal use of MAST, taproot, or other possible Bitcoin |
| 174 | + protocol upgrades. That means, as the Bitcoin protocol advances, |
| 175 | + the user or developer who invested time into crafting a policy won't |
| 176 | + have to redo their work in order to continue using it with newer |
| 177 | + technology. |
| 178 | + |
| 179 | + The speaker has provided an interactive Javascript [demo of the |
| 180 | + miniscript compiler][miniscript demo], and he and his collaborators |
| 181 | + also have a Rust language version of the compiler they plan to |
| 182 | + release as open source soon. |
| 183 | + |
| 184 | +- **Probabilistic Bitcoin soft forks (sporks)** presented by Jeremy |
| 185 | + Rubin ([transcript][spork txt], [video][spork vid]). By March 2017, |
| 186 | + almost all Bitcoin nodes were ready to begin enforcing the segwit soft |
| 187 | + fork but miners seemed unwilling to send the activation signal. This |
| 188 | + created confusion: do miners get to veto protocol upgrades? If they |
| 189 | + do, is segwit dead? If they don't, what do users do to override them? |
| 190 | + Ultimately the situation was resolved, but it was a mess that many |
| 191 | + would prefer not to repeat. |
| 192 | + |
| 193 | + The speaker identifies the root cause of the problem as miners being |
| 194 | + able to delay activation at no cost to themselves. He proposes a |
| 195 | + solution: use the randomness remaining in a block header hash to |
| 196 | + determine whether or not a block signals for activation. For |
| 197 | + example, we'd choose a target that only 1 header hash out of 26,000 |
| 198 | + would match. A block matching that target would be produced once every |
| 199 | + six months on average, although nobody would know exactly when |
| 200 | + (about 10% of the time, it'd be within 3 weeks; but another 10% of |
| 201 | + the time, it'd take more than a year). |
| 202 | + |
| 203 | + Miners would have no control over whether or not their block |
| 204 | + signaled for activation, but they would have control over whether |
| 205 | + they published that block. A miner who refused to publish his own |
| 206 | + block if it signaled for activation would lose the income from that |
| 207 | + block but would successfully prevent the fork from activating at |
| 208 | + least until the next signaling block was produced (which could be |
| 209 | + tomorrow or could be two years later). This gives miners a real |
| 210 | + chance to hold back a change but only by sacrificing real income. |
| 211 | + The end of the talk suggests some variations on the method with |
| 212 | + different tradeoffs. |
| 213 | + |
| 214 | + The idea needs to be analyzed for possible problems, but it does |
| 215 | + provide an interesting alternative to [BIP9][]-style miner-activated |
| 216 | + soft forks (MASFs) and [BIP8][]-style user-activated soft forks (UASFs). |
| 217 | + |
| 218 | + At the conclusion of his talk, this speaker also announced that the |
| 219 | + next Scaling Bitcoin conference and EdgeDev++ training sessions will |
| 220 | + be later in 2019 in Tel Aviv, Israel. |
| 221 | + |
| 222 | +## Notable code changes |
| 223 | + |
| 224 | +*Notable code changes this week in [Bitcoin Core][bitcoin core repo], |
| 225 | +[LND][lnd repo], [C-Lightning][c-lightning repo], [Eclair][eclair repo], |
| 226 | +and [libsecp256k1][libsecp256k1 repo].* |
| 227 | + |
| 228 | +- [Bitcoin Core #14929][] allows peers that your node automatically |
| 229 | + disconnected for misbehavior (e.g. sending invalid data) to reconnect |
| 230 | + to your node if you have unused incoming connection slots. If your |
| 231 | + slots fill up, the misbehaving nodes are disconnected to make room for |
| 232 | + nodes without a history of problems (unless the misbehaving node helps |
| 233 | + your node in some other way, such as by connecting to a part of the |
| 234 | + Internet from which you don't have many other peers). Previously, |
| 235 | + Bitcoin Core banned the IP addresses of misbehaving peers for a period |
| 236 | + of time (default of 1 day); this was easily circumvented by attackers |
| 237 | + with multiple IP addresses. This solution gives those peers a chance |
| 238 | + to be useful but provides priority to potentially more helpful peers. |
| 239 | + If you manually ban a peer, such as by using the `setban` RPC, |
| 240 | + connections from that peer will still be rejected. |
| 241 | + |
| 242 | +- [Bitcoin Core #13926][] adds a new `bitcoin-wallet` tool to the |
| 243 | + executables Bitcoin Core provides. Without using RPCs or any network access, |
| 244 | + this tool can currently create a new wallet file or display some basic |
| 245 | + information about an existing wallet, such as whether the wallet is |
| 246 | + encrypted, whether it uses an HD seed, how many transactions it |
| 247 | + contains, and how many address book entries it has. This helps people |
| 248 | + who have a wallet file that hasn't been synced to the most recent chain |
| 249 | + tip; they can do a quick inspection on the wallet to see if it's |
| 250 | + interesting before they perform the lengthy rescan necessary to import |
| 251 | + it. Developers plan to add more features to the tool in the future. |
| 252 | + |
| 253 | +- [Bitcoin Core #15159][] changes the `getrawtransaction` RPC so that it |
| 254 | + will now only return transactions in the mempool by default. If you |
| 255 | + have enabled the optional transaction index (txindex), it will also |
| 256 | + return confirmed transactions as well. Prior to this change, even |
| 257 | + if you didn't have the txindex enabled, it would return confirmed |
| 258 | + transactions if they hadn't yet had all their outputs spent. This |
| 259 | + previous behavior confused users: the call would work on some |
| 260 | + confirmed transactions but not others, and sometimes transactions that |
| 261 | + previously worked would suddenly stop working. This change makes the |
| 262 | + RPC act more consistently (although, of course, mempools vary between |
| 263 | + nodes and change over time). |
| 264 | + |
| 265 | +- [LND #2538][] increases the default time between sending updates about |
| 266 | + what public nodes exist on the network from 30 seconds to 90 seconds. |
| 267 | + This slows down propagation on the network, which has grown hugely in |
| 268 | + size, in order to conserve bandwidth. Separately from this PR, LN |
| 269 | + protocol devs are preparing changes to the gossip protocol to be more |
| 270 | + bandwidth efficient, although a lower update frequency will still save |
| 271 | + bandwidth there as well. (See also [C-Lightning #2297][] for the fix |
| 272 | + this week to a bug some nodes were encountering because the volume of |
| 273 | + gossip they received was so large.) |
| 274 | + |
| 275 | +- [LND #2554][] deprecates the `IncorrectHtlcAmount` onion error |
| 276 | + in favor of the `UnknownPaymentHash` error that now includes the |
| 277 | + amount of the failed payment. LND will still handle the old error |
| 278 | + code but it will no longer generate it. |
| 279 | + |
| 280 | +- [LND #2500][] disconnects any peers that don't support the Data Loss |
| 281 | + Protection (DLP) protocol. This ensures that LND's new backup format |
| 282 | + will be usable. See the *notable commits* section and footnote from |
| 283 | + [last week's newsletter][Newsletter #31] for information about the new |
| 284 | + backup protocol and the existing DLP protocol. |
| 285 | + |
| 286 | +{% include references.md %} |
| 287 | +{% include linkers/issues.md issues="2500,2554,15159,13926,2538,14929,2297" %} |
| 288 | +[accumulators txt]: http://diyhpl.us/wiki/transcripts/stanford-blockchain-conference/2019/accumulators/ |
| 289 | +[accumulators vid]: https://youtu.be/XckwEw8FyEA?t=20295 |
| 290 | +[miniscript txt]: http://diyhpl.us/wiki/transcripts/stanford-blockchain-conference/2019/miniscript/ |
| 291 | +[miniscript vid]: https://youtu.be/sQOfnsW6PTY?t=22539 |
| 292 | +[miniscript slides]: https://prezi.com/view/KH7AXjnse7glXNoqCxPH/ |
| 293 | +[miniscript demo]: http://bitcoin.sipa.be/miniscript/miniscript.html |
| 294 | +[spork txt]: http://diyhpl.us/wiki/transcripts/stanford-blockchain-conference/2019/spork-probabilistic-bitcoin-soft-forks/ |
| 295 | +[spork vid]: https://youtu.be/sQOfnsW6PTY?t=29762 |
| 296 | +[sbc]: https://cyber.stanford.edu/sbc19 |
| 297 | +[transcripts]: http://diyhpl.us/wiki/transcripts/stanford-blockchain-conference/2019/ |
| 298 | +[day 1]: https://www.youtube.com/watch?v=XckwEw8FyEA |
| 299 | +[day 2]: https://www.youtube.com/watch?v=sQOfnsW6PTY |
| 300 | +[day 3]: https://www.youtube.com/watch?v=U5fEvfAFs_o |
| 301 | +[utreexo]: https://dci.mit.edu/research/2018/11/28/utreexo-a-dynamic-accumulator-for-bitcoin-state-a-description-of-research-by-thaddeus-dryja |
| 302 | +[btcpay utxo]: https://github.com/btcpayserver/btcpayserver-docker/tree/master/contrib/FastSync |
0 commit comments