Using Transaction IDs with Defender Sentinel

I'm trying to submit a transaction to mint an NFT for users and get the token ID from the confirmed transaction logs. Right now, I have an event listener monitoring the events of the contract after sending the transaction to the Relayer. However, our server will only monitor for up to 2 minutes before it times out.

I'm wondering if there is a way to have the Defender Sentinel to monitor events and use the transaction ID, provided by the Relayer, to match a specific transaction hash?

What would be the best method for using the Sentinel to monitor and match a specific transaction with a previously provided transaction ID?

:computer: Environment

Relayer and Autotask

Submitting a signed NFT minting request to the Relayer through an autotask to mint to the user for free with no gas.


Using an event listener is not the ideal way for us to monitor for a completed transaction in order to retrieve the token ID from the event logs. This could fail in the case a transaction takes too long to confirm on chain.

I know the Sentinels can monitor events for transactions. However, the Relayer provides us a transaction ID in order to query the transaction hash. But the transaction ID does not exist in the transaction that the Sentinel picks up.

We need a way to match the confirmed minting transaction the Relayer sends to pull the specific token ID from the event logs in order to save it to our DB for reference. The Sentinel seems like a good solution to monitor for this event but we can't know if the transaction it picks up is the exact transaction the Relayer sent using the transaction ID provided. In the case of multiple people minting simultaneously, we may not be able to correctly match IDs with transaction hashes if any are dropped. And I'm not sure there's a way to submit data to an Autotask connected to a Sentinel to cross reference such information.

:1234: Code to reproduce

Hi @Jshanks21,

I'm thinking about a potential solution and I see these scenarios:

Scheduled Autotask + since query param on Relayer /list endpoint

  1. Setup an Autotask running every 5 minutes (or whatever you need), query the /list endpoint of the Relayer API with status confirmed. The request will give you the transactionId and the obtained transactionHash.
  2. At the end of the execution, you set the current timestamp on the kv data store, and next time you use that timestamp as a since param on the relayer /list endpoint

Sentinel + since query param on Relayer /list endpoint

This one is pretty much the same as the last one, but instead of an schedule, you use a Sentinel to trigger your Autotask.

Although this option might seem better than the last one, Sentinel confirmation blocks and Relayer confirmation blocks might differ, so using the last execution timestamp as the since param and avoid assuming that a sentinel alert means we've already flagged the transaction as confirmed is encouraged

Save user's address and nonce

I personally think this is the best:

  1. Setup a sentinel that monitors transactions from your contract
  2. On your UI, save the user's address and the nonce they signed and save them along with the transactionId on your database (or in the kv data store)
  3. Each time a sentinel detects a transaction, get the nonce from the Sentinel's alert, and the from of the transaction
  4. Using both, you can call an Autotask upon Sentinel alert, and match the transactionId with the nonce and address of the user
  5. Forward the confirmation to whatever DB you're using

If I think in another potential solution, or somebody from the team jumps in, I'll let you know.

1 Like

Thank you very much for the great suggestions @ernestognw! :pray:

I will share these with the rest of my team to discuss further.

1 Like