public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: "Russell O'Connor" <roconnor@blockstream.io>
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Subject: [bitcoin-dev] Quadratic Hashing in BIP 134
Date: Fri, 28 Apr 2017 16:53:05 -0400	[thread overview]
Message-ID: <CAMZUoK=FtNjvfO3uBHFy-fO_hqum+UtpJVQ7o5aq=6hYrpn_0A@mail.gmail.com> (raw)

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

I noticed that the the latest BIP 134
<https://github.com/bitcoin/bips/blob/959fecc15bdad070afa63455468b1dba54655fa6/bip-0134.mediawiki>
now supports SIGHASH_SINGLE and friends.  However, this support seems to
reintroduce some quadratic hashing behavior because it calls
<https://github.com/zander/bitcoinclassic/blob/9c688c6d3866890f16a36aaea453e8bdd43c1266/src/script/interpreter.cpp#L1186>SerializePartialTransactionv4
per non-SIGHASH_ALL input
<https://github.com/bitcoinclassic/bitcoinclassic/blob/9c688c6d3866890f16a36aaea453e8bdd43c1266/src/script/interpreter.cpp#L1186>.
In particular, if each input in a transaction has one SIGHASH_SINGLE
CHECKSIG operation then the total amount of hashing done for the
transaction will be quadratic in the number of inputs.  While amount of
hashing is not as severe as with the SIGHASH_ALL case, the amount of
hashing done is still non-linear.

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

                 reply	other threads:[~2017-04-28 20:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMZUoK=FtNjvfO3uBHFy-fO_hqum+UtpJVQ7o5aq=6hYrpn_0A@mail.gmail.com' \
    --to=roconnor@blockstream.io \
    --cc=bitcoin-dev@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox