Need advice about merkle tree implementation and its connection with dapp

Hey everyone!
I'm facing an issue regarding the ERC721 contract integration with Merkle tree. So I've generate the Merkle root, put it on the contract, and when I'm trying to pass the bytes32[] data, but it always throws one of the following errors:

This is the proof.

[0xe4aa63f87306767c7dca38d95089fd748b4c3b2b793034bf5ea88843a5f09c7b, 0x39a01635c6a38f8beb0adde454f205fffbb2157797bf1980f8f93a5f70c9f8e6, 0x7496d9000555231d4e66c25b1ccce004a8f0060c2802eee4b267cd885239e2b4]
['0xe4aa63f87306767c7dca38d95089fd748b4c3b2b793034bf5ea88843a5f09c7b', '0x39a01635c6a38f8beb0adde454f205fffbb2157797bf1980f8f93a5f70c9f8e6', '0x7496d9000555231d4e66c25b1ccce004a8f0060c2802eee4b267cd885239e2b4']
["0xe4aa63f87306767c7dca38d95089fd748b4c3b2b793034bf5ea88843a5f09c7b", "0x39a01635c6a38f8beb0adde454f205fffbb2157797bf1980f8f93a5f70c9f8e6", "0x7496d9000555231d4e66c25b1ccce004a8f0060c2802eee4b267cd885239e2b4"]

invalid arrayify value (argument="value", value="0x0x39a01635c6a38f8beb0adde454f205fffbb2157797bf1980f8f93a5f70c9f8e6", code=INVALID_ARGUMENT, version=bytes/5.1.0)

invalid arrayify value (argument="value", value=""0xe4aa63f87306767c7dca38d95089fd748b4c3b2b793034bf5ea88843a5f09c7b"", code=INVALID_ARGUMENT, version=bytes/5.1.0)

invalid number

The interesting part comes when I remove the 0x from all of the proofs except the first.
My question is the following:
What is the best practice to verify the proof? :slight_smile:

P.S the working proof is shown below

[0xe4aa63f87306767c7dca38d95089fd748b4c3b2b793034bf5ea88843a5f09c7b, 39a01635c6a38f8beb0adde454f205fffbb2157797bf1980f8f93a5f70c9f8e6, 7496d9000555231d4e66c25b1ccce004a8f0060c2802eee4b267cd885239e2b4]

If anyone faces such an issue, it's related to the web3.js library. In web3 js, ABI format params are not working properly with Merkle hashes.

On the front-end side, you definitely should use ethers.js.
If you want to pass the proof hash directly to your mint method via the etherscan, it can throw the following error:

1 Like