Skip to main content

Read Contract Events with ethers.js

Listen to and query historical smart contract events using ethers.js. Listen to and query historical smart contract events using ethers.js.

Explanation

queryFilter retrieves historical events by name and block range. The .on method subscribes to new events as they’re mined. Indexed parameters (from, to) are filterable; non-indexed (value) is decoded from the event data.

Code


Canonical knowledge ID: code-example:read-contract-events-ethers