summaryrefslogtreecommitdiff
path: root/64/ecc1da813410d3acb340ea12817720ec2ab9ac
blob: 4b964de9c5e5d0c6b9f3615c71fcf011c72e0dfc (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
Return-Path: <tomz@freedommail.ch>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id B7AA6B5D
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 20 Jan 2017 14:00:56 +0000 (UTC)
X-Greylist: from auto-whitelisted by SQLgrey-1.7.6
Received: from mx-out01.mykolab.com (mx.kolabnow.com [95.128.36.1])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 947A1137
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 20 Jan 2017 14:00:55 +0000 (UTC)
X-Virus-Scanned: amavisd-new at kolabnow.com
X-Spam-Score: -2.9
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW
	autolearn=ham version=3.3.1
Received: from mx03.mykolab.com (mx03.mykolab.com [10.20.7.101])
	by mx-out01.mykolab.com (Postfix) with ESMTPS id E53E2623F9
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Fri, 20 Jan 2017 15:00:51 +0100 (CET)
From: Tom Zander <tomz@freedommail.ch>
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Date: Fri, 20 Jan 2017 15:02:22 +0100
Message-ID: <3264264.qpyyi8nbyQ@strawberry>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
X-Mailman-Approved-At: Thu, 26 Jan 2017 09:32:44 +0000
Subject: [bitcoin-dev] Changing the transaction version number to be varint
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: Fri, 20 Jan 2017 14:00:56 -0000

Hi all,

In the transaction today we have a version field which is always 4 bytes.
The rest of the integer encoding in a transaction is variable-size because 
it saves on bytes.

Specifically, in practice this means that almost all of the transaction have 
bytes 2, 3 & 4 set to zero[1].

The question that I was pondering is that when we accept a new version of 
transaction format (flextrans uses 4), what would the impact be of also 
changing the way that the version number is actually serialized to be var 
int.

The benefit would be that each and every transaction looses 3 bytes. These 
can be used differently in v1 transactions and are not needed at all to be 
there for newer transaction formats.
The secondairy benefit is that, at least for FlexTrans[2], 100% of all the 
integers in the transaction are following exactly the same encoding, the
var-int encoding.

There is currently no consensus rule that rejects transactions which lie 
about their version, so obviously this rule should not and can not be 
introduced retro-actively. It will be from a certain block-height.

The way to do this is that from a certain block-height the current 
transaction format labels bytes 2, 3 & 4 to be unused.
From that same block height the interpretation of the first byte is as 
varint.
Last, we add the rule from that block-height that only transactions that do 
not lie about their version number are valid. Which means version 1.

Do people see any problems with this?
This could be done as a soft fork.

1) It should be 100% because there is no transaction version defined that 
sets them to non-zero, but there is no consensus rule that rejects 
transactions that lie about their version number.
2) https://bitcoinclassic.com/devel/Flexible%20Transactions.html

-- 
Tom Zander
Blog: https://zander.github.io
Vlog: https://vimeo.com/channels/tomscryptochannel