Max Proof Length for Tensor cNFTs
Introduction
Merkle trees, are a data structure where the leaves hold hashed data blocks, and internal nodes hold hashes of their children's combined information. This creates a condensed hash for the entire data set stored in the root node.
When interacting with data stored in Merkle tree leaves, we may want to validate it exists, or update it; to do this we don't need to rehash all the leaf nodes, we only need to have certain values to hash together until we calculate our Merkle root. These values are known as the Proof for the leaf.
TLDR
- To support Tensor’s Compressed marketplace the proof (tree depth less canopy) should not exceed:
- 5 (if 4 creators)
- 8 (if 1 creator)
- 12 (if 1 creator + shorter metadata - but ideally we don’t rely on this)
- If a creator already a minted a tree/NFTs, and cant change it
- we can do some magic to at least support a proof length of 12, potentially up to 16
- When buying with USDC (
buy_spl
instruction) the proof should not exceed:- 6 (if 4 creators)
- 10 (if 2 creators)
- 12 (if 1 creator)
To be safe mint your trees with proofs no longer than 8, worst case 10
Detailed Calculation
Below assumes no taker/maker brokers.
Unless otherwise specified, we assume max metadata size: name (32) + symbol (4) + uri (200).
Proof length = depth - canopy
Tx / Max Proof → | WORST CASE 4 creators + core LUT | 1 creator + core LUT | ⭐️ AVG CASE 1 creator + core LUT + shorter URI+name+symbol (129 chars) | Any number of creators + custom LUT* | BEST CASE Any number of creators + custom LUT* + shorter URI+name+symbol (129 chars) |
---|---|---|---|---|---|
list + Buy | 14 | 17 (+3) | 21 (+7) | 21 (+7) | 25 (+11) |
bid + take bid (single) | 14 | 17 (+3) | 21 (+7) | 21 (+7) | 25 (+11) |
bid + take bid (collection / name) | 5 | 8 (+3) | 12 (+7) | 12 (+7) | 16 (+11) |
- Custom LUT means we include the following into it:
- Merkle tree
- Tree authority
- Whitelist (relevant for bids only)
- Creators (up to all 4)
We can do it for a few select trees where it makes a difference and saves the creator from having to remint the tree.
Additional Reading
Updated 8 months ago