List Validators
validator.list
Gets the complete set of validators.
Usage
import { } from './viem.config'
const = await ..()
.('Result:', .)
Result: 4import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Flag Inactive Validators on a Monitoring Dashboard
Filter the set by active to surface validators that are registered but out of consensus.
import { } from './viem.config'
const = await ..()
const = .(() => !.)
for (const { } of )
.('Out of consensus:', )
Out of consensus: 0x8ba1f109551bD432803012645Ac136ddd64DBA72import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Build a Peer List for a New Node
Map active validators to their inbound endpoints to seed a new node's peer configuration.
import { } from './viem.config'
const = await ..()
const =
.(() => .)
.(() => .)
.('Peers:', )
Peers: ['validator.example.com:9000', '203.0.113.20:9000']import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type Validator = {
publicKey: Hex
active: boolean
index: bigint
validatorAddress: Address
inboundAddress: string
outboundAddress: string
}[]The complete set 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.