Developers Forum for XinFin XDC Network

Rushabh Parmar
Rushabh Parmar

Posted on

Understanding the XDC Network Slashing Mechanism: Ensuring Network Stability

Introduction

The XDC Network, powered by its XDC 2.0 consensus mechanism, employs a slashing mechanism to maintain network stability and ensure validator accountability. Unlike punitive slashing systems in other blockchains, XDC's approach focuses on corrective measures that balance network efficiency with fairness to node operators.

This article explores how slashing works, its impact on network performance, and practical solutions for masternode operators to avoid slashing events.


Why Slashing is Critical for Network Performance

The Timeout Problem

In XDPoS, masternodes create blocks in a round-robin fashion. When a masternode fails to create a block during its designated turn, the entire network experiences a 10-second timeout before the next masternode proceeds.

Impact Example:

If 27 masternodes (25% of the 108-node network) are underperforming:

  • Wasted time per epoch: 27 nodes × 6 average turns × 10 seconds = 1,620 seconds
  • Normal epoch duration: 1,800 seconds
  • Performance degradation: 47.4%
  • Network throughput: Reduced from 2,000+ TPS to ~1,050 TPS

Without slashing, these underperforming masternodes would continue degrading network performance indefinitely. With slashing, the network automatically excludes them, restoring full operational efficiency.


How XDC Slashing Works

The Slashing Trigger

Primary Condition: A masternode that fails to sign any block during an entire epoch (900 blocks) will be slashed.

The system evaluates complete inactivity over an epoch, not isolated missed blocks. This prevents false positives from temporary network hiccups while identifying genuinely unresponsive masternodes.

The Slashing Cycle

Phase 1: Performance Monitoring

Each epoch consists of 900 blocks (approximately 30 minutes):

Epoch N (900 blocks, ~1800 seconds)
├── Masternodes take turns creating blocks
├── Block Signer smart contract records all signatures
└── Block 900 (Checkpoint): Performance evaluation
Enter fullscreen mode Exit fullscreen mode

Phase 2: Detection and Slashing

At the checkpoint block:

for each masternode M in MasternodeSet {
    signatures = BlockSigner.getSignatureCount(M, currentEpoch);

    if (signatures == 0) {
        slashMasternode(M);
        addToSlashedList(M, currentEpoch + 4);
    }
}
Enter fullscreen mode Exit fullscreen mode

Key Point: Zero signatures = automatic slashing. Partial participation = no slashing.

Phase 3: Exclusion Period (4 Epochs)

Once slashed, a masternode enters a 4-epoch exclusion period (~2 hours):

Epoch N: Masternode slashed (0 signatures)
├── Epochs N+1 to N+4: Excluded from block creation
│   └── Can still verify/sign blocks created by others
└── Epoch N+5: Eligible for reinstatement
Enter fullscreen mode Exit fullscreen mode

During Exclusion:

  • Cannot create blocks
  • Can verify and sign blocks (demonstrates liveness)
  • This activity is required for recovery

Phase 4: Automatic Reinstatement

After 4 epochs, the masternode automatically rejoins if:

  1. It signed blocks during the exclusion period
  2. Stake remains locked in the smart contract
  3. No additional slashing events occurred

Byzantine Fault Tolerance and Network Safety

The XDC Network maintains Byzantine Fault Tolerance through its 75% finality requirement:

BFT Parameters:

  • Finality requires: 81 validator signatures (75% of 108)
  • Network tolerates: Up to 27 faulty/offline masternodes
  • Critical threshold: If 28+ masternodes are slashed, finality becomes impossible
Slashed Nodes Active Nodes BFT Status
0-10 98-108 ✅ Excellent
11-27 81-97 ✅ Safe
27 81 ⚠️ Critical
28+ <81 ❌ Broken

Double Validation Integration

XDC's slashing mechanism integrates with its Double Validation system:

How It Works:

  1. Block Creator: Creates block per round-robin schedule
  2. Block Verifier: Randomly selected to verify and co-sign
  3. Finalization: Requires both signatures

Slashing Impact:

  • Slashed masternodes are excluded from block creator rotation
  • Can still participate as random block verifiers
  • Allows demonstration of liveness for recovery

Solutions to Avoid Slashing

Alternative: Third-Party Masternode Services

If you do not have the technical resources, infrastructure, or time to maintain a masternode yourself, there are several third-party services and volunteers willing to provide professional masternode hosting and management services. These providers handle all technical aspects including:

  • Infrastructure setup and maintenance
  • 24/7 uptime management
  • Security hardening and updates
  • Failover and redundancy
  • Technical support and troubleshooting

Available Third-Party Services:

  • IndSoft - Professional masternode hosting
  • NODE FORGE - Managed validator services
  • Zeeve - Enterprise blockchain infrastructure
  • BlockDaemon - Institutional-grade node operations
  • Tatum - Blockchain infrastructure platform
  • NOWNodes - Node hosting and API services
  • Asternodes - Validator management services
  • Ankr - Decentralized node infrastructure
  • thirdweb - Web3 infrastructure provider
  • GOLDSKY - Blockchain data infrastructure

Important Considerations:

When selecting a third-party service provider:

  1. Research their track record and uptime history
  2. Understand their fee structure
  3. Verify their security practices
  4. Check their support responsiveness
  5. Review client testimonials
  6. Ensure they have experience with XDC Network

DISCLAIMER: XDC Network does not officially endorse any third-party services. Please perform due diligence and research before proceeding with any service provider. You remain responsible for your staked XDC and masternode performance.


For Self-Hosted Masternodes:Infrastructure Requirements

Hardware Specifications

Minimum Requirements:

  • CPU: 12+ core
  • RAM: 32 GB
  • Storage: 2 TB NVMe SSD
  • Network: 100 Mbps (1 Gbps recommended)

Why This Matters:

  • Insufficient CPU → slow block processing
  • Insufficient RAM → system swapping and delays
  • HDD instead of SSD → missed signing windows
  • Unstable network → failed peer communication

Network Infrastructure

Critical Requirements:

  • Static Public IP (mandatory)
  • 99.99%+ uptime SLA (use tier-3+ data centers)
  • DDoS protection
  • Low latency (<100ms to network peers)
  • Redundant connectivity

1. Proper Node Setup

Follow the official setup guide:

Repository: https://github.com/XinFinOrg/XinFin-Node

Setup Steps:

# Clone the official repository
git clone https://github.com/XinFinOrg/XinFin-Node
cd XinFin-Node

# Run the setup script
./setup.sh

# Key configuration parameters:
# - Static IP address
# - Port 30303 open for P2P
# - Proper keystore and password
# - Adequate system resources
Enter fullscreen mode Exit fullscreen mode

Essential Configuration:

  • --syncmode "full": Complete blockchain sync
  • --mine: Enable block creation
  • Firewall: Open port 30303, restrict RPC access

2. Implement Hot Standby Architecture

Setup:

┌─────────────────────┐         ┌─────────────────────┐
│  Primary Masternode │         │  Hot Standby Node   │
│  - Active mining    │◄───────►│  - Synced, ready    │
│  - Signing blocks   │         │  - Not mining       │
└─────────────────────┘         └─────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Critical Rules:

  1. Never run both nodes with same key simultaneously (causes double-signing → 100% stake loss)
  2. Keep standby fully synced at all times
  3. Document failover procedure
  4. Practice failover monthly
  5. Target failover time: <5 minutes

3. Regular Maintenance

Update Schedule:

  • Critical patches: Within 24 hours
  • Protocol upgrades: Per XDC Team announcements
  • Regular updates: Monthly maintenance windows

Planned Maintenance:

# Update procedure
cd XinFin-Node && git pull origin master
docker-compose up -d

# Restart (target: <10 minutes downtime)
docker-compose down
docker-compose up -d

# Verify node is signing blocks within 5 minutes
Enter fullscreen mode Exit fullscreen mode

4. Security Hardening

Firewall Configuration:

# Basic firewall setup
ufw default deny incoming
ufw default allow outgoing

# Allow P2P (essential)
ufw allow 30303/tcp

# Allow RPC only from localhost
ufw allow from 127.0.0.1 to any port 8545

# Allow SSH from trusted IPs only
ufw allow from YOUR_ADMIN_IP to any port 22

ufw enable
Enter fullscreen mode Exit fullscreen mode

Key Protection:

  • Use strong passwords (25+ characters)
  • Store keys in encrypted files with restricted permissions (chmod 600)
  • Never store unencrypted private keys on servers

5. Verify Network Connectivity

Check Peer Connections:

# Check peer count (should be >10)
docker exec -it xinfinnetwork_xdcnode_1 geth attach /work/xdcchain/XDC.ipc \
  --exec 'admin.peers.length'

# Add peers manually if needed
docker exec -it xinfinnetwork_xdcnode_1 geth attach /work/xdcchain/XDC.ipc \
  --exec 'admin.addPeer("enode://PEER_ID@IP:PORT")'
Enter fullscreen mode Exit fullscreen mode

Target: Maintain 15-30 peer connections for optimal resilience.

6. Ensure Continuous Sync

Verify Sync Status:

# Check current block number
docker exec -it xinfinnetwork_xdcnode_1 geth attach /work/xdcchain/XDC.ipc \
  --exec 'eth.blockNumber'

# Compare to network: https://xinfin.network

# Check sync status
docker exec -it xinfinnetwork_xdcnode_1 geth attach /work/xdcchain/XDC.ipc \
  --exec 'eth.syncing'
# Should return "false" if fully synced
Enter fullscreen mode Exit fullscreen mode

Action Guidelines:

  • <10 blocks behind → Monitor
  • 10-100 blocks behind → Check peers and connectivity
  • >100 blocks behind → Investigate immediately, may need restart

7. Pre-Launch Checklist

Before activating your masternode:

  • Hardware meets recommended specifications
  • Static IP configured and tested
  • Node deployed from official repository
  • Full blockchain sync completed
  • Firewall configured correctly
  • Hot standby node synced
  • Failover procedure documented and tested
  • Keys secured properly
  • 10,000,000 XDC staked
  • KYC completed

8. Daily Operational Checks

Daily:

  • Verify sync status (within 10 blocks)
  • Check peer count (>10 peers)
  • Review system logs for errors

Weekly:

  • Verify standby node is synced
  • Test failover readiness
  • Check for software updates

Monthly:

  • Update node software
  • Test complete failover
  • Security audit
  • Backup configurations

Recovery After Slashing

If your masternode gets slashed, follow this recovery process:

Step 1: Confirm Slashing (5 Minutes)

Check your status:

  • Visit https://xdcscan.com
  • Enter your masternode address
  • Verify epoch performance shows 0 signatures

Step 2: Diagnose Root Cause (30 Minutes)

Issue Check Solution
Node offline Service status Restart service
Out of sync Sync progress Wait for completion
No peers Peer count Add peers manually
Disk full Disk usage Clear space
Memory issues System resources Restart, upgrade RAM

Step 3: Fix the Issue (1 Hour)

Restart Node:

docker-compose restart
docker-compose logs -f --tail 100

# Verify sync resumption
docker exec -it xinfinnetwork_xdcnode_1 geth attach /work/xdcchain/XDC.ipc \
  --exec 'eth.syncing'
Enter fullscreen mode Exit fullscreen mode

Add Peers:

# Check firewall
ufw status

# Verify P2P port
netstat -tuln | grep 30303

# Add peers
bash peer.sh

Enter fullscreen mode Exit fullscreen mode

Step 4: Demonstrate Liveness (4 Epochs)

During the 4-epoch exclusion:

  • Your node can verify and sign blocks (even though it can't create them)
  • This demonstrates operational status
  • Target: Sign >50% of blocks during exclusion

Step 5: Automatic Reinstatement (Epoch N+5)

Your masternode automatically rejoins if:

  • You signed blocks during exclusion
  • Stake remains locked
  • No additional slashing occurred

Verify Recovery:

  • Node creates blocks again within first few hundred blocks of epoch N+5
  • Check your signatures in Block Signer contract
  • Confirm address in active masternode list

Best Practices Summary

Do's ✅

  1. Use tier-3+ data centers or reputable cloud providers
  2. Maintain a fully synced hot standby node
  3. Follow official setup guide: https://github.com/XinFinOrg/XinFin-Node
  4. Keep software updated with security patches
  5. Use strong security practices (firewall, key protection)
  6. Verify sync status daily
  7. Document all procedures
  8. Test failover monthly
  9. Maintain adequate system resources
  10. Keep >10 peer connections

Don'ts ❌

  1. Never run two nodes with same key simultaneously
  2. Don't use unreliable infrastructure
  3. Don't ignore software updates
  4. Don't skip regular maintenance
  5. Don't store unencrypted private keys
  6. Don't let node fall >100 blocks behind
  7. Don't operate without failover plan
  8. Don't use insufficient hardware
  9. Don't neglect firewall configuration
  10. Don't skip pre-launch checklist

Conclusion

The XDC Network's slashing mechanism maintains network stability through:

  1. Correction over punishment - Technical issues allow recovery
  2. Transparent enforcement - Automated via smart contracts
  3. Network efficiency - Excludes underperforming nodes to maintain throughput
  4. Byzantine fault tolerance - Ensures security up to 25% faulty nodes

Key Takeaways

For Prevention:

  • Robust infrastructure eliminates slashing risk
  • Proper configuration and maintenance are critical
  • Hot standby provides failover capability
  • Regular checks catch issues early

For Recovery:

  • Slashing is temporary, not permanent
  • Demonstrate liveness during exclusion
  • Automatic reinstatement after 4 epochs
  • Fix root cause to prevent recurrence

By following these guidelines, masternode operators can avoid slashing while contributing to a stable, high-performance XDC Network.


Resources


Discussion (0)