How to get the Sapling Commitment Tree for a given block height?

Note sure if this is the right place to ask but here it goes…

In the library librustzcash and in particular in https://github.com/zcash/librustzcash/blob/master/zcash_client_sqlite/src/wallet/init.rs, there is a function to initialize the blocks table at a given height, understandingly to avoid having to scan from the activation height. The last parameter is the sapling_tree which is the serialized Sapling commitment tree.

I looked at a few implementation that provide checkpoints. For instance https://github.com/adityapk00/zecwallet-light-cli/blob/0c14287ec9ded76e9865730aa498bc289b1525ff/lib/src/lightclient/checkpoints.rs

I don’t get why the sapling_tree are so short. I thought they would contain all the note commitments as a incremental merkle tree and I was expecting thousands of hashes per tree. How is this tree constructed exactly?

Thanks,
–h

3 Likes

I believe it’s only the Merkle frontier of the tree, i.e. a Merkle path from the last used leaf to the root. That’s sufficient if we know that all note witnesses needed by the wallet will be after that point.

Thanks, I think I understand now. Just to be sure, is it because it is an incremental merkle tree? Nodes are always appended, therefore you only need to keep the latest node and path to root in order to build the anchor?