Alerts And Monitoring

We have a powerful monitoring engine that let's you monitor a smart contract with exactly the conditions you want

How we function

There are some concepts to take care of. First, you need to login at demo.thirdeyelabs.xyz and create an account + organization. Bear in mind, Each organization has a notification limit of 5 for now, as we are just in our testing phase.

How does thirdeye monitor transactions?

When you create a smart contract from the contracts page, You will be only then be able to create an alert for it which is the way to monitor transactions. Internally, In the backend, We start getting each transaction for the contract that you have submitted. We filter and send you only transactions that matter however from the YAML configuration you have set from the alerts page.

Alert

An alert configuration is the YAML configuration that runs every transaction we receive from the RPC.

Here are some existing presets from the preset page:

Feel free to recommend any new cool presets that you would like us to add in our collection on 0x0elliot on twitter.

Preset variables

Preset variables are variables you give to presets. Anything that starts with "$" in the YAML is a preset variable that you will have to fill.

In the YAML:

blockchain_alerts:
  - alert_type: 'every_transaction'
    alerts:
      nameA:
        condition: "txn['gasPrice']  >= ${GAS_PRICE_THRESHOLD}"
        webhook_url: '${WEBHOOK_URL}'
        notifications:
          - send_webhook

${GAS_PRICE_THRESHOLD} and ${WEBHOOK_URL} are presets that the user would have to fill.

Breaking down an Alert YAML configuration

Let's break down one of our simpler existing presets, The "Gas Price Threshold" preset.

Here is how it looks like:

blockchain_alerts:
  - alert_type: 'every_transaction'
    alerts:
      nameA:
        condition: "txn['gasPrice']  >= ${GAS_PRICE_THRESHOLD}"
        webhook_url: '${WEBHOOK_URL}'
        notifications:
          - send_webhook
  • alert_type: There are two types of alert types. One "every_transaction" and "cron_job".

  • alerts: You can by design define multiple alerts in an alert configuration.

  • nameA: Whatever you choose to call the alert (Reflects in your notification received)

  • notifications: There are multiple kinds of notifications you can enter here: send_webhook (works now), send_sms (coming soon) and send_email (coming soon).

  • webhook_url: If you select "send_webhook", enter the webhook URL in the field. Remember, anything that starts with "$" in the example is a placeholder for preset variables.

  • condition: This is the most beautiful part of the YAML. Here, you can define a condition that looks like python, but isn't exactly python. That means, you can introduce boolean logic, Make use of injected variables and functions (We have a bunch of special functions that we provide you), Use default python functions etc. And it runs pretty fast for itself.

    • The most important injected variable is txn. It contains all details passed by the RPC with a timestamp from our end. For ethereum, it might look like this:

{
  "r": "0x6be17b7a7279634f6d7924ea730512c838f8329f5a503780ef1504111ea1dab0",
  "s": "0x21bc9aafcd6e0a9d225d5a0eb7ec174993a93d12d251a2292362e7ea633e45b7",
  "v": "0x1",
  "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "gas": 73404,
  "from": "0xd5a6c661e839825734950f8f18e82cad2bd52e9c",
  "hash": "0xb5dd96df1f0198760dbefc5b014c8c05023d183a464d9f5303657cbac498c35f",
  "input": "0x095ea7b3000000000000000000000000cafd2f0a35a4459fa40c0517e17e6fa2939441ca00000000000000000000000000000000000000000000000000000000004c4b40",
  "nonce": 57,
  "value": 0,
  "output": "",
  "fn_name": "",
  "gasPrice": 34000000000,
  "blockHash": null,
  "timestamp": 1711298394.145415,
  "blockNumber": null,
  "transactionIndex": null
}

Add ABI to your contract for magic

Once you add your contract, Click on "manage"

Click on "Add now" to add ABI to the contract.

You can choose to both upload the contract or add Text.

With the ABI, now in both the YAML and the transaction received, you get the decoded input!

Notice how it's decoded now!

Last updated