Skip to content
LogoLogo

Get Validator Count

validator.getCount

Gets the total number of validators.

Usage

import {  } from './viem.config'
 
const  = await ..()
 
.('Result:', )
Result: 4n

Recipes

Derive Quorum Figures for a Health Dashboard

Use the validator count to derive standard BFT fault-tolerance figures for a network health dashboard.

import {  } from './viem.config'
 
const  = await ..()
 
const  = ( - 1n) / 3n
const  =  - 
 
.(`Quorum: ${} of ${} validators`)
Quorum: 3 of 4 validators

Return Value

type ReturnType = bigint

The total number of validators.

Parameters

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.