Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C2460EBA for ; Thu, 28 Jun 2018 20:51:47 +0000 (UTC) X-Greylist: delayed 00:09:33 by SQLgrey-1.7.6 Received: from smtp89.iad3a.emailsrvr.com (smtp89.iad3a.emailsrvr.com [173.203.187.89]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C9D56674 for ; Thu, 28 Jun 2018 20:51:46 +0000 (UTC) Received: from smtp28.relay.iad3a.emailsrvr.com (localhost [127.0.0.1]) by smtp28.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 220FA5290 for ; Thu, 28 Jun 2018 16:42:13 -0400 (EDT) Received: from smtp105.iad3b.emailsrvr.com (relay.iad3a.rsapps.net [172.27.255.110]) by smtp28.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTPS id 1AC355215 for ; Thu, 28 Jun 2018 16:42:13 -0400 (EDT) Received: from smtp14.relay.iad3b.emailsrvr.com (localhost [127.0.0.1]) by smtp14.relay.iad3b.emailsrvr.com (SMTP Server) with ESMTP id 1A3C6E008D; Thu, 28 Jun 2018 16:42:11 -0400 (EDT) X-Auth-ID: rodolfo@coinkite.com Received: by smtp14.relay.iad3b.emailsrvr.com (Authenticated sender: rodolfo-AT-coinkite.com) with ESMTPSA id BC590E0095; Thu, 28 Jun 2018 16:42:10 -0400 (EDT) X-Sender-Id: rodolfo@coinkite.com Received: from [10.10.0.11] (CPE44d9e70592e4-CM64777d5e0200.cpe.net.cable.rogers.com [99.248.13.208]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:465 (trex/5.7.12); Thu, 28 Jun 2018 16:42:11 -0400 From: Rodolfo Novak Message-Id: <9EE074B3-5A3D-489E-90F1-207BBD281BBE@coinkite.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_4ACC3DF0-E3FE-47C3-B859-F0B92AD67D34" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Thu, 28 Jun 2018 16:42:09 -0400 In-Reply-To: <0BT4A0BFbcfUM9xlYjS-7Cy1zpaI1J9qsIpWH_xgv2ZLhcmxb4Es5KlpMJCvHVEu8BDbBweZ92RHnES5HxDMulRhJkYSZAPi-CgXQ3uwkfY=@achow101.com> To: Achow101 , Bitcoin Protocol Discussion References: <20180621195654.GC99379@coinkite.com> <87k1qk7oca.fsf@jb55.com> <0BT4A0BFbcfUM9xlYjS-7Cy1zpaI1J9qsIpWH_xgv2ZLhcmxb4Es5KlpMJCvHVEu8BDbBweZ92RHnES5HxDMulRhJkYSZAPi-CgXQ3uwkfY=@achow101.com> X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Thu, 28 Jun 2018 21:08:33 +0000 Subject: Re: [bitcoin-dev] BIP 174 thoughts X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 20:51:47 -0000 --Apple-Mail=_4ACC3DF0-E3FE-47C3-B859-F0B92AD67D34 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello Folks, Thanks for expediting this debate, I understand some still disagree = about how this final spec should look like. 1. Coldcard's plugin for Electrum using the original BIP spec is ready, = https://github.com/spesmilo/electrum/pull/4470 = 2. Our hardware is ready with this spec (src will be public soon) 3. Samourai Wallet and Sentinel also are ready with the current spec. We intend to upgrade it once the final spec is ready, but I need to ship = Coldcard. Cheers, =E2=84=9D. Rodolfo Novak || Founder, Coinkite || twitter @nvk || GPG: = B444CDDA > On Jun 27, 2018, at 13:55, Achow101 via bitcoin-dev = wrote: >=20 > Hi,=E2=80=8B >=20 > On June 26, 2018 11:09 PM, William Casarin wrote: >=20 >> =E2=80=8B=E2=80=8B >>=20 >> Hey Andrew, >>=20 >> If I'm reading the spec right: the way it is designed right now, you >>=20 >> could create hundreds of thousands of zero bytes in the input or = output >>=20 >> key-value arrays. As far as I can tell this would be considered = valid, >>=20 >> as it is simply a large array of empty dictionaries. Is this right? = I'm >>=20 >> worried about buffer overflows in cases where someone sends a large = blob >>=20 >> of zeros to an unsuspecting implementation. >=20 > No, that is incorrect. That whole paragraph is actually outdated, it = was intended > for the possibility of adding output maps, which we have already done. = I have=20 > removed it from the BIP. >=20 > However, it is possible for a PSBT to contain very large unknown = key-value pairs=20 > which could potentially cause a problem. But I do not think that large = PSBTs should=20 > really be a problem as they are really something that the user has to = enter rather=20 > than something received remotely without user interaction. >=20 >=20 >=20 > On June 27, 2018 6:39 AM, Andrea via bitcoin-dev = wrote: >=20 >> =E2=80=8B=E2=80=8B >>=20 >> Hi William, Andrew, list, >>=20 >> As noted by William there are some types missing in the global-types = definition, because the number of each map for I/O must be known to the = parser in order to use the correct definitions for the types. At the = moment a parser reading a key-value record does not know whether it = should read it as per-input type or per-output, a way to address this is = to declare in advance the number of maps and ensure they are ordered = (inputs first). If you haven't already worked out some types for that i = propose using: >>=20 >=20 > Parsers actually do know because that information is present in the = unsigned transaction=20 > at the beginning of each PSBT. Since each input and output must be = accounted for, > a parser can just parse the unsigned transaction and from there it can = know how > many inputs and outputs to expect. If it sees more or less, it should = throw an error > as the transaction is invalid. >=20 > Of course this implies that implementations will need to parse the = unsigned transaction, > but not all actually need to. Combiners do not need to, they just need = to merge the > maps together and follow the key uniqueness rule. They don't really = need to know > or care about the number of inputs and outputs, just that the PSBTs = being merged > share the same unsigned transaction and have the same number of maps. >=20 > Other roles need to understand the unsigned transaction anyways, so = they still need > to parse it thus this isn't really a problem for those roles. >=20 >>=20 >> On another note I think we can set a hard limit on the size of the = PSBT, currently is 'legal' to produce a very large PSBT with an = excessive number of Inputs and Outputs. By excessive I mean that even in = the best case scenario (using the smallest possible scriptPubKey as in = P2WPKH) it is possible to create a PSBT that would certainly create an = invalid transaction (because of its size) when finalized. I haven't = found anything related to this in the previous discussions, please = ignore this if it was already proposed/discussed. >>=20 >=20 > I don't think such a limitation is practical or useful. A transaction = can currently have, at most, > ~24000 inputs and ~111000 outputs (+/- a few hundred) which is well = beyond any useful limit. > Additionally, such limits may not be as extensible for future work. It = is hard to determine what > is a reasonable limit on transaction size, and I don't think it is = useful to have a limit. At worst > we would simply create an invalid transaction if it were too large. >=20 >=20 > Andrew >=20 >=20 > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev --Apple-Mail=_4ACC3DF0-E3FE-47C3-B859-F0B92AD67D34 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Hello Folks,

Thanks for expediting this debate, I = understand some still disagree about how this final spec should look = like.

1. = Coldcard's plugin for Electrum using the original BIP spec is = ready, https://github.com/spesmilo/electrum/pull/4470
2. Our hardware is ready with this spec (src will be public = soon)
3. Samourai Wallet and Sentinel also are = ready with the current spec.

We intend to upgrade it once the final = spec is ready, but I need to ship Coldcard.

Cheers,

=E2=84=9D.

Rodolfo Novak  ||  Founder, Coinkite =  ||  twitter @nvk  ||  GPG: B444CDDA

On Jun 27, 2018, at 13:55, Achow101 via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:

Hi,=E2=80=8B

On June 26, 2018 = 11:09 PM, William Casarin <jb55@jb55.com> wrote:

=E2=80=8B=E2=80=8B

Hey Andrew,

If = I'm reading the spec right: the way it is designed right now, you

could create hundreds of thousands of zero = bytes in the input or output

key-value = arrays. As far as I can tell this would be considered valid,

as it is simply a large array of empty = dictionaries. Is this right? I'm

worried = about buffer overflows in cases where someone sends a large blob

of zeros to an unsuspecting implementation.

No, that is incorrect. That whole = paragraph is actually outdated, it was intended
for the = possibility of adding output maps, which we have already done. I have =
removed it from the BIP.

However, it is possible for a PSBT to contain very large = unknown key-value pairs
which could potentially cause a = problem. But I do not think that large PSBTs should
really = be a problem as they are really something that the user has to enter = rather
than something received remotely without user = interaction.



On= June 27, 2018 6:39 AM, Andrea via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:

=E2=80=8B=E2= =80=8B

Hi William, Andrew, list,

As noted by William there are some types = missing in the global-types definition, because the number of each map = for I/O must be known to the parser in order to use the correct = definitions for the types. At the moment a parser reading a key-value = record does not know whether it should read it as per-input type or = per-output, a way to address this is to declare in advance the number of = maps and ensure they are ordered (inputs first). If you haven't already = worked out some types for that i propose using:


Parsers actually do know because = that information is present in the unsigned transaction
at = the beginning of each PSBT. Since each input and output must be = accounted for,
a parser can just parse the unsigned = transaction and from there it can know how
many inputs and = outputs to expect. If it sees more or less, it should throw an error
as the transaction is invalid.

Of = course this implies that implementations will need to parse the unsigned = transaction,
but not all actually need to. Combiners do = not need to, they just need to merge the
maps together and = follow the key uniqueness rule. They don't really need to know
or care about the number of inputs and outputs, just that the = PSBTs being merged
share the same unsigned transaction and = have the same number of maps.

Other roles = need to understand the unsigned transaction anyways, so they still = need
to parse it thus this isn't really a problem for = those roles.


   On another note I think we = can set a hard limit on the size of the PSBT, currently is 'legal' to = produce a very large PSBT with an excessive number of Inputs and = Outputs. By excessive I mean that even in the best case scenario (using = the smallest possible scriptPubKey as in P2WPKH) it is possible to = create a PSBT that would certainly create an invalid transaction = (because of its size) when finalized. I haven't found anything related = to this in the previous discussions, please ignore this if it was = already proposed/discussed.


I don't think such a limitation is practical or useful. A = transaction can currently have, at most,
~24000 inputs and = ~111000 outputs (+/- a few hundred) which is well beyond any useful = limit.
Additionally, such limits may not be as extensible = for future work. It is hard to determine what
is a = reasonable limit on transaction size, and I don't think it is useful to = have a limit. At worst
we would simply create an invalid = transaction if it were too large.


Andrew


_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev<= br class=3D"">

= --Apple-Mail=_4ACC3DF0-E3FE-47C3-B859-F0B92AD67D34--