Skip to main content

Creating a watcher

Watchers represent conditions that are checked upon inspection of the block. When the conditions of a watcher are met, the watcher triggers and create a webhook and send to the server url provided during the watcher's creation. With Starton, you can create watchers from both smart contracts and blockchain addresses, enabling you to monitor a wide range of blockchain events.


Starton enables the creation of watchers for any smart contracts. From the ABI we enable you to track any event emitted from the contract. No ABI? No problem. Starton offers templates for events emitted by ERC20, ERC721, and ERC1155 contracts. You can monitor a variety of events such as:

  • specific transfer events for ERC721 and ERC1155 contracts.

To create a watcher from the code of your application, use the following snippet. You can find the full list of networks and event types in our API reference.

const axios = require("axios")
// First, authenticate to the API
const startonApi = axios.create({
baseURL: "",
headers: {
"x-api-key": "YOUR_API_KEY",
// Use the watcher creation endpoint
.post("/v3/watcher", {
name: "Name of your watcher", // Enter a name for your watcher
description: "Describe your watcher", // Enter a description for your watcher
address: "0x000000000000", // Enter the address to watch (either a wallet or a smart contract)
network: "polygon-amoy", // Enter a network, you can find the list of networks available in our API reference.
type: "EVENT_MINT", // Select an event type
webhookUrl: "https://xxxxxxx/", // Enter the address of the webhook
confirmationsBlocks: 50, // Depending on your needs, select the number of confirmed blocks before an event triggers your watcher
.then((response) => {

Let's go through the parameters provided to create a watcher:

  • name: This field specifies the name of your watcher. Useful for identification purposes, especially if you have multiple watchers set up for the same address or contract at different confirmation speeds different confirmation speeds.
  • type: The type of blockchain event that you want the watcher to monitor. Starton provides you with a list of events as well as the possibility to watch events from your own custom contract .
    Event typeDescription
    EVENT TRANSFERTriggers when an ERC20 contract emits a transfer event, to track when tokens are moved.
    EVENT MINTTriggers when an ERC20 contract emits a transfer event where sending address is 0x0, to track when new tokens are created.
    EVENT APPROVALTriggers when an ERC20 contract emits an approval event, to track when a new allowance has been granted or revoked.
    ERC721 EVENT TRANSFERTriggers when an ERC721 contract emits a transfer event, to track when an NFT is moved.
    ERC1155 EVENT TRANSFER SINGLETriggers when an ERC1155 contract emits a transfer event, to track when one NFT is moved.
    ERC1155 EVENT TRANSFER BATCHTriggers when an ERC1155 contract emits a batch transfer event, to track when several NFTs are moved.
    Custom Event(s)Triggers when a smart contract emits one or multiple events you select from your ABI.
  • address: This is the specific blockchain address you want to monitor. It can be a wallet address or a smart contract address, depending on the event type you chose.
  • network: This specifies the blockchain network on which is the given address. In the provided example, polygon-amoy refers to the amoy testnet of the Polygon (previously known as Matic) network. For more, see Supported Networks.
  • webhookUrl: This URL is where the notifications will be sent when the watched event occurs. Essentially, once the watcher detects the specified event on the blockchain, it will send an HTTP POST request to this URL with details of the event. You can use or test a webhook on your local environment using ngrok.
  • confirmationsBlocks: This is the number of confirmed blocks before an event triggers the watcher. It's a safety measure to ensure that the event (like a transaction) is well-confirmed on the blockchain and is not likely to be reversed. The higher the number, the more confirmations are required, and vice versa. Each network has its own default confirmation blocks number, for more information, see Understanding confirmation blocks.
  • Creating a watcher from an address