summaryrefslogtreecommitdiff
path: root/e8/f2ba88fa43fcfb0afce39744b5a46842a7b890
blob: 45e1e7905e9b48a297f50e28d16f2404616bf09f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
Return-Path: <sergio.d.lerner@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id 68DA2B65
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Mon,  8 May 2017 22:43:06 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-qt0-f182.google.com (mail-qt0-f182.google.com
	[209.85.216.182])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 48BE61B5
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Mon,  8 May 2017 22:43:05 +0000 (UTC)
Received: by mail-qt0-f182.google.com with SMTP id n4so62471577qte.2
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Mon, 08 May 2017 15:43:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to:cc;
	bh=xJF/3dEaccJ3WqAE4uvIrq651xxUPtDLupPX1vJ1MLY=;
	b=FUphiRX9yVAA3vTWwMLcSPxS2axikuCG80O6SjwMkl0H3rHSAxtkXv2vLSjSVB9HGQ
	e7w5e61jwQJu2dL17iUKLO2LrtIpujLtcSMfD7HHc9OCokPgpkQZzO/kzGi1YzsEgkda
	CG1RnkJhsMJgYTZvYz7lf6e+AjRb/2dxpKoCcZoeTyKAgWU+ioy0iSWcrzgHouLP2iWW
	ODsV8OT4axnqPjqH7ABipTq/+rbVuO2JT9gXPc5RAMuo7jSz1pTYAXGDGJrWp3pPnKKU
	nsJO/vq/qOMtx9GYHSFYeZ2q0DXxRGhbKEkdRsexl8G7Ciq5QSJ8GiUP4wqCIy2G3b1W
	fyZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc;
	bh=xJF/3dEaccJ3WqAE4uvIrq651xxUPtDLupPX1vJ1MLY=;
	b=tbrhimyJegfdtuZJIxaPHWNdWEs/43toGPVF9DpgkeocdM6Kl1tscpsuDf+jNtphrz
	irP/fkTwB9EvIHC+yMihhfh6fRHQyc7KGpYGc0YC3WJB0r8c50Wpqi6+eOFyb7Gi9aQx
	r071tAzXp+/Ya3hEGr3JwH1C6npz+3XrXMwSMz5Zd+nwK7/lE9ILqby/iuxO1td+KUZu
	CNrji3WQwT4JyeuJJh1YebUsbHLKiPj4Pbm+AqIikPqlb5ZrKcHyAc4r8E10jfgNrMKg
	ZUZdfPIu/VBWeUTVKkRxLZ45I6MUeKsWKMefgSG/xOaNPpv7xTwfmaD+8nwm0gjCs8gy
	/iGA==
X-Gm-Message-State: AN3rC/7AJ0XSV06jQdhglgQxnP7aDcw5BQabWesEHVIDcFf0fkFBshUd
	oAjbI/1zoygmLfFix/AobJ9j6M7q9bYiY8k=
X-Received: by 10.200.47.73 with SMTP id k9mr20235202qta.11.1494283384252;
	Mon, 08 May 2017 15:43:04 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.165.132 with HTTP; Mon, 8 May 2017 15:42:23 -0700 (PDT)
From: Sergio Demian Lerner <sergio.d.lerner@gmail.com>
Date: Mon, 8 May 2017 19:42:23 -0300
Message-ID: <CAKzdR-qojNn8OtUTPbxa0JauK9nmo2ZGm4ihKuyzsz_FAgokDw@mail.gmail.com>
To: bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org>
Content-Type: multipart/alternative; boundary=001a114670904fed79054f0af6e8
X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE,
	RCVD_IN_DNSWL_LOW, 
	RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
Cc: hello@p2sh.info
Subject: [bitcoin-dev] Some real-world results about the current Segwit
	Discount
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Mon, 08 May 2017 22:43:06 -0000

--001a114670904fed79054f0af6e8
Content-Type: text/plain; charset=UTF-8

I have processed 1000 blocks starting from Block #461653.

I computed several metrics, including the supposed size of witness data and
non-witness data (onchain), assuming all P2SH inputs/outputs are converted
to P2PWSH and all P2PKH inputs/outputs are converted to P2WPKH.

This takes into account that other types of transactions will not be
modified by Segwit (e.g. OP_RETURN outputs, or P2PK). This analysis doesn't
take into account that LN transactions may affect the current state,
 increasing the segwit/nosegwit ratio.

Among a lot of information, I've got the following real world results...

acMainChainSpace =352608924
acSegwitSpace =599400403
Ratio segwit/nosegwit=1.6999

This implies that the 75% that discount is not the best option to prevent
witness spam in a block of 4 MB, as stated in
https://segwit.org/why-a-discount-factor-of-4-why-not-2-or-8-bbcebe91721e.

The non-witness data weight factor should not be 4 but 2.35. The closest
integer value is 2, which leads to a 50% witness discount.

The Bitcoinj source code is available for anyone to review. I encourage
anyone to re-compute this with another utility to cross-check. Maybe
Antoine Le Calvez (p2sh.info) would like to double-check.

--001a114670904fed79054f0af6e8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I have processed 1000 blocks starting from=C2=A0Block #461=
653.<div><br></div><div>I computed several metrics, including the supposed =
size of witness data and non-witness data (onchain), assuming all P2SH inpu=
ts/outputs are converted to P2PWSH and all P2PKH inputs/outputs=C2=A0are co=
nverted to P2WPKH.</div><div><br></div><div>This takes into account that ot=
her types of transactions will not be modified by Segwit (e.g. OP_RETURN ou=
tputs, or P2PK). This analysis doesn&#39;t take into account that LN transa=
ctions may affect the current state, =C2=A0increasing the segwit/nosegwit r=
atio.</div><div><br></div><div>Among a lot of information, I&#39;ve got the=
 following real world results...</div><div><br></div><div><div>acMainChainS=
pace =3D352608924</div><div>acSegwitSpace =3D599400403</div><div>Ratio segw=
it/nosegwit=3D1.6999</div></div><div><br></div><div>This implies that the 7=
5% that discount is not the best option to prevent witness spam in a block =
of 4 MB, as stated in <a href=3D"https://segwit.org/why-a-discount-factor-o=
f-4-why-not-2-or-8-bbcebe91721e">https://segwit.org/why-a-discount-factor-o=
f-4-why-not-2-or-8-bbcebe91721e</a>.</div><div><br></div><div>The non-witne=
ss data weight factor should not be 4 but 2.35. The closest integer value i=
s 2, which leads to a 50% witness discount.<br></div><div><br></div><div>Th=
e Bitcoinj source code is available for anyone to review. I encourage anyon=
e to re-compute this with another utility to cross-check. Maybe Antoine Le =
Calvez (<a href=3D"http://p2sh.info">p2sh.info</a>) would like to double-ch=
eck.</div><div><div><br></div><div><br></div><div><br></div><div><br></div>=
<div><br></div></div></div>

--001a114670904fed79054f0af6e8--