<oembed><type>rich</type><version>1.0</version><author_name>npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_name><author_url>https://nostr.ae/npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2015-12-08&#xA;📝 Original message:On Mon, Dec 07, 2015 at 10:02:17PM +0000, Gregory Maxwell via bitcoin-dev wrote:&#xA;&gt; ... bringing Segregated Witness to Bitcoin.&#xA;&gt; The particular proposal amounts to a 4MB blocksize increase at worst.&#xA;&#xA;Bit ambiguous what &#34;worst&#34; means here; lots of people would say the&#xA;smallest increase is the worst option. :)&#xA;&#xA;By my count, P2PKH transactions get 2x space saving with segwit [0],&#xA;while 2-of-2 multisig P2SH transactions (and hence most of the on-chain&#xA;lightning transactions) get a 3x space saving [1]. An on-chain HTLC (for&#xA;a cross-chain atomic swap eg) would also get 3x space saving [2]. The most&#xA;extreme lightning transactions (uncooperative close with bonus anonymity)&#xA;could get a 6x saving, but would probably run into SIGOP limits [3].&#xA;&#xA;&gt; If widely used this proposal gives a 2x capacity increase&#xA;&gt; (more if multisig is widely used),&#xA;&#xA;So I think it&#39;s fair to say that on its own it gives up to a 2x increase&#xA;for ordinary pay to public key transactions, and a 3x increase for 2/2&#xA;multisig and (on-chain) lightning transactions (which would mean lightning&#xA;could scale to ~20M users with 1MB block sizes based on the estimates&#xA;from Tadge Dryja&#39;s talk). More complicated smart contracts (even just 3&#xA;of 5 multisig) presumably benefit even more from this, which seems like&#xA;an interesting approach to (part of) jgarzik&#39;s &#34;Fidelity problem&#34;.&#xA;&#xA;Averaging those numbers as a 2.5x improvement, means that combining&#xA;segwit with other proposals would allow you to derate them by a factor&#xA;of 2.5, giving:&#xA;&#xA; BIP-100: maximum of 12.8MB&#xA; BIP-101: 3.2MB in 2016, 6.4MB in 2018, 12.8MB in 2020, 25.6MB in 2022..&#xA; 2-4-8:   800kB in 2016, 1.6MB in 2018, 3.2MB in 2020&#xA; BIP-103: 400kB in 2016, 470kB in 2018, 650kB in 2020, 1MB in 2023...&#xA;&#xA;(ie, if BIP-103 had been the &#34;perfect&#34; approach, then post segwit,&#xA;it would make sense to put non-consensus soft-limits back in place&#xA;for quite a while)&#xA;&#xA;&gt; TL;DR:  I propose we work immediately towards the segwit 4MB block&#xA;&gt; soft-fork which increases capacity and scalability, and recent speedups&#xA;&gt; and incoming relay improvements make segwit a reasonable risk.&#xA;&#xA;I guess segwit effectively introduces two additional dimensions for&#xA;working out how to optimally pack transactions into a block -- there&#39;s&#xA;the existing constraints on block bytes (&lt;=1MB) and sigops (&lt;=20k), but&#xA;there are problably additional constraints on witness bytes (&lt;=3MB) and&#xA;there *could* be a different constraint for sigops in witnesses (&lt;=3*20k?&#xA;&lt;=4*20k?) compared to sigops in the block while remaining a soft-fork.&#xA;&#xA;It could also be an opportunity to combine the constraints, ie&#xA;(segwit_bytes + 50*segwit_sigs &lt; 6M) which would make it easier to avoid&#xA;attacks where people try sending transactions with lots of sigops in very&#xA;few bytes, filling up blocks by sigops, but only paying fees proportional&#xA;to their byte count.&#xA;&#xA;Hmm, after a quick look, I&#39;m not sure if the current segwit branch&#xA;actually accounts for sigops in segregated witnesses? If it does, afaics&#xA;it simply applies the existing 20k limit to the total, which seems&#xA;too low to me?&#xA;&#xA;Having segwit with the current 1MB limit on the traditional block&#xA;contents plus an additional 3MB for witness data seems like it would&#xA;also give a somewhat gradual increase in transaction volume from the&#xA;current 1x rate to an eventual 2x or 3x rate as wallet software upgrades&#xA;to support segregated witness transactions. So if problems were found&#xA;when block+witness data hit 1.5MB, there&#39;d still be time to roll out&#xA;fixes before it got to 1.8MB or 2MB or 3MB. ie this further reduces the&#xA;risk compared to a single step increase to 2x capacity.&#xA;&#xA;BTW, it&#39;s never been quite clear to me what the risks are precisely.&#xA;Here are some:&#xA;&#xA; - sometime soon, blockchain supply can&#39;t meet demand&#xA;&#xA;    + I&#39;ve never worked out how you&#39;d tell if this is the case;&#xA;      there&#39;s potentially infinite demand if everything free, so at&#xA;      one level it&#39;s trivially true, but that&#39;s not helpful.&#xA;&#xA;    + Presumably if this were happening in a way that &#34;matters&#34;, fees&#xA;      would rise precipitously. Perhaps median fees of $2 USD/kB would&#xA;      indicate this is happening? If so, it&#39;s not here yet and seems&#xA;      like it&#39;s still a ways off.&#xA;&#xA;    + If it were happening, then, presumably, people become would be&#xA;      less optimistic about bitcoin and the price of BTC would drop/not&#xA;      rise, but that seems pretty hard to interpret.&#xA;&#xA; - it becomes harder to build on blocks found by other miners,&#xA;   encouraging mining centralisation (which then makes censorship easier,&#xA;   and fungibility harder) or forcing trust between miners (eg SPV mining&#xA;   empty blocks)&#xA;&#xA;    + latency/bandwidth limitations means miners can&#39;t get block&#xA;      information quickly enough (mitigated by weak blocks and IBLT)&#xA;&#xA;    + blocks can&#39;t be verified quickly enough (due to too many crypto&#xA;      ops per block, or because the UTXO set can&#39;t be kept in RAM)&#xA;      (mitigated by libsecp256k1 improvements, ..?)&#xA;&#xA;    + constructing a new block to mine takes too long&#xA;&#xA; - it becomes harder to maintain a validating, but non-mining node,&#xA;   which in turn makes non-validating nodes harder to run safely (ie,&#xA;   Sybil attacks become easier)&#xA;&#xA;    + increased CPU to verify bigger/more complicated blocks (can&#39;t keep&#xA;      up on a raspberry pi)&#xA;&#xA;    + increased storage (60GB of blockchain might mean it won&#39;t fit on&#xA;      your laptop)&#xA;&#xA;    + increased bandwidth&#xA;&#xA;    + increased initial sync time (delayed reward = less likely to&#xA;      bother)&#xA;&#xA;Cheers,&#xA;aj&#xA;&#xA;[0] AIUI, segwit would make the &#34;in block&#34; transactions look like:&#xA;&#xA;     * (4) version&#xA;     * (1) input count&#xA;     * for each input:&#xA;       - (32) tx hash&#xA;       - (4) txout index&#xA;       - (1) script length = 0&#xA;       - (4) sequence number&#xA;     * (1) output count&#xA;     * for each output:&#xA;       - (8) value&#xA;       - (1) script length = 34&#xA;       - (34) &lt;33 byte push&gt;&#xA;     * (4) locktime&#xA;&#xA;    So about 10+41i+43o bytes (with the other information being external to&#xA;    the block and the 1MB limit, but committed to via the coinbase).&#xA;&#xA;    A standard pay to public key hash would have a 25 byte output script&#xA;    instead of 34 bytes, but also a 105 bytes of input script, so about&#xA;    10+146i+34o bytes.&#xA;&#xA;    Over enough transactions inputs and outputs are about equal, so that&#39;s&#xA;    10+84o versus 10+180o, so a factor of 2x-2.14x in the usual case.&#xA;&#xA;[1] With a P2SH to a 2-of-2 multisig address, the output script would&#xA;    be 23 bytes, and the input script would be a 71B redeem script, plus&#xA;    two signatures and an OP_0 for about 215B, so totalling 10+256i+32o.&#xA;&#xA;    Again treating i=o over the long term, that&#39;s 10+84o version 10+288o,&#xA;    so that&#39;s a 3.2x-3.4x improvement. 2-of-2 multisig payment would&#xA;    cover the normal case for on-chain lightning channel transactions,&#xA;    ie where both sides are able to cooperatively close the channel.&#xA;&#xA;[2] A basic HTLC, ie: &#34;pay to A if they know the preimage for X, or pay&#xA;    to B after a timeout of T&#34;, done by P2SH has about 98B of redeem script&#xA;    and either ~105B of signature or ~72B of signature for a total of 203B&#xA;    or 170B of input script. So that comes to 10+244i+32o or 10+211i+32o.&#xA;    Segwit gives an improvement of 3x-3.3x or 2.7x-2.9x there.&#xA;&#xA;[3] A lightning-style HTLC, which adds a third option of &#34;, or pay to&#xA;    B if A was trying to cheat&#34; adds an extra 25 bytes or so to the&#xA;    redeem script, changing those numbers to 10+270i+32o and 10+236i+32o,&#xA;    and an improvement of 3.3x-3.6x or 2.9x-3.2x.&#xA;&#xA;    A lightning-style HTLC that also uses ecc private keys as the secret&#xA;    preimages to be revealed [4] might use an additional ~260 bytes of&#xA;    redeem script / script signature, which would make the worst case&#xA;    numbers be 10+530i+32o, so 10+562o versus 10+84o, which would be a&#xA;    6x-6.7x improvement. But those particular scripts would be constrained&#xA;    by consensus sigop limits before the filled up much more than a quarter&#xA;    of a block in a segwit/1MB world anyway.&#xA;&#xA;[4] http://lists.linuxfoundation.org/pipermail/lightning-dev/2015-November/000344.html</html></oembed>