public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [bitcoin-dev] Flexible Transactions.
@ 2016-11-21 15:54 Russell O'Connor
  2016-11-21 20:28 ` Tom Zander
  0 siblings, 1 reply; 3+ messages in thread
From: Russell O'Connor @ 2016-11-21 15:54 UTC (permalink / raw)
  To: Tom, Bitcoin Protocol Discussion

[-- Attachment #1: Type: text/plain, Size: 3120 bytes --]

Hi Tom,

On Tue, Sep 20, 2016 at 1:15 PM, Tom via bitcoin-dev <bitcoin-dev@lists.
linuxfoundation.org> wrote:

>
> The OP_CHECKSIG is the most well known and, as its name implies, it
> validates a signature.
> In the new version of 'script' (version 2) the data that is signed is
> changed to be equivalent to the transaction-id. This is a massive
> simplification and also the only change between version 1 and version 2 of
> script.
>

I'm a fan of simplicity too; Unfortunately, your proposal above to change
the semantics of OP_CHECKSIG is too naive.

The SIGHASH data used in both the original Bitcoin script and in Segwit
script contains data indicating which input is being signed.  In Bitcoin
script, the input is being signed is indicated by the input that has a
non-empty scriptSig field.  In the Segwit script, the outpoint
corresponding to the input being signed is explicitly included in the
signature data. By signing only the transaction id, your proposed signature
does not include the data that tells which input of the transaction is
being signed.  Thus if different inputs share the same public key due to
key reuse, then the signatures on those different inputs will be
identical.  Your Flexible Transactions proposal opens up a new line of
attack against Bitcoin that doesn't currently exist.

Consider the following simple example, suppose you and I are jointly
preparing a transaction to mix our coins, or perhaps we are jointly funding
some purchase.  We jointly prepare a transaction with one input from you
and another input from me.  We each sign the transaction and hand the
signature data over to each other so we can produce a completed
transaction.  But oh no! I lied to you. I didn't use my own input to the
transaction.  "My input" was actually the outpoint from one of *your*
transactions; one that has the same public key as the input you have
chosen.  Now I copy your signature you have provided in your input to cover
"my input", which is really your coins.  Surprise, it turns out you are
funding both inputs to our "jointly" funded purchase.  Other protocols are
likely similarly broken by your Flexible Transactions proposal.

I personally rate this flaw as about the same caliber as the transaction
malleability you are trying to fix.  Sure, with enough vigilance, perhaps
you can detect and avoid this trap.  However, it requires a bunch of
unexpected work.  You must always examine every other input to a
transaction you are about to sign to make sure that it isn't one of your
inputs, which means you probably need a copy of the UXTO set to lookup
outpoints, which is a huge burden, especially if you are a hardware
wallet.  If you are not vigilante, your funds may end up stolen. Surely it
is better not to open this line of attack.

For the most part, the SIGHASH works the way it does in Bitcoin for a
reason. You cannot simply throw away the parts you don't understand or
appreciate.  You should take the time to learn why things are the way they
are, and then, only once you are certain that some aspects are not, or no
longer, needed then can you propose removing them.

[-- Attachment #2: Type: text/html, Size: 3613 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bitcoin-dev] Flexible Transactions.
  2016-11-21 15:54 [bitcoin-dev] Flexible Transactions Russell O'Connor
@ 2016-11-21 20:28 ` Tom Zander
  2016-11-21 21:29   ` Russell O'Connor
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Zander @ 2016-11-21 20:28 UTC (permalink / raw)
  To: Bitcoin Protocol Discussion

On Monday, 21 November 2016 10:54:19 CET Russell O'Connor wrote:
> Hi Tom,
> 
> On Tue, Sep 20, 2016 at 1:15 PM, Tom via bitcoin-dev <bitcoin-dev@lists.
> 
> linuxfoundation.org> wrote:
> > The OP_CHECKSIG is the most well known and, as its name implies, it
> > validates a signature.
> > In the new version of 'script' (version 2) the data that is signed is
> > changed to be equivalent to the transaction-id. This is a massive
> > simplification and also the only change between version 1 and version 2
> > of script.
> 
> I'm a fan of simplicity too; Unfortunately, your proposal above to change
> the semantics of OP_CHECKSIG is too naive.

Thanks for your email, Russell.

Unfortunately you waited 6 weeks with writing this and the problem you are 
seeing has been fixed quite some time ago.

Thanks again for reviewing, though!
-- 
Tom Zander
Blog: https://zander.github.io
Vlog: https://vimeo.com/channels/tomscryptochannel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bitcoin-dev] Flexible Transactions.
  2016-11-21 20:28 ` Tom Zander
@ 2016-11-21 21:29   ` Russell O'Connor
  0 siblings, 0 replies; 3+ messages in thread
From: Russell O'Connor @ 2016-11-21 21:29 UTC (permalink / raw)
  To: Tom Zander, Bitcoin Protocol Discussion

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

On Mon, Nov 21, 2016 at 3:28 PM, Tom Zander via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

> Thanks for your email, Russell.
>
> Unfortunately you waited 6 weeks with writing this and the problem you are
> seeing has been fixed quite some time ago.
>

Oh, that is good news!  I look forward to seeing BIP 134 updated with your
solution.


> Thanks again for reviewing, though!

[-- Attachment #2: Type: text/html, Size: 980 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-21 21:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 15:54 [bitcoin-dev] Flexible Transactions Russell O'Connor
2016-11-21 20:28 ` Tom Zander
2016-11-21 21:29   ` Russell O'Connor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox