# Unilateral Exit

**URL:** <https://delvingbitcoin.org/t/unilateral-exit/664>\
**Category:** Protocol Design\
**Created:** [March 11, 2024, 9:07am UTC](https://delvingbitcoin.org/t/unilateral-exit/664 "2024-03-11T09:07:34Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![ZmnSCPxj](https://delvingbitcoin.org/letter_avatar_proxy/v4/letter/z/ee7513/32.png) [@ZmnSCPxj](https://delvingbitcoin.org/u/ZmnSCPxj)\
**Post date:** [March 12, 2024, 11:42pm UTC](https://delvingbitcoin.org/t/unilateral-exit/664/9 "2024-03-12T23:42:13Z")

</div>

> [@ZmnSCPxj](#):
>
> Of note is that an entire Merkle tree with N leaves has a total data size O(N log N).

_ **OOOPS THIS IS WRONG** _.

Turns out that any tree structure with N leaves is total data size O(N), not O(N log N). However, there is a constant multiplier on N relative to an array of N entries.

For a binary tree, the multiplier is 2.0. For a tree where nodes have 4 children, the multiplier is 4/3, which honestly is pretty dang close to 1 (this is the same as mipmaps for 2d textures, they _only_ add 33.33% more vram use; every 4 pixels in the original texture is 1 pixel in the next-smaller mipmap, which is equivalent to grouping 4 leaves in a single parent node, have I ever mentioned that I am an indie game dev wannabe who got suckered into buying Bitcoin).

So yes a `CTV` tree is more expensive in data size due to the above constant multiplier, plus the necessary overhead of using P2SH/P2WSH/P2TR, but is O(N) on the number of leaves, and increasing the fanout gets it closer to the case of “publish all the outputs”. Hmmm.

---

_[View the full topic](https://delvingbitcoin.org/t/unilateral-exit/664)._
