This repository contains a set of Vercel serverless functions to monitor ZenChain's network health, checking for issues related to block finality, speed, and stalls.
This software has not been audited or reviewed for security. It may contain vulnerabilities and is not recommended for use with real financial assets.
Use at your own risk.
The authors of this software are not responsible for any loss, damage, or liability resulting from its use.
- Finality Check: Detects if block finality is lagging beyond a defined threshold.
- Speed Check: Measures block production speed over time.
- Stall Detection: Checks if block production is delayed beyond an acceptable limit.
-
Clone the repository:
git clone https://github.com/zenchain-protocol/monitoring.git cd monitoring
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.example
to.env
and modify the values as your prefer.
- Copy
To test the functions locally using Vercel, install the Vercel CLI and run:
npm install -g vercel
vercel dev
This will start a local server at http://localhost:3000/api/{function}
.
.
├── api
│ └── block
│ ├── finality.ts # Detects finality lag
│ ├── speed.ts # Measures block production speed
│ └── stall.ts # Detects block production stalls
├── .env.example # Example environment variables
├── LICENSE # MIT License
├── package.json # Dependencies & scripts
└── README.md # Project documentation
Endpoint | Description |
---|---|
/api/block/finality |
Checks block finality and alerts if lagging. |
/api/block/speed |
Measures block production speed. |
/api/block/stall |
Detects if block production is delayed. |
Each function returns a JSON response indicating the network health:
Success Example (200 OK
)
{
"status": "ok",
"message": "Finality is healthy",
"finalizedBlock": 1000,
"bestBlock": 1002,
"lag": 2
}
Error Example (500 ERROR
)
{
"status": "error",
"message": "Finality is stalled!",
"finalizedBlock": 900,
"bestBlock": 1002,
"lag": 102
}
Deploy instantly with Vercel:
vercel
or connect the repository to Vercel Dashboard for auto-deployment.
This project is licensed under the MIT License.