'Initialize a Merkle tree of 8 with blank leaves in solidity
I am trying to initialise an empty merkle tree in the constructor my solidity contract
I have a merkle tree of 8 leaves, so that means that the flattened out form of the merkle tree would be something like uint256 [15] hashes
. But i want to initalize it in the constructor. The first 8 leaves will be 0 and we can assume they're already hashed. after that there will be 4 nodes which would be hashes of the leaves and then 2 and then the root. How can I implement this using poseidon hash?
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|