To operate, Bitcoin uses two ports on which the client will listen to establish connections, namely:
- p2p port (by default, 8333 in mainnet and 18333 in testnet)
- RPC port (by default, 8332 in mainnet and 18332 in testnet)
We will define different ports for both mainnet and testnet, in order to be able to run your altcoin alongside a Bitcoin client without port overlap. Remember, mainnet and testnet are abbreviations for the main and test public networks.
Get your favourite text editor and open up chainparams.cpp and chainparamsbase.cpp located in the src/ folder. Find the network parameters, including the ports, and then change the following variables:
- For mainnet (CMainParams and CBaseMainParams classes):