I need to trigger a sensitive offchain action based on a users interaction with my smart contract.

My current approach is to emit and event (Trigger(msg.sender, 123)) and then use a filterQuery with my contract address to listen to these events on my offchain backend.

Is this in general the correct approach or is there a better way to do this?

What are the security considerations I have to be aware of in this context?
Waiting for confirmations to ensure the block is/stays included is one I assume? Anything else I'd need to be aware of of how this setup could be attacked?

1 Answer 1


Yes wanting for confirmation is good. Don't look at pending transaction or worse, at transaction in mempool.

Then you can wait for few confirmations block so your are 100% sure that the transaction from the event must be confirmed multiple times (like when you send something from an exchange, they wait for 10 blocks because adding to your balance).

Then you need to secure your node, or API key.

  • what you mean by securing your node or API key? Commented Oct 22, 2021 at 12:07

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.