15.7 Monitoring and Event Handling
Smart contracts emit events that can be used to track activity.
Using ethers.js:
contract.on("PaymentReceived", (sender, amount) => {
console.log(`Payment from ${sender}: ${amount}`);
});This allows applications to respond to blockchain events in real time.
Last updated