**WORK IN PROGRESS - instructions only work for besu version 24.23.0 -RC4 which is still going through testing onwards**
UPDATE: Since 24.6.0, this feature has been promoted to production ready and is enabled by default: `--bonsai-limit-trie-logs-enabled`
Step by Step Guide
IMPORTANT: we strongly recommend reading the rest of this documentation before running these commands because your node’s configuration may require changes to these commands…
(Targeting 24.2.0 release, but currently you must be on 24.2.0-RC4 or the besu main
branch for this to work)
Update besu config to add
--Xbonsai-limit-trie-logs-enabled
but don’t restart yetStop besu
(optional) Run:
sudo /usr/local/bin/besu/bin/besu --data-storage-format=BONSAI --data-path=/var/lib/besu --sync-mode=X_SNAP storage x-trie-log prune
Start besu (remembering to run
sudo systemctl daemon-reload
if you use a systemd service file as per CoinCashew and Somer)Look out for
Limit trie logs enabled: retention: 512; prune window: 30000
in your besu config printout during startupEnjoy more GBs
...
In reality, whilst the Merkle Patricia Trie is implicitly pruned, the BONSAI feature did introduce an extra data structure: the Trie Log (more detail about BONSAI and trie logs here: https://consensys.io/blog/bonsai-tries-guide)
The Trie Logs are retained in order to cope with chain reorgs. After each block is finalized, Trie Logs older than that are no longer required so it is safe to remove them from both the node's and the network's point of view.
How?
If you want to use this feature before it is enabled by default, simply add this option to your besu command: --Xbonsai-limit-trie-logs-enabled
When you restart besu it will begin pruning, block by block (and a cheeky bit during besu startup).
...
https://github.com/hyperledger/besu/issues/5390
https://github.com/hyperledger/besu/pull/6026
https://github.com/hyperledger/besu/pull/6303