A fast and efficient C++ implementation of a Sparse Merkle Tree library using OpenSSL.
❌ Do not use in production. NOT AUDITED
Cerkle Tree provides a templated implementation of Sparse Merkle Trees with configurable hash functions. The default implementation uses SHA-256 via OpenSSL.
- Path Finding Algorithm - Algorithm for determining the intersection of leaves in a Sparse Merkle Tree
- CMake (>= 3.14)
- OpenSSL
- Boost (for testing)
mkdir build
cd build
cmake ..
make
This will generate:
libcerkle-tree.a
: The static librarycerkle-tree_test
: The test executable
Tests are implemented using the Boost Test Framework. To run the tests:
cd build
ctest --output-on-failure
#include "smt.h"
#include "hash_sha256.h"
// Create a new SMT context (uses empty ByteVector as default value)
Sha256HashFunction hashFunc;
SmtContext<Sha256HashFunction> smt(hashFunc);
// Get the root hash
ByteVector rootHash = smt.getRootHash();
std::string rootHashString = smt.getRootHashString();
This project is open source and available under the MIT License.