Skip to main content

Node Operation

Starting the Node

Basic Start

java -jar dist/shamwariQKP.jar

With Custom Configuration

java -jar dist/shamwariQKP.jar -c /etc/shamwari/nxt.properties

Service Mode (Linux)

Create /etc/systemd/system/shamwari.service:

[Unit]
Description=Shamwari Network Node
After=network.target

[Service]
Type=simple
User=shamwari
WorkingDirectory=/opt/shamwari
ExecStart=/usr/bin/java -jar /opt/shamwari/dist/shamwariQKP.jar
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable shamwari
sudo systemctl start shamwari

Monitoring

Health Check

curl http://localhost:6876/nxt?requestType=getBlockchainStatus

Key metrics to monitor:

  • isScanning - Should be false
  • isDownloading - Should be false when synced
  • numberOfBlocks - Should match network height
  • availableProcessors - Node capacity

Log Monitoring

# Follow logs
tail -f logs/shamwari.log | grep -E "ERROR|WARN|block"

# API request monitoring
grep "API request" logs/shamwari.log | tail -20

# Peer connections
grep "Peer" logs/shamwari.log | tail -20

Metrics

# Get node state
curl http://localhost:6876/nxt?requestType=getState

Administration

Peer Management

# Add peer
curl -X POST http://localhost:6876/nxt \
-d "requestType=addPeer" \
-d "peer=123.45.67.89:6876" \
-d "adminPassword=your_password"

# Blacklist peer
curl -X POST http://localhost:6876/nxt \
-d "requestType=blacklistPeer" \
-d "peer=123.45.67.89" \
-d "adminPassword=your_password"

# Dump peers
curl "http://localhost:6876/nxt?requestType=dumpPeers"

Configuration Changes

# Update logging
curl -X POST http://localhost:6876/nxt \
-d "requestType=setLogging" \
-d "logging=DEBUG" \
-d "adminPassword=your_password"

# Update configuration
curl -X POST http://localhost:6876/nxt \
-d "requestType=setConfiguration" \
-d "maxAPIRecords=1000" \
-d "adminPassword=your_password"

Shutdown

# Graceful shutdown
curl -X POST http://localhost:6876/nxt \
-d "requestType=shutdown" \
-d "adminPassword=your_password"

Backup and Recovery

Database Backup

# Stop node
sudo systemctl stop shamwari

# Backup database
cp -r db backups/db-$(date +%Y%m%d)

# Restart
sudo systemctl start shamwari

Configuration Backup

# Backup configuration
tar -czf shamwari-config-$(date +%Y%m%d).tar.gz conf/

Performance Tuning

JVM Options

# Recommended JVM settings
JAVA_OPTS="
-Xms4g
-Xmx8g
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:+UseStringDeduplication
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
"

java $JAVA_OPTS -jar dist/shamwariQKP.jar

Database Optimization

# In nxt.properties
nxt.dbCacheKB=200000
nxt.maxDbConnections=50
nxt.trimDerivedTables=false

Security

API Security

# Enable HTTPS
nxt.apiSSL=true
nxt.keyStorePath=/path/to/keystore
nxt.keyStorePassword=keystore_password

# Restrict API access
nxt.apiServerHost=127.0.0.1
nxt.allowedBotHosts=*

Admin Password

# Always set strong admin password
nxt.adminPassword=complex_password_here

# Disable admin password for localhost only
nxt.disableAdminPassword=false

Firewall Configuration

# Allow only necessary ports
sudo ufw allow 6876/tcp # HTTP API
sudo ufw allow 6877/tcp # HTTPS API
sudo ufw allow 7876/tcp # Peer communication
sudo ufw enable

Troubleshooting

Common Issues

IssueCauseSolution
Slow syncInsufficient peersAdd more peers, check firewall
High memoryLarge dbCacheKBReduce cache size
API not respondingSSL misconfigurationCheck keystore config
Database lockedMultiple instancesEnsure single instance

Log Analysis

# Check for errors
grep -i error logs/shamwari.log | tail -20

# Check sync status
grep -i "scanning" logs/shamwari.log | tail -5

# Check peer connections
grep -i "connected peer" logs/shamwari.log | tail -10