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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
Return-Path: <achow101-lists@achow101.com>
Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])
by lists.linuxfoundation.org (Postfix) with ESMTP id A7068C013B
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 9 Dec 2020 22:33:04 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by whitealder.osuosl.org (Postfix) with ESMTP id 95CB48756C
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 9 Dec 2020 22:33:04 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from whitealder.osuosl.org ([127.0.0.1])
by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id UQr7-qmTed8J
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 9 Dec 2020 22:33:02 +0000 (UTC)
X-Greylist: delayed 00:07:09 by SQLgrey-1.7.6
Received: from mail-41103.protonmail.ch (mail-41103.protonmail.ch
[185.70.41.103])
by whitealder.osuosl.org (Postfix) with ESMTPS id 60ADA8737C
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 9 Dec 2020 22:33:02 +0000 (UTC)
Received: from mail-02.mail-europe.com (mail-02.mail-europe.com
[51.89.119.103])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits))
(No client certificate requested)
by mail-41103.protonmail.ch (Postfix) with ESMTPS id 1A3632002C6E
for <bitcoin-dev@lists.linuxfoundation.org>;
Wed, 9 Dec 2020 22:25:50 +0000 (UTC)
Authentication-Results: mail-41103.protonmail.ch;
dkim=pass (2048-bit key) header.d=achow101.com header.i=@achow101.com
header.b="b/u7ML0V"
Date: Wed, 09 Dec 2020 22:25:37 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=achow101.com;
s=protonmail2; t=1607552740;
bh=ds8SPtlXjOwf2uVYhcu0ZDm4N6hVwprzAuFnn4TcyJw=;
h=Date:To:From:Reply-To:Subject:From;
b=b/u7ML0VWIgM3noMpvteBlBDFNdyvgCqZeRSI6IE0PnryPBwZh3jTL46drZ2OM+Ks
3WWwn3w9NwJi8obQPfg4m92ft5q/HVk15eYXJuayKDUoKoChs14xRPwmMKij1wxmPF
4JW43DuSQrhppvHsVlyhRkAv+UR5+IrqczNOAkHOmRdKWfjF4OQy5fSFcmfzQXVz5y
JRcdL/yo2hJYhZGK43G2avhzMrLsVk57TGHTaI2RPR0SLPG0XbNYhBAcJtb+yyQJzI
91xBEAIiWVttBHYbXhzPmEqdtxTQvytyVF+5yz7XYOAbvwVrauuWbhfaa3QKrlOaq8
pAqMINOKRcNGA==
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
From: Andrew Chow <achow101-lists@achow101.com>
Reply-To: Andrew Chow <achow101-lists@achow101.com>
Message-ID: <1dd8c285-e3f4-4f03-d608-103a5026146d@achow101.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: [bitcoin-dev] New PSBT version proposal
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
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: Wed, 09 Dec 2020 22:33:04 -0000
Hi All,
I would like to propose a new PSBT version that addresses a few=20
deficiencies in the current PSBT v0. As this will be backwards=20
incompatible, a new PSBT version will be used, v1.
The primary change is to truly have all input and output data for each=20
in their respective maps. Instead of having to parse an unsigned=20
transaction and lookup some data from there, and other data from the=20
correct map, all of the data for an input will be contained in its map.=20
Doing so also disallows PSBT_GLOBAL_UNSIGNED_TX in this new version.=20
Thus I propose that the following fields be added:
Global:
* PSBT_GLOBAL_TX_VERSION =3D 0x02
=C2=A0 * Key: empty
=C2=A0 * Value: 32-bit little endian unsigned integer for the transaction=
=20
version number. Must be provided in PSBT v1 and omitted in v0.
* PSBT_GLOBAL_PREFERRED_LOCKTIME =3D 0x03
=C2=A0 * Key: empty
=C2=A0 * Value: 32 bit little endian unsigned integer for the preferred=20
transaction lock time. Must be omitted in PSBT v0. May be provided in=20
PSBT v1, assumed to be 0 if not provided.
* PSBT_GLOBAL_INPUT_COUNT =3D 0x04
=C2=A0 * Key: empty
=C2=A0 * Value: Compact size unsigned integer. Number of inputs in this=20
PSBT. Must be provided in PSBT v1 and omitted in v0.
* PSBT_GLOBAL_OUTPUT_COUNT =3D 0x05
=C2=A0 * Key: empty
=C2=A0 * Value: Compact size unsigned integer. Number of outputs in this=
=20
PSBT. Must be provided in PSBT v1 and omitted in v0.
Input:
* PSBT_IN_PREVIOUS_TXID =3D 0x0e
=C2=A0 * Key: empty
=C2=A0 * Value: 32 byte txid of the previous transaction whose output at=
=20
PSBT_IN_OUTPUT_INDEX is being spent. Must be provided in PSBT v1 and=20
omitted in v0.
* PSBT_IN_OUTPUT_INDEX =3D 0x0f
=C2=A0 * Key: empty
=C2=A0 * Value: 32 bit little endian integer for the index of the output=
=20
being spent. Must be provided in PSBT v1 and omitted in v0.
* PSBT_IN_SEQUENCE =3D 0x0f
=C2=A0 * Key: empty
=C2=A0 * Value: 32 bit unsigned little endian integer for the sequence=20
number. Must be omitted in PSBT v0. May be provided in PSBT v1 assumed=20
to be max sequence (0xffffffff) if not provided.
* PSBT_IN_REQUIRED_LOCKTIME =3D 0x10
=C2=A0 * Key: empty
=C2=A0 * Value: 32 bit unsigned little endian integer for the lock time th=
at=20
this input requires. Must be omitted in PSBT v0. May be provided in PSBT=20
v1, assumed to be 0 if not provided.
Output:
* PSBT_OUT_VALUE =3D 0x03
=C2=A0 * Key: empty
=C2=A0 * Value: 64-bit unsigned little endian integer for the output's=20
amount in satoshis. Must be provided in PSBT v1 and omitted in v0.
* PSBT_OUT_OUTPUT_SCRIPT =3D 0x04
=C2=A0 * Key: empty
=C2=A0 * Value: The script for this output. Otherwise known as the=20
scriptPubKey. Must be provided in PSBT v1 and omitted in v0.
This change allows for PSBT to be used in the construction of=20
transactions. With these new fields, inputs and outputs can be added as=20
needed. One caveat is that there is no longer a unique transaction=20
identifier so more care must be taken when combining PSBTs.=20
Additionally, adding new inputs and outputs must be done such that=20
signatures are not invalidated. This may be harder to specify.
An important thing to note in this proposal are the fields=20
PSBT_GLOBAL_PREFERRED_LOCKTIME and PSBT_IN_REQUIRED_LOCKTIME. A Bitcoin=20
transaction only has a single locktime yet a PSBT may have multiple=20
locktimes. To choose the locktime for the transaction, finalizers must=20
choose the maximum of all of the *_LOCKTIME fields.=20
PSBT_IN_REQUIRED_LOCKTIME is added because some inputs, such as those=20
involving OP_CHECKLOCKTIMEVERIFY, require a specific minimum locktime to=20
be set. This field allows finalizers to choose a locktime that is high=20
enough for all inputs without needing to understand the scripts=20
involved. The PSBT_GLOBAL_PREFERRED_LOCKTIME is the locktime to use if=20
no inputs require a particular locktime.
As these changes disallow the PSBT_GLOBAL_UNSIGNED_TX field, PSBT v1=20
needs the version number bump to enforce backwards incompatibility.=20
However once the inputs and outputs of a PSBT are decided, a PSBT could=20
be "downgraded" back to v0 by creating the unsigned transaction from the=20
above fields, and then dropping these new fields.
If the list finds that these changes are reasonable, I will write a PR=20
to modify BIP 174 to incorporate them.
Thanks,
Andrew Chow
|