platform.sampleValidators
Sample validators from the specified Subnet.
This method will use 60
Compute Units.
Parameters
height
- int - the numerical value representing the P-Chain height to get the validator set at.
subnetID
- string - (optional) the subnet ID to get the validator set of. If not given, gets validator set of the Primary Network.
Returns
validators
- object - the validators and their weights of a subnet or the Primary Network.
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"validators": [
"NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ",
"NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN"
]
}
}
curl https://mainnet.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/P \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id" :1,
"method" :"platform.sampleValidators",
"params" :{
"size":2
}
}'
curl https://fuji.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/P \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id" :1,
"method" :"platform.sampleValidators",
"params" :{
"size":2
}
}'