diff --git a/content/docs/developer/smart-contracts/.deploy-using-foundry.mdx.swp b/content/docs/developer/smart-contracts/.deploy-using-foundry.mdx.swp index e521f26..1298f8b 100644 Binary files a/content/docs/developer/smart-contracts/.deploy-using-foundry.mdx.swp and b/content/docs/developer/smart-contracts/.deploy-using-foundry.mdx.swp differ diff --git a/content/docs/run-a-node/advanced-operations/automation.mdx b/content/docs/run-a-node/advanced-operations-old/automation.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/automation.mdx rename to content/docs/run-a-node/advanced-operations-old/automation.mdx diff --git a/content/docs/run-a-node/advanced-operations/backup-restore.mdx b/content/docs/run-a-node/advanced-operations-old/backup-restore.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/backup-restore.mdx rename to content/docs/run-a-node/advanced-operations-old/backup-restore.mdx diff --git a/content/docs/run-a-node/advanced-operations/disaster-recovery.mdx b/content/docs/run-a-node/advanced-operations-old/disaster-recovery.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/disaster-recovery.mdx rename to content/docs/run-a-node/advanced-operations-old/disaster-recovery.mdx diff --git a/content/docs/run-a-node/advanced-operations/meta.json b/content/docs/run-a-node/advanced-operations-old/meta.json similarity index 100% rename from content/docs/run-a-node/advanced-operations/meta.json rename to content/docs/run-a-node/advanced-operations-old/meta.json diff --git a/content/docs/run-a-node/advanced-operations/networking.mdx b/content/docs/run-a-node/advanced-operations-old/networking.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/networking.mdx rename to content/docs/run-a-node/advanced-operations-old/networking.mdx diff --git a/content/docs/run-a-node/advanced-operations/overview.mdx b/content/docs/run-a-node/advanced-operations-old/overview.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/overview.mdx rename to content/docs/run-a-node/advanced-operations-old/overview.mdx diff --git a/content/docs/run-a-node/advanced-operations/performance-tuning.mdx b/content/docs/run-a-node/advanced-operations-old/performance-tuning.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/performance-tuning.mdx rename to content/docs/run-a-node/advanced-operations-old/performance-tuning.mdx diff --git a/content/docs/run-a-node/advanced-operations/security.mdx b/content/docs/run-a-node/advanced-operations-old/security.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/security.mdx rename to content/docs/run-a-node/advanced-operations-old/security.mdx diff --git a/content/docs/run-a-node/advanced-operations/upgrades.mdx b/content/docs/run-a-node/advanced-operations-old/upgrades.mdx similarity index 100% rename from content/docs/run-a-node/advanced-operations/upgrades.mdx rename to content/docs/run-a-node/advanced-operations-old/upgrades.mdx diff --git a/content/docs/run-a-node/advanced-operations.mdx b/content/docs/run-a-node/advanced-operations.mdx new file mode 100644 index 0000000..794dbbe --- /dev/null +++ b/content/docs/run-a-node/advanced-operations.mdx @@ -0,0 +1,421 @@ +--- +title: Advanced Operations +description: Advanced node operations, monitoring, and production best practices +--- + +import { Callout } from 'fumadocs-ui/components/callout'; + +# Advanced Node Operations + +This guide covers advanced operational topics for running production-grade Shardeum nodes. + + +While the current codebase supports advanced node operations, operators attempting advanced configurations should have a solid understanding of blockchain infrastructure and system administration. + + +## 1. Production Deployment Best Practices + +### Using systemd Service + +Create a systemd service file for automatic restarts and easier management: + +```bash +sudo nano /etc/systemd/system/shardeumd.service +``` + +**Example service file:** + +```ini +[Unit] +Description=Shardeum Node +After=network-online.target + +[Service] +User=root +ExecStart=/usr/local/bin/shardeumd start --home /root/.mainnet/node0 +Restart=on-failure +RestartSec=3 +LimitNOFILE=65535 + +[Install] +WantedBy=multi-user.target +``` + +**Enable and start the service:** + +```bash +sudo systemctl enable shardeumd +sudo systemctl start shardeumd +sudo systemctl status shardeumd +``` + +### Firewall Configuration + +**For Full Nodes / RPC Nodes:** + +```bash +sudo ufw allow 26656/tcp # P2P +sudo ufw allow 26657/tcp # RPC (optional, for local access only) +sudo ufw allow 8545/tcp # JSON-RPC +sudo ufw allow 8546/tcp # WebSocket +sudo ufw enable +``` + +**For Validators:** + +```bash +sudo ufw allow 26656/tcp # P2P only +sudo ufw enable +``` + + +For validators, consider restricting RPC access to localhost only. Never expose validator RPC endpoints publicly. + + +## 2. Monitoring and Alerting + +### Enable Prometheus Metrics + +Edit `config.toml`: + +```toml +prometheus = true +prometheus_listen_addr = ":26660" +``` + +### Monitoring Stack Setup + +**Recommended tools:** +- **Prometheus** - Metrics collection +- **Grafana** - Visualization dashboards +- **Alertmanager** - Alert notifications + +**Key metrics to monitor:** +- Sync status +- Block height +- Validator jail status +- Disk space usage +- Memory usage +- CPU usage +- Missed blocks +- Peer count +- Network latency + +### Alert Conditions + +Set up alerts for: +- Node falls behind by more than 100 blocks +- Validator is jailed +- Disk usage exceeds 80% +- Memory usage exceeds 90% +- Peer count drops below 5 +- Node stops producing blocks (for validators) + +## 3. Security Best Practices + +### Sentry Node Architecture + +A recommended production setup for validators: + +``` +Internet → Sentry Nodes (Public) → Validator (Private IP only) +``` + +**Benefits:** +- Hides validator's IP address +- Absorbs DDoS traffic +- Reduces attack surface +- Improves security + +**Configuration:** +1. Run validator on private network +2. Connect validator only to sentry nodes +3. Configure sentry nodes with public IPs +4. Update `persistent_peers` to point validator at sentries + +### Key Management System (KMS) + +For enhanced security, consider: +- **Tendermint KMS** for validator key management +- Hardware Security Modules (HSM) for key storage +- YubiHSM2 integration +- Remote signing capabilities + + +KMS setup requires advanced configuration. Thoroughly test in a non-production environment first. + + +### Security Checklist + +- ✅ Use firewall rules to restrict access +- ✅ Disable SSH password authentication (use keys only) +- ✅ Keep system packages updated +- ✅ Use fail2ban or similar intrusion prevention +- ✅ Implement DDoS protection +- ✅ Regular security audits +- ✅ Monitor logs for suspicious activity +- ✅ Use VPN for administrative access + +## 4. Backup and Recovery + +### Critical Files to Back Up + +**Validator-specific:** +```bash +~/.mainnet/$NODE_ID/config/priv_validator_key.json +~/.mainnet/$NODE_ID/data/priv_validator_state.json +``` + +**All nodes:** +```bash +~/.mainnet/$NODE_ID/config/node_key.json +~/.mainnet/$NODE_ID/config/config.toml +~/.mainnet/$NODE_ID/config/app.toml +``` + +**Wallet keys:** +```bash +# Mnemonic phrase (keep offline and secure) +``` + +### Backup Script Example + +```bash +#!/bin/bash +NODE_ID="node0" +BACKUP_DIR="/secure/backup/location" +DATE=$(date +%Y%m%d_%H%M%S) + +# Create backup directory +mkdir -p $BACKUP_DIR/$DATE + +# Backup critical files +cp ~/.mainnet/$NODE_ID/config/priv_validator_key.json $BACKUP_DIR/$DATE/ +cp ~/.mainnet/$NODE_ID/config/node_key.json $BACKUP_DIR/$DATE/ +cp ~/.mainnet/$NODE_ID/config/*.toml $BACKUP_DIR/$DATE/ + +# Create encrypted archive +tar -czf $BACKUP_DIR/backup_$DATE.tar.gz -C $BACKUP_DIR $DATE +rm -rf $BACKUP_DIR/$DATE + +echo "Backup completed: backup_$DATE.tar.gz" +``` + +### Disaster Recovery + +**If validator key is compromised:** +1. Immediately unbond and remove validator +2. Generate new keys +3. Create new validator +4. Report incident to network + +**If node fails:** +1. Deploy new server with identical configuration +2. Restore backup files +3. Sync node to current block height +4. Unjail validator if necessary + +## 5. Performance Optimization + +### Pruning Strategies + +**Full nodes (custom pruning):** +```toml +pruning = "custom" +pruning-keep-recent = "10000" +pruning-interval = "50" +``` + +**Archive nodes (no pruning):** +```bash +--pruning nothing +``` + +**Validators:** +- Use minimal pruning or default settings +- Avoid aggressive pruning to maintain full state + +### Database Optimization + +**Enable state sync for faster initial sync:** + +Edit `config.toml`: +```toml +[statesync] +enable = true +rpc_servers = "rpc1.shardeum.org:26657,rpc2.shardeum.org:26657" +trust_height = +trust_hash = "" +``` + +### Hardware Tuning + +**SSD optimization:** +```bash +# Enable TRIM +sudo systemctl enable fstrim.timer + +# Check I/O scheduler +cat /sys/block/nvme0n1/queue/scheduler +``` + +**Network tuning:** +```bash +# Increase network buffers +sudo sysctl -w net.core.rmem_max=134217728 +sudo sysctl -w net.core.wmem_max=134217728 +``` + +## 6. Scaling RPC Infrastructure + +### Load Balancing + +**For high-traffic dApps:** +- Use Nginx, HAProxy, or AWS ELB +- Run multiple RPC nodes behind a reverse proxy +- Implement rate limiting to avoid overload +- Separate "public RPC" from "private infra RPC" + +**Example Nginx configuration:** + +```nginx +upstream rpc_backend { + least_conn; + server 10.0.1.10:8545; + server 10.0.1.11:8545; + server 10.0.1.12:8545; +} + +server { + listen 80; + server_name rpc.example.com; + + location / { + proxy_pass http://rpc_backend; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + + # Rate limiting + limit_req zone=rpc_limit burst=10 nodelay; + } +} +``` + +### Caching Strategies + +- Cache common queries (latest block, chain ID) +- Use Redis for query caching +- Implement CDN for static responses + +## 7. Logging and Debugging + +### Viewing Logs + +**If using systemd:** +```bash +journalctl -u shardeumd -f +journalctl -u shardeumd --since "1 hour ago" +``` + +**If running manually:** +```bash +tail -f ~/.mainnet/$NODE_ID/node.log +``` + +### Debug Mode + +Enable verbose logging in `config.toml`: +```toml +log_level = "debug" +``` + +### Common Debug Commands + +```bash +# Check sync status +shardeumd status | jq '.SyncInfo' + +# Check peer connections +curl -s http://localhost:26657/net_info | jq '.result.n_peers' + +# Query consensus state +curl -s http://localhost:26657/consensus_state + +# Check validator signing info +shardeumd query slashing signing-info $(shardeumd comet show-validator) +``` + +## 8. Upgrade Procedures + +### Coordinated Network Upgrades + +**Preparation:** +1. Monitor official announcements for upgrade schedule +2. Backup all critical files +3. Test upgrade on testnet first +4. Prepare rollback plan + +**Upgrade steps:** +1. Stop the node: `sudo systemctl stop shardeumd` +2. Backup current binary: `cp $(which shardeumd) shardeumd.backup` +3. Download and install new binary +4. Verify version: `shardeumd version` +5. Start node: `sudo systemctl start shardeumd` +6. Monitor logs for issues + +### Rollback Procedure + +If upgrade fails: +```bash +sudo systemctl stop shardeumd +cp shardeumd.backup /usr/local/bin/shardeumd +sudo systemctl start shardeumd +``` + +## 9. Troubleshooting Advanced Issues + +### High Memory Usage + +```bash +# Check memory usage +free -h +htop + +# Restart node to clear memory +sudo systemctl restart shardeumd +``` + +### Database Corruption + +```bash +# Reset data (will require full resync) +shardeumd tendermint unsafe-reset-all --home ~/.mainnet/$NODE_ID + +# Restore from snapshot (if available) +# Download snapshot and extract to data directory +``` + +### Network Connectivity Issues + +```bash +# Test peer connectivity +telnet 26656 + +# Check firewall +sudo ufw status verbose + +# Monitor network traffic +sudo iftop -i eth0 +``` + +## 10. Important Resources + +- **Chain ID:** `shardeum_8118-1` (mainnet) +- **EVM Chain ID:** `8118` (hex: `0x1fb6`) +- **Official Documentation:** [docs.shardeum.org](https://docs.shardeum.org) +- **GitHub:** [github.com/shardeum](https://github.com/shardeum) +- **Discord:** Community support and announcements + + +Advanced operations require careful planning and testing. Always test configuration changes in a non-production environment first. + diff --git a/content/docs/run-a-node/delegate-shm.mdx b/content/docs/run-a-node/delegate-shm.mdx index a98e44c..68f7eb3 100644 --- a/content/docs/run-a-node/delegate-shm.mdx +++ b/content/docs/run-a-node/delegate-shm.mdx @@ -1,34 +1,250 @@ --- title: Delegate SHM -description: Guide to delegating SHM tokens on Shardeum +description: Earn rewards by supporting the Shardeum network through delegation --- import { Callout } from 'fumadocs-ui/components/callout'; - - This page is getting updated +# Delegate SHM — Earn Rewards by Supporting the Network + +Delegating SHM lets you earn rewards without running your own validator. +You simply choose a validator you trust, stake your SHM with them, and start earning a share of their rewards. + + +Your SHM always stays in your wallet — validators cannot spend your funds. + + +## 1. What Is Delegation? (Simple Explanation) + +A validator needs stake to participate in the network. +Delegators help validators by adding their tokens to the validator's total stake. + +**In return:** + +- You earn a share of the validator's rewards +- The network becomes more decentralized +- You do not need to run any hardware +- You can delegate, re-delegate, and unbond your tokens at any time (subject to network rules) + +## 2. What You Need Before Delegating + +You only need: + +**A Web3 wallet:** + +- MetaMask +- Keplr +- Ledger (optional, for hardware wallet users) + +**SHM tokens in your wallet** + +**The validator's address or the validator list in your wallet UI** + +## 3. Add Shardeum Mainnet to Your Wallet + +### MetaMask + +Open MetaMask → Add Network → Enter: + +- **Network Name:** Shardeum +- **RPC URL:** https://api.shardeum.org +- **Chain ID:** 8118 +- **Currency Symbol:** SHM +- **Explorer:** https://explorer.shardeum.org + +Save the network. + +## 4. Choose a Validator + +When choosing a validator, consider: + +- **Uptime** (higher = better) +- **Commission rate** (lower = better returns) +- **Voting power** (choose a mix; avoid only-large validators) +- **Identity / website** (shows validator is active) +- **No history of slashing** + +Your wallet will show a validator list with all these details. + + +**Tip:** Spread your delegation across multiple validators to reduce risk. + + +## 5. How to Delegate SHM + +### Step 1 — Connect your wallet + +Open your wallet and switch to Shardeum Mainnet. + +### Step 2 — Open the Staking Dashboard + +**Official Staking Dashboard:** + +**URL:** [dashboard.shardeum.org](https://dashboard.shardeum.org) + +**Features:** +- Delegate tokens to validators +- Undelegate tokens +- Claim rewards +- View validator details and statistics +- Manage multiple delegations + +You can also stake from: + +- Keplr Dashboard +- Wallet Staking UI +- Validator's profile page on the explorer +- Any dApp that supports Shardeum staking + +### Step 3 — Select a Validator + +Browse the validator list on the dashboard. + +**View validator commission:** +- Navigate to the **Validators** tab on the dashboard +- Click on an individual validator's profile +- Commission rates vary by validator + +Choose a validator based on uptime, commission rate, and reputation, then click **Delegate**. + +### Step 4 — Enter Amount + +Enter the amount of SHM you want to delegate. + +You must pay gas in SHM, so keep a small balance (≈ 1–2 SHM) for fees. + +### Step 5 — Approve the Transaction + +Your wallet will show a popup. + +**Check:** + +- Amount +- Validator +- Gas fee + +Click **Confirm**. + +### Step 6 — Done + +Once the transaction succeeds, your SHM is delegated and earning rewards. + +You can verify your delegation in: + +- Explorer (Delegations tab) +- Wallet "Staking" section + +## 6. Rewards: How They Work + +You earn rewards when: + +- Your validator produces blocks +- Your validator stays online and behaves correctly +- The network distributes emissions to validators and their delegators + +Rewards accumulate automatically. + +You can claim them anytime in your wallet under **Withdraw Rewards**. + +## 7. Unbonding Period (Important) + +If you want to remove your stake: + +1. Click **Unbond** or **Undelegate** +2. Your tokens enter a **21-day unbonding period** + +During this time: + +- You **cannot** withdraw them +- They **do not** earn rewards + +Once the period ends, your SHM appears back in your wallet. + + +**Note:** These parameters may evolve with governance. + + +## 8. Re-Delegation (Move Stake Without Waiting) + +You can instantly move your delegated stake from one validator to another without waiting 21 days — but only **once per validator per unbonding period**. + +**Use this when:** + +- Your validator has high downtime +- Commission increases +- You prefer a different validator + +Open staking UI → Select your validator → **Redelegate**. + +## 9. Risks You Should Know + +Delegating is safe, but you should still be aware: + +### Slashing Risk + +If your validator: + +- Goes offline for too long +- Double-signs a block + +They may be **slashed** and lose a small amount of stake, including part of delegated tokens. + + +Choose validators with good uptime and reputation. -# Delegate SHM +### Commission Fees + +Validators charge a commission on rewards. +This does **not** reduce your staked SHM — only your earnings. + +## 10. How to Withdraw Rewards + +1. Open staking UI +2. Your delegations +3. **Withdraw Rewards** +4. Confirm + +Rewards appear immediately in your wallet. + +## 11. How to Unbond Your SHM + +1. Open staking dashboard +2. Select validator +3. Click **Unbond / Undelegate** +4. Confirm transaction +5. Wait 21 days +6. Withdraw your SHM to your wallet + +## 12. Frequently Asked Questions + +### Can validators steal my tokens? + +No. Delegation never gives validators control of your wallet. + +### Do I need to keep MetaMask open? -Learn how to delegate your SHM tokens to validators and earn rewards. +No. Delegation is on-chain. Your wallet can be offline. -## What is Delegation? +### What happens if my validator gets jailed? -Delegation allows SHM token holders to stake their tokens with validators without running a node themselves. Delegators earn a portion of the validator's rewards. +You stop earning rewards until they unjail or until you redelegate to someone else. -## How to Delegate +### Can I delegate to multiple validators? -Step-by-step guide to delegate your SHM tokens to a validator. +Yes, and it's a good practice. -## Choosing a Validator +### Is there a minimum delegation amount? -Learn how to evaluate and choose the right validator for delegation based on performance, commission rates, and reliability. +Minimum amount is defined by governance and may evolve. -## Delegation Rewards +## 13. Delegation Complete -Understand how delegation rewards are calculated, distributed, and claimed. +You are now staking SHM and helping secure Shardeum while earning rewards. -## Undelegating +You can: -Learn about the undelegation process, unbonding periods, and how to withdraw your staked tokens. +- Monitor your validator +- Redelegate if needed +- Withdraw rewards regularly +- Support decentralization by choosing reliable validators diff --git a/content/docs/run-a-node/node-types.mdx b/content/docs/run-a-node/node-types.mdx index 568700c..eb8db2f 100644 --- a/content/docs/run-a-node/node-types.mdx +++ b/content/docs/run-a-node/node-types.mdx @@ -12,7 +12,7 @@ The Shardeum network runs on two main types of nodes. Each node type serves a di ## Full Nodes -- **Role**: Full nodes do not participate in consensus. They maintain and verify the blockchain state, functioning as a reliable “source of truth” for applications, wallets, and other network participants. +- **Role**: Full nodes do not participate in consensus. They maintain and verify the blockchain state, functioning as a reliable "source of truth" for applications, wallets, and other network participants. - **Configuration**: Full nodes run with pruning enabled by default, storing only the most recent state needed for operation. - **Use cases include**: 1. Running infrastructure for dApps diff --git a/content/docs/run-a-node/run-a-full-node.mdx b/content/docs/run-a-node/run-a-full-node.mdx index dd39db5..e21fc1a 100644 --- a/content/docs/run-a-node/run-a-full-node.mdx +++ b/content/docs/run-a-node/run-a-full-node.mdx @@ -1,40 +1,323 @@ --- title: Run a Full Node -description: Guide to running a full node on Shardeum +description: Guide to running a full node on Shardeum EVM Mainnet --- import { Callout } from 'fumadocs-ui/components/callout'; - - This page is getting updated +# Run a Full Node — Shardeum EVM Mainnet + +A full node verifies blocks, relays network data, and can optionally serve RPC endpoints for dApps and infrastructure partners. Full nodes do not participate in consensus and do not require staking. + +## 1. System Requirements + +**Recommended:** + +- **OS:** Ubuntu 22.04 LTS +- **CPU:** 4 cores +- **RAM:** 8–16 GB +- **Storage:** 500 GB+ NVMe SSD +- **Network:** 100 Mbps +- **Dependencies:** git, jq, curl, make, build-essential, pkg-config +- **Go:** v1.25+ + +### Install dependencies: + +```bash +sudo apt update +sudo apt install git jq curl make build-essential pkg-config -y +``` + +### Install Go: + +```bash +curl -LO https://go.dev/dl/go1.25.0.linux-amd64.tar.gz +sudo rm -rf /usr/local/go +sudo tar -C /usr/local -xzf go1.25.0.linux-amd64.tar.gz +echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc +source ~/.bashrc +go version +``` + +## 2. Install Shardeum Node Binary + +```bash +git clone https://github.com/shardeum/shardeum-evm.git +cd shardeum-evm +make install +``` + +Verify: + +```bash +shardeumd version +command -v shardeumd +``` + +## 3. Environment Variables + +```bash +export SHARDEUM_CONFIG_DIR="$PWD/config" +export SHARDEUM_NETWORK=mainnet +export BINARY=$(command -v shardeumd) +``` + +## 4. Initialize the Node + +Choose a node ID and moniker (ASCII only): + +```bash +NODE_ID="node0" +MONIKER="shardeum-fullnode" + +shardeumd init "$MONIKER" \ + --chain-id shardeum_8118-1 \ + --home $HOME/.mainnet/$NODE_ID \ + --overwrite +``` + +## 5. Copy Genesis File + +```bash +cp config/mainnet-genesis.json $HOME/.mainnet/$NODE_ID/config/genesis.json +ls -lh $HOME/.mainnet/$NODE_ID/config/genesis.json +jq -r '.chain_id' $HOME/.mainnet/$NODE_ID/config/genesis.json +``` + +## 6. Start and Sync the Node + +**Start:** + +```bash +shardeumd start \ + --home $HOME/.mainnet/$NODE_ID \ + --chain-id shardeum_8118-1 \ + --p2p.seeds a6b7640991e0d5070dc99ecc07f969275a130045@34.93.254.18:27656 \ + --p2p.laddr tcp://0.0.0.0:27656 \ + > $HOME/.mainnet/$NODE_ID/node.log +``` + +**Monitor:** + +```bash +shardeumd status | jq '.SyncInfo' +``` + +Or tail the log: + +```bash +tail -f $HOME/.mainnet/$NODE_ID/node.log +``` + +Sync is complete when block height matches the explorer. + +## 7. Optional: Run as systemd Service + +Create service: + +```bash +sudo nano /etc/systemd/system/shardeumd.service +``` + +Example content: + +```ini +[Unit] +Description=Shardeum Full Node +After=network-online.target + +[Service] +User=root +ExecStart=/usr/local/bin/shardeumd start --home /root/.mainnet/node0 +Restart=on-failure +LimitNOFILE=65535 + +[Install] +WantedBy=multi-user.target +``` + +Enable: + +```bash +sudo systemctl enable shardeumd +sudo systemctl start shardeumd +sudo systemctl status shardeumd +``` + +## 8. Optional: Enable JSON-RPC + +Edit `config/app.toml` inside your node directory. + +Enable: + +```toml +json-rpc.enable = true +json-rpc.address = "0.0.0.0:8545" +json-rpc.ws-address = "0.0.0.0:8546" +``` + +Restart the node if using systemd. + +## 9. Firewall Configuration + +```bash +sudo ufw allow 26656/tcp # P2P +sudo ufw allow 8545/tcp # JSON-RPC (optional) +sudo ufw allow 8546/tcp # WebSocket (optional) +sudo ufw enable +``` + + +For production, restrict JSON-RPC to trusted IPs or localhost. -# Run a Full Node +## 10. Optional: Pruning Settings + +Full nodes can reduce storage usage. + +Edit `app.toml`: + +```toml +pruning = "default" +``` + +Or for higher performance: + +```toml +pruning = "custom" +pruning-keep-recent = "10000" +pruning-interval = "50" +``` + +Restart node after making changes. + +## 11. Node Management Commands + +### Checking Node Status + +**Sync status:** + +```bash +shardeumd status | jq '.SyncInfo' +``` + +**Node ID:** + +```bash +shardeumd comet show-node-id +``` + +**Check peers:** + +```bash +curl -s http://localhost:26657/net_info | jq '.result' +curl -s http://localhost:26657/net_info | jq '.result.n_peers' +``` + +**Check logs:** + +```bash +journalctl -u shardeumd -f +``` + +Or if running without systemd: + +```bash +tail -f $HOME/.mainnet/$NODE_ID/node.log +``` + +### Account and Balance Management + +**List all keys:** + +```bash +shardeumd keys list +``` + +**Account balance:** + +```bash +shardeumd query bank balances
+``` + +### Stopping the Node + +**Stop shardeumd process:** + +```bash +pkill shardeumd +``` + +**If using systemd:** + +```bash +sudo systemctl stop shardeumd +``` + +## 12. Troubleshooting + +### Node Won't Sync + +**Check peer connections:** + +```bash +shardeumd status | jq '.SyncInfo.latest_block_height' +curl -s http://localhost:26657/net_info | jq '.result.n_peers' +``` + +**Common fixes:** + +- Verify seeds in `config.toml` +- Try adding more persistent peers +- Check your time sync (NTP): `timedatectl status` +- Check port 26656 is open + +### Out of Disk Space -Learn how to set up and run a full node on Shardeum network. +**Check disk usage:** -## What is a Full Node? +```bash +df -h +``` -A full node stores the complete blockchain data and validates all transactions and blocks. Full nodes contribute to the network's decentralization and security. +**Solutions:** -## Prerequisites +- For full nodes: Enable pruning in `app.toml`: + ```toml + pruning = "default" + ``` +- Or use custom pruning: + ```toml + pruning = "custom" + pruning-keep-recent = "10000" + pruning-interval = "50" + ``` +- Increase disk space -- System requirements and hardware specifications -- Operating system compatibility -- Network and storage requirements +**Important:** If running as Archive Node with `--pruning nothing`, you need adequate storage for complete history. -## Installation +### RPC Not Responding -Step-by-step guide to install and configure your full node. +- Check firewall rules: `sudo ufw status` +- Verify RPC enabled in `app.toml` +- Confirm bind address is correct (`0.0.0.0:8545` for external access) +- Check node is fully synced +- Restart the service: `sudo systemctl restart shardeumd` -## Configuration +## 13. Important Notes -Configure your full node for optimal performance and reliability. +- **Chain ID:** `shardeum_8118-1` (mainnet) +- **EVM Chain ID:** `8118` (hex: `0x1fb6`) for MetaMask and EVM interactions +- **Unbonding Period:** 21 days (if you later become a validator) +- **Archive Node:** Use `--pruning nothing` flag to maintain complete history +- **Backups:** Always back up `node_key.json` securely -## Monitoring +## Full Node Complete -Monitor your full node's health, performance, and synchronization status. +Your Shardeum full node is now running and contributing to network decentralization. -## Troubleshooting +You may proceed to: -Common issues and solutions for running a full node on Shardeum. +- Promote it to a validator, or +- Enable RPC for dApps, or +- Pair with a sentry node for validator security diff --git a/content/docs/run-a-node/run-a-validator-node.mdx b/content/docs/run-a-node/run-a-validator-node.mdx index c2d3c40..3fae12e 100644 --- a/content/docs/run-a-node/run-a-validator-node.mdx +++ b/content/docs/run-a-node/run-a-validator-node.mdx @@ -1,40 +1,541 @@ --- title: Run a Validator Node -description: Guide to running a validator node on Shardeum +description: Guide to running a validator node on Shardeum EVM Mainnet --- import { Callout } from 'fumadocs-ui/components/callout'; - - This page is getting updated +# Run a Validator Node — Shardeum EVM Mainnet + +A validator node participates in block production and consensus, requires staking, and must maintain high uptime. Validators can be jailed or slashed for misbehavior. + +This guide describes how to install, configure, and operate a validator node on Shardeum EVM mainnet. + +## 1. System Requirements + +**Recommended:** + +- **OS:** Ubuntu 22.04 LTS +- **CPU:** 4 cores (8 threads) +- **RAM:** 16 GB +- **Storage:** 1 TB NVMe SSD +- **Network:** 100 Mbps dedicated +- **Dependencies:** git, jq, curl, make, build-essential, pkg-config +- **Go:** v1.25+ + +### Install dependencies: + +```bash +sudo apt update +sudo apt install git jq curl make build-essential pkg-config -y +``` + +### Install Go: + +```bash +curl -LO https://go.dev/dl/go1.25.0.linux-amd64.tar.gz +sudo rm -rf /usr/local/go +sudo tar -C /usr/local -xzf go1.25.0.linux-amd64.tar.gz +echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc +source ~/.bashrc +go version +``` + +## 2. Install Shardeum Node Binary + +```bash +git clone https://github.com/shardeum/shardeum-evm.git +cd shardeum-evm +make install +``` + +Verify: + +```bash +shardeumd version +command -v shardeumd +``` + +## 3. Environment Variables + +```bash +export SHARDEUM_CONFIG_DIR="$PWD/config" +export SHARDEUM_NETWORK=mainnet +export BINARY=$(command -v shardeumd) +``` + +## 4. Initialize the Node + +Choose identifiers: + +```bash +NODE_ID="node0" +MONIKER="shardeum-validator" +``` + +Initialize: + +```bash +shardeumd init "$MONIKER" \ + --chain-id shardeum_8118-1 \ + --home $HOME/.mainnet/$NODE_ID \ + --overwrite +``` + +## 5. Copy Genesis File + +```bash +cp config/mainnet-genesis.json $HOME/.mainnet/$NODE_ID/config/genesis.json +ls -lh $HOME/.mainnet/$NODE_ID/config/genesis.json +jq -r '.chain_id' $HOME/.mainnet/$NODE_ID/config/genesis.json +``` + +## 6. Start and Sync the Node + +Start: + +```bash +shardeumd start \ + --home $HOME/.mainnet/$NODE_ID \ + --chain-id shardeum_8118-1 \ + --p2p.seeds a6b7640991e0d5070dc99ecc07f969275a130045@34.93.254.18:27656 \ + --p2p.laddr tcp://0.0.0.0:27656 \ + > $HOME/.mainnet/$NODE_ID/node.log +``` + +Monitor sync: + +```bash +shardeumd status | jq '.SyncInfo' +``` + +Or use: + +```bash +tail -f $HOME/.mainnet/$NODE_ID/node.log +``` + +Sync is complete when block height matches the explorer. + +## 7. Create the Validator Key (After Sync) + +Create: + +```bash +shardeumd keys add validator-key +``` + +Or recover: + +```bash +shardeumd keys add validator-key --recover +``` + +View address: + +```bash +shardeumd keys show validator-key -a +``` + + +Store your mnemonic securely. Do not share validator keys. + + +## 8. Fund Your Validator Account + +Your validator account must have enough SHM for: + +- **Minimum stake:** 1 SHM +- **Gas fees for create-validator:** ~1024 SHM +- **Total recommended:** 1025 SHM or more + +Send funds from: + +- MetaMask (RPC: https://api.shardeum.org) +- Keplr +- Exchanges + +Verify balance: + +```bash +shardeumd query bank balances $(shardeumd keys show validator-key -a) +``` + +## 9. Get Validator Consensus Key + +```bash +shardeumd comet show-validator --home $HOME/.mainnet/$NODE_ID +``` + +Copy the "key" value. + +## 10. Create validator.json + +Create configuration file: + +```bash +nano validator.json +``` + +Example: + +```json +{ + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "" + }, + "amount": "1000000000000000000ashm", + "moniker": "your-validator", + "identity": "", + "website": "", + "security": "", + "details": "", + "commission-rate": "0.10", + "commission-max-rate": "0.20", + "commission-max-change-rate": "0.01", + "min-self-delegation": "1" +} +``` + +Save and exit (Ctrl+O, Enter, Ctrl+X). + +## 11. Create the Validator + +```bash +shardeumd tx staking create-validator validator.json \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + +Confirm when prompted. + +A successful result contains: + +``` +code: 0 +txhash: +``` + +## 12. Verify Validator Status + +View validator: + +```bash +shardeumd query staking validator $(shardeumd keys show validator-key --bech val -a) +``` + +You should see: + +``` +status: BOND_STATUS_BONDED +``` + +View voting power: + +```bash +shardeumd status | jq '.ValidatorInfo.VotingPower' +``` + +List validator set: + +```bash +shardeumd query comet-validator-set +``` + +## 13. Validator Operations + + +At this step, your validator is set up and should be contributing to the network. It should also be earning rewards. + +Below commands are for informational purposes. You can execute them as required. + + +### Checking Validator Status + +**Validator info:** + +```bash +shardeumd status | jq '.ValidatorInfo' +``` + +**View validator:** + +```bash +shardeumd query staking validator $(shardeumd keys show validator-key --bech val -a) +``` + +**Voting power:** + +```bash +shardeumd status | jq '.ValidatorInfo.VotingPower' +``` + +**Check delegations:** + +```bash +shardeumd query staking delegations +``` + +**Check rewards:** + +```bash +shardeumd query distribution rewards +``` + +### Delegate More Stake + +```bash +shardeumd tx staking delegate \ + $(shardeumd keys show validator-key --bech val -a) \ + 1000000000000000000ashm \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + +### Unbond (21-day wait) + +```bash +shardeumd tx staking unbond \ + $(shardeumd keys show validator-key --bech val -a) \ + 1000000000000000000ashm \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + + +**Important:** Once you initiate the undelegate action, your funds enter a lock-up period. They will not be available in your wallet until the 21-day cycle is complete. -# Run a Validator Node +### Withdraw Rewards + +```bash +shardeumd tx distribution withdraw-all-rewards \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + +### Unjail Validator + +```bash +shardeumd tx slashing unjail \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + +### Edit Validator Details + +```bash +shardeumd tx staking edit-validator \ + --moniker="" \ + --website="" \ + --identity="" \ + --details="" \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + +## 14. Production Recommendations + +### systemd Service + +```bash +sudo nano /etc/systemd/system/shardeumd.service +``` + +Enable: + +```bash +sudo systemctl enable shardeumd +sudo systemctl start shardeumd +``` + +### Firewall + +```bash +sudo ufw allow 26656/tcp # P2P +sudo ufw enable +``` + + +Do not expose RPC on a validator. Leave all RPC interfaces on localhost. + + +### Monitoring and Alerts + +Enable Prometheus in `config.toml`: + +```toml +prometheus = true +prometheus_listen_addr = ":26660" +``` + +**Set up monitoring for:** + +- Sync status +- Validator jail status +- Disk space usage +- Memory usage +- Missed blocks +- Peer count + +**Recommended monitoring stack:** + +- **Prometheus** - Metrics collection +- **Grafana** - Visualization dashboards +- **Alertmanager** - Alert notifications + +Use Prometheus and Grafana for comprehensive monitoring to prevent downtime and slashing. + +### Sentry Node Architecture (Recommended) + +A common layout: + +``` +Internet → Sentry Nodes → Validator (private IP only) +``` + +Sentry nodes: + +- Hide validator's IP +- Absorb traffic +- Reduce DDoS risk + +### Security Considerations + +**For validators, consider:** + +- **Key Management System (KMS)** like Tendermint KMS +- **Sentry node architecture** (validators behind full nodes) +- Regular security updates +- Secure key backup procedures +- DDoS protection +- Reference: [Cosmos Security Documentation](https://docs.cosmos.network/) + +### Backup Important Files + +**Always back up:** + +- **Validator private key:** `~/.mainnet/$NODE_ID/config/priv_validator_key.json` +- **Node key:** `~/.mainnet/$NODE_ID/config/node_key.json` +- **Mnemonic phrase** (keep offline and secure) + + +**NEVER share your `priv_validator_key.json` or mnemonic phrase!** + +Store backups securely offline. Loss of these files means loss of validator access. + + +## 15. Troubleshooting + +### Node Won't Sync + +**Check peer connections:** + +```bash +shardeumd status | jq '.SyncInfo.latest_block_height' +curl -s http://localhost:26657/net_info | jq '.result.n_peers' +``` + +**Common fixes:** + +- Verify seeds in `config.toml` +- Try adding more persistent peers +- Check your time sync (NTP): `timedatectl status` + +### Validator is Jailed + +**Check jail reason:** + +```bash +shardeumd query slashing signing-info $(shardeumd comet show-validator) +``` + +**Common reasons:** + +- Downtime (missed too many blocks) +- Double signing + +**To unjail:** + +1. Fix the underlying issue (restart node, check connectivity) +2. Wait for node to sync completely +3. Run the unjail command: + +```bash +shardeumd tx slashing unjail \ + --from=validator-key \ + --chain-id=shardeum_8118-1 \ + --gas="auto" \ + --gas-adjustment="1.5" \ + --gas-prices="2048130280389041ashm" +``` + +### Insufficient Gas Errors + +**Increase gas adjustment:** + +```bash +--gas="auto" --gas-adjustment="2.0" +``` -Learn how to set up and run a validator node on Shardeum network. +**Or specify explicit gas amount:** -## What is a Validator Node? +```bash +--gas="300000" +``` -Validator nodes participate in the consensus mechanism, validate transactions, and earn rewards for securing the network. +### Out of Disk Space -## Prerequisites +**Check disk usage:** -- System requirements and hardware specifications -- Minimum SHM tokens required for staking -- Network and technical requirements +```bash +df -h +``` -## Installation +**Solutions:** -Step-by-step guide to install and configure your validator node. +- For validators: Increase disk space (pruning not recommended for active validators) +- Adjust pruning settings carefully in `app.toml` +- Monitor disk usage regularly to prevent issues -## Staking +## 16. Important Notes -Learn about staking requirements, how to stake SHM tokens, and manage your stake. +- **Chain ID:** `shardeum_8118-1` (mainnet) +- **EVM Chain ID:** `8118` (hex: `0x1fb6`) for MetaMask and EVM interactions +- **Minimum Stake:** 1 SHM (verify current governance parameters) +- **Unbonding Period:** 21 days (tokens are locked during this period) +- **Slashing:** Validators can be slashed for downtime or double-signing +- **Commission:** Set thoughtfully as `max-rate` cannot be increased later +- **Backups:** Always back up keys and mnemonic phrase securely +- **Gas Fees:** Approximately 1024 SHM for create-validator transaction -## Monitoring +## Validator Setup Complete -Monitor your validator node's performance, uptime, and rewards. +Your node is now validating Shardeum EVM mainnet and participating in consensus. -## Troubleshooting +**Key responsibilities:** -Common issues and solutions for running a validator node on Shardeum. +- Maintain high uptime to avoid jailing +- Monitor metrics regularly (sync, voting power, missed blocks) +- Secure your validator keys +- Keep software updated +- Respond quickly to any issues to prevent slashing diff --git a/content/docs/run-a-node/run-an-rpc-node.mdx b/content/docs/run-a-node/run-an-rpc-node.mdx index 05e26ca..982044b 100644 --- a/content/docs/run-a-node/run-an-rpc-node.mdx +++ b/content/docs/run-a-node/run-an-rpc-node.mdx @@ -1,40 +1,272 @@ --- title: Run an RPC Node -description: Guide to running an RPC node on Shardeum +description: Guide to running an RPC node on Shardeum EVM Mainnet --- import { Callout } from 'fumadocs-ui/components/callout'; - - This page is getting updated +# Run an RPC Node — Shardeum EVM Mainnet + +An RPC node provides JSON-RPC and WebSocket endpoints for developers, dApps, indexers, infrastructure providers, and partners. +RPC nodes do not validate blocks and do not require staking. + + +RPC nodes should not expose consensus ports publicly and must follow strict security practices. + + +## 1. System Requirements + +**Recommended:** + +- **OS:** Ubuntu 22.04 LTS +- **CPU:** 4 cores +- **RAM:** 8–16 GB +- **Storage:** 500 GB+ NVMe SSD +- **Network:** High-bandwidth connection +- **Dependencies:** git, jq, curl, make, build-essential, pkg-config +- **Go:** v1.25+ + +### Install dependencies: + +```bash +sudo apt update +sudo apt install git jq curl make build-essential pkg-config -y +``` + +### Install Go: + +```bash +curl -LO https://go.dev/dl/go1.25.0.linux-amd64.tar.gz +sudo rm -rf /usr/local/go +sudo tar -C /usr/local -xzf go1.25.0.linux-amd64.tar.gz +echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc +source ~/.bashrc +go version +``` + +## 2. Install Shardeum Node Binary + +```bash +git clone https://github.com/shardeum/shardeum-evm.git +cd shardeum-evm +make install +``` + +Verify: + +```bash +shardeumd version +command -v shardeumd +``` + +## 3. Environment Variables + +```bash +export SHARDEUM_CONFIG_DIR="$PWD/config" +export SHARDEUM_NETWORK=mainnet +export BINARY=$(command -v shardeumd) +``` + +## 4. Initialize the Node + +```bash +NODE_ID="rpcnode" +MONIKER="shardeum-rpc" + +shardeumd init "$MONIKER" \ + --chain-id shardeum_8118-1 \ + --home $HOME/.mainnet/$NODE_ID \ + --overwrite +``` + +## 5. Copy Genesis File + +```bash +cp config/mainnet-genesis.json $HOME/.mainnet/$NODE_ID/config/genesis.json +jq -r '.chain_id' $HOME/.mainnet/$NODE_ID/config/genesis.json +``` + +## 6. Start and Sync the Node + +Start: + +```bash +shardeumd start \ + --home $HOME/.mainnet/$NODE_ID \ + --chain-id shardeum_8118-1 \ + --p2p.seeds a6b7640991e0d5070dc99ecc07f969275a130045@34.93.254.18:27656 \ + --p2p.laddr tcp://0.0.0.0:26656 \ + > $HOME/.mainnet/$NODE_ID/node.log +``` + +Monitor: + +```bash +shardeumd status | jq '.SyncInfo' +tail -f $HOME/.mainnet/$NODE_ID/node.log +``` + +Wait until fully synced. + +## 7. Enable JSON-RPC + +Edit `$HOME/.mainnet/$NODE_ID/config/app.toml`. + +Find the RPC section and set: + +```toml +json-rpc.enable = true +json-rpc.address = "0.0.0.0:8545" +json-rpc.ws-address = "0.0.0.0:8546" +``` + +Restart your node if using systemd. + +## 8. Optional: Enable gRPC & REST Endpoints + +In `app.toml`: + +```toml +grpc.enable = true +grpc.address = "0.0.0.0:9090" + +api.enable = true +api.address = "0.0.0.0:1317" +``` + +Enable these only if required by your infrastructure. + +## 9. Firewall Configuration + +Expose only RPC/WebSocket ports: + +```bash +sudo ufw allow 8545/tcp # JSON-RPC +sudo ufw allow 8546/tcp # WebSocket +sudo ufw allow 9090/tcp # gRPC (optional) +sudo ufw allow 1317/tcp # REST API (optional) +sudo ufw allow 26656/tcp # P2P +sudo ufw enable +``` + + +Do not expose port 26657 (Tendermint RPC) to the public. +Restrict sensitive endpoints to localhost or trusted IPs. -# Run an RPC Node +## 10. systemd Service (Recommended) + +Create service: + +```bash +sudo nano /etc/systemd/system/shardeumd-rpc.service +``` + +Example: + +```ini +[Unit] +Description=Shardeum RPC Node +After=network-online.target + +[Service] +User=root +ExecStart=/usr/local/bin/shardeumd start --home /root/.mainnet/rpcnode +Restart=on-failure +LimitNOFILE=65535 + +[Install] +WantedBy=multi-user.target +``` + +Enable: + +```bash +sudo systemctl enable shardeumd-rpc +sudo systemctl start shardeumd-rpc +``` + +## 11. Pruning (Recommended for RPC Nodes) + +RPC nodes often use custom pruning. + +Edit `app.toml`: + +```toml +pruning = "custom" +pruning-keep-recent = "10000" +pruning-interval = "50" +``` + +Restart the node. + +## 12. Scaling RPC Nodes (Optional) + +For high-traffic dApps: + +- Use load balancers (Nginx, HAProxy, AWS ELB) +- Run multiple RPC nodes behind a reverse proxy +- Rate-limit requests to avoid overload +- Separate "public RPC" from "private infra RPC" +- Run indexing services in parallel (The Graph, SubQuery, etc.) + +## 13. Useful Commands + +**Check sync:** + +```bash +shardeumd status | jq '.SyncInfo' +``` + +**Check network peers:** + +```bash +curl -s http://localhost:26657/net_info | jq '.result' +``` + +**Check logs:** + +```bash +journalctl -u shardeumd-rpc -f +``` -Learn how to set up and run an RPC node on Shardeum network. +**Query RPC:** -## What is an RPC Node? +```bash +curl -s http://:8545 \ + -X POST \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' +``` -RPC (Remote Procedure Call) nodes provide API endpoints for applications to interact with the Shardeum blockchain. They serve as the gateway for dApps and wallets. +## 14. Troubleshooting -## Prerequisites +### RPC endpoint not responding -- System requirements and hardware specifications -- Network bandwidth and storage requirements -- Technical knowledge of API management +- Confirm RPC enabled in `app.toml` +- Confirm IP binding is correct +- Check firewall rules +- Check node is fully synced -## Installation +### High latency -Step-by-step guide to install and configure your RPC node. +- Reduce pruning window +- Increase hardware resources +- Add more RPC nodes behind a proxy -## Configuration +### Node stuck catching up -Configure your RPC node endpoints, security settings, and rate limiting. +- Check peers +- Restart node +- Verify time sync (NTP) -## Monitoring +## RPC Node Setup Complete -Monitor your RPC node's performance, request volume, and response times. +Your RPC node is operational and serving JSON-RPC / WebSocket traffic for the Shardeum EVM mainnet. -## Troubleshooting +Use this setup for: -Common issues and solutions for running an RPC node on Shardeum. +- dApp backend integrations +- Indexing services +- Developer environments +- High-availability RPC infrastructure