I'm trying to create a whitelist merkle tree for a NFT collection so I tried this code:
const { MerkleTree } = require('merkletreejs');
const keccak256 = require('keccak256');
const leaves = tab.map((address) => keccak256(address));
const tree = new MerkleTree(leaves, keccak256, { sort: true });
const root = tree.getHexRoot();
const leaf = keccak256('myaddress');
const proof = tree.getHexProof(leaf);
But proof is always empty, why?
PS: leaf look like that when I'm trying to log it: ���_�vD��CT,��sh��+o�j��ߧ
Juan Pablo Isaza
The proof was empty because my address ("myaddress" in the code) was not in the whitelist