Port Selection

All RPC interfaces are exposed on specific ports that depend on the network type or network ID you are connecting to.

RPC interface ports can be changed when running kaspad using the following arguments:

  • --rpclisten=<ip>[:<port>] for gRPC
  • --rpclisten-borsh=<ip>[:<port>] for wRPC with Borsh encoding
  • --rpclisten-json=<ip>[:<port>] for wRPC with JSON encoding

For local interface binding, you can specify 127.0.0.1 or localhost as the IP address. For public interface binding, you can specify 0.0.0.0 or the specific IP address you want to bind to.

NOTE: Rusty Kaspa does not have a specific port for the Testnet network type. The 1*210 port is used for all testnet networks. However, when running two testnet nodes on the same machine, it is customary to use 16210 for Testnet-10 and 16310 for Testnet-11. As such, these ports are listed as defaults. However, if you simply pass the --testnet flag to kaspad, it will assign the default testnet port of 1*210 regardless of the testnet network ID.

Default gRPC Ports

  • Mainnet: 16110
  • Testnet-10: 16210
  • Testnet-11: 16310
  • Simnet: 16510
  • Devnet: 16610

wRPC Port Handling

wRPC uses URLs when specifying connection endpoints. The wRPC client performs auto-detection of ports when validating the supplied endpoint URL as follows:

  • If the URL is fully formed, containing a protocol scheme (ws:// or wss://) or a path, the port is not specified unless manually supplied as part of the URL.
  • If the URL does not contain a protocol scheme, the default port and protocol scheme are assigned based on the network type.

The default protocol scheme assignment is based on the execution environment. If running the RPC client in a browser accessing an HTTPS endpoint, the protocol will be forced to wss://. If running the RPC client in a Node.js environment or a browser via an HTTP endpoint, the protocol will be set to ws://. (A page located at an HTTPS endpoint cannot open unsecure WebSocket connections to ws:// endpoints due to security restrictions.)

Default wRPC Borsh Encoding Ports

  • Mainnet: 17110
  • Testnet-10: 17210
  • Testnet-11: 17310
  • Simnet: 17510
  • Devnet: 17610

Default wRPC JSON Encoding Ports

  • Mainnet: 18110
  • Testnet-10: 18210
  • Testnet-11: 18310
  • Simnet: 18510
  • Devnet: 18610