Hi I was in the webinar just now and I’m trying to figure out the advantage of using Merkle trees vs. signing transactions and getting the digest.
How is a merkle tree with proofs better than just signing a bunch of transactions from a verified account for lazy minting?
Skyge
May 7, 2021, 12:58am
2
Hi, welcome!
Sorry, I am not sure what you mean.
For the Merkle trees, do you mean the transactions from the wallet account or the algorithm achieved by the contract.
I mean for the code represented here:
const { ethers } = require('hardhat');
const { MerkleTree } = require('merkletreejs');
const keccak256 = require('keccak256');
const { expect } = require('chai');
const tokens = require('./tokens.json');
async function deploy(name, ...params) {
const Contract = await ethers.getContractFactory(name);
return await Contract.deploy(...params).then(f => f.deployed());
}
function hashToken(tokenId, account) {
return Buffer.from(ethers.utils.solidityKeccak256(['uint256', 'address'], [tokenId, account]).slice(2), 'hex')
}
describe('ERC721MerkleDrop', function () {
before(async function() {
this.accounts = await ethers.getSigners();
this.merkleTree = new MerkleTree(Object.entries(tokens).map(token => hashToken(...token)), keccak256, { sortPairs: true });
This file has been truncated. show original
How is a merkle proof better than a signature proof? What does having leaf node proofs offer over signature proofs? I think it is some kind of multiple level option, but I don’t fully understand.
It's a pity this question found no answer. I was wondering exactly the same...