Validator Setup
Learn how to set up and manage validators for your liquid staking protocol.
Last updated: 2024-03-21
Edit on GitHubOverview
Proper validator setup and management is crucial for running a secure and efficient liquid staking protocol. This guide covers all aspects of validator management, from selection criteria to performance monitoring and stake management.
Setup Checklist
- •Selection criteria defined
- •Performance metrics set
- •Monitoring configured
- •Security measures in place
Validator Selection Criteria
Define comprehensive criteria for selecting and evaluating validators.
Selection Configuration
1// validator/selection.ts
2export const VALIDATOR_CRITERIA = {
3 // Performance requirements
4 performance: {
5 minUptime: 0.98, // 98% uptime
6 maxSkipRate: 0.01, // 1% max skip rate
7 minEpochCredits: 80_000,
8 maxVoteDistance: 32, // slots
9 },
10
11 // Stake requirements
12 stake: {
13 minSelfStake: new BN(100_000_000_000), // 100 SOL
14 maxTotalStake: new BN(10_000_000_000_000), // 10,000 SOL
15 minDelegations: 10,
16 maxStakeShare: 0.1, // 10% of total stake
17 },
18
19 // Commission settings
20 commission: {
21 min: 5, // 5%
22 max: 10, // 10%
23 maxChange: 1, // 1% max change per epoch
24 },
25
26 // Infrastructure requirements
27 infrastructure: {
28 requiredVersion: '1.17.0',
29 minCPUCores: 16,
30 minRAMGB: 32,
31 minStorageGB: 512,
32 dataCenter: {
33 tier: 'Tier 3',
34 redundancy: true,
35 },
36 }
37}
Scoring System
1// validator/scoring.ts
2export const SCORING_SYSTEM = {
3 // Score weights
4 weights: {
5 uptime: 0.3,
6 skipRate: 0.2,
7 voteDistance: 0.1,
8 commission: 0.1,
9 infrastructure: 0.1,
10 governance: 0.1,
11 community: 0.1,
12 },
13
14 // Scoring functions
15 scoring: {
16 uptime: (value: number) =>
17 value >= 0.98 ? 100 :
18 value >= 0.95 ? 80 :
19 value >= 0.90 ? 50 : 0,
20
21 skipRate: (value: number) =>
22 value <= 0.01 ? 100 :
23 value <= 0.02 ? 80 :
24 value <= 0.05 ? 50 : 0,
25
26 commission: (value: number) =>
27 value <= 5 ? 100 :
28 value <= 8 ? 80 :
29 value <= 10 ? 60 : 0,
30 },
31
32 // Minimum requirements
33 minimums: {
34 totalScore: 80, // minimum 80/100 to be selected
35 uptimeScore: 90,
36 skipRateScore: 90,
37 }
38}
Performance Monitoring
Set up comprehensive performance monitoring for validators.
Performance Metrics
1// validator/metrics.ts
2export const PERFORMANCE_METRICS = {
3 // Real-time metrics
4 realtime: {
5 voteDistance: {
6 metric: 'vote_distance',
7 threshold: 32,
8 window: '5m',
9 },
10 skipRate: {
11 metric: 'skip_rate',
12 threshold: 0.01,
13 window: '1h',
14 },
15 latency: {
16 metric: 'vote_latency_ms',
17 threshold: 100,
18 window: '1m',
19 },
20 },
21
22 // Epoch metrics
23 epoch: {
24 credits: {
25 metric: 'epoch_credits',
26 threshold: 80_000,
27 window: '1epoch',
28 },
29 uptime: {
30 metric: 'uptime_percentage',
31 threshold: 0.98,
32 window: '1epoch',
33 },
34 commission: {
35 metric: 'commission_rate',
36 threshold: 10,
37 window: '1epoch',
38 },
39 },
40
41 // Historical metrics
42 historical: {
43 avgUptime: {
44 metric: 'average_uptime',
45 threshold: 0.99,
46 window: '30d',
47 },
48 slashingEvents: {
49 metric: 'slashing_count',
50 threshold: 0,
51 window: '365d',
52 },
53 }
54}
Performance Monitoring Best Practices
- Monitor metrics in real-time
- Set up alerts for threshold violations
- Track historical performance
- Implement automated responses
- Regular performance reviews
Stake Management
Implement efficient stake management and distribution strategies.
Stake Distribution
1// validator/stake.ts
2export const STAKE_MANAGEMENT = {
3 // Distribution strategy
4 distribution: {
5 method: 'score_weighted',
6 minStake: new BN(1000_000_000_000), // 1,000 SOL
7 maxStake: new BN(100_000_000_000_000), // 100,000 SOL
8 targetCount: 100, // target number of validators
9 },
10
11 // Rebalancing rules
12 rebalancing: {
13 threshold: 0.1, // 10% imbalance triggers rebalance
14 maxChange: 0.05, // 5% max change per update
15 frequency: 'epoch',
16 cooldown: 2, // epochs between rebalances
17 },
18
19 // Stake activation
20 activation: {
21 method: 'gradual',
22 rateLimit: 0.1, // 10% per epoch
23 minAmount: new BN(100_000_000_000), // 100 SOL
24 warmupPeriod: 2, // epochs
25 },
26
27 // Emergency procedures
28 emergency: {
29 maxUnstakeRate: 0.5, // 50% max unstake per day
30 cooldownPeriod: 24 * 60 * 60, // 24 hours
31 approvalRequired: true,
32 }
33}
Stake Operations
1// validator/operations.ts
2export const STAKE_OPERATIONS = {
3 // Delegation operations
4 delegation: {
5 minAmount: new BN(1_000_000_000), // 1 SOL
6 maxAmount: new BN(1_000_000_000_000), // 1,000 SOL
7 incrementSize: new BN(100_000_000), // 0.1 SOL
8 warmupPeriod: 2, // epochs
9 },
10
11 // Withdrawal operations
12 withdrawal: {
13 minAmount: new BN(1_000_000_000), // 1 SOL
14 maxAmount: new BN(100_000_000_000), // 100 SOL
15 cooldownPeriod: 2, // epochs
16 processingDelay: 1, // epoch
17 },
18
19 // Commission handling
20 commission: {
21 changeThreshold: 1, // 1% max change
22 notificationPeriod: 7, // days notice required
23 maxRate: 10, // 10% maximum
24 }
25}
Security Measures
Implement comprehensive security measures for validator operations.
Security Configuration
1// validator/security.ts
2export const SECURITY_CONFIG = {
3 // Access control
4 access: {
5 keyManagement: 'hardware_wallet',
6 multiSig: {
7 threshold: 3,
8 members: 5,
9 },
10 ipWhitelist: ['validator_ips'],
11 },
12
13 // Monitoring
14 monitoring: {
15 slashing: {
16 threshold: 0,
17 response: 'immediate_unstake',
18 },
19 doubleSign: {
20 detection: true,
21 response: 'blacklist',
22 },
23 availability: {
24 threshold: 0.95,
25 window: '1h',
26 },
27 },
28
29 // Infrastructure
30 infrastructure: {
31 ddosProtection: true,
32 firewallRules: [
33 'allow_rpc',
34 'allow_gossip',
35 'deny_all',
36 ],
37 backups: {
38 frequency: '1h',
39 retention: '30d',
40 },
41 },
42
43 // Incident response
44 incidents: {
45 responseTime: '5m',
46 escalation: [
47 'validator_operator',
48 'security_team',
49 'protocol_admin',
50 ],
51 recoveryProcedures: {
52 slashing: 'procedures/slashing.md',
53 outage: 'procedures/outage.md',
54 compromise: 'procedures/compromise.md',
55 },
56 }
57}
Critical Security Measures
- Use hardware security modules (HSMs)
- Implement proper key management
- Regular security audits
- Network security measures
- Incident response procedures
Maintenance Procedures
Establish regular maintenance procedures for validators.
Maintenance Schedule
1# maintenance/schedule.yaml
2maintenance:
3 # Regular updates
4 updates:
5 software:
6 frequency: weekly
7 window: "Sunday 02:00 UTC"
8 maxDuration: 2h
9 notification: 24h
10
11 security:
12 frequency: daily
13 window: "00:00 UTC"
14 maxDuration: 30m
15 automatic: true
16
17 # Health checks
18 health_checks:
19 basic:
20 frequency: 5m
21 checks:
22 - node_status
23 - vote_status
24 - network_connectivity
25
26 comprehensive:
27 frequency: 1h
28 checks:
29 - resource_usage
30 - performance_metrics
31 - security_status
32
33 # Backup procedures
34 backups:
35 snapshots:
36 frequency: 6h
37 retention: 7d
38 verification: true
39
40 ledger:
41 frequency: 1d
42 retention: 30d
43 compression: true
Automation Rules
1# maintenance/automation.yaml
2automations:
3 # Performance optimization
4 optimization:
5 - trigger: cpu_usage > 80%
6 action: scale_resources
7 params:
8 resource: cpu
9 increment: 2
10
11 - trigger: memory_usage > 80%
12 action: cleanup_memory
13 params:
14 target: 60%
15
16 # Health management
17 health:
18 - trigger: vote_distance > 32
19 action: restart_validator
20 params:
21 gracePeriod: 5m
22
23 - trigger: missed_blocks > 10
24 action: notify_operator
25 severity: high
26
27 # Resource management
28 resources:
29 - trigger: disk_usage > 80%
30 action: cleanup_ledger
31 params:
32 target: 60%
33
34 - trigger: bandwidth_usage > 90%
35 action: throttle_gossip
36 params:
37 reduction: 50%
Maintenance Best Practices
- Schedule maintenance during low-impact periods
- Implement proper testing procedures
- Maintain comprehensive documentation
- Regular backup verification
- Monitor maintenance impact
- Keep maintenance logs