text
stringlengths
0
1.08k
| tH_LEAF(A) | | tH_LEAF(B) | |
+-----^------+ +-----^------+ |
| | |
+-+-+ +-+-+ +-+-+
| A | | B | | C |
+---+ +---+ +---+
```
**2)** According to Taproot rules, **every branch and leaf hashing operation is performed in lexicographic order of the two operands**.
Therefore, **three cases** that lead to two different proofs of uniqueness of the commitment can occur.
**a)** If the hash of the Tapret commitment (`tHT`) **is greater** than the top-level hash of the Script Path Spend (`tHABC`), it will be put on **the right side of the Script Tree**. In this case, the commitment at this position is considered as a valid proof of uniqueness. The related Merkle Proof of inclusion and un...
<pre><code><strong>* tHABC &#x3C; tHT case
</strong>
+---+ +---+ +---+ +---+
| Q | = | P | + | t | * | G |
+---+ +---+ +-^-+ +---+
|
+--------------------+
|
+---------------+------------+
| tH_TWEAK(P || Script_root) |
+---------------------^------+
|
+--------------+----------+
| tH_BRANCH(tHABC || tHT) |
+-------------^-------^---+
| |
+-------------------------------+ +-------+
| |
+----------+-------------+ +-----------------+--------------------+
| tH_BRANCH(tHAB || tHC) | | tH_BRANCH(64_byte_Tapret_Commitment) |
+------------------------+ +--------------------------------------+
</code></pre>
**b)** If the hash of the tapret commitment (`tHT`) **is smaller** than the top-level hash of the Script Path Spend (`tHABC`), it will be placed on **the left side of the Script Tree**. In this case, it is necessary to show that there are no other Tapret commitments on the right side of the Tree. To do this, two cases ...
**b1)** If the old root is a merkle node with two branches, `tHAB` and `tHC` must be revealed and form the Merkle proof of inclusion and uniqueness along with `P`, as shown in the diagram below:
```
* tHABC > tHT case (branch)
+---+ +---+ +---+ +---+
| Q | = | P | + | t | * | G |
+---+ +---+ +-^-+ +---+
|
+--------------------+
|
+---------------+------------+
| tH_TWEAK(P || Script_root) |
+---------------------^------+
|
+--------------+----------+
| tH_BRANCH( tHT || tHABC)|
+-------------^-------^---+
| |
+------------------+ +------------------+
| |
+--------------------+-----------------+ +------------+-----------+
| tH_BRANCH(64_byte_Tapret_Commitment) | | tH_BRANCH(tHAB || tHC) |
+--------------------------------------+ +------------^-------^---+
| |
+------------+ +--------+
| |
+------------+----------+ +------+-----+
| tH_BRANCH(tHA || tHB) | | tH_LEAF(C) |
+-----------------------+ +------------+
```
*Note:* although the tapret commitment is the same length of two concatenated hashes (64 bytes), it's not possible to hide an alternative commitment by splitting it into two fake subtree roots since the taproot hashing strategy (tag + encoded data) for branches is different from the one for leaves. Therefore, no extra ...
**b2)** If the old root is itself a leaf node, then the leaf content must be revealed and form the Merkle proof of inclusion and uniqueness along with `P`, as shown in the diagram below:
```
* tHABC > tHT case (leaf)
+---+ +---+ +---+ +---+
| Q | = | P | + | t | * | G |
+---+ +---+ +-^-+ +---+
|
+--------------------+
|
+---------------+------------+
| tH_TWEAK(P || Script_root) |
+---------------------^------+
|
+--------------+----------+
| tH_BRANCH( tHT || tHC)|
+-------------^-------^---+
| |
+------------------+ +------------------+
| |
+--------------------+-----------------+ +------+-----+
| tH_BRANCH(64_byte_Tapret_Commitment) | | tH_LEAF(C) |
+--------------------------------------+ +------------+
```
## **Nonce optimization**