I have this event on my code event CrowdSourceCreated(address indexed contractAddress, address indexed creator, uint indexed amount);. As per eth documentation, to get this event signature I will need to hash the event name and the params which is this ethers.id("CrowdSourceCreated(address,address,uint)"). Now when I do this, I get this hash 0x4ab3f8efdb1b05ed7aab7d0d63f0e4a8af9a673ebef82aaae36e6528bd94b3ac. But hardhat returns an empty array when I pass this as my topic. I called getLogs on the blockHash without passing a topic and hardhat returns an event response with a different hash as the event signature.

    provider: JsonRpcProvider {},
    transactionHash: '0xf30efb07d9250e96db3d46f03d1ebc731029bf86da34a4252f9ecdac6a95593d',
    blockHash: '0x5711386d47b932241a6672e33fba275192c8ae26d28411c468c1cc071249fa14',
    blockNumber: 9326342,
    removed: false,
    address: '0xd3924Aed3dbE4bdBC12FBc5917bBa7202141FE6F',
    data: '0x',
    topics: [
    index: 1,
    transactionIndex: 0

I would wager I'm doing something wrong with my hash calculation. But I can't seem to find what it is. I have used online tools to check my event signature and it's the same with ethers, so why does Hardhat generate a different one?

1 Answer 1


Turns out you don't use an alias when specifying the data type eg: instead of ethers.id("CrowdSourceCreated(address,address,uint)"), the correct format is ethers.id("CrowdSourceCreated(address,address,uint256)")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.