Skip to content

Security

Securing blockchain nodes is critical to protect your infrastructure and prevent unauthorized access.


┌─────────────────────────────────────────────────────────────────┐
│ NODE SECURITY LAYERS │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ 1. NETWORK SECURITY │ │
│ │ - Firewall rules │ │
│ │ - VPN/VPC isolation │ │
│ │ - Port restrictions │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ 2. ACCESS CONTROL │ │
│ │ - Authentication │ │
│ │ - Authorization │ │
│ │ - Rate limiting │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ 3. DATA SECURITY │ │
│ │ - Encryption at rest │ │
│ │ - TLS/SSL │ │
│ │ - Key management │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ 4. SYSTEM HARDENING │ │
│ │ - Run as non-root │ │
│ │ - Regular updates │ │
│ │ - Monitoring/alerting │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘

Terminal window
# Allow only necessary ports
sudo ufw default deny incoming
sudo ufw default allow outgoing
# Allow SSH
sudo ufw allow 22/tcp
# Allow P2P
sudo ufw allow 30303/tcp
# Allow RPC only from specific IP
sudo ufw allow from YOUR_IP to any port 8545
# Enable firewall
sudo ufw enable
Terminal window
# DON'T do this (exposes to public):
geth --http --http.addr 0.0.0.0
# DO this (only local access):
geth --http --http.addr 127.0.0.1

MethodSecurityUse Case
Hardware WalletHighestValidators
Keystore FileMediumDevelopment
MnemonicMediumBackup
Private KeyLowNever use
  1. Never store private keys on RPC nodes
  2. Use hardware wallets for validators
  3. Keep backups in secure locations
  4. Never share private keys

Terminal window
# Generate certificates
openssl req -x509 -newkey rsa:4096 \
-keyout key.pem -out cert.pem \
-days 365 -nodes
# Use with Nginx proxy

  • Prevent DDoS attacks
  • Protect node resources
  • Ensure fair usage
http {
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=100r/s;
server {
location / {
limit_req zone=api_limit burst=200;
}
}
}

Terminal window
# Create dedicated user
sudo useradd -r -s /sbin/nologin ethereum
# Set ownership
sudo chown -R ethereum:ethereum /data/ethereum
[Service]
User=ethereum
Group=ethereum
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/data/ethereum

QuestionAnswer
How to secure RPC endpoint?Bind to localhost, use TLS, rate limiting
Why run as non-root?Limit damage if compromised
What is key management?Secure storage and handling of private keys

  • Network security: firewall, restrict ports
  • Access control: rate limiting, authentication
  • Key management: never expose keys on RPC nodes
  • System hardening: run as non-root, regular updates

In Chapter 32: Key Management & Wallets, we’ll explore key management.


Last Updated: 2026-02-20