我正在尝试为 NFT 集合创建一个白名单 merkle 树,所以我尝试了以下代码:
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);
但是证明总是空的,为什么?
PS:当我尝试记录它时,叶子看起来像这样:��_�vD��CT,��sh��+o�j����