> For the complete documentation index, see [llms.txt](https://nocturne-xyz.gitbook.io/nocturne/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nocturne-xyz.gitbook.io/nocturne/protocol-details/offchain-actors/subtree-updater.md).

# Subtree Updater

The Subtree Updater is an offchain actor that saves the protocol gas by inserting batches of new notes into the [commitment tree](/nocturne/protocol-details/commitment-tree.md) through "ZK Subtree Updates". The role is permissionless, so anyone can run a Subtree Updater.

You can read more about the subtree update mechanism [here](/nocturne/protocol-details/commitment-tree.md#zk-subtree-update-insertions), but the TL;DR is that the subtree updater polls the contracts for new merkle tree insertions and keeps a local, up-to-date copy of the commitment tree in-memory. When enough insertions occur, the subtree updater will compute the new root using its local copy of the tree, publish it on-chain, and prove that it's correct using a zero-knowledge proof.
