public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Nikita Schmidt <nikita@megiontechnologies.com>
To: Matt Whitlock <bip@mattwhitlock.name>
Cc: bitcoin-development <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] Presenting a BIP for Shamir's Secret Sharing of Bitcoin private keys
Date: Fri, 4 Apr 2014 17:51:07 +0400	[thread overview]
Message-ID: <CAC7yFxQXn=c7CEC326yMx4bF7Cv7Gc62shS7xU0XvSp5sQSGZw@mail.gmail.com> (raw)
In-Reply-To: <3837746.jqWvB0Uxrs@crushinator>

On 4 April 2014 01:42, Matt Whitlock <bip@mattwhitlock.name> wrote:
> The fingerprint field, Hash16(K), is presently specified as a 16-bit field. Rationale: There is no need to consume 4 bytes just to allow shares to be grouped together. And if someone has more than 100 different secrets, they probably have a good system for managing their shares and won't need the hash anyway.

Right, of course.  Sorry, I didn't notice there was an update.  Two
bytes are plenty.

I'm worried however about the dependency on SHA-512, which may be
stretching it for a tiny embedded application.  The other uses of
HashL can be avoided.  We are balancing here between consistency with
the rest of this proposal, where everything is done via HashL, and
consistency with the general practice of generating fingerprints with
SHA-256, like in Base58Check.

Similarly, re-assembly software suddenly finds itself having to
implement Hash16 just to check this particular fingerprint.  So I'd
vote for a more traditional approach here, also considering that HashL
is designed specifically to generate numbers in a finite field.

>
>> Encoding for the testnet is not specified.
>
> Hmm, is that actually needed?

It's been a tradition to support it in general, however I guess it's
not really needed here.  I'm happy without a dedicated testnet
encoding.

>
>> Speaking of encoding, is it not wasteful to allocate three different
>> application/version bytes just for the sake of always starting with
>> 'SS'?  It would be OK if it were accepted as a BIP, but merely as a
>> de-facto standard it should aim at minimising future chances of
>> collision.
>
> I agree on principle, however I think the more user-acceptable behavior is for all base58-encoded Shamir shares to begin with a common prefix, such as "SS". Users are accustomed to relying on the prefix of the base58 encoding to understand what the object is: "1" for mainnet pubkey hash, "3" for mainnet script hash, "5" for uncompressed private key, "P" for passphrase-protected private key, etc.

Yes, "5" for uncompressed private key and "K" or "L" for compressed
private key.  One A/VB and three prefixes in base58.  Am I the only
one to see this as a counter-example?

However, thinking about this, I can find logic in wanting to stabilise
text prefixes at a cost of six A/V bytes (as per the latest spec).
There are only 58 first characters versus 256 AVBs, so we should
rather be saving the former.

>> What about using the same P256 prime as for the elliptic curve?  Just
>> for consistency's sake.
>
> The initial draft of this BIP used the cyclic order (n) of the generator point on the secp256k1 elliptic curve as the modulus. The change to the present scheme was actually done for consistency's sake, so all sizes of secret can use a consistently defined modulus.

Fair enough.  Although I would have chosen the field order (p) simply
because that's how all arithmetic already works in bitcoin.  One field
for everybody.  It's also very close to 2^256, although still smaller
than your maximum prime.  Now of course with different bit lengths we
have to pick one consistency over others.

>
>> Also, I'm somewhat inclined towards using the actual x instead of j in
>> the encoding.  I find it more direct and straightforward to encode the
>> pair (x, y).  And x=0 can denote a special case for future extensions.
>>  There is no technical reason behind this, it's just for (subjective)
>> clarity and consistency.
>
> There is a technical reason for encoding j rather than x[j]: it allows for the first 256 shares to be encoded, rather than only the first 255 shares.

Wow, big deal.  It's hard to imagine anyone needing exactly 256
shares, but who knows.  And with j = x (starting from 1) we'd get
user-friendly share numbering and simpler formulas in the spec and
possibly in the implementation, with no off-by-one stuff.  And M
instead of M-2...

>
> If you want a sentinel value reserved for future extensions, then you might take notice that 0xFFFF is an invalid key fingerprint, along with several other values, and also that 0xFF is an unusable value of M-2, as that would imply M=257, but the scheme can only encode up to 256 shares, so one would never have enough shares to meet the threshold. I considered having the two optional fields be mandatory and allowing 0xFFFF and 0xFF as "redacted" field values, but I like allowing the shares to be shorter if the optional fields are omitted. (Imagine engraving Shamir secret shares onto metal bars by hand with an engraving tool. Fewer characters is better!)

Exactly.  Thank you.  Without these fields, a secret share still fits
into a 29x29 QR code.  Add one more byte and it'll need a 33x33.
Imagine engraving that onto metal plates!  Or the hassle of going
above 32 bits per line in a tiny embedded system.



  reply	other threads:[~2014-04-04 13:51 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 12:41 [Bitcoin-development] Presenting a BIP for Shamir's Secret Sharing of Bitcoin private keys Nikita Schmidt
2014-04-03 21:42 ` Matt Whitlock
2014-04-04 13:51   ` Nikita Schmidt [this message]
2014-04-04 14:14     ` Gregory Maxwell
2014-04-04 16:05       ` Matt Whitlock
2014-04-04 16:25         ` Gregory Maxwell
2014-04-04 16:36           ` Matt Whitlock
2014-04-04 17:08             ` Gregory Maxwell
2014-04-04 17:16               ` Matt Whitlock
2014-04-04 17:51                 ` Gregory Maxwell
2014-04-04 18:53                   ` Matt Whitlock
2014-04-04 16:03     ` Matt Whitlock
2014-04-08  0:33       ` Nikita Schmidt
2014-04-08  0:38         ` Gregory Maxwell
2014-04-08  1:46           ` Matt Whitlock
2014-04-08  2:07             ` Gregory Maxwell
2014-04-08 11:52               ` Matt Whitlock
2014-04-10 22:31                 ` Nikita Schmidt
2014-04-22  8:06                   ` Jan Møller
2014-04-22  8:11                     ` Matt Whitlock
2014-04-22  8:27                       ` Jan Møller
2014-04-22  8:29                         ` Matt Whitlock
2014-04-22  8:39                           ` Jan Møller
2014-04-22  8:43                             ` Matt Whitlock
2014-04-22  8:51                               ` Jan Møller
2014-04-22  9:13                             ` Matt Whitlock
2014-04-22 11:50                               ` Justin A
2014-04-22  8:35                       ` Matt Whitlock
2014-04-22  8:39                         ` Tamas Blummer
2014-04-22  8:40                           ` Matt Whitlock
2014-04-22  8:43                             ` Tamas Blummer
2014-04-22  8:47                               ` Matt Whitlock
2014-04-22  8:50                                 ` Tamas Blummer
2014-04-22 15:32                           ` Mark Friedenbach
2014-04-22 15:49                             ` Tamas Blummer
2014-04-22 17:03                               ` Mark Friedenbach
2014-04-22 17:07                               ` Jan Møller
2014-04-22 18:29                                 ` Tamas Blummer
2014-04-22 18:46                                   ` Gregory Maxwell
2014-04-23  5:33                                     ` Tamas Blummer
2014-04-23  6:16                                       ` Gregory Maxwell
2014-05-05 19:36                                         ` Nikita Schmidt
2014-05-12 12:09                                           ` Jan Møller
2014-08-14 19:23                                             ` Nikita Schmidt
2014-04-22 13:37                       ` Nikita Schmidt
2014-04-22  8:15                     ` Gregory Maxwell
2014-04-22  8:49                       ` Jan Møller
     [not found] <CACsn0ckScTWG4YxNCscxvtdsmcUkxtR2Gi-rdBs2HCkirPz5rA@mail.gmail.com>
2014-03-29 15:44 ` Matt Whitlock
2014-03-29 16:59   ` Alan Reiner
2014-03-29 17:19     ` Matt Whitlock
2014-03-29 17:52       ` Alan Reiner
2014-03-29 18:00         ` Matt Whitlock
2014-03-29 18:08           ` Alan Reiner
2014-03-29 18:10             ` Matt Whitlock
     [not found]               ` <CAAt2M18j7bGDsKouVw+e4j+FMiJ4vK6-sx+nrkwHyiKLqiH7Jg@mail.gmail.com>
2014-03-29 19:34                 ` Natanael
2014-04-04  2:38               ` Jeff Garzik
2014-03-29 18:16         ` Tamas Blummer
2014-03-29 18:41           ` Alan Reiner
2014-03-29 17:28     ` Roy Badami
2014-03-29 17:42       ` Matt Whitlock
2014-03-29 17:51         ` Roy Badami
2014-03-29 17:28   ` devrandom
     [not found]   ` <1396113933.8809.91.camel@mimiz>
2014-03-29 17:38     ` Matt Whitlock
2014-03-29 17:46       ` Gregory Maxwell
2014-03-29 19:49         ` Tamas Blummer
2014-03-29 17:48       ` devrandom
2014-03-29 17:51         ` Matt Whitlock
2014-03-29 17:56           ` devrandom
  -- strict thread matches above, loose matches on Subject: below --
2014-03-29  8:05 Matt Whitlock
2014-03-29  8:34 ` Tamas Blummer
2014-03-29  8:44 ` Tamas Blummer
2014-03-29  8:51   ` Matt Whitlock
2014-03-29  8:54     ` Matt Whitlock
2014-03-29 16:54   ` Matt Whitlock
2014-03-29 17:37     ` Tamas Blummer
2014-03-29  9:08 ` Chris Beams
2014-03-29  9:31   ` Matt Whitlock
2014-03-29 11:16   ` Matt Whitlock
2014-03-29 11:54     ` Chris Beams
2014-03-29 13:27       ` Jeff Garzik
2014-03-29 13:36         ` Mike Hearn
2014-03-29 13:38           ` Tamas Blummer
2014-03-29 14:10           ` Matt Whitlock
2014-03-29 14:19             ` Jeff Garzik
2014-03-29 14:55               ` Matt Whitlock
2014-03-29 15:04                 ` Mike Hearn
2014-03-29 14:28             ` Watson Ladd
2014-03-29 14:36               ` Gregory Maxwell
2014-03-29 15:01                 ` Matt Whitlock
2014-03-29  9:21 ` Chris Beams

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='CAC7yFxQXn=c7CEC326yMx4bF7Cv7Gc62shS7xU0XvSp5sQSGZw@mail.gmail.com' \
    --to=nikita@megiontechnologies.com \
    --cc=bip@mattwhitlock.name \
    --cc=bitcoin-development@lists.sourceforge.net \
    /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