-
Notifications
You must be signed in to change notification settings - Fork 0
Health checks
Use health checks when an application needs to verify Canton services before submitting commands or when a LocalNet boot sequence needs to wait for services to finish starting.
Validator health probes call the Canton Network Quickstart validator endpoints:
await canton.validator.isReady();
await canton.validator.isLive();The endpoints are unauthenticated and map to:
/api/validator/readyz
/api/validator/livez
The unified client exposes a non-blocking health summary:
const canton = new Canton({ network: 'localnet', provider: 'app-provider' });
const health = await canton.checkHealth();
if (!health.ok) {
console.log(health.services);
}checkHealth() does not throw for partial service failures. It returns per-service status for:
| Service | Probe |
|---|---|
ledger |
JSON Ledger API version endpoint |
validator |
Validator readyz and livez
|
scan |
Scan readyz, livez, and status endpoint |
Limit the check to selected services when an application only depends on part of the stack:
const health = await canton.checkHealth({ services: ['validator'] });Use waitForReady() when startup should block until selected services are healthy:
import { Canton, waitForReady } from '@fairmint/canton-node-sdk';
const canton = new Canton({ network: 'localnet', provider: 'app-provider' });
await waitForReady(canton, {
healthCheck: { services: ['validator'] },
timeout: 300_000,
interval: 5_000,
});The default timeout is five minutes because LocalNet can take several minutes to become ready. Override timeout, interval, and timeoutMessage for shorter application-specific probes.
Digital Asset's CN Quickstart project structure documents validator health checks on ports ending in 903, with empty successful responses from /api/validator/readyz.