Return-Path: Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 17DC8C002C; Sun, 10 Apr 2022 16:52:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 030D94059D; Sun, 10 Apr 2022 16:52:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -2.098 X-Spam-Level: X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JLN1EEjkR3xd; Sun, 10 Apr 2022 16:52:06 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by smtp2.osuosl.org (Postfix) with ESMTPS id C19864053E; Sun, 10 Apr 2022 16:52:05 +0000 (UTC) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-2eafabbc80aso142200387b3.11; Sun, 10 Apr 2022 09:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=l3D0pTmaOppSVUyH5YtF1BbhPgUeYp0yDfCR34KibYk=; b=b31660rzN7vpGend+iqc4tE4pmamAjKC/07MF+1VrZgDW9E6ysbvHzKKzvKrvlobiZ QcBAhtZNHd/QZP8RQly+4na7o87lVsc+5nJWviDmU2ASLqf1gArkx0RMCJVSzmWZJhnu dO9OQe++kJFPNNlsmLuL7pU7lXqOMyYUgFfmkXifwPK0mXu4AETryANwuLPBQ40s9dXG Wsudw9aleLzMjyiQwKoewbwXhnGRPBbelj3nOX8KJRyNL6K9rr+griqrEhxZMblwDJqr ZKeLAdYvOa4D2zZFrWyF+EOrWIc2FkYTriHnYhFGnpZGBs8oNmgM0kbC3o3rAHMrFjLu i1ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=l3D0pTmaOppSVUyH5YtF1BbhPgUeYp0yDfCR34KibYk=; b=Mq1Is7d/n198JtZ7m6iIJrCRyXNsI5yfKhEBjDaE8Cjtz9+QjmDrRHS9jKRih1g8Qo 24lBidu30cCT7w20LWu8mpiSrpmYd0IPcWGxoFhVe/LUT931XwEdZdI5QsZjzjigRtQC 0YpGHb/KfTqXM6PxDKUNMfSAIXtj+7QRRSY5mOFsy1L1oWvghQqbIzFDlUT2spJrGdXk QiHCDg5ON7GyJpHmPqT46jj7pNUVzAeX7u6MuMIllxOkvg37S9b64Tey8Q1gPMLAQBvP jbcwvf2Paj+pUglG9MPiiUK/gMhFcpdHi1jyAEXGVSiQNRYRaJtpoI9mv7xkTBYew9tj Zy9Q== X-Gm-Message-State: AOAM53074Ts7XBNjj1ecvYkYQ3ZsVUVHH4l2PwPnS3ySOWEwhrMEvvnv wRxufqRHeLZCyVjfxqy9tQqCv7KpogsJnny+zPI= X-Google-Smtp-Source: ABdhPJz9qcU2s9NpIYTw0rKuH1khZByD1aErmRNPwu9g3XRni7xxnYTP84Sanv7ErQer9KcDqI4VJtwJRqwTFu3F9tk= X-Received: by 2002:a81:58c1:0:b0:2eb:faf0:1e25 with SMTP id m184-20020a8158c1000000b002ebfaf01e25mr4822697ywb.311.1649609524236; Sun, 10 Apr 2022 09:52:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ruben Somsen Date: Sun, 10 Apr 2022 18:51:52 +0200 Message-ID: To: Olaoluwa Osuntokun , Bitcoin Protocol Discussion , lightning-dev Content-Type: multipart/alternative; boundary="000000000000b5d66805dc4fa5d6" X-Mailman-Approved-At: Sun, 10 Apr 2022 16:53:03 +0000 Subject: Re: [bitcoin-dev] Taro: A Taproot Asset Representation Overlay X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2022 16:52:08 -0000 --000000000000b5d66805dc4fa5d6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Laolu, >happy to hear that someone was actually able to extract enough details from the RGB devs/docs to be able to analyze it properly Actually, even though I eventually puzzled everything together, this did not go well for me either. There is a ton of documentation, but it's a maze of unhelpful details, and none of it clearly maps out the fundamental design. I was also disappointed by the poor response I received when asking questions, and I ended up getting chastised for helping others understand it and pointing out potential flaws[1][2][3].Given my experience, I think the project is not in great shape, so the decision to rebuild from scratch seems right to me. That said, in my opinion the above should not factor into the decision of whether RGB should be credited in the Taro documentation. The design clearly precedes (and seems to have inspired) Taro, so in my opinion this should be acknowledged. Also, the people that are responsible for the current shape of RGB aren't the people who originated the idea, so it would not be fair to the originators either (Peter Todd, Alekos Filini, Giacomo Zucco). >assets can be burnt if a user doesn't supply a valid witness I am in agreement with what you said, but it is not clear to me whether we are on the same page. What I tried to say was that it does not make sense to build scripting support into Taro, because you can't actually do anything interesting with it due to this limitation. The only type of smart contract you can build is one where you limit what the owner (as defined by Bitcoin's script) can do with their own Taro tokens, or else he will burn them =E2=80=93 not very useful. Anything involving a conditional transfer o= f ownership to either A or B (i.e. any meaningful type of script) won't work. Do you see what I mean, or should I elaborate further? >TAPLEAF_UPDATE_VERIFY can actually be used to further _bind_ Taro transiti= ons at the Bitcoin level, without Bitcoin explicitly needing to be aware That is conceptually quite interesting. So theoretically you could get Bitcoin covenants to enforce certain spending conditions on Taro assets. Not sure how practical that ends up being, but intriguing to consider. >asset issuer to do a "re-genesis" Yes, RGB suggested the same thing, and this can work under some circumstances, but note that this won't help for tokens that aim to have a publicly audited supply, as the proof that a token was legitimately re-issued is the history of the previous token (so you'd actually be making things worse, as now everyone has to verify it). And of course the idea also requires the issuer to be active, which may not always be the case. >I'm not familiar with how the RGB "teleport" technique works [...] Can you point me to a coherent explanation of the technique To my knowledge no good explanation exists. "Teleporting" is just what I thought was a good way of describing it. Basically, in your design when Alice wants to send a Taro token to Bob, Alice has to spend her own output, make a new output for Bob, and make a change output for herself. Inside the Taro tree you'll then point to the index of Bob's output in order to assign the tokens to his new output. Instead of pointing to the index, you could point to the outpoint (txid, index) of an existing UTXO owned by Bob, thus "teleporting" the Taro tokens to this UTXO. This saves on-chain space, as now you don't have to create a new output for Bob (but now you have to ensure Bob doesn't spend from this output while you're simultaneously sending tokens to it, as I mentioned in my previous post, as this would destroy the tokens). The above also reminds me of another potential issue which you need to be aware of, if you're not already. Similar to my comment about how the location of the Taro tree inside the taproot tree needs to be deterministic for the verifier, the output in which you place the Taro tree also needs to be. If it's not, then you can commit to a different Taro tree in each output of the transaction, allowing you to secretly fork the history. Hope this helps. Cheers, Ruben [1] https://twitter.com/SomsenRuben/status/1397267261619064836 [2] https://twitter.com/SomsenRuben/status/1397559406565462017 [3] https://twitter.com/afilini/status/1397484341236797441 On Fri, Apr 8, 2022 at 7:48 PM Olaoluwa Osuntokun wrote= : > (this might be a double post as it ran into the size limit) > > Hi Ruben, > > Thanks! I don't really consider things final until we have a good set of > test > vectors in the final set, after which we'd start to transition the set of > documents beyond the draft state. > > > Seeing as there's a large amount of overlap with RGB, a protocol which = I > have > > examined quite extensively, I believe some of the issues I uncovered in > that > > project also apply here. > > I'm happy to hear that someone was actually able to extract enough detail= s > from > the RGB devs/docs to be able to analyze it properly! In the past I tried > to ask > their developers questions about how things like transfers worked[1][2], > but it > seemed either people didn't know, or they hadn't finished the core design > (large TBD sections) as they were working on adding other components to > create > a "new new Internet". > > > Furthermore, the Taro script is not enforced by Bitcoin, meaning those > who > > control the Bitcoin script can always choose to ignore the Taro script > and > > destroy the Taro assets as a result. > > This is correct, as a result in most contexts, an incentive exists for th= e > holder of an asset to observe the Taro validation rules as otherwise, the= ir > assets are burnt in the process from the PoV of asset verifiers. In the > single > party case things are pretty straight forward, but more care needs to be > taken > in cases where one attempts to express partial application and permits > anyone > to spend a UTXO in question. > > By strongly binding all assets to Bitcoin UTXOs, we resolve issues relate= d > to > double spending or duplicate assets, but needs to mind the fact that > assets can > be burnt if a user doesn't supply a valid witness. There're likely ways t= o > get > around this by lessening the binding to Bitcoin UTXO's, but then the syst= em > would need to be able to collect, retain and order all the set of possibl= e > spends, essentially requiring a parallel network. The core of the system > as it > stands today is pretty simple (which was an explicit design goal to avoid > getting forever distracted by the large design space), with a minimal > implementation being relatively compact given all the Bitcoin > context/design > re-use. > > Also one cool trait of the way commitments are designed is that the Taro > commitment impact the final derived taproot output key. As a result, > potential > Script extensions like TAPLEAF_UPDATE_VERIFY can actually be used to > further > _bind_ Taro transitions at the Bitcoin level, without Bitcoin explicitly > needing to be aware of the Taro rules. In short, covenants can allow > Bitcoin > Script to bind Taro state transitions, without any of the logic bleeding > over, > as the covenant just checks for a certain output key, which is a function > of > the Taro commitment being present. > > > There are two possible designs here: a.) The token history remains > separate =E2=80=93 > > Dave receives Alice's 2 tokens, Bob's tokens are split and he receives = 2 > (or > > 3 from Bob 1 from Alice). b.) The token history gets merged =E2=80=93 = Dave > receives > > 4 tokens (linking the new output with both Alice and Bob's history). > > Mechanically, with respect to the way the change/UTXOs work in the system= , > both > are expressible: Dave can chose to merge them into a single UTXO (with th= e > appropriate witnesses included for each of them), or Dave can keep them > distinct in the asset tree. You're correct in that asset issuers may opt = to > issue assets in denominations vs allowing them to be fully divisible. > Ultimately, the compatibility with the LN layer will be the primary way t= o > keep > asset histories compressed, without relying on another trust model, or > relying > on the incentive of an asset issuer to do a "re-genesis" which would > effectively re-create assets in a supply-preserving manner (burn N units, > then > produce a new genesis outpoint for N units). Alternatively, > implementations can > also chose to utilize a checkpointing system similar to what some Bitcoin > full > node clients do today. > > > is that you end up with a linked transaction graph, just like in Bitco= in > > This is correct, the protocol doesn't claim to achieve better privacy > guarantees than the base chain. However inheriting this transaction graph > model > imo makes it easier for existing Bitcoin developers to interact with the > system, and all the data structures are very familiar tooling wise. > However any > privacy enhancing protocol used for on-chain top-level Bitcoin UTXOs can > also > be applied to Taro, so people can use things like coinswap and coinjoin, > along > with LN to shed prior coin lineages. > > > This implies the location of the Taro tree inside the taproot tree is n= ot > > fixed. What needs to be prevented here is that a taproot tree contains > more > > than one Taro tree, as that would enable the owner of the commitment to > show > > different histories to different people. > > Great observation, I patched a similar issue much earlier in the design > process > by strongly binding all signatures to a prevOut super-set (so the outpoin= t > along with the unique key apth down into the tree), which prevents > duplicating > the asset across outputs, as signature verification would fail. > > In terms of achieving this level of binding within the Taro tree itself, = I > can > think of three options: > > 1. Require the Taro commitment to be in the first/last position within > the > (fully sorted?) Tapscript tree, and also require its sibling to be the > hash > of some set string (all zeroes or w/e). We'd require the sibling to the > empty > as the tapscript hashes are sorted before hashing so you sort of lose > that > final ordering information. > > 2. Include the position of the Taro commitment within the tapscript tre= e > within the sighash digest (basically the way the single input in the > virtual > transaction is created from the TLV structure). > > 3. Include the position of the Taro commitment within the tapscript tre= e > as > part of the message that's hashed to derive asset IDs. > > AFAICT, #1 resolves the issue entirely, #2 renders transfers outside of t= he > canonical history invalid, and #2 minds hte asset ID to the initial > position > meaning you can track a canonical lineage from the very start. > > > Finally, let me conclude with two questions. Could you clarify the > purpose of > > the sparse merkle tree in your design? > > Sure, it does a few things: > > * Non-inclusion proofs so I can do things like prove to your I'm no > longer > committing to my 1-of-1 holographic beefzard card when we swap. > > * The key/tree structure means that the tree is history independent, > meaning > that if you and I insert the same things into the tree in a different > order, we'll get the same root hash. This is useful for things like > tracking all the issuance events for a given asset, or allowing two > entities to sync their knowledge/history of a single asset, or a set = of > assets. > > * Each asset/script mapping to a unique location within the tree means > it's > easy to ensure uniqueness of certain items/commitments (not possible = to > commit to the same asset ID twice in the tree as an example). > > * The merkle-sum trait means I that validation is made simpler, as you > just > check that the input+output commitment sum to the same value, and I c= an > also verify that if we're swapping, then you aren't committing to mor= e > units that exist (so I make sure I don't get an invalid split). > > > And the second question =E2=80=93 when transferring Taro token ownershi= p from one > > Bitcoin UTXO to another, do you generate a new UTXO for the recipient o= r > do > > you support the ability to "teleport" the tokens to an existing UTXO > like how > > RGB does it? If the latter, have you given consideration to timing issu= es > > that might occur when someone sends tokens to an existing UTXO that > > simultaneously happens to get spent by the owner? > > So for interactive transfers, the UTXOs generated as just the ones part o= f > the > MIMO transaction. When sending via the address format, a new non-dust > output is > created which holds the new commitment, and uses an internal key provided > by > the receiver, so only they can move the UTXO. Admittedly, I'm not familia= r > with > how the RGB "teleport" technique works, I checked out some slide decks a > while > back, but they were mostly about all the new components they were creatin= g > and > their milestone of 1 million lines of code. Can you point me to a coheren= t > explanation of the technique? I'd love to compare/contrast so we can > analyze > the diff tradeoffs being made here. > > Thanks for an initial round of feedback/analysis, I'll be updating the > draft > over the next few days to better spell things out and particularly that > commitment/sighash uniqueness trait. > > -- Laolu > > [1]: > https://twitter.com/roasbeef/status/1330654936074371073?s=3D20&t=3DfeV0kW= AjJ6MTQlFm06tSxA > [2]: > https://twitter.com/roasbeef/status/1330692571736117249?s=3D20&t=3DfeV0kW= AjJ6MTQlFm06tSxA > --000000000000b5d66805dc4fa5d6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Laolu,

>happy to hear that someone was actually able to extract enough de= tails from=C2=A0the RGB devs/docs= to be able to analyze it properly

Actually, even th= ough I eventually puzzled everything together, this did not go well for me = either. There is a ton of documentation, but it's a maze of unhelpful d= etails, and none of it clearly maps out the fundamental design. I was also = disappointed by the poor response I received when asking questions, and I e= nded up getting chastised for helping others understand it and pointing out= potential flaws[1][2][3].Given my experience, I think the project is not i= n great shape, so the=C2=A0decision to rebuild from scratch seems right to = me.

That said, in my opinion the above should not factor into t= he decision of whether RGB should be credited in the Taro documentation. Th= e design clearly precedes (and seems to have inspired) Taro, so in my opini= on this should be acknowledged. Also, the people that are responsible for t= he current shape of RGB aren't the people who originated the idea, so i= t would not be fair to the originators either=C2=A0(Peter Todd,=C2=A0Alekos Filini,=C2=A0Giacomo Zucco).

>assets can= =C2=A0be burnt if a user doesn= 9;t supply a valid witness

I am in agreement with what you said= , but it is not clear to me whether we are on the same page. What I tried t= o say was that it does not make sense to build scripting support into Taro,= because you can't actually do anything interesting with it due to this= limitation. The only type of smart contract you can build is one where you= limit what the owner (as defined by Bitcoin's script) can do with thei= r own Taro tokens, or else he will burn them =E2=80=93 not very useful. Any= thing involving a conditional transfer of ownership to either A or B (i.e. = any meaningful type of script) won't work. Do you see what I mean, or s= hould I elaborate further?

>TAPLEAF_UPDATE_VERIFY can actually be used to further=C2=A0_bind_=C2=A0Taro=C2=A0transiti= ons at the Bitcoin level, without Bitcoin explicitly=C2=A0needing to be aware

That is conceptually quite interesting. So theoretically you could ge= t Bitcoin covenants to enforce certain spending conditions on Taro assets. = Not sure how practical that ends up being, but intriguing to consider.

>a= sset issuer to do a "re-genesis"

Yes, RGB suggested the same thing, a= nd this can work under some circumstances, but note that this won't hel= p for tokens that aim to have a publicly audited supply, as the proof that = a token was legitimately re-issued is the history of the previous token (so= you'd actually be making things worse, as now everyone has to verify i= t). And of course the=C2=A0idea also requires the issuer to be active, whic= h may not always be the case.

>I'm not fami= liar with how the RGB "teleport" technique works [...] Can you po= int me to a coherent explanation of the technique

<= div>To my knowledge no good explanation exists. "Teleporting" is = just what I thought was a good way of describing it. Basically, in your des= ign when Alice wants to send a Taro token to Bob, Alice has to spend her ow= n output, make a new output for Bob, and make a change output for herself. = Inside the Taro tree you'll then point to the index of Bob's output= in order to assign the tokens to his new output. Instead of pointing to th= e index, you could point to the outpoint (txid, index) of an existing UTXO = owned by Bob, thus "teleporting" the Taro tokens to this UTXO. Th= is saves on-chain space, as now you don't have to create a new output f= or Bob (but now you have to ensure Bob doesn't spend from this output w= hile you're simultaneously sending tokens to it, as I mentioned in my p= revious post, as this would destroy the tokens).

T= he above also reminds me of another potential issue which you need to be aw= are of, if you're not already. Similar to my comment about how the loca= tion of the Taro tree inside the taproot tree needs to be deterministic for= the verifier, the output in which you place the Taro tree also needs to be= . If it's not, then you can commit to a different Taro tree in each out= put of the transaction, allowing you to secretly fork the history.

Hope this helps.

Cheers,
Ruben
On Fri, Apr 8, 2022 at 7:48 = PM Olaoluwa Osuntokun <laolu32@gmail.com> wrote:
(this might be a double post as it = ran into the size limit)

Hi Ruben,

Thanks! I= don't really consider things final until we have a good set of testvectors in the final set, after which we'd start to transition the set= of
documents beyond the draft state.

> Seeing as there's = a large amount of overlap with RGB, a protocol which I have
> examine= d quite extensively, I believe some of the issues I uncovered in that
&g= t; project also apply here.

I'm happy to hear that someone was = actually able to extract enough details from
the RGB devs/docs to be abl= e to analyze it properly! In the past I tried to ask
their developers qu= estions about how things like transfers worked[1][2], but it
seemed eith= er people didn't know, or they hadn't finished the core design
(= large TBD sections) as they were working on adding other components to crea= te
a "new new Internet".

> Furthermore, the Taro scr= ipt is not enforced by Bitcoin, meaning those who
> control the Bitco= in script can always choose to ignore the Taro script and
> destroy t= he Taro assets as a result.

This is correct, as a result in most con= texts, an incentive exists for the
holder of an asset to observe the Tar= o validation rules as otherwise, their
assets are burnt in the process f= rom the PoV of asset verifiers. In the single
party case things are pret= ty straight forward, but more care needs to be taken
in cases where one = attempts to express partial application and permits anyone
to spend a UT= XO in question.

By strongly binding all assets to Bitcoin UTXOs, we= resolve issues related to
double spending or duplicate assets, but need= s to mind the fact that assets can
be burnt if a user doesn't supply= a valid witness. There're likely ways to get
around this by lesseni= ng the binding to Bitcoin UTXO's, but then the system
would need to = be able to collect, retain and order all the set of possible
spends, ess= entially requiring a parallel network. The core of the system as it
stan= ds today is pretty simple (which was an explicit design goal to avoid
ge= tting forever distracted by the large design space), with a minimal
impl= ementation being relatively compact given all the Bitcoin context/designre-use.

Also one cool trait of the way commitments are designed is = that the Taro
commitment impact the final derived taproot output key. As= a result, potential
Script extensions like TAPLEAF_UPDATE_VERIFY can ac= tually be used to further
_bind_ Taro transitions at the Bitcoin level, = without Bitcoin explicitly
needing to be aware of the Taro rules. In sh= ort, covenants can allow Bitcoin
Script to bind Taro state transitions, = without any of the logic bleeding over,
as the covenant just checks for = a certain output key, which is a function of
the Taro commitment being p= resent.

> There are two possible designs here: a.) The token hist= ory remains separate =E2=80=93
> Dave receives Alice's 2 tokens, = Bob's tokens are split and he receives 2 (or
> 3 from Bob 1 from = Alice). =C2=A0b.) The token history gets merged =E2=80=93 Dave receives
= > 4 tokens (linking the new output with both Alice and Bob's history= ).

Mechanically, with respect to the way the change/UTXOs work in th= e system, both
are expressible: Dave can chose to merge them into a sing= le UTXO (with the
appropriate witnesses included for each of them), or D= ave can keep them
distinct in the asset tree. You're correct in that= asset issuers may opt to
issue assets in denominations vs allowing them= to be fully divisible.
Ultimately, the compatibility with the LN layer = will be the primary way to keep
asset histories compressed, without rely= ing on another trust model, or relying
on the incentive of an asset issu= er to do a "re-genesis" which would
effectively re-create asse= ts in a supply-preserving manner (burn N units, then
produce a new genes= is outpoint for N units). Alternatively, implementations can
also chose = to utilize a checkpointing system similar to what some Bitcoin full
node= clients do today.

> =C2=A0is that you end up with a linked trans= action graph, just like in Bitcoin

This is correct, the protocol doe= sn't claim to achieve better privacy
guarantees than the base chain.= However inheriting this transaction graph model
imo makes it easier for= existing Bitcoin developers to interact with the
system, and all the da= ta structures are very familiar tooling wise. However any
privacy enhanc= ing protocol used for on-chain top-level Bitcoin UTXOs can also
be appli= ed to Taro, so people can use things like coinswap and coinjoin, along
w= ith LN to shed prior coin lineages.

> This implies the location o= f the Taro tree inside the taproot tree is not
> fixed. What needs to= be prevented here is that a taproot tree contains more
> than one Ta= ro tree, as that would enable the owner of the commitment to show
> d= ifferent histories to different people.

Great observation, I patched= a similar issue much earlier in the design process
by strongly binding = all signatures to a prevOut super-set (so the outpoint
along with the un= ique key apth down into the tree), which prevents duplicating
the asset = across outputs, as signature verification would fail.

In terms of ac= hieving this level of binding within the Taro tree itself, I can
think o= f three options:

=C2=A0 1. Require the Taro commitment to be in the = first/last position within the
=C2=A0 (fully sorted?) Tapscript tree, an= d also require its sibling to be the hash
=C2=A0 of some set string (all= zeroes or w/e). We'd require the sibling to the empty
=C2=A0 as the= tapscript hashes are sorted before hashing so you sort of lose that
=C2= =A0 final ordering information.

=C2=A0 2. Include the position of th= e Taro commitment within the tapscript tree
=C2=A0 within the sighash di= gest (basically the way the single input in the virtual
=C2=A0 transacti= on is created from the TLV structure).

=C2=A0 3. Include the positio= n of the Taro commitment within the tapscript tree as
=C2=A0 part of the= message that's hashed to derive asset IDs.

AFAICT, #1 resolves = the issue entirely, #2 renders transfers outside of the
canonical histor= y invalid, and #2 minds hte asset ID to the initial position
meaning you= can track a canonical lineage from the very start.

> Finally, le= t me conclude with two questions. Could you clarify the purpose of
> = the sparse merkle tree in your design?

Sure, it does a few things:<= br>
=C2=A0 * Non-inclusion proofs so I can do things like prove to your = I'm no longer
=C2=A0 =C2=A0 committing to my 1-of-1 holographic beef= zard card when we swap.

=C2=A0 * The key/tree structure means that t= he tree is history independent, meaning
=C2=A0 =C2=A0 that if you and I = insert the same things into the tree in a different
=C2=A0 =C2=A0 order,= we'll get the same root hash. This is useful for things like
=C2=A0= =C2=A0 tracking all the issuance events for a given asset, or allowing two=
=C2=A0 =C2=A0 entities to sync their knowledge/history of a single asse= t, or a set of
=C2=A0 =C2=A0 assets.

=C2=A0 * Each asset/script m= apping to a unique location within the tree means it's
=C2=A0 =C2=A0= easy to ensure uniqueness of certain items/commitments (not possible to=C2=A0 =C2=A0 commit to the same asset ID twice in the tree as an example)= .

=C2=A0 * The merkle-sum trait means I that validation is made simp= ler, as you just
=C2=A0 =C2=A0 check that the input+output commitment su= m to the same value, and I can
=C2=A0 =C2=A0 also verify that if we'= re swapping, then you aren't committing to more
=C2=A0 =C2=A0 units = that exist (so I make sure I don't get an invalid split).

> A= nd the second question =E2=80=93 when transferring Taro token ownership fro= m one
> Bitcoin UTXO to another, do you generate a new UTXO for the r= ecipient or do
> you support the ability to "teleport" the = tokens to an existing UTXO like how
> RGB does it? If the latter, hav= e you given consideration to timing issues
> that might occur when so= meone sends tokens to an existing UTXO that
> simultaneously happens = to get spent by the owner?

So for interactive transfers, the UTXOs g= enerated as just the ones part of the
MIMO transaction. When sending via= the address format, a new non-dust output is
created which holds the ne= w commitment, and uses an internal key provided by
the receiver, so only= they can move the UTXO. Admittedly, I'm not familiar with
how the R= GB "teleport" technique works, I checked out some slide=C2=A0deck= s a while
back, but they were mostly about all the new components they w= ere creating and
their milestone of 1 million lines of code. Can you poi= nt me to a coherent
explanation of the technique? I'd love to compar= e/contrast so we can analyze
the diff tradeoffs being made here.

= Thanks for an initial round of feedback/analysis, I'll be updating the = draft
over the next few days to better spell things out and particularly= that
commitment/sighash uniqueness trait.

-- Laolu

[1]: <= a href=3D"https://twitter.com/roasbeef/status/1330654936074371073?s=3D20&am= p;t=3DfeV0kWAjJ6MTQlFm06tSxA" target=3D"_blank">https://twitter.com/roasbee= f/status/1330654936074371073?s=3D20&t=3DfeV0kWAjJ6MTQlFm06tSxA
[= 2]: https://twitter.com/ro= asbeef/status/1330692571736117249?s=3D20&t=3DfeV0kWAjJ6MTQlFm06tSxA=
--000000000000b5d66805dc4fa5d6--