Operators#
Description Operators#
Merkle Tree operators are used to configure the tree structure and execution.
They are combined via addition (+) to form a Merkle Tree descriptor.
Size#
-
template<unsigned int Size>
Size()#
Sets the size of the Merkle Tree. Sizes 2 to 2^21 are supported. The default value is 2048.
Precision#
-
template<typename Precision>
Precision()#
Sets the precision of the Merkle Tree. Currently, the only supported precisions are uint8_t, and uint32_t. SHA2, SHA3, and SHAKE hashes use uint8_t, and Poseidon2 uses uint32_t. The default value is uint8_t.
Merkle Tree Aliases#
For convenience, we provide aliases for Merkle Trees with the supported sizes and precisions. They are in the following format:
MERKLE_<PRECISION>_<SIZE> where <PRECISION> takes the values BYTE or FIELD representing uint8_t or uint32_t respectively, and <SIZE> is the size
as a raw number, not the power of 2 exponent.
For example, MERKLE_BYTE_2048 is an alias for decltype(Algorithm<algorithm::MERKLE>() + Size<2048>() + Precision<uint8_t>() + Function<function::Merkle>() + Block()).
Recall that the precision is tied to the respective hash algorithm that will be used in tandem with the Merkle Tree, in the case of our example, this Merkle Tree will be used with SHA2, SHA3, or SHAKE.
Execution Operator#
Block execution#
-
Block()#
Specifies that the operator will execute on each CUDA block. Merkle Tree generation utilizes a thread-based hash function to generate the tree using a full block.
BlockDim#
-
template<unsigned int X, unsigned int Y = 1, unsigned int Z = 1>
BlockDim(
Sets the number of threads per block. The default value is BlockDim<128, 1, 1>.
This is used to specify the number of threads per block for the Merkle Tree generation functions.
Currently, the maximum supported value is BlockDim<256, 1, 1>.