Checkpoint Notifier

This script is useful for checking validator activity, notifying you whenever the validator misses a checkpoint.

import requests
import time


api_url = "https://monitor.vn.stakepool.dev.br/missing_signers"

my_validator_ids = input("Enter the validator IDs to monitor (comma-separated): ").split(",")

my_validator_ids = [validator_id.strip() for validator_id in my_validator_ids]

while True:
    try:
        response = requests.get(api_url)

        
        if response.status_code == 200:
            data = response.json()
  
            missed_checkpoints = {validator_id: False for validator_id in my_validator_ids}

            
            for item in data:
                validator_id = str(item.get("ID"))  
                validator_signer = item.get("signer")  

               
                if validator_id in my_validator_ids:
                    print(f"Validator {validator_id} ({validator_signer}) missed a checkpoint!")
                    missed_checkpoints[validator_id] = True

            
            for validator_id, missed in missed_checkpoints.items():
                if not missed:
                    print(f"Validator {validator_id} has not missed checkpoints.")

        else:
            print("Request error:", response.status_code)

    except Exception as e:
        print("Error:", e)

    
    time.sleep(60)

Python and Requests Installation:

Make sure you have Python installed on your system. Open the terminal or command prompt. Execute the following command to install the requests library:

pip install requests

Script Execution:

Save the Python script (Your_script.py) in the directory of your choice. Place a file named "addresses.txt" in the same directory as the script, containing the addresses of the validators.

Run the Script:

In the terminal or command prompt, navigate to the directory where the script is located. Execute the script using the following command:

python3 your_script.py

Results:

The script will begin monitoring the validator's activity and display messages whenever the validator signs a new checkpoint. You can stop the script at any time by pressing Ctrl + C in the terminal.

Last updated