From: Anthony Towns <aj@erisian•com.au>
To: Bitcoin Protocol Discussion <bitcoin-dev@lists•linuxfoundation.org>
Subject: [bitcoin-dev] Generalised taproot
Date: Fri, 13 Jul 2018 11:51:57 +1000 [thread overview]
Message-ID: <20180713015157.k637vndspx4hgpfu@erisian.com.au> (raw)
In-Reply-To: <CAAS2fgSApdSYUWZx+_G7tMPPQm5bC4xjYzZ_mQZv=w-FD-4jWw@mail.gmail.com>
On Fri, Jan 26, 2018 at 09:34:39PM +0000, Gregory Maxwell via bitcoin-dev wrote:
> I ask because recursive taproot by itself isn't very interesting,
> since (other than accountability) there is no gain to not just merging
> the alternative, but if there are additional conditions then it can be
> useful. E.g.
>
> [pubkey]
> \-[pubkey]&&CSV
> \-[fancy script]
I think it's possible to do recursive taproot in this manner in a
neat way, using Pedersen Commitments.
(Background: A Pedersen commitment uses a second generator in the curve,
and rather than constructing a point from a single secret, like A=a*G,
it constructs a point from two secrets, like C=a*G+b*G2, and finding a
different c,d such that C=c*G+d*G2 gives you the discrete log of G2)
So combining this with the taproot structure gives an equation like:
P = a*G + s*G2 + H(a*G+s*G2, Q)*G
If you take "a" to be a private key (so A=a*G is the corresponding
pubkey), "s" to be (the hash of) a set of additional conditions for
spending with the pubkey, and "Q" to be an alternative method of spending,
you get a recursive taproot construction.
To spend "P", you would either:
- sign with P directly (only possible if s=0, indicating there are no
additional conditions to satisfy when spending with this key)
- reveal the extra conditions you have to satisfy (s), satisfy
them, and provide a signature the key "P-s*G2"
- reveal the points "a*G+s*G2" and "Q", and satisfy "Q"
If you structure the conditions as:
(pubkey A) |
(pubkey B & script x) |
(pubkey C & script y) |
(merkle tree of scripts, root=z)
Then you can construct a pubkey point as:
D' = z
C' = C + y*G2 + H(C+y*G2, D')*G
B' = B + x*G2 + H(B+x*G2, C')*G
A' = A + H(A, B')*G
and if you want to spend something with a scriptPubKey of A', you could
use:
(1) plain signature with privkey = a+H(A,B')
(2) reveal [A, B'], reveal [x], provide [witness(x)],
signature with privkey = b+H(B+x*G2,C')
(3) reveal [A, B'], reveal [B+x*G2, C'], reveal [y], provide
[witness(y)], signature with privkey = c+H(C+y*G2, D')
(4) reveal [A, B'], reveal [B+x*G2, C'], reveal [C+y*G2],
reveal [script], reveal merkle path from script to z,
provide [witness(script)].
That way, you can keep two sets of things secret:
- until you hit the merkle-tree of scripts, you don't reveal
whether there are or aren't any lower layers
- you don't reveal the conditions corresponding with any of the
keys, other than the key you're spending with
This is as (space) efficient as basic taproot:
taproot: P + H(P, [Q CHECKSIGVERIFY cond])
witness:
(1) sig(P)
(2) P [Q CHECKSIGVERIFY cond] sig(Q) witness(cond)
becomes:
g'root: P + H(P, Q + cond*G2)*G
witness:
(1) sig(P+H(..)*G)
(2) P Q sig(Q) cond witness(cond)
[0]
It's potentially more efficient for cases where the taproot assumption
doesn't hold, and the common case is to spend with conditions:
g'root: P + cond*G2 + H(P+cond*G2, Q)*G
witness:
(1) cond witness(cond) sig(P+H(..)*G)
(2) [P+cond*G2] Q sig(Q)
taproot: Q + H(Q, [P checksig cond])*G
(1) Q [P CHECKSIG cond] [sig(P) witness(cond)] (64 bytes overhead)
(2) sig(Q+H(..)*G) (64 bytes saved)
It's also potentially more efficient than using a merkle tree with taproot
when there are three spending paths, and one merkle branch is more likely
than the other, eg, if the conditions are "sign with A", or "sign with
B and satisfy x", or (least likely) "sign with C and satisfy y":
Let s = [B CHECKSIGVERIFY x], t = [C CHECKSIGVERIFY y], r = H(H(s),H(t))
taproot+MAST: A + H(A,r)*G
(1t) sig(A+H(..)*G)
(2t) A,s,H(t),sig(B),witness(x)
(3t) A,t,H(s),sig(C),witness(y)
g'root: A', where:
C' = C + y*G2
B' = B + x*G2 + H(B+x*G2,C')*G
A' = A + H(A,B')*G
(1g) sig(A+H(..)*G)
(2g) A B' x sig(B'-x*G2) witness(x)
(3g) A B' [B+x*G2] C' y sig(C) witness(y)
(1t) and (1g) are the same; (2t) is about 32B larger than (2g) because
s=[B x], and (3t) is about 32B smaller than (3g) because the g'root
descent reveals two additional points.
(As far as deployment goes, I think it makes sense to get an initial
schnorr/taproot/mast deployment out first, and add graftroot/aggregation
later. My feeling is there's no great urgency for generalised taproot, so
it would make sense to keep doing schnorr/taproot/mast for now, take time
analysing generalised taproot, and if it seems sane and useful, aim to
enable it in a later phase, eg at the same time as graftroot/aggregation)
Cheers,
aj
[0] My inital name for these was "MAST-ended sc'roots", since it
combines "taproot" and "scripts" and something MAST-like but only
at the very end, but I was warned that the Mimblewimble folks have
vast teams monitoring for Harry Potter references and will DMCA me,
which I assume stands for "Dementors, Ministry, Cruciatus and Avada
kedavra"... So I'm abbreviating generalised taproot as "g'root"
instead. After all, what's the worst the Marvel guys could do?
next prev parent reply other threads:[~2018-07-13 1:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 0:30 [bitcoin-dev] Taproot: Privacy preserving switchable scripting Gregory Maxwell
2018-01-23 1:55 ` Chris Belcher
2018-01-23 2:51 ` Matt Corallo
2018-01-23 14:39 ` Mark Friedenbach
2018-01-23 21:23 ` Matt Corallo
2018-01-23 21:38 ` Gregory Maxwell
2018-01-23 6:44 ` Anthony Towns
2018-01-23 13:15 ` Gregory Maxwell
2018-01-23 22:22 ` Anthony Towns
2018-01-23 22:45 ` Gregory Maxwell
2018-01-24 1:52 ` Andrew Poelstra
2018-01-24 9:28 ` Tim Ruffing
2018-01-24 12:51 ` Natanael
2018-01-24 15:38 ` Tim Ruffing
2018-01-24 18:51 ` Natanael
2018-01-24 23:22 ` Tim Ruffing
2018-01-25 0:09 ` Natanael
2018-01-26 13:14 ` [bitcoin-dev] Recovery of old UTXOs in a post-quantum world Tim Ruffing
2018-01-27 17:07 ` [bitcoin-dev] Taproot: Privacy preserving switchable scripting Russell O'Connor
2018-01-27 17:23 ` Matt Corallo
2018-01-23 15:43 ` Greg Sanders
2018-01-26 21:34 ` Gregory Maxwell
2018-07-13 1:51 ` Anthony Towns [this message]
2018-10-24 2:22 ` [bitcoin-dev] Generalised taproot Pieter Wuille
2018-02-05 9:27 ` [bitcoin-dev] Taproot: Privacy preserving switchable scripting ZmnSCPxj
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=20180713015157.k637vndspx4hgpfu@erisian.com.au \
--to=aj@erisian$(echo .)com.au \
--cc=bitcoin-dev@lists$(echo .)linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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