Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
Free 30-min Web3 Consultation
Book Now
Smart Contract Security Audits
Learn More
Custom DeFi Protocol Development
Explore
Full-Stack Web3 dApp Development
View Services
LABS
Guides

Setting Up Node Access Controls

A technical guide for developers on implementing authentication, network-level security, and API restrictions for blockchain nodes like Geth, Erigon, and Solana validators.
Chainscore © 2026
introduction
SECURITY

Introduction to Node Access Controls

A guide to implementing granular permission systems for blockchain node infrastructure.

Node access controls are a critical security layer for blockchain infrastructure, determining who can interact with your node's RPC endpoints and administrative functions. Unlike a simple firewall, these controls enforce fine-grained permissions at the application level. For example, you can allow public read access to the Ethereum eth_blockNumber method while restricting write operations like eth_sendTransaction to a whitelist of authorized wallets. This prevents unauthorized transactions and protects sensitive node data from being queried by malicious actors. Implementing these controls is essential for node operators in production environments, especially when running validator clients or public RPC services.

The core components of a node access control system typically include authentication, authorization, and rate limiting. Authentication verifies the identity of a requestor, often via API keys, JWT tokens, or IP whitelisting. Authorization defines the specific JSON-RPC methods (e.g., eth_getBalance, debug_traceTransaction) that an authenticated identity is permitted to call. Rate limiting protects the node from denial-of-service attacks by capping the number of requests per user or IP address within a time window. Tools like Nginx with auth_request, dedicated middleware like node-access-control, or proxy layers are commonly used to implement these policies before requests reach the core client software like Geth or Erigon.

For developers, implementing access controls often involves configuring a reverse proxy. A basic setup with Nginx might use the $http_authorization header to check for a valid API key and the location block to map keys to specific allowed methods. More advanced systems integrate with identity providers or use smart contract-based allowlists for dynamic permission management. It's also crucial to segment access: your frontend dApp might use a key with read-only permissions, your backend indexer might need access to historical logs, and your administrative scripts would require full access. This principle of least privilege minimizes the attack surface if any single key is compromised.

When setting up controls, audit your node's exposed endpoints. Clients expose numerous JSON-RPC methods, some of which are highly sensitive. Methods under the debug_ or admin_ namespaces can expose private keys, slow down the node, or modify its state. Always restrict these to trusted internal IPs. Furthermore, consider the security of your permissioning layer itself; store API keys securely using environment variables or secret managers, and rotate them periodically. For Ethereum nodes, the Execution API specification is a key reference for understanding available methods and their risks.

In practice, access control is not a one-time setup. You must monitor access logs for unusual patterns, such as spikes in requests for a single method or attempts to call forbidden endpoints. Integrating with logging and alerting systems like Grafana or Prometheus allows for proactive security. As your dApp or service evolves, regularly review and update permissions to ensure they align with current needs. Proper node access controls transform your node from an open utility into a secure, enterprise-grade piece of infrastructure, enabling safe participation in networks and reliable service provision.

prerequisites
PREREQUISITES AND SECURITY MINDSET

Setting Up Node Access Controls

This guide covers the essential security practices for controlling access to your blockchain node, focusing on RPC endpoint restrictions, authentication, and firewall configuration.

Node access controls are the first line of defense for your blockchain infrastructure. An exposed RPC (Remote Procedure Call) endpoint is a primary attack vector, allowing unauthorized users to query your node, drain funds from unlocked accounts, or disrupt service. The core principle is to restrict access to the bare minimum required. For development, localhost binding is sufficient. For production nodes serving applications, you must implement network-level firewalls, authentication, and reverse proxies. Tools like iptables, ufw, or cloud security groups are non-negotiable for enforcing these rules.

Authentication is critical for any externally accessible endpoint. Most node clients, including Geth and Erigon for Ethereum, support the --http.api and --ws.api flags to limit which APIs are exposed (e.g., eth,net,web3). For stronger protection, use token-based authentication via a reverse proxy like NGINX or Caddy. You can configure them to require a JWT (JSON Web Token) or HTTP Basic Authentication header. For example, an NGINX location block can include auth_basic "Restricted"; and auth_basic_user_file /etc/nginx/.htpasswd; to gate access to your node's RPC port.

Network segmentation further isolates your node. Place it in a private subnet, not directly on the public internet. Use a bastion host or VPN for administrative SSH access instead of exposing port 22. For cloud deployments, configure security groups or VPC firewalls to only allow traffic from specific IP addresses—your application servers, monitoring tools, or team members' IPs. Regularly audit open ports with netstat -tulpn or ss -tulpn. Remember, disabling the HTTP RPC entirely and using only IPC (Inter-Process Communication) for local applications is the most secure configuration where possible.

Monitoring and logging complete your security posture. Tools like Prometheus and Grafana can track failed authentication attempts and unusual RPC call volumes, which are indicators of a breach. Configure your node's logging level (e.g., Geth's --verbosity) to record access events. For consensus clients like Prysm or Lighthouse, ensure the validator API ports are similarly locked down, as they control your staking keys. Always follow the principle of least privilege: if a service doesn't need an API, disable it. Start with a deny-all policy and explicitly allow only what is necessary for your specific node's role in the network.

COMMON NODE PORTS

Default Ports and Their Purposes

Standard network ports used by blockchain clients and their associated services. Firewall rules should be configured to restrict access to these ports.

PortProtocolDefault ServiceAccess Recommendation

8545

TCP

JSON-RPC HTTP

Restrict to localhost or trusted IPs

8546

TCP

JSON-RPC WebSocket

Restrict to localhost or trusted IPs

30303

TCP & UDP

P2P Network (DevP2P)

Open to all for node discovery

30304

TCP & UDP

P2P Network (Snap Sync)

Open to all for data sync

26656

TCP

Tendermint P2P

Open to all for consensus

26657

TCP

Tendermint RPC

Restrict to localhost or trusted IPs

9650

TCP

AvalancheGo HTTP API

Restrict to localhost or trusted IPs

9651

TCP

AvalancheGo Health Check

Open for load balancers

firewall-configuration
SECURING YOUR NODE

Step 1: Configure Network-Level Firewall Rules

The first line of defense for any blockchain node is a properly configured firewall. This step isolates your node from unnecessary internet exposure, drastically reducing the attack surface.

A network-level firewall acts as a gatekeeper for all traffic entering and leaving your node's server. Its primary function is to enforce a default-deny policy, meaning all incoming connections are blocked unless explicitly permitted by a rule. For most nodes, you only need to allow inbound traffic on the specific P2P port used by your client (e.g., port 30303 for Ethereum execution clients, 26656 for Cosmos SDK chains) and, if applicable, a port for the RPC API. This prevents unauthorized access attempts on thousands of other common service ports.

Configuration is typically done via command-line tools like ufw (Uncomplicated Firewall) on Linux or iptables for more granular control. For a Geth execution client, a basic ufw setup would involve enabling the firewall, allowing SSH for management, and opening the Ethereum P2P port: sudo ufw allow 30303/tcp and sudo ufw allow 30303/udp. It is critical to always allow your SSH port first before enabling the firewall to avoid locking yourself out of the server.

For enhanced security, consider implementing port knocking or using a VPN for administrative access instead of exposing SSH directly. If your node provides RPC endpoints for applications like a block explorer or validator frontend, restrict RPC port access (8545 for HTTP, 8546 for WS) to specific, trusted IP addresses using rules like sudo ufw allow from 192.168.1.100 to any port 8545. Never expose unrestricted RPC access to the public internet, as this is a common vector for theft and node hijacking.

Regularly audit your firewall rules with sudo ufw status verbose or sudo iptables -L. This confirms only the intended ports are open and helps detect any unauthorized changes. Combine firewall rules with your cloud provider's security groups (AWS, GCP, Azure) for a defense-in-depth approach, applying identical restrictive rules at both the virtual network and instance levels.

rpc-authentication
SECURING YOUR ENDPOINT

Step 2: Implement RPC API Authentication

Configure authentication to secure your node's RPC endpoint, preventing unauthorized access and protecting against DDoS attacks.

By default, many node clients like Geth, Erigon, and Nethermind expose their JSON-RPC API without authentication, making them vulnerable to public exploitation. Implementing access controls is a critical security step. Authentication acts as a gatekeeper, ensuring only authorized applications, scripts, or users can submit transactions, query blockchain data, or manage your node. This prevents malicious actors from draining your node's resources, submitting spam transactions, or accessing sensitive wallet information.

The most common and straightforward method is HTTP Basic Authentication. You configure your node client to require a username and password for all RPC connections. For example, in Geth, you start the node with flags like --http --http.api eth,net,web3 --http.addr 0.0.0.0 --http.port 8545 --http.vhosts=* --http.corsdomain=* --authrpc.vhosts=*. Crucially, you add --authrpc.jwtsecret /path/to/jwt.hex for Engine API security and set HTTP credentials via a reverse proxy like Nginx, which handles the Basic Auth layer before requests reach Geth.

For programmatic access from applications, you include the credentials in the RPC connection string. Using the ethers.js library, you would instantiate a provider like: new ethers.JsonRpcProvider('http://username:password@your-node-ip:8545'). In a web3.py script, you would use Web3(Web3.HTTPProvider('http://username:password@your-node-ip:8545')). Always use HTTPS in production to encrypt these credentials in transit. For advanced use cases, consider JWT (JSON Web Token) authentication, which is required for the Engine API used by consensus clients and offers more granular, stateless authorization.

A best practice is to never expose the raw RPC port directly to the internet. Place your node behind a reverse proxy (Nginx, Apache, Caddy) on a separate server or container. The proxy handles SSL/TLS termination, rate limiting, IP whitelisting, and the HTTP Basic Authentication. This creates a defense-in-depth strategy. Your node configuration should also restrict RPC modules using --http.api (e.g., eth,net,web3) to enable only the necessary APIs, disabling admin modules like personal or debug in production.

For team or multi-application environments, implement API key management. Services like Chainstack, Alchemy, and Infura use this model, issuing unique keys for different services. You can replicate this by configuring your reverse proxy to validate a specific header (e.g., X-API-Key). This allows you to monitor usage per key, revoke access individually, and apply different rate limits. Audit logs are essential; ensure your proxy and node client logs record authentication attempts and RPC method calls to detect anomalous behavior.

Finally, test your setup thoroughly. Use curl to verify that unauthenticated requests are rejected: curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://your-node:8545 should fail. An authenticated request with curl -u username:password ... should succeed. Regularly rotate credentials and JWT secrets, and keep your node client and proxy software updated to patch any security vulnerabilities in the RPC stack.

engine-api-security
ACCESS CONTROL

Step 3: Secure the Engine API (Ethereum Execution Clients)

Configure authentication and authorization to protect your execution client's Engine API from unauthorized access.

The Engine API (also called the Engine JSON-RPC API) is a critical interface that allows your consensus client to communicate with your execution client. It handles tasks like proposing new blocks and validating payloads. By default, this API is exposed locally without authentication, which is a significant security risk if left unsecured. An unprotected Engine API could allow malicious actors on your server to submit fraudulent blocks or disrupt your node's operations. The primary method for securing this endpoint is JWT (JSON Web Token) authentication, which is supported by all major execution clients including Geth, Nethermind, and Besu.

To implement JWT authentication, you must first generate a secret token. This token is a shared secret that both your execution client and consensus client will use to authenticate their communication. You can generate a secure 256-bit hex-encoded secret using a command like openssl rand -hex 32. Store this secret in a secure file, such as jwt.hex, with restricted permissions (e.g., chmod 600 jwt.hex). This file's path will be referenced in your client configuration. The token acts as a cryptographic key, ensuring that only your authorized consensus client can issue commands via the Engine API.

Next, configure your execution client to require this JWT for Engine API access. The specific flag varies by client. For Geth, use --authrpc.jwtsecret /path/to/jwt.hex. For Nethermind, use --JsonRpc.JwtSecretFile /path/to/jwt.hex. For Besu, use --engine-jwt-secret /path/to/jwt.hex. You must also ensure the Engine API is only listening on the intended interface. Use flags like --authrpc.addr 127.0.0.1 (Geth) or --JsonRpc.Host 127.0.0.1 (Nethermind) to bind it to localhost, preventing external network access. This creates a layered defense: the API is only reachable locally and requires a valid token.

Finally, you must configure your consensus client (like Lighthouse, Prysm, or Teku) to use the same JWT secret when connecting to the execution client. This is typically done via a flag such as --jwt-secret /path/to/jwt.hex. The consensus client will include the token in the HTTP header of its requests to the Engine API. Without the correct token, the execution client will reject the connection, preventing the consensus layer from functioning. After restarting both clients with the new configuration, verify the secure connection by checking your client logs for successful authentication and the absence of "invalid JWT" or "unauthorized" errors.

p2p-peer-restrictions
NODE SECURITY

Step 4: Apply P2P Peer Restrictions

Configure your node's P2P layer to accept connections only from trusted peers, a critical step for private network security.

P2P peer restrictions are a fundamental security control for blockchain nodes, especially in private or consortium networks. By default, a node's P2P server is open and will accept incoming connections from any peer that discovers it. For a production deployment, this is often undesirable. Applying restrictions allows you to define an allowlist (or denylist) of specific peer IDs or IP addresses, ensuring your node only communicates with authorized participants. This prevents unsolicited connections from unknown nodes, reducing the attack surface and network noise.

To implement these controls, you configure your node's networking stack. Most client implementations, such as Geth for Ethereum or Erigon, use command-line flags or a configuration file (like config.toml for Cosmos SDK chains). The key parameters are typically --maxpeers to limit total connections and flags like --allow-incoming paired with a list of authorized peer IDs. For example, a Geth node might be started with --maxpeers 50 --staticnodes="enode://peer1-id@ip:port,enode://peer2-id@ip:port" to only connect to a predefined set.

The most secure method is to use a static node list or a bootnode allowlist. Static nodes are peers your node will always try to maintain a connection with, and if configured to reject other incoming connections, this creates a closed network. You must exchange and securely store the enode URL or libp2p multiaddr for each authorized peer. This URL contains the peer's public key, IP address, and discovery port. Mismanagement of this list is a common point of failure, so it should be version-controlled and distributed securely among operators.

Beyond basic allowlisting, consider implementing peer scoring. Clients like Prysm for Ethereum or Lotus for Filecoin implement gossip sub protocols that can penalize or ban peers based on behavior (e.g., sending invalid blocks, spamming messages). You can adjust scoring parameters in the config to be more aggressive in a private network setting. Monitoring tools like Prometheus with client-specific dashboards are essential to watch the number of connected peers and identify any unauthorized connection attempts post-configuration.

Testing your P2P restrictions is crucial. After configuration, restart your node and use the admin RPC API (e.g., admin.peers in Geth) or CLI commands to list connected peers. Verify only the allowed peers are present. Then, attempt to connect from an unauthorized node; the connection should be rejected. Document this configuration and the peer list as part of your network's runbook. Remember, P2P restrictions are a layer of defense-in-depth and should be combined with network-level firewalls and secure node identity management.

IMPLEMENTATION GUIDES

Client-Specific Configuration Examples

Geth (Go-Ethereum) Configuration

For the Geth client, node access is controlled via command-line flags or a configuration file (geth.toml). The primary method is the --http.api and --ws.api flags, which define which APIs are exposed over the HTTP and WebSocket JSON-RPC interfaces.

Basic Command Example:

bash
geth --http --http.api "eth,net,web3" --http.corsdomain "https://myapp.com" --http.vhosts "myapp.com"

This command starts Geth with the HTTP JSON-RPC server enabled, exposing only the eth, net, and web3 APIs. It restricts CORS to myapp.com and sets the virtual host for the HTTP server.

Advanced TOML Configuration:

toml
[HTTP]
Enabled = true
Host = "127.0.0.1"
Port = 8545
API = ["eth", "net", "web3", "debug"]
CorsDomains = ["https://myapp.com"]
VirtualHosts = ["myapp.com"]

To restrict access to specific IPs, use the --http.addr flag to bind to 127.0.0.1 (localhost only) or configure firewall rules. For production, always disable the personal API (personal) and admin API (admin) unless specifically required.

NODE CONFIGURATION

Troubleshooting Common Access Controls

Resolve common errors when configuring access for your blockchain node. This guide covers permission issues, connection failures, and security misconfigurations.

A 403 Forbidden or 401 Unauthorized error indicates your access control list (ACL) is blocking the request. This is a security feature, not a bug.

Common causes and fixes:

  • IP Whitelist Misconfiguration: Your client's IP address is not in the --http.addr or --ws.addr whitelist. For Geth, ensure your command includes --http.addr 0.0.0.0 for all IPs or a specific CIDR range like 192.168.1.0/24.
  • Missing Authentication: If using JWT authentication (required for Engine API), verify the --authrpc.jwtsecret path is correct and the JWT token in your client (e.g., execution/consensus client) matches.
  • CORS Issues: If accessing from a browser-based DApp, ensure CORS headers are set. For Geth: --http.corsdomain "https://yourdapp.com".

Quick Check: Run curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:8545. A successful response confirms RPC is open.

COMPARISON

Node Access Control Implementation Matrix

A comparison of common methods for securing RPC and validator node endpoints, detailing their security posture, complexity, and operational overhead.

Security ControlSSH TunnelingVPN (WireGuard)API Gateway (Nginx)Cloud VPC / Firewall Rules

Encryption in Transit

Authentication Required

Granular IP Allowlisting

Client-Side Configuration Complexity

Medium

High

Low

Low

Server Maintenance Overhead

Low

Medium

High

Low (Managed)

Defense Against DDoS

None

Limited

Strong (w/ WAF)

Strong (Cloud-native)

Cost (Beyond Infrastructure)

$0

$0 (Self-hosted)

$0 (Self-hosted)

Varies by Provider

Audit Logging Capability

Basic (SSH logs)

Basic

Comprehensive

Comprehensive

NODE ACCESS CONTROLS

Frequently Asked Questions

Common questions and solutions for configuring and troubleshooting access to your blockchain node.

Node access controls are the security rules that define who or what can interact with your blockchain node's RPC (Remote Procedure Call) endpoints. These controls are critical for protecting your node from unauthorized use, DDoS attacks, and excessive resource consumption. A common example is restricting RPC access to specific IP addresses or requiring API keys for sensitive methods like eth_sendRawTransaction.

Without proper controls, an exposed node can be abused for free transactions, drained of bandwidth, or used to query private data. Implementing access controls is a foundational security practice for any node operator, especially when running public-facing infrastructure for applications or staking services.

How to Set Up Node Access Controls: A Developer Guide | ChainScore Guides