Skip to content

Instantly share code, notes, and snippets.

@ImHukam
Created March 28, 2023 11:10
Show Gist options
  • Save ImHukam/a147a8b28a5408debfc97b3cf702f3a1 to your computer and use it in GitHub Desktop.
Save ImHukam/a147a8b28a5408debfc97b3cf702f3a1 to your computer and use it in GitHub Desktop.
zkEVM logs
const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://zkevm-rpc.com');
// Define the range of blocks to retrieve logs for
const fromBlock = 100;
const toBlock = 9000;
// Define the filter to use for the logs
const filter = {
address: 'CONTRACT_ADDRESS',
topics: [] // Set topics to an empty array
};
// Make the request to get the logs
provider.getLogs(filter,fromBlock, toBlock).then(logs => {
console.log(logs);
}).catch(error => {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment